WO2015021753A1 - Data compression method, computer system and device - Google Patents

Data compression method, computer system and device Download PDF

Info

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
Application number
PCT/CN2014/070865
Other languages
French (fr)
Chinese (zh)
Inventor
陈普
黄杨锋
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015021753A1 publication Critical patent/WO2015021753A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods 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

An embodiment of the present invention relates to a data compression method, computer system and device, the method comprising: receiving a data compression request; determining a feature identifier of the image data to be compressed; and according to the feature identifier, acquiring the stored compression data corresponding to the feature identifier so as to obtain the compression data of the image data to be compressed without employing a compression algorithm, thus avoiding repeated compression, improving data compression efficiency, and saving system resources.

Description

一种数据压缩的方法、 计算机系统和装置 技术领域  Data compression method, computer system and device
本发明实施例涉及计算机技术, 特别是一种数据压缩的方法、 计算机系 统和装置。  Embodiments of the present invention relate to computer technology, and in particular, to a data compression method, computer system, and apparatus.
背景技术  Background technique
数据压缩可以降低原始数据的大小, 便于网络传输, 并减少对存储空间 的占用, 广泛应用于众多领域。 现有技术中对数据进行压缩是先通过压缩接 口接收应用程序模块的待压缩数据信息, 然后通过压缩算法实现对待压缩数 据的压缩, 压缩完成后再通过压缩接口将压缩后的数据返回给应用程序模 块。  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. In the prior art, 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.
现有技术是对应用程序模块产生的数据进行直接压缩。 然而, 在有些应 用场景下, 应用程序模块会产生大量需要进行压缩的数据。 例如, 在虚拟桌 面基础架构 (Virtual Desktop Infrastructure, VDI )场景下, 多个虚拟机同时 产生数据压缩需求, 导致服务器有大量数据需要压缩, 此时系统 CPU的利用 率非常高, 在系统中产生了数据压缩的瓶颈, 导致数据处理效率不高, 同时 系统资源消耗也较大。  The prior art is to directly compress the data generated by the application module. However, in some application scenarios, the application module generates a large amount of data that needs to be compressed. For example, in a virtual desktop infrastructure (VDI) scenario, 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. At this time, 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.
发明内容  Summary of the invention
本发明实施例提出了一种数据压缩的方法、 计算机系统和装置, 以提高 数据压缩效率。  Embodiments of the present invention provide a data compression method, computer system, and apparatus to improve data compression efficiency.
第一方面, 本发明实施例提出了一种数据压缩的方法, 所述方法包括: 接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据进行压 缩;  In a first aspect, 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.
结合第一方面, 在第一种可能的实现方式中, 所述确定所述待压缩的图 片数据的特征标识包括: 计算所述待压缩的图片数据的特征标识, 所述特征 标识包括循环冗余码或者海明码。  With reference to the first aspect, in a first possible implementation, 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.
结合第一方面, 在第二种可能的实现方式中, 所述方法还包括: 确定所 述待压缩的图片数据是否满足压缩加速的条件,如果满足所述压缩加速的条 件, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压缩数据存管 模块保存的所述特征标识对应的压缩数据的步骤。  With reference to the first aspect, in a second possible implementation, 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.
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述确定所述待压缩的图片数据是否满足压缩加速的条件, 包括:  With reference to the second possible implementation of the first aspect, in a third possible implementation, the determining whether the picture data to be compressed meets the conditions of the compression acceleration includes:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者,  Determining whether the resource used for compressing the picture data to be compressed exceeds a first threshold, and if yes, determining that the picture data to be compressed satisfies a condition of compression acceleration; or determining an attribute of the picture data to be compressed Whether the value exceeds the second threshold, if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, and the attribute value includes any one of the following factors or any combination thereof: size, length, width or bit depth of the picture data; Or,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。  Determining whether the complexity of the picture data to be compressed exceeds a third threshold, and if so, determining that the picture data to be compressed satisfies a condition of compression acceleration.
结合第一方面的任一种可能的实现方式, 在第四种可能的实现方式中, 所述方法还包括: 建立所述压缩数据存管模块, 其中, 所述压缩数据存管模 块用于保存图片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识 作为索引来保存不同图片数据的压缩数据。  With reference to any possible implementation of the first aspect, in a fourth possible implementation, 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.
结合第一方面的第四种可能的实现方式, 在第五种可能的实现方式中, 所述根据所述待压缩的图片数据的特征标识,获取压缩数据存管模块保存的 所述特征标识对应的压缩数据之前, 还包括: 确定所述压缩数据存管模块是 否保存所述特征标识对应的压缩数据, 如果是, 则执行所述根据所述待压缩 的图片数据的特征标识, 获取压缩数据存管模块保存的所述特征标识对应的 压缩数据的步骤。 With reference to the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner, the acquiring, by the feature identifier of the image data to be compressed, acquiring the feature identifier saved by the compressed data storage module Before compressing the data, 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.
第二方面, 本发明实施例提出了一种数据压缩的装置, 所述装置包括: 接收单元, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的 图片数据进行压缩;  In a second aspect, 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;
获取单元, 用于根据所述确定单元确定的所述待压缩的图片数据的特征 标识, 获取压缩数据存管模块保存的所述特征标识对应的压缩数据;  And 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;
响应单元, 用于返回数据压缩响应, 所述数据压缩响应携带从所述压缩 数据存管模块获取的所述特征标识对应的压缩数据。  And 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.
结合第二方面, 在第一种可能的实现方式中, 所述确定单元具体用于: 计算所述待压缩的图片数据的特征标识, 所述特征标识包括循环冗余码或者 海明码。  With reference to the second aspect, in a first possible implementation, 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.
结合第二方面, 在第二种可能的实现方式中, 所述装置还包括: 分类单元, 用于确定所述待压缩的图片数据是否满足压缩加速的条件; 在所述分类单元确定所述待压缩的图片数据满足所述压缩加速的条件时, 所 述获取单元具体用于根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据。  With reference to the second aspect, in a second possible implementation, 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. .
结合第二方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述分类单元具体用于:  With reference to the second possible implementation of the second aspect, in a third possible implementation, the classification unit is specifically configured to:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者, Determining whether the resource used for compressing the picture data to be compressed exceeds a first threshold, and if yes, determining that the picture data to be compressed satisfies a condition of compression acceleration; or determining an attribute of the picture data to be compressed Whether the value exceeds the second threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, and the attribute value includes any of the following factors: One or any combination thereof: the size, length, or depth of the picture data; or,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。  Determining whether the complexity of the picture data to be compressed exceeds a third threshold, and if so, determining that the picture data to be compressed satisfies a condition of compression acceleration.
结合第二方面的任一种可能的实现方式, 在第四种可能的实现方式中, 所述压缩数据存管模块设置于所述数据压缩的装置内部或者外部, 用于保存 图片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来 保存不同图片数据的压缩数据。  With reference to any possible implementation of the second aspect, in a fourth possible implementation, 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.
结合第二方面的第四种可能的实现方式, 在第五种可能的实现方式中, 所述确定单元还用于: 确定所述压缩数据存管模块是否保存所述特征标识对 应的压缩数据; 所述获取单元具体用于在所述确定单元确定所述压缩数据存 管模块保存有所述特征标识对应的压缩数据时,根据所述待压缩的图片数据 的特征标识, 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数 据。  With reference to the fourth possible implementation of the second aspect, in a fifth possible implementation, 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.
第三方面, 本发明实施例提出了一种数据压缩系统, 所述系统包括: 数 据压缩装置, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的图 片数据进行压缩, 确定所述待压缩的图片数据的特征标识, 其中, 所述特征 标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的 压缩数据, 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所述数据压缩响 应携带从所述压缩数据存管模块获取的所述特征标识对应的压缩数据; 所述 压缩数据存管模块, 用于保存图片数据的压缩数据集合, 所述压缩数据集合 通过所述特征标识作为索引来保存不同图片数据的压缩数据。  In a third aspect, 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. Compressing data corresponding to the feature identifier saved by the compressed data storage module, and returning a data compression response, where the data compression response carries compressed data corresponding to the feature identifier acquired from the compressed data storage module; a storage module, configured to store a compressed data set of the picture data, where the compressed data set uses the feature identifier as an index to store compressed data of different picture data.
在本发明实施例中, 由于能够在接收到数据压缩请求之后, 确定所述待 压缩的图片数据的特征标识, 并根据所述待压缩的图片数据的特征标识, 获 取压缩数据存管模块保存的所述特征标识对应的压缩数据, 无需调用压缩算 法对所述待压缩的图片数据进行压缩, 就可获得所述待压缩的图片数据的压 缩数据, 从而避免了数据的重复压缩工作, 提高了数据压缩效率, 有效节约 了系统资源。 图片数据的压缩数据图片数据的压缩数据图片数据的压缩数 据。 附图说明 In the embodiment of the present invention, after the data compression request is received, 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. DRAWINGS
为了更清楚地说明本发明实施例的技术方案, 下面将对现有技术或实施 例中所需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳 动的前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the prior art or the embodiments will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work.
图 1是根据本发明实施例提供的一种方法流程图;  FIG. 1 is a flowchart of a method according to an embodiment of the present invention;
图 2是根据本发明实施例提供的又一种方法流程图;  2 is a flow chart of still another method according to an embodiment of the present invention;
图 3是根据本发明实施例提供的又一种方法流程图;  3 is a flow chart of still another method according to an embodiment of the present invention;
图 4是根据本发明实施例提供的一种数据压缩装置的组成图; 图 5是根据本发明实施例提供的又一种数据压缩装置的组成图; 图 6是根据本发明实施例提供的又一种数据压缩装置的组成图; 图 7是根据本发明实施例提供的一种数据压缩系统的组成图; 图 8是根据本发明实施例提供的一种计算机的组成图。  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; and FIG. 8 is a composition diagram of a computer according to an embodiment of the present invention.
具体实施方式 detailed description
本发明实施例提出了一种数据压缩的方法、 计算机系统和装置, 当有数 据需要压缩时, 直接获取保存的压缩数据, 可以避免重复压缩工作, 提高数 据处理效率并降低处理器的资源消耗。  The embodiment of the invention provides a data compression method, a computer system and a device. When data needs to be compressed, directly acquiring the saved compressed data can avoid repeated compression work, improve data processing efficiency, and reduce processor resource consumption.
下面对数据压缩方法的实施例进行介绍, 如图 1所示, 为本发明实施例 提供的数据压缩方法的流程, 包括:  The following describes an embodiment of a data compression method. As shown in FIG. 1 , the flow of the data compression method provided by the embodiment of the present invention includes:
101 : 接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据 进行压缩。  101: Receive a data compression request, the data compression request indicating compression of the picture data to be compressed.
例如, 数据压缩模块从操作系统获取应用程序模块触发的数据压缩请 求; 或者, 数据压缩模块接收到数据压缩请求, 根据所述数据压缩请求获取 所述待压缩的图片数据。 For example, the data compression module obtains the data compression triggered by the application module from the operating system. Or the data compression module receives the data compression request, and acquires the image data to be compressed according to the data compression request.
优选地, 所述待压缩的图片数据可以为一帧图片数据或者多帧图片数 据。  Preferably, the picture data to be compressed may be one frame of picture data or multiple frames of picture data.
102: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的压缩数 据。  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.
所述确定所述待压缩的图片数据的特征标识, 可以是数据压缩模块从所 述应用程序模块或者操作系统获取所述待压缩的图片数据的特征标识,也可 以是数据压缩模块通过计算获取所述待压缩的图片数据的特征标识。  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.
优选地, 所述待压缩的图片数据的特征标识可以包括所述待压缩的图片 数据所包含的每帧图片数据的特征标识, 所述每帧图片数据的特征标识可以 用于代表所述每帧图片数据, 特征标识相同的图片数据具有相同的压缩数 据。 例如, 所述每帧图片数据的特征标识可以为所述每帧图片数据的图像特 征码。  Preferably, 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. For example, the feature identifier of each frame of picture data may be an image feature code of the frame data of each frame.
103: 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据。  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.
具体地, 所述压缩数据存管模块用于保存压缩数据集合, 即用于保存采 用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保存各压缩 数据与其对应的特征标识的对应关系。 由于特征标识相同的图片数据具有相 同的压缩数据, 因此可以根据所述待压缩的图片数据的特征标识获取所述压 缩数据存管模块保存的压缩数据, 并将所获取的压缩数据作为所述待压缩的 图片数据的压缩数据。  Specifically, 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.
104: 返回数据压缩响应, 所述数据压缩响应携带所获取的所述特征标 识对应的压缩数据。  104: Return a data compression response, where the data compression response carries the acquired compressed data corresponding to the feature identifier.
在本发明实施例中, 在接收到数据压缩请求之后, 确定所述待压缩的图 片数据的特征标识, 根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据, 并将所获取的压缩数据 携带在数据压缩响应中返回, 避免了进行重复的压缩工作, 提高了数据压缩 效率, 有效节约了系统资源。 In the embodiment of the present invention, after receiving the data compression request, determining the to-be-compressed graph And obtaining, 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, and carrying the acquired compressed data in the data compression response Back, avoiding repeated compression work, improving data compression efficiency and effectively saving system resources.
在本发明的又一实施例中, 如图 2所示, 该方法可以具体包括: In another embodiment of the present invention, as shown in FIG. 2, the method may specifically include:
201 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。 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.
在数据压缩模块接收数据压缩请求之前,所述方法还包括建立压缩数据 存管模块, 所述压缩数据存管模块用于保存图片数据的压缩数据集合, 所述 压缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压 缩数据, 因此所述数据压缩模块可以根据图片数据的特征标识, 从所述压缩 数据存管模块中获取保存的该图片数据的特征标识对应的压缩数据, 所述压 缩数据存管模块可以设置于所述数据压缩装置内部或外部。  Before the data compression module receives the data compression request, 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.
上述步骤 201为可选步骤, 在其他的实施例中, 可以选用现有的存储模 块来保存压缩数据集合, 并非需要执行本步骤来建立压缩数据存管模块。  The foregoing step 201 is an optional step. In other embodiments, 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.
202: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。  202: Receive a data compression request, and obtain image data to be compressed according to the data compression request.
用户在访问应用程序模块时产生了压缩图片数据的需求, 所述应用程序 模块触发操作系统进行处理,操作系统指示数据压缩模块对所述待压缩的图 片数据进行压缩, 所述数据压缩模块接收到数据压缩请求后, 可以直接获取 所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请 求中的指示查询相关模块, 获取所述待压缩的图片数据。  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. After the data compression request, 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.
203: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。  203: Determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent picture data, and the picture data with the same feature identifier has the same compressed data.
优选地, 如果所述待压缩的图片数据为一帧图片数据, 则确定所述一帧 图片数据的特征标识, 如果所述待压缩的图片数据为多帧图片数据, 则确定 所述每帧图片数据的特征标识。 Preferably, if 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.
所述确定所述待压缩的图片数据的特征标识, 可以是数据压缩模块从所 述应用程序模块获取所述待压缩的图片数据的特征标识,也可以是数据压缩 模块通过计算确定所述待压缩的图片数据的特征标识, 所述特征标识可以是 图像特征码, 具体表现形式可以是字符序列或数字序列, 例如可以是循环冗 余码(Cyclic Redundancy Code, CRC ), 海明码, 但不仅限于此。  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. .
所述数据压缩模块计算所述待压缩的图片数据的特征标识可以是采用 不同的算法对所述待压缩的图片数据进行计算得到, 例如可以将所述图片数 据视为二进制数, 参照 CRC32的计算方式获取所述图片数据的特征标识, 其中, 所述 CRC还可以包括 CRC8、 CRC12、 CRC16、 CRC32、 CRC32c等。  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. For example, 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.
204: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 205, 否则执行步骤 206。  And determining, by the compressed data storage module, 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, step 205 is performed, otherwise step 206 is performed. .
具体地, 由于所述压缩数据存管模块用于保存压缩数据集合, 即可以用 于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保 存各压缩数据与其对应的特征标识的对应关系, 因此所述数据压缩模块可以 根据所述待压缩的图片数据的特征标识,确定所述压缩数据存管模块是否保 存有所述特征标识对应的压缩数据, 即是否保存有所述待压缩的图片数据的 压缩数据。  Specifically, 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. Corresponding relationship, so 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.
205: 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据, 然后执行步骤 208。  205: 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.
206: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 207。 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.
如果确定所述压缩数据存管模块没有保存所述特征标识对应的压缩数 据, 所述数据压缩模块采用压缩算法对所述待压缩的图片数据进行压缩, 得 到所述待压缩的图片数据的压缩数据, 然后执行步骤 207。  If it is determined that the compressed data storage module does not store the compressed data corresponding to the feature identifier, 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.
207: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存。  207: 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.
具体地, 可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据 的特征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述 压缩数据; 优选地, 在执行所述步骤 207的保存动作之前, 还可以进一步执 行如下步骤:  Specifically, 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. Before the saving operation of the step 207, the following steps may be further performed:
207' : 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足所述压缩加速的条件, 执行步骤 207, 否则执行步骤 208。  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.
具体地, 数据压缩模块在使用压缩算法压缩所述待压缩的图片数据之 后, 可以进一步确定所述待压缩的图片数据是否满足压缩加速的条件, 如果 满足所述压缩加速的条件, 则可以执行步骤 207, 如果不满足所述压缩加速 的条件, 则可以执行步骤 208。  Specifically, after compressing the to-be-compressed picture data by using a compression algorithm, 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.
确定所述待压缩的图片数据是否满足压缩加速的条件,具体可以采用如 下方式:  Determining whether the picture data to be compressed satisfies the condition of compression acceleration, specifically, the following manner may be adopted:
确定压缩该图片数据所消耗的系统资源的大小, 并将所述压缩该图片数 据所消耗的系统资源与预设的第一阈值进行比较, 如果超过所述第一阈值, 说明该图片数据属于压缩消耗资源较大的图片数据, 则可以执行步骤 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
207, 其中所述第一阈值属于经验值; 或者, 207, 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 that the picture data to be compressed satisfies a condition of compression acceleration, where the attribute value includes any one of the following factors or any combination thereof: The size, length, or bit depth of the data, specifically, determining whether the attribute value of the picture data to be compressed exceeds a second threshold 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. Obtaining, the second threshold is an empirical value, and the second threshold may be a value, or may be a plurality of values Collection; 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.
208: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。  208: Return a data compression response, where the data compression response carries compressed data of the picture data to be compressed.
数据压缩模块返回数据压缩响应给所述应用程序模块,使得所述应用程 序模块对应的客户端可以获取所述待压缩的图片数据的压缩数据, 并可以根 据所述压缩数据进行图片显示。 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.
具体地, 当确定所述压缩数据存管模块保存有所述待压缩的图片数据的 特征标识对应的压缩数据时, 所述数据压缩模块将获取的所述特征标识对应 的压缩数据携带在数据压缩响应中返回, 当确定所述压缩数据存管模块没有 保存所述待压缩的图片数据的特征标识对应的压缩数据时, 所述数据压缩模 块将采用压缩算法压缩得到的压缩数据携带在数据压缩响应中返回。  Specifically, when it is determined that the compressed data storage module saves the compressed data corresponding to the feature identifier of the image data to be compressed, the data compression module carries the acquired compressed data corresponding to the feature identifier in data compression. Returning from the response, when it is determined that the compressed data storage module does not save the compressed data corresponding to the feature identifier of the picture data to be compressed, the data compression module carries the compressed data compressed by the compression algorithm in the data compression response. Return in.
在本发明实施例中, 在数据压缩模块接收到数据压缩请求之后, 可以先 确定所述压缩数据存管模块是否保存有所述待压缩的图片数据的压缩数据, 如果保存有, 则从所述压缩数据存管模块中获取保存的所述待压缩的图片数 据的压缩数据, 避免重复的压缩工作, 有效节约系统资源, 如果没有保存, 则用压缩算法获取所述待压缩的图片数据的压缩数据, 并将该图片数据的压 缩数据在所述压缩数据存管模块中进行保存, 用以完善和更新所述压缩数据 存管模块, 使得下次需要该图片数据的压缩数据时, 不再重复压缩该图片数 据。  In the embodiment of the present invention, after the data compression module receives the data compression request, it 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.
优选地, 在数据压缩完成后, 可以进一步确定所述待压缩的图片数据是 否满足压缩加速的条件, 如果满足压缩加速的条件, 说明该图片数据属于压 缩消耗资源较大的图片数据, 将该图片数据的压缩数据进行保存, 使得下次 需要该图片数据的压缩数据时, 不用消耗较大的系统资源去重复该压缩图片 数据, 如果不满足压缩加速的条件, 说明该图片数据不属于压缩消耗资源较 大的图片数据, 可以采用压缩算法直接获取该图片数据的压缩数据, 既合理 利用了系统资源, 又节约了系统的存储空间。 据  Preferably, after the data compression is completed, it may be further determined 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 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. For larger picture data, 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
在本发明的又一实施例中, 如图 3所示, 该方法可以具体包括: In another embodiment of the present invention, as shown in FIG. 3, the method may specifically include:
301 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。 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.
在数据压缩模块接收数据压缩请求之前,所述方法还包括建立压缩数据 存管模块, 所述压缩数据存管模块用于保存图片数据的压缩数据集合, 所述 压缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压 缩数据, 因此所述数据压缩模块可以根据图片数据的特征标识, 从所述压缩 数据存管模块中获取保存的该图片数据的特征标识对应的压缩数据, 所述压 缩数据存管模块可以设置于所述数据压缩装置内部或外部。 Before the data compression module receives the data compression request, 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.
302: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。  302: Receive a data compression request, and obtain image data to be compressed according to the data compression request.
用户在访问应用程序模块时产生了压缩图片数据的需求, 所述应用程序 模块触发操作系统进行处理,操作系统指示数据压缩模块对所述待压缩的图 片数据进行压缩, 所述数据压缩模块接收到数据压缩请求后, 可以直接获取 所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请 求中的指示查询相关模块, 获取所述待压缩的图片数据。  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. After the data compression request, 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.
303: 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满足 压缩加速的条件, 执行步骤 304, 否则执行步骤 309。  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.
数据压缩模块接收所述数据压缩请求之后, 可以进一步确定所述待压缩 的图片数据是否满足压缩加速的条件, 如果满足压缩加速的条件, 表示该图 片数据属于压缩耗费资源较大的图片数据, 系统可能已经保存了该图片数据 的压缩数据,可以直接执行步骤 304至 306对该图片数据的压缩数据的获取 过程进行加速, 即在需要压缩的时候, 系统直接获取预先保存的所述待压缩 的图片数据的压缩数据, 从而有效节约系统资源, 提高数据压缩的效率。  After receiving the data compression request, 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:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者, Determining whether the resource used for compressing the picture data to be compressed exceeds a first threshold, and if yes, determining that the picture data to be compressed satisfies a condition of compression acceleration; or determining an attribute of the picture data to be compressed Whether the value exceeds the second threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, and the attribute value includes any of the following factors: One or any combination thereof: the size, length, or depth of the picture data. Specifically, determining whether the attribute value of the picture data to be compressed exceeds a second threshold may be determining the picture data to be compressed. 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. .
304: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。  304: Determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent picture data, and the picture data with the same feature identifier has the same compressed data.
数据压缩模块在接收到数据压缩请求之后,确定所述待压缩的图片数据 的特征标识, 所述确定所述待压缩的图片数据的特征标识可以在步骤 302之 后执行, 还可以在步骤 302之前执行, 本发明实施例在此不作限定。  After receiving the data compression request, 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.
所述确定所述待压缩的图片数据的特征标识, 可以是从所述应用程序模 块获取所述待压缩的图片数据的特征标识,也可以是数据压缩模块通过计算 获取所述待压缩的图片数据的特征标识, 所述特征标识可以是图像特征码, 具体表现形式可以是字符序列或数字序列, 例如可以是循环冗余码 ( Cyclic Redundancy Code, CRC ), 海明码, 但不仅限于此, 所述数据压缩模块计算 所述待压缩的图片数据的特征标识可以是采用不同的算法对所述待压缩的 图片数据进行计算得到, 例如可以将所述图片数据视为二进制数, 参照 CRC32的计算方式确定所述图片数据的特征标识, 其中, 所述 CRC还可以 包括 CRC8、 CRC12、 CRC16、 CRC32、 CRC32c等。 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.
优选地, 如果所述待压缩的图片数据为一帧图片数据, 则确定所述一帧 图片数据的特征标识, 如果所述待压缩的图片数据为多帧图片数据, 则确定 所述每帧图片数据的特征标识。  Preferably, if 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.
305: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 306, 否则执行步骤 307。  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. .
具体地, 由于所述压缩数据存管模块用于保存压缩数据集合, 即可以用 于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保 存各压缩数据与其对应的特征标识的对应关系, 因此所述数据压缩模块可以 根据所述待压缩的图片数据的特征标识,确定所述压缩数据存管模块是否保 存有所述特征标识对应的压缩数据, 即是否保存有所述待压缩的图片数据的 压缩数据。 图片数据的压缩数据  Specifically, 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. Corresponding relationship, so 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
306: 获取从所述压缩数据存管模块中保存的所述特征标识对应的压缩 数据, 然后执行步骤 309。  306: Acquire compressed data corresponding to the feature identifier saved in the compressed data storage module, and then perform step 309.
数据压缩模块如果确定保存有所述特征标识对应的压缩数据, 则从所述 压缩数据存管模块中获取保存的所述特征标识对应的压缩数据, 由于特征标 识相同的图片数据具有相同的压缩数据, 因此可以将所获取的压缩数据作为 所述待压缩的图片数据的压缩数据, 避免了重复的压缩工作。  And if 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.
307: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 308。  307: Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 308.
如果确定所述压缩数据存管模块没有保存所述特征标识对应的压缩数 据, 则数据压缩模块采用压缩算法对所述待压缩的图片数据进行压缩, 得到 所述待压缩的图片数据的压缩数据, 然后执行步骤 308。 If it is determined that the compressed data storage module does not save the compression number corresponding to the feature identifier 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.
308: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存, 然后执行步骤 310。  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.
具体地, 可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据 的特征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述 压缩数据;  Specifically, 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;
309: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 310。  309: Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 310.
如果确定所述待压缩的图片数据不满足压缩加速的条件,表明所述待压 缩的图片数据属于压缩耗费资源较小的图片数据,数据压缩模块通过压缩算 法直接获取所述待压缩的图片数据的压缩数据, 并在该步骤完成后执行步骤 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.
310: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。  310: Return a data compression response, where the data compression response carries compressed data of the picture data to be compressed.
数据压缩模块返回数据压缩响应给所述应用程序模块,使得所述应用程 序模块对应的客户端可以获取所述待压缩的图片数据的压缩数据, 并可以根 据所述压缩数据进行图片显示。  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.
在本发明实施例中, 所述数据压缩模块接收到数据压缩请求之后, 确定 所述压缩数据存管模块是否保存有所述待压缩的图片数据的压缩数据,如果 保存有, 则从所述压缩数据存管模块中获取保存的所述待压缩的图片数据的 压缩数据, 避免重复的压缩工作, 有效节约系统资源, 如果没有保存, 则用 压缩算法获取所述待压缩的图片数据的压缩数据, 并将该图片数据的压缩数 据在所述压缩数据存管模块中进行保存, 用以完善和更新所述压缩数据存管 模块, 使得下次需要该图片数据的压缩数据时, 不再重复压缩该图片数据。 In the embodiment of the present invention, after receiving the data compression request, 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.
进一步, 在本发明实施例中, 所述数据压缩模块在接收到数据压缩请求 之后, 还包括确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足压缩加速的条件, 则对所述待压缩的图片数据的压缩数据的获取过程进行 加速, 即当确定保存有所述待压缩的图片数据的特征标识对应的压缩数据 时, 直接从所述压缩数据存管模块中获取保存的所述特征标识对应的压缩数 据, 避免了对压缩耗费资源较大的图片数据的压缩工作, 使得该图片数据的 压缩数据的获取过程得以被加速, 更进一步的节约了系统资源, 提高了数据 压缩效率。本发明实施例的方法可以应用于 VDI场景下,不同客户端对应的 虚拟机可以将不同图片数据的压缩数据保存于同一个压缩数据存管模块中, 所述压缩数据存管模块可以设置在虚拟机或 PC机上, 使得如果多个客户端 需要压缩该第一图片数据时或者第一客户端需要多次压缩该第一图片数据 时, 可以直接从所述压缩数据存管模块中获取该第一图片数据的压缩数据, 避免了重复的压缩工作, 此外, 还可以将待压缩的图片数据的压缩数据保存 于本地应用程序所在的虚拟机的压缩数据存管模块中,使得所述本地应用程 序需要重复压缩所述待压缩的图片数据时, 直接从所述虚拟机的压缩数据存 管模块中获取, 避免了数据的重复压缩工作, 提高了数据压缩的效率, 而且 从本地获取待压缩的图片数据保障了通信的实时性和快速性。  Further, in the embodiment of the present invention, 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. In addition, 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 When 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.
本发明装置实施例  Apparatus apparatus of the present invention
本发明实施例提供的数据压缩装置,应用于计算机系统中,如图 4所示, 所述装置 400包括:  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:
接收单元 401 , 用于接收数据压缩请求, 所述数据压缩请求指示对待压 缩的图片数据进行压缩; 确定单元 402, 用于确定所述待压缩的图片数据的特征标识, 其中, 所 述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有 相同的压缩数据。 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.
获取单元 403 , 用于根据所述待压缩的图片数据的特征标识, 获取压缩 数据存管模块保存的所述特征标识对应的压缩数据。  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.
响应单元 404, 用于返回数据压缩响应, 所述数据压缩响应携带所获取 的所述特征标识对应的压缩数据。  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.
其中, 所述待压缩的图片数据可以根据所述数据压缩请求获取, 所述待 压缩的图片数据可以为一帧图片数据或者多帧图片数据, 所述确定单元 402 确定待压缩的图片数据的特征标识可以是从所述应用程序模块或者操作系 统获取所述待压缩的图片数据的特征标识,也可以是所述确定单元 402通过 计算获取所述待压缩的图片数据的特征标识。  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.
在本发明实施例中, 所述压缩数据存管模块用于保存压缩数据集合, 即 用于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时 保存各压缩数据与其对应的特征标识的对应关系, 所述确定单元 402在所述 接收单元 401接收到数据压缩请求之后,确定所述待压缩的图片数据的特征 标识, 所述获取单元 403根据所述待压缩的图片数据的特征标识, 从所述压 缩数据存管模块中获取保存的所述特征标识对应的压缩数据, 所述响应单元 404返回携带所获取的所述特征标识对应的压缩数据的数据压缩响应, 避免 了数据的重复压缩工作, 提高了数据压缩效率, 有效节约了系统资源。  In the embodiment of the present invention, 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.
在本发明的又一装置实施例中, 如图 5所示, 所述数据压缩装置 500可 包括: 接收单元 501、 确定单元 502、 获取单元 503、 响应单元 504、 压缩数 据存管模块 505和第二压缩单元 506, 其中, 在另一个实施例中, 所述压缩 数据存管模块 505还可以设置于所述数据压缩装置 500的外部。  In another apparatus embodiment of the present invention, as shown in FIG. 5, 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.
所述压缩数据存管模块 505用于保存图片数据的压缩数据集合,所述压 缩数据集合 505通过图片数据的特征标识作为索引来保存不同图片数据的压 缩数据, 使得所述数据压缩装置 500可以根据图片数据的特征标识, 从所述 压缩数据存管模块 505 中获取保存的该图片数据的特征标识对应的压缩数 据。 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.
具体地, 用户在访问应用程序模块时产生了压缩图片数据的需求, 所述 应用程序模块触发操作系统进行处理,操作系统指示所述数据压缩装置对所 述待压缩的图片数据进行压缩, 所述接收单元 501用于接收数据压缩请求, 并根据所述数据压缩请求获取待压缩的图片数据, 其中, 接收单元 501可以 直接获取所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数 据压缩请求中的指示查询相关模块, 获取所述待压缩的图片数据, 其中, 所 述数据压缩请求指示对待压缩的图片数据进行压缩。  Specifically, 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, and 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.
所述确定单元 502在所述接收单元 501接收数据压缩请求之后, 用于确 定所述待压缩的图片数据的特征标识, 并利用所述特征标识, 确定所述压缩 数据存管模块 505是否保存有所述特征标识对应的压缩数据, 其中, 所述特 征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同 的压缩数据, 具体地, 所述确定单元 502可以从所述应用程序模块获取所述 待压缩的图片数据的特征标识,还可以是所述确定单元 502通过计算获取所 述待压缩的图片数据的特征标识, 所述特征标识可以是图像特征码, 具体表 现形式可以是字符序列或数字序列, 例如可以是循环冗余码 ( Cyclic Redundancy Code, CRC ) , 海明码, 但不仅限于此。  After the receiving unit 501 receives the data compression request, 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. Specifically, 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.
所述获取单元 503 ,在所述确定单元 502确定所述压缩数据存管模块 505 保存有所述特征标识对应的压缩数据时, 用于根据所述特征标识, 获取所述 压缩数据存管模块 505保存的所述特征标识对应的压缩数据, 由于特征标识 相同的图片数据具有相同的压缩数据, 因此可以将所获取的所述特征标识对 应的压缩数据作为所述待压缩的图片数据的压缩数据。  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.
所述响应单元 504用于返回携带从所述获取单元 503获取的所述特征标 识对应的压缩数据的数据压缩响应。 所述第二压缩单元 506, 在所述确定单元 502确定所述压缩数据存管模 块 505没有保存所述特征代码对应的压缩数据时, 用于采用压缩算法对所述 待压缩的图片数据进行压缩,得到所述待压缩的图片数据的压缩数据,其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本发明实施例 在此不作限定。 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.
所述压缩数据存管模块 505还用于保存所述第二压缩单元 506采用压缩 算法压缩得到的压缩数据, 使得系统下次需要压缩所述待压缩的图片数据 时, 可以直接从所述压缩数据存管模块 505中获取, 无需进行重复的压缩, 具体地,可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据的特 征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述压缩 数据。  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. Specifically, 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.
所述响应单元 504还用于返回携带所述第二压缩单元 506采用压缩算法 压缩得到的压缩数据的数据压缩响应。  The response unit 504 is further configured to return a data compression response carrying the compressed data compressed by the second compression unit 506 by using a compression algorithm.
优选地, 所述装置还可以进一步包括:  Preferably, the device may further include:
分类单元 507, 用于确定所述待压缩的图片数据是否满足压缩加速的条 件; 所述压缩数据存管模块 505在所述待压缩的图片数据满足压缩加速的条 件时, 具体用于触发所属确定单元 502根据所述特征标识, 确定所述压缩数 据存管模块 505是否保存有所述特征标识对应的压缩数据,或者保存所述第 二压缩单元 506采用压缩算法压缩得到的压缩数据;  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;
其中, 在另一优选实施例中, 所述确定所述待压缩的图片数据是否满足 压缩加速的条件, 具体包括:  In another preferred embodiment, 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. Specifically, 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.
在本发明实施例中, 所述确定单元 502在所述接收单元 501接收到数据 压缩请求之后,确定所述压缩数据存管模块 505是否保存有所述待压缩的图 片数据的压缩数据, 如果保存有, 则所述响应单元 504从所述压缩数据存管 模块 505中获取保存的所述待压缩的图片数据的压缩数据,避免重复的压缩 工作, 有效节约系统资源, 如果没有保存, 则所述第二压缩单元 506采用压 缩算法获取所述待压缩的图片数据的压缩数据, 所述压缩数据存管模块 505 将所述第二压缩单元 506压缩得到的压缩数据进行保存, 用以完善和更新所 述压缩数据存管模块 505 , 使得下次需要该图片数据的压缩数据时, 不再重 复压缩该图片数据。 In the embodiment of the present invention, after the receiving unit 501 receives the data compression request, 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.
优选地, 在所述第二压缩单元 506完成数据压缩后, 所述分类单元 507 可以进一步确定所述待压缩的图片数据是否满足压缩加速的条件,如果满足 压缩加速的条件, 说明该图片数据属于压缩消耗资源较大的图片数据, 所述 压缩数据存管模块 505将所述第二压缩单元 506压缩得到的压缩数据进行保 存, 使得下次需要该图片数据的压缩数据时, 不用消耗较大的系统资源去重 复该压缩图片数据, 如果不满足压缩加速的条件, 说明该图片数据不属于压 缩消耗资源较大的图片数据, 下次需要该图片数据的压缩数据时, 可以采用 压缩算法直接获取该图片数据的压缩数据, 既合理利用了系统资源, 又节约 了系统的存储空间。  Preferably, after the second compression unit 506 completes the data compression, 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. When the compressed data of the image data is needed next time, 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.
在本发明的又一装置实施例中, 如图 6所示, 所述数据压缩装置 600可 包括: 接收单元 601、 确定单元 602、 获取单元 603、 响应单元 604、 压缩数 据存管模块 605、 第二压缩单元 606、 分类单元 607和第一压缩单元 608, 其 中,所述压缩数据存管模块 605还可以设置于所述数据压缩装置 600的外部。  In another apparatus embodiment of the present invention, as shown in FIG. 6, 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.
所述压缩数据存管模块 605用于保存图片数据的压缩数据集合, 所述压 缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压缩 数据, 使得所述数据压缩装置 600可以根据图片数据的特征标识, 从所述压 缩数据存管模块 605中获取保存的该图片数据的特征标识对应的压缩数据。  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.
所述接收单元 601用于接收数据压缩请求, 并根据所述数据压缩请求获 取待压缩的图片数据; 优选地, 所述接收单元 601可以直接获取所述数据压 缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请求中的指示 查询相关模块, 获取所述待压缩的图片数据, 其中, 所述数据压缩请求指示 对待压缩的图片数据进行压缩。  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.
所述分类单元 607, 在所述接收单元 601接收数据压缩请求之后, 用于 确定所述待压缩的图片数据是否满足压缩加速的条件; 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;
优选地, 所述分类单元 607可以确定压缩该图片数据所消耗的系统资源 的大小, 并将所述压缩该图片数据所消耗的系统资源与预设的第一阈值进行 比较, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者,  Preferably, 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. Specifically, 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.
所述确定单元 602在所述分类单元 607确定所述待压缩的图片数据满足 压缩加速的条件时, 用于确定所述待压缩的图片数据的特征标识, 并根据所 述特征标识,确定所述压缩数据存管模块 605是否保存有所述特征标识对应 的压缩数据, 其中, 所述特征标识用于代表所述待压缩的图片数据, 特征标 识相同的图片数据具有相同的压缩数据, 所述确定单元 602确定所述待压缩 的图片数据的特征标识也可以是在所述分类单元 607确定所述待压缩的图片 数据满足压缩加速的条件之前, 具体地, 所述确定单元 602可以从所述应用 程序模块获取所述待压缩的图片数据的特征标识, 还可以是所述确定单元 602通过计算获取所述待压缩的图片数据的特征标识, 所述特征标识可以是 图像特征码, 具体表现形式可以是字符序列或数字序列。 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. Whether 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, and the determining unit 602 determines that the feature identifier of the image data to be compressed is also Before the determining unit 607 determines that the picture data to be compressed satisfies the condition of the compression acceleration, 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.
所述获取单元 603 , 在所述确定单元确定所述压缩数据存管模块保存有 所述特征标识对应的压缩数据时, 用于根据所述特征标识, 获取所述压缩数 据存管模块 605保存的所述特征标识对应的压缩数据, 由于特征标识相同的 图片数据具有相同的压缩数据, 因此可以将所获取的所述特征标识对应的压 缩数据作为所述待压缩的图片数据的压缩数据。  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.
所述响应单元 604用于返回携带从所述获取单元 603获取的所述特征标 识对应的压缩数据的数据压缩响应。  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.
所述第二压缩单元 606, 在所述确定单元 602确定所述压缩数据存管模 块 605没有保存所述特征代码对应的压缩数据时, 用于采用压缩算法对所述 待压缩的图片数据进行压缩,得到所述待压缩的图片数据的压缩数据,其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本发明实施例 在此不作限定。  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.
所述压缩数据存管模块 605还用于保存所述第二压缩单元 606采用压缩 算法压缩得到的压缩数据, 使得系统下次需要压缩所述待压缩的图片数据 时, 可以直接从所述压缩数据存管模块 605中获取, 无需进行重复的压缩, 具体地,可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据的特 征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述压缩 数据。  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. Specifically, 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.
所述响应单元 604还用于返回携带所述第二压缩单元 606采用压缩算法 压缩得到的压缩数据的数据压缩响应。 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.
所述第一压缩单元 608, 在所述分类单元 607确定所述待压缩的图片数 据不满足压缩加速的条件时, 用于采用压缩算法对所述待压缩的图片数据进 行压缩, 得到所述待压缩的图片数据的压缩数据, 其中, 所述压缩算法可以 是有损压缩算法, 还可以是无损压缩算法, 本发明实施例在此不作限定。  The first compression unit 608, when the classification unit 607 determines that the picture data to be compressed does not satisfy the condition of the compression acceleration, is used to compress the picture data to be compressed by using a compression algorithm, to obtain the to-be-compressed 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.
所述响应单元 604还用于返回携带所述第一压缩单元 608采用压缩算法 压缩得到的压缩数据的数据压缩响应。  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.
在本发明实施例中, 所述确定单元 602在所述接收单元接收到数据压缩 请求之后,确定所述压缩数据存管模块 605是否保存有所述待压缩的图片数 据的压缩数据, 如果保存有, 则所述响应单元 604从所述压缩数据存管模块 605中获取保存的所述待压缩的图片数据的压缩数据,避免重复的压缩工作, 有效节约系统资源, 如果没有保存, 则所述第二压缩单元 606采用压缩算法 获取所述待压缩的图片数据的压缩数据, 所述压缩数据存管模块 605将所述 第二压缩单元 606压缩得到的压缩数据进行保存, 用以完善和更新所述压缩 数据存管模块 605 , 使得下次需要该图片数据的压缩数据时, 不再重复压缩 该图片数据。  In the embodiment of the present invention, after the receiving unit receives the data compression request, 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.
进一步, 在本发明实施例中, 所述分类单元 607在所述接收单元 601接 收到数据压缩请求之后, 用于进一步确定所述待压缩的图片数据是否满足压 缩加速的条件, 如果满足压缩加速的条件, 所述数据压缩装置 600对所述待 压缩的图片数据的压缩数据的获取过程进行加速, 即在所述确定单元 602确 定保存有所述待压缩的图片数据的特征标识对应的压缩数据时, 所述获取单 元 603直接从所述压缩数据存管模块 605中获取保存的所述特征标识对应的 压缩数据, 避免了对压缩耗费资源较大的图片数据的压缩工作, 使得该图片 数据的压缩数据的获取过程得以被加速, 更进一步的节约了系统资源, 提高 了数据压缩效率。  Further, in the embodiment of the present invention, after the receiving unit 601 receives the data compression request, 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.
如图 7为本发明实施例提供的数据压缩系统 700, 所述系统可包括: 数据压缩装置 701 , 用于接收数据压缩请求, 所述数据压缩请求指示对 待压缩的图片数据进行压缩,确定所述待压缩的图片数据的特征标识,其中, 所述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具 有相同的压缩数据, 根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所 述数据压缩响应携带从所述压缩数据存管模块 702获取的所述特征标识对应 的压缩数据; 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;
所述压缩数据存管模块 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.
如图 8 , 为本发明实施例提供的计算机的结构组成示意图。 本发明实施 例的计算机 800可包括:  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:
处理器 801、 存储器 802、 系统总线 804和通信接口 805。 处理器 801、 存储器 802和通信接口 805之间通过系统总线 804连接并完成相互间的通信。  Processor 801, memory 802, system bus 804, and communication interface 805. The processor 801, the memory 802, and the communication interface 805 are connected by the system bus 804 and communicate with each other.
处理器 801可能为单核或多核中央处理单元, 或者为特定集成电路, 或 者为被配置成实施本发明实施例的一个或多个集成电路。  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.
存储器 802 可以为高速 RAM 存储器, 也可以为非易失性存储器 ( non-vo la t i l e memory ), 例如至少一个磁盘存储器。  The memory 802 can be a high speed RAM memory or a non-volatile memory, such as at least one disk memory.
存储器 802用于计算机执行指令 803。 具体的, 计算机执行指令 703中 可以包括程序代码。  Memory 802 is used by computer to execute instructions 803. Specifically, the program code may be included in the computer execution instruction 703.
当计算机运行时, 处理器 801运行计算机执行指令 803 , 可以执行如下 方法流程:  When the computer is running, the processor 801 runs the computer execution instruction 803, and can perform the following method flow:
所述方法流程具体包括: 101 : 接收数据压缩请求, 所述数据压缩请求 指示对待压缩的图片数据进行压缩。  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: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的压缩数 据。 103: 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据。 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.
104: 返回数据压缩响应, 所述数据压缩响应携带所获取的所述特征标 识对应的压缩数据。  104: Return a data compression response, where the data compression response carries the acquired compressed data corresponding to the feature identifier.
所述方法流程具体还可以包括: 201 : 建立压缩数据存管模块, 所述压 缩数据存管模块用于保存图片数据的压缩数据集合。  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.
202: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。  202: Receive a data compression request, and obtain image data to be compressed according to the data compression request.
203: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。  203: Determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent picture data, and the picture data with the same feature identifier has the same compressed data.
204: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 205 , 否则执行步骤 206。  And determining, by the compressed data storage module, 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, step 205 is performed, otherwise step 206 is performed. .
205: 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据, 然后执行步骤 208。  205: Acquire compressed data corresponding to the feature identifier saved by the compressed data storage module, and then perform step 208.
206: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 207。  206: Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 207.
207: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存。  207: The compressed data obtained by the compression is saved in the compressed data storage module.
优选地, 在执行所述步骤 207的保存动作之前, 还可以进一步执行如下 步骤:  Preferably, before performing the saving operation of the step 207, the following steps may be further performed:
207' : 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足所述压缩加速的条件, 执行步骤 207, 否则执行步骤 208。  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.
208: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。  208: Return a data compression response, where the data compression response carries compressed data of the picture data to be compressed.
所述方法流程具体还可以包括: 301 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。 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.
302: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。  302: Receive a data compression request, and obtain image data to be compressed according to the data compression request.
303: 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满足 压缩加速的条件, 执行步骤 304, 否则执行步骤 309。  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.
304: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。  304: Determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent picture data, and the picture data with the same feature identifier has the same compressed data.
305: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 306, 否则执行步骤 307。  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. .
306: 获取从所述压缩数据存管模块中保存的所述特征标识对应的压缩 数据, 然后执行步骤 309。  306: Acquire compressed data corresponding to the feature identifier saved in the compressed data storage module, and then perform step 309.
307: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 308。  307: Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 308.
308: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存, 然后执行步骤 310。  308: Save the compressed compressed data in the compressed data storage module, and then perform step 310.
309: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 310。  309: Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 310.
310: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。  310: Return a data compression response, where the data compression response carries compressed data of the picture data to be compressed.
本领域普通技术人员将会理解, 本发明的各个方面、 或各个方面的可能 实现方式可以被具体实施为系统、 方法或者计算机程序产品。 因此, 本发明 的各方面、 或各个方面的可能实现方式可以采用完全硬件实施例、 完全软件 实施例 (包括固件、驻留软件等等), 或者组合软件和硬件方面的实施例的形 式, 在这里都统称为"电路"、 "模块 "或者 "系统"。 此外, 本发明的各方面、 或各个方面的可能实现方式可以采用计算机程序产品的形式,计算机程序产 品是指存储在计算机可读介质中的计算机可读程序代码。 Those of ordinary skill in the art will appreciate that various aspects of the present invention, or possible implementations of various aspects, may be embodied as a system, method, or computer program product. Thus, 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." Moreover, 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.
计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。 计算机可读存储介质包含但不限于电子、 磁性、 光学、 电磁、 红外或半导体 系统、 设备或者装置, 或者前述的任意适当组合, 如随机存取存储器 (RAM), 只读存储器 (ROM)、 可擦除可编程只读存储器 (EPROM 或者快闪 存储器)、 光纤、 便携式只读存储器 (CD-ROM)。  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. . It should also be noted that in some alternative implementations, 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. For example, depending on the functionality involved, 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.
本领域普通技术人员可以意识到, 结合本文中所公开的实施例描述的各 示例的单元及算法步骤, 能够以电子硬件、 或者计算机软件和电子硬件的结 合来实现。 这些功能究竟以硬件还是软件方式来执行, 取决于技术方案的特 定应用和设计约束条件。 专业技术人员可以对每个特定的应用来使用不同方 法来实现所描述的功能, 但是这种实现不应认为超出本发明的范围。  Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in a combination of electronic hardware or computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。  The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.

Claims

权利要求 Rights request
1、 一种数据压缩的方法, 其特征在于, 包括: 1. A data compression method, characterized by including:
接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据进行压 缩; Receive a data compression request, the data compression request indicates that the picture data to be compressed is compressed;
确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用于代表 所述待压缩的图片数据, 特征标识相同的图片数据具有相同的压缩数据; 根据所述待压缩的图片数据的特征标识,获取压缩数据存管模块保存的 所述特征标识对应的压缩数据; Determine the characteristic identifier of the picture data to be compressed, where the characteristic identifier is used to represent the picture data to be compressed, and picture data with the same characteristic identifier has the same compressed data; according to the characteristic identifier of the picture data to be compressed Feature identifier: obtain the compressed data corresponding to the feature identifier saved by the compressed data storage module;
返回数据压缩响应, 所述数据压缩响应携带从所述压缩数据存管模块获 取的所述特征标识对应的压缩数据。 Return a data compression response, where the data compression response carries the compressed data corresponding to the feature identifier obtained from the compressed data storage module.
2、 根据权利要求 1所述的方法, 其特征在于, 所述确定所述待压缩的 图片数据的特征标识包括: 2. The method according to claim 1, wherein determining the characteristic identifier of the image data to be compressed includes:
计算所述待压缩的图片数据的特征标识,所述特征标识包括循环冗余码 或者海明码。 Calculate the feature identifier of the image data to be compressed, where the feature identifier includes a cyclic redundancy code or a Hamming code.
3、 根据权利要求 2所述的方法, 其特征在于, 所述计算所述待压缩的 图片数据的特征标识包括: 3. The method according to claim 2, wherein the calculating the characteristic identifier of the image data to be compressed includes:
提取所述待压缩的图片数据的每帧图片数据; Extract each frame of picture data from the picture data to be compressed;
计算所述每帧图片数据的特征标识。 Calculate the feature identifier of each frame of picture data.
4、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 确定所述待压缩的图片数据是否满足压缩加速的条件,如果满足所述压 缩加速的条件, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压 缩数据存管模块保存的所述特征标识对应的压缩数据的步骤。 4. The method according to claim 1, characterized in that, the method further includes: determining whether the image data to be compressed satisfies the conditions for compression acceleration, and if the conditions for compression acceleration are met, executing the step according to The step of obtaining the characteristic identifier of the image data to be compressed and the compressed data corresponding to the characteristic identifier saved by the compressed data storage module.
5、 根据权利要求 4所述的方法, 其特征在于, 所述确定所述待压缩的 图片数据是否满足压缩加速的条件, 包括: 5. The method according to claim 4, wherein the determining whether the image data to be compressed meets the conditions for compression acceleration includes:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者, Determine whether the resources consumed by compressing the image data to be compressed exceed a first threshold, and if so, determine that the image data to be compressed meets the conditions for compression acceleration; or, Determine whether the attribute value of the image data to be compressed exceeds a second threshold. If so, determine that the image data to be compressed meets the conditions for compression acceleration. The attribute value includes any one of the following factors or any combination thereof: Picture The size, length, width, or bit depth of the data; or,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。 It is determined whether the complexity of the picture data to be compressed exceeds a third threshold, and if so, it is determined that the picture data to be compressed satisfies the conditions for compression acceleration.
6、 根据权利要求 4所述的方法, 其特征在于, 如果所述待压缩的图片 数据不满足压缩加速的条件, 所述方法还包括: 6. The method according to claim 4, characterized in that, if the picture data to be compressed does not meet the conditions for compression acceleration, the method further includes:
对所述待压缩的图片数据采用压缩算法进行压缩; Use a compression algorithm to compress the image data to be compressed;
返回数据压缩响应, 所述数据压缩响应携带所述采用压缩算法压缩得到 的压缩数据。 Return a data compression response, which carries the compressed data compressed using the compression algorithm.
7、 根据权利要求 1-5任意一项所述的方法, 其特征在于, 还包括: 建立所述压缩数据存管模块, 其中, 所述压缩数据存管模块用于保存图 片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来保 存不同图片数据的压缩数据。 7. The method according to any one of claims 1 to 5, further comprising: establishing the compressed data storage module, wherein the compressed data storage module is used to save a compressed data set of picture data , the compressed data set uses the feature identifier as an index to save compressed data of different picture data.
8、 根据权利要求 7所述的方法, 其特征在于, 所述根据所述待压缩的 图片数据的特征标识, 获取压缩数据存管模块保存的所述特征标识对应的压 缩数据之前, 还包括: 8. The method according to claim 7, characterized in that, before obtaining the compressed data corresponding to the characteristic identifier saved by the compressed data storage module according to the characteristic identifier of the picture data to be compressed, the method further includes:
确定所述压缩数据存管模块是否保存所述特征标识对应的压缩数据,如 果是, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压缩数据存 管模块保存的所述特征标识对应的压缩数据的步骤。 Determine whether the compressed data storage module saves the compressed data corresponding to the feature identification, and if so, execute the feature identification according to the picture data to be compressed to obtain the feature identification saved by the compressed data storage module Corresponding steps for compressing data.
9、 根据权利要求 8所述的方法, 其特征在于, 如果确定所述压缩数据 存管模块未保存所述特征标识对应的压缩数据, 所述方法还包括: 9. The method according to claim 8, wherein if it is determined that the compressed data storage module does not save the compressed data corresponding to the feature identifier, the method further includes:
对所述待压缩的图片数据采用压缩算法进行压缩; Use a compression algorithm to compress the image data to be compressed;
返回数据压缩响应, 所述数据压缩响应携带所述采用压缩算法压缩得到 的压缩数据。 Return a data compression response, which carries the compressed data compressed using the compression algorithm.
10、 根据权利要求 9所述的方法, 其特征在于, 所述方法还包括: 将所述采用压缩算法压缩得到的压缩数据和所述待压缩的图片数据的 特征标识保存到所述压缩数据存管模块。 10. The method according to claim 9, characterized in that, the method further includes: The compressed data obtained by using the compression algorithm and the characteristic identifier of the picture data to be compressed are saved to the compressed data storage module.
11、 一种数据压缩的装置, 其特征在于, 包括: 11. A data compression device, characterized by including:
接收单元, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的 图片数据进行压缩; A receiving unit, configured to receive a data compression request, where the data compression request indicates that the picture data to be compressed is to be compressed;
确定单元, 用于确定所述待压缩的图片数据的特征标识, 其中, 所述特 征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同 的压缩数据; Determining unit, used to determine the characteristic identifier of the picture data to be compressed, wherein the characteristic identifier is used to represent the picture data to be compressed, and picture data with the same characteristic identifier has the same compressed data;
获取单元, 用于根据所述确定单元确定的所述待压缩的图片数据的特征 标识, 获取压缩数据存管模块保存的所述特征标识对应的压缩数据; An acquisition unit, configured to obtain the compressed data corresponding to the characteristic identifier stored by the compressed data storage module according to the characteristic identifier of the picture data to be compressed determined by the determination unit;
响应单元, 用于返回数据压缩响应, 所述数据压缩响应携带从所述压缩 数据存管模块获取的所述特征标识对应的压缩数据。 A response unit, configured to return a data compression response, where the data compression response carries compressed data corresponding to the feature identifier obtained from the compressed data storage module.
12、 根据权利要求 11所述的装置, 其特征在于, 所述确定单元具体用 于: 12. The device according to claim 11, characterized in that the determining unit is specifically used to:
计算所述待压缩的图片数据的特征标识,所述特征标识包括循环冗余码 或者海明码。 Calculate the feature identifier of the image data to be compressed, where the feature identifier includes a cyclic redundancy code or a Hamming code.
13、 根据权利要求 12所述的装置, 其特征在于, 所述确定单元具体用 于: 13. The device according to claim 12, characterized in that the determining unit is specifically used to:
提取所述待压缩的图片数据的每帧图片数据; Extract each frame of picture data from the picture data to be compressed;
计算所述每帧图片数据的特征标识。 Calculate the feature identifier of each frame of picture data.
14、 根据权利要求 11所述的装置, 其特征在于, 所述装置还包括: 分类单元, 用于确定所述待压缩的图片数据是否满足压缩加速的条件; 在所述分类单元确定所述待压缩的图片数据满足所述压缩加速的条件 时, 所述获取单元具体用于根据所述待压缩的图片数据的特征标识, 获取所 述压缩数据存管模块保存的所述特征标识对应的压缩数据。 14. The device according to claim 11, characterized in that, the device further includes: a classification unit, used to determine whether the image data to be compressed satisfies the conditions for compression acceleration; When the compressed picture data meets the compression acceleration condition, the acquisition unit is specifically configured to obtain the compressed data corresponding to the characteristic identifier saved by the compressed data storage module according to the characteristic identifier of the image data to be compressed. .
15、 根据权利要求 14所述的装置, 其特征在于, 所述分类单元具体用 于: 15. The device according to claim 14, characterized in that the classification unit is specifically used At:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, Determine whether the resources consumed by compressing the image data to be compressed exceed a first threshold, and if so, determine that the image data to be compressed meets the conditions for compression acceleration; or,
确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者, Determine whether the attribute value of the image data to be compressed exceeds a second threshold. If so, determine that the image data to be compressed meets the conditions for compression acceleration. The attribute value includes any one of the following factors or any combination thereof: Picture The size, length, width, or bit depth of the data; or,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。 It is determined whether the complexity of the picture data to be compressed exceeds a third threshold, and if so, it is determined that the picture data to be compressed satisfies the conditions for compression acceleration.
16、 根据权利要求 14所述的装置, 其特征在于, 所述装置还包括: 第一压缩单元,在所述分类单元确定所述待压缩的图片数据不满足压缩 加速的条件时, 用于对所述待压缩的图片数据采用压缩算法进行压缩; 16. The device according to claim 14, wherein the device further includes: a first compression unit, configured to perform compression when the classification unit determines that the image data to be compressed does not meet the conditions for compression acceleration. The image data to be compressed is compressed using a compression algorithm;
所述响应单元还用于返回携带所述第一压缩单元采用压缩算法压缩得 到的压缩数据的数据压缩响应。 The response unit is also configured to return a data compression response carrying the compressed data compressed by the first compression unit using a compression algorithm.
17、 根据权利要求 11-16任意一项所述的装置, 其特征在于, 所述压缩 数据存管模块设置于所述数据压缩的装置内部或者外部, 用于保存图片数据 的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来保存不同 图片数据的压缩数据。 17. The device according to any one of claims 11 to 16, characterized in that the compressed data storage module is arranged inside or outside the data compression device and is used to save a compressed data set of picture data, so The compressed data set uses the feature identifier as an index to store compressed data of different picture data.
18、 根据权利要求 17所述的装置, 其特征在于, 所述确定单元还用于: 确定所述压缩数据存管模块是否保存所述特征标识对应的压缩数据; 存有所述特征标识对应的压缩数据时,根据所述待压缩的图片数据的特征标 识, 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据。 18. The device according to claim 17, wherein the determining unit is further configured to: determine whether the compressed data storage module stores the compressed data corresponding to the characteristic identifier; When compressing data, the compressed data corresponding to the characteristic identifier stored in the compressed data storage module is obtained according to the characteristic identifier of the picture data to be compressed.
19、 根据权利要求 18所述的装置, 其特征在于, 所述装置还包括: 第二压缩单元, 用于在所述确定单元确定所述压缩数据存管模块未保存 所述特征标识对应的压缩数据时,对所述待压缩的图片数据采用压缩算法进 行压缩; 所述响应单元还用于返回携带所述第二压缩单元采用压缩算法压缩得 到的压缩数据的数据压缩响应。 19. The device according to claim 18, characterized in that, the device further includes: a second compression unit, configured to determine in the determining unit that the compressed data storage module does not save the compressed data corresponding to the characteristic identifier. When collecting data, the image data to be compressed is compressed using a compression algorithm; The response unit is also configured to return a data compression response carrying the compressed data compressed by the second compression unit using a compression algorithm.
20、 根据权利要求 19所述的装置, 其特征在于, 所述第二压缩单元还 用于: 20. The device according to claim 19, characterized in that the second compression unit is also used for:
将所述采用压缩算法压缩得到的压缩数据和所述待压缩的图片数据的 特征标识保存到所述压缩数据存管模块。 The compressed data obtained by using the compression algorithm and the characteristic identifier of the picture data to be compressed are saved to the compressed data storage module.
21、 一种数据压缩系统, 其特征在于, 包括: 21. A data compression system, characterized by including:
数据压缩装置, 用于接收数据压缩请求, 所述数据压缩请求指示对待压 缩的图片数据进行压缩, 确定所述待压缩的图片数据的特征标识, 其中, 所 述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有 相同的压缩数据, 根据所述待压缩的图片数据的特征标识, 获取压缩数据存 管模块保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所述数据 压缩响应携带从所述压缩数据存管模块获取的所述特征标识对应的压缩数 据; Data compression device, configured to receive a data compression request, the data compression request indicates to compress the picture data to be compressed, and determine the characteristic identifier of the picture data to be compressed, wherein the characteristic identifier is used to represent the image data to be compressed of picture data, picture data with the same feature identifier has the same compressed data, according to the feature identifier of the image data to be compressed, obtain the compressed data corresponding to the feature identifier saved by the compressed data storage module, and return a data compression response, The data compression response carries the compressed data corresponding to the feature identifier obtained from the compressed data storage module;
所述压缩数据存管模块, 用于保存图片数据的压缩数据集合, 所述压缩 数据集合通过所述特征标识作为索引来保存不同图片数据的压缩数据。 The compressed data storage module is used to save a compressed data set of picture data, and the compressed data set uses the feature identifier as an index to save compressed data of different picture data.
PCT/CN2014/070865 2013-08-15 2014-01-20 Data compression method, computer system and device WO2015021753A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310356700.XA CN104376584B (en) 2013-08-15 2013-08-15 A kind of method of data compression, computer system and device
CN201310356700.X 2013-08-15

Publications (1)

Publication Number Publication Date
WO2015021753A1 true WO2015021753A1 (en) 2015-02-19

Family

ID=52467988

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/070865 WO2015021753A1 (en) 2013-08-15 2014-01-20 Data compression method, computer system and device

Country Status (2)

Country Link
CN (1) CN104376584B (en)
WO (1) WO2015021753A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106157337B (en) * 2015-04-09 2020-10-13 腾讯科技(深圳)有限公司 Picture analysis method and analysis system
CN106383670B (en) * 2016-09-21 2020-02-14 华为技术有限公司 Data processing method and storage device
CN109716660B (en) * 2017-01-24 2021-08-13 华为技术有限公司 Data compression apparatus and method
CN108933945B (en) * 2018-08-17 2020-06-19 腾讯科技(深圳)有限公司 GIF picture compression method, device and storage medium
CN112084155B (en) * 2020-09-09 2024-03-22 深圳市欢太科技有限公司 Picture processing method, device, equipment, terminal and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143183A (en) * 2011-03-24 2011-08-03 镇江星浪科技产品有限公司 Document versioning method
CN103136243A (en) * 2011-11-29 2013-06-05 中国电信股份有限公司 File system duplicate removal method and device based on cloud storage
CN103227818A (en) * 2013-03-27 2013-07-31 福建伊时代信息科技股份有限公司 Terminal, server, file transferring method, file storage management system and file storage management method
CN103237040A (en) * 2012-03-19 2013-08-07 天津书生投资有限公司 Storage method, storage server and storage client

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110188763A1 (en) * 2010-01-29 2011-08-04 Nenad Rijavec Image Header Compression Mechanism
CN102982046B (en) * 2011-09-07 2017-09-26 中国移动通信集团公司 A kind of web data compression and storage method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143183A (en) * 2011-03-24 2011-08-03 镇江星浪科技产品有限公司 Document versioning method
CN103136243A (en) * 2011-11-29 2013-06-05 中国电信股份有限公司 File system duplicate removal method and device based on cloud storage
CN103237040A (en) * 2012-03-19 2013-08-07 天津书生投资有限公司 Storage method, storage server and storage client
CN103227818A (en) * 2013-03-27 2013-07-31 福建伊时代信息科技股份有限公司 Terminal, server, file transferring method, file storage management system and file storage management method

Also Published As

Publication number Publication date
CN104376584B (en) 2018-02-13
CN104376584A (en) 2015-02-25

Similar Documents

Publication Publication Date Title
JP6316974B2 (en) Flash memory compression
CN109918205B (en) Edge equipment scheduling method, system, device and computer storage medium
WO2017028697A1 (en) Method and device for growing or shrinking computer cluster
WO2015021753A1 (en) Data compression method, computer system and device
WO2019109518A1 (en) Data list uploading method and terminal thereof
CN104899204B (en) Data storage method and device
US8438275B1 (en) Formatting data for efficient communication over a network
CN107146623B (en) Speech recognition method, device and system based on artificial intelligence
CN106685429B (en) Integer compression method and device
CN115567589B (en) Compression transmission method, device and equipment of JSON data and storage medium
WO2015013981A1 (en) Image display method and device
WO2023169274A1 (en) Data processing method and device, and storage medium and processor
CN105988941B (en) Cache data processing method and device
CN114760369A (en) Protocol metadata extraction method, device, equipment and storage medium
CN113238912A (en) Aggregation processing method for network security log data
CN111966647A (en) Cloud storage method and device for small files, server and storage medium
CN109788251B (en) Video processing method, device and storage medium
US11755540B2 (en) Chunking method and apparatus
WO2014075564A1 (en) Picture compression method and device
CN110879749A (en) Scheduling method and scheduling device for real-time transcoding task
WO2024001163A1 (en) Attribute data conversion method and apparatus, storage medium, and electronic device
CN112084210A (en) Data processing method and device, electronic equipment and storage medium
CN113395523A (en) Image decoding method, device and equipment based on parallel threads and storage medium
WO2020155538A1 (en) Video processing method and system, computer device and storage medium
US8677028B2 (en) Interrupt-based command processing

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