CN109067405A - A kind of method, apparatus of data compression, terminal and computer readable storage medium - Google Patents

A kind of method, apparatus of data compression, terminal and computer readable storage medium Download PDF

Info

Publication number
CN109067405A
CN109067405A CN201810844131.6A CN201810844131A CN109067405A CN 109067405 A CN109067405 A CN 109067405A CN 201810844131 A CN201810844131 A CN 201810844131A CN 109067405 A CN109067405 A CN 109067405A
Authority
CN
China
Prior art keywords
data
coded markings
byte
compressed
byte serial
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201810844131.6A
Other languages
Chinese (zh)
Other versions
CN109067405B (en
Inventor
刘均
韩浩瀚
李镐炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Hesvit Health Technology Co Ltd
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 Hesvit Health Technology Co Ltd filed Critical Hesvit Health Technology Co Ltd
Priority to CN201810844131.6A priority Critical patent/CN109067405B/en
Publication of CN109067405A publication Critical patent/CN109067405A/en
Application granted granted Critical
Publication of CN109067405B publication Critical patent/CN109067405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code

Abstract

This application involves technical field of data compression, the method for disclosing data compression includes: to 2 currently read inNA data to be compressed carry out integer wavelet transformation and obtain wavelet coefficient;Judge whether wavelet coefficient is greater than fluctuation threshold;If more than wavelet coefficient is then added to compressed package tail portion, everybody is corresponded in coded markings byte serial, the first default value is written;Wherein position and byte serial in compressed package are sequentially corresponding in coded markings byte serial, and the first default value indicates that the corresponding byte serial of this is uncoded data;If being not more than, the corresponding Hofmann coding of wavelet coefficient is added to compressed package tail portion, and correspond to everybody in coded markings byte serial and the second default value is written;Second default value indicates that the corresponding byte serial of this is the data after coding;This method can realize data compression under ultralow operational capability system;Disclosed herein as well is the device of data compression, terminal and computer readable storage mediums, have above-mentioned beneficial effect.

Description

A kind of method, apparatus of data compression, terminal and computer readable storage medium
Technical field
This application involves technical field of data processing, in particular to a kind of method, apparatus of data compression, terminal and calculating Machine readable storage medium storing program for executing.
Background technique
Currently, data compression algorithm mostly uses greatly the principle and its mutation of entropy coding, such as huffman coding, Shannon to compile Code, arithmetic compression algorithm.Or the algorithm using repetitive structure compression, such as LZ77 compression algorithm.Wherein, using entropy coding original The compression algorithm of reason needs to count data and construct dictionary;The algorithm compressed using repetitive structure is since its logic is multiple Miscellaneous, corresponding space complexity is high.Wherein, the coding of any information is not lost in entropy coding, that is, cataloged procedure by Entropy principle.
It can be seen that although above-mentioned various types of compact method compression effectiveness is relatively good, their calculating for processor Performance requirement is very high, therefore to be used for the processor performances such as PC, server, smart phone, camera stronger by their overwhelming majority In system.In equipment for only existing microcontroller, since microcontroller computing capability is weaker, memory headroom is extremely limited, So above-mentioned compression algorithm can not be executed.
Summary of the invention
The purpose of the application is to provide the method, apparatus, terminal and computer readable storage medium of a kind of data compression, energy It is enough to realize data compression under ultralow operational capability system.
In order to solve the above technical problems, the application provides a kind of method of data compression, which comprises
To 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet coefficient;
Judge whether the wavelet coefficient is greater than fluctuation threshold;
If more than the wavelet coefficient being then added to compressed package tail portion, and correspond to everybody in coded markings byte serial The first default value is written;
If being not more than, the corresponding Huffman Hofmann coding of the wavelet coefficient is added to the compressed package tail portion, And everybody is corresponded in the coded markings byte serial, the second default value is written.
Optionally, everybody being corresponded in coded markings byte serial, the first default value is written, comprising:
Update coded markings byte string length and index bit according to the byte length of the compressed package, and according to update after Coded markings byte string length and index bit correspond to everybody in the coded markings byte serial to be written described first pre- If numerical value;
Everybody is corresponded in the coded markings byte serial, and the second default value is written, comprising:
Update coded markings byte string length and index bit according to the byte length of the compressed package, and according to update after Coded markings byte string length and index bit correspond to everybody in the coded markings byte serial to be written described second pre- If numerical value.
Optionally, to 2 currently read inNA data to be compressed carry out integer wavelet transformation, before obtaining wavelet coefficient, also Include:
Initialization compression header file;Wherein, the compression header file includes Huffman Hofmann tree stored in ROM And the coded markings byte serial, the coded markings byte string length being stored in memory and the index bit.
Optionally, before initialization compression header file, further includes:
Data compression task is added, and sets minimum for the priority of the data compression task.
Optionally, described to judge whether the wavelet coefficient is greater than before fluctuation threshold, the method also includes:
Obtain the sample data to be compressed of preset quantity;
Determine the maximum value of the sample data to be compressed and the difference of minimum value;
The presupposition multiple of the difference is chosen as the fluctuation threshold.
A kind of device of data compression is also disclosed in the application, comprising:
Wavelet transformation module, for 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain small echo Coefficient;
Judgment module, for judging whether the wavelet coefficient is greater than fluctuation threshold;
First execution module, for if more than the fluctuation threshold, then the wavelet coefficient being added to compressed package tail portion, And everybody is corresponded in coded markings byte serial, the first default value is written;
Second execution module, if for being not more than the fluctuation threshold, by the corresponding Huffman of the wavelet coefficient Hofmann coding is added to the compressed package tail portion, and corresponds to everybody in the coded markings byte serial and be written second in advance If numerical value.
Optionally, described device further include:
Initialization module, for initializing compression header file;Wherein, the compression header file includes stored in ROM Huffman Hofmann tree and the coded markings byte serial, the coded markings byte string length being stored in memory with And the index bit.
Optionally, described device further include:
Fluctuation threshold determining module, for obtaining the sample data to be compressed of preset quantity;Determine the sample to be compressed The maximum value of data and the difference of minimum value;The presupposition multiple of the difference is chosen as the fluctuation threshold.
A kind of terminal is also disclosed in the application, comprising:
Memory, for storing computer program;
Processor, the step of method of data compression as described above is realized when for executing the computer program.This A kind of computer readable storage medium is also disclosed in application, and computer program, institute are stored on the computer readable storage medium The step of stating the method that data compression as described above is realized when computer program is executed by processor.
The method of data compression provided herein, comprising: to 2 currently read inNA data to be compressed carry out integer Wavelet transformation obtains wavelet coefficient;Judge whether wavelet coefficient is greater than fluctuation threshold;If more than then wavelet coefficient is added to Compressed package tail portion, and correspond to everybody in coded markings byte serial and the first default value is written;If being not more than, by wavelet systems The corresponding Hofmann coding of number is added to compressed package tail portion, and corresponds to everybody in coded markings byte serial and be written second in advance If numerical value.
As it can be seen that this method reduces computation complexity in such a way that Hofmann coding and wavelet transformation combine, (its is medium and small Wave conversion and Hofmann encoding computational complexity are all smaller), realize the data compression under ultralow operational capability system;And it is logical It crosses fluctuation threshold to treat data separation to be compressed, to improve compression ratio;Present invention also provides the devices of data compression, end End and computer readable storage medium have above-mentioned beneficial effect, and details are not described herein.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is the flow chart of the method for data compression provided by the embodiment of the present application;
Fig. 2 is the structural block diagram of the device of data compression provided by the embodiment of the present application.
Specific embodiment
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application In attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is Some embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art Every other embodiment obtained without making creative work, shall fall in the protection scope of this application.
Either still repetitive structure is used to compress using the method that entropy coding principle carries out data compression in the prior art Method, corresponding computation complexity is all very high, therefore these methods all can be only applied in the very strong processor of performance.And It then can not achieve above-mentioned compression algorithm when in face of only having the equipment of microprocessor.Data compression method tool provided in this embodiment There is very low computation complexity compression ratio with higher simultaneously, can be realized the progress data pressure under ultralow operational capability system Contracting.Specifically referring to FIG. 1, Fig. 1 is the flow chart of the method for data compression provided by the embodiment of the present application;This method can wrap It includes:
S100, to 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet coefficient.
The type that the present embodiment does not treat compressed data is defined, such as can be exercise data, electrocardiogram (ECG) data, figure As data etc..In order to improve data compression ratio, it is preferred that the present embodiment can choose the lesser data of fluctuation.Work as needs The data fluctuations compressed are less than threshold value, then as data to be compressed.It can be understood as the variation of data small amplitude Amount it is relatively more, the amount being widely varied is smaller.Such as the HR values of heart rate sensor acquisition, it can be deposited in a section In fluctuation within a narrow range, but seldom appear in the HR values outside the section.I.e. the present embodiment is for such data (as passed Sensor data) compression ratio with very little.
Specifically, the main purpose of the step be the data to be compressed that currently obtain are carried out integer wavelet transformation obtain it is small Wave system number.I.e. the present embodiment needs to treat in batches according to the quantity of data to be compressed when treating compressed data and being compressed Compressed data carries out data compression.Such as data to be compressed according to signal source, sequentially read in 2NA data to be compressed It carries out integer wavelet transformation and (reads in 2 every timeNA data to be compressed).The step is exactly to 2 currently read inNIt is a to be compressed Data carry out integer wavelet transformation.The numerical value of N is not defined, can be carried out according to hardware computing capability in the present embodiment It determines.Since the computing capability of microprocessor is limited, computation complexity can be improved if the value of N is excessive, will affect ultralow The effect of data compression is carried out under operational capability system;If data calculation times to be compressed will increase if the range of N is too small. Therefore in order to guarantee to calculate effect, it is preferred that the range of N can be between 8 to 10 in the present embodiment.Further, at hardware When reason ability is lower, in order to reduce data for the occupancy of processor memory, current 2 can be directly read in from ROMNIt is a to Compressed data carries out integer wavelet transformation.(i.e. currently available is small after determining that currently available wavelet coefficient has all been handled Wave system number has all executed subsequent operation), next 2 can be read in sequenceNA data to be compressed carry out integer wavelet change It changes.
Wherein, wavelet coefficient is exactly wavelet basis function coefficient similar with original signal.Wavelet transformation calculation amount very little.This reality It applies example not to be defined the process of specific integer wavelet transformation, can specifically become with reference to integer wavelet in the prior art The calculating process changed.
S110, judge whether wavelet coefficient is greater than fluctuation threshold.
Wherein, fluctuation threshold is distinguished for treating compressed data, executes different compressed actions according to result is distinguished. When wavelet coefficient is greater than fluctuation threshold, then the corresponding data to be compressed of the wavelet coefficient do not need to be encoded and (do not need to carry out Hofmann coding), when no more than fluctuation threshold, then the corresponding data to be compressed of the wavelet coefficient are encoded wavelet coefficient (needing to carry out Hofmann coding).Therefore fluctuation threshold is related to the compression ratio of data to be compressed.
Specifically, not being defined to the specific value of fluctuation threshold in the present embodiment.Such as user can according to The fluctuating characteristic and experience of compressed data carry out setting fluctuation threshold;User can also be by treating the corresponding sample of compressed data The fluctuation of notebook data (can be referred to as sample data to be compressed) carries out that fluctuation threshold is calculated.
Further, in order to improve compression ratio, it is preferred that fluctuating threshold value determination method in the present embodiment may include:
Obtain the sample data to be compressed of preset quantity;
Determine the maximum value of sample data to be compressed and the difference of minimum value;
The presupposition multiple of difference is chosen as fluctuation threshold.
Specifically, the present embodiment is not defined the numerical value of preset quantity.Preset quantity gets over the matter of fundamental importance under normal circumstances The corresponding compression ratio of obtained fluctuation threshold is higher.User can determine according to the type of practical sample data to be compressed and correspond to Preset quantity numerical value.The present embodiment is not also defined the specific value of presupposition multiple, under normal circumstances, presupposition multiple For the numerical value less than 1.Such as the numerical value of presupposition multiple is 0.1.
In order to improve computational efficiency in the present embodiment, step S110 to step S130 can be after obtaining a wavelet coefficient It is carried out once, until current 2NThe wavelet coefficient that a data to be compressed obtain all executes the step S110 to step S130 Afterwards, step S100 can be executed again.
S120, if more than wavelet coefficient being then added to compressed package tail portion, and correspond to everybody in coded markings byte serial The first default value is written;Wherein, position and byte serial in compressed package are sequentially corresponding in coded markings byte serial, the first present count Value indicates that byte serial is uncoded data in the corresponding compressed package of this.
If S130, being not more than, the corresponding Huffman Hofmann coding of wavelet coefficient is added to compressed package tail portion, and Everybody is corresponded in coded markings byte serial, and the second default value is written;Wherein, the second default value indicates that this is corresponding Byte serial is the data after coding in compressed package.
In the present embodiment wavelet coefficient corresponding Hofmann coding can by being obtained in Hofmann number, i.e., from The corresponding Hofmann coding of wavelet coefficient is found in Hofmann number.Wherein, Hofmann coding does not need big model, It does not need to be iterated the algorithm that calculating etc. is a kind of calculation amount very little.Wherein, Hofmann tree (Hofman tree) is cum rights path The shortest tree of length, the biggish node of weight are closer from root.The setting of Hofmann tree can be according to fluctuation threshold and to be compressed The type of data is determined.The present embodiment is not limited thereto.
In the present embodiment when wavelet coefficient be greater than fluctuation threshold, then illustrate that its corresponding data is mutated, it is such The frequency that data occur is very low, therefore corresponding Hofmann coding can be very long, therefore in order to improve computational efficiency, reduces and calculate Complexity, the present embodiment do not need to carry out it in such a case, it is possible to wavelet coefficient is directly added to compressed package tail portion Hofmann coding.When wavelet coefficient is not more than fluctuation threshold, then illustrate that its corresponding data is very stable, such data occur Frequency it is very high, therefore corresponding Hofmann coding can it is very short, therefore in order in the case where computation complexity very little improve pressure Contracting ratio, the present embodiment are added to compressed package tail portion in such a case, it is possible to which the corresponding Hofmann of wavelet coefficient is encoded, this When need to obtain its corresponding Hofmann coding.
Wherein, the present embodiment is not defined the specific value of the first default value and the second default value, as long as Can be determined by the numerical value recorded on each position in coded markings byte serial in the corresponding compressed package of this byte serial whether into Row coding (i.e. Hofmann coding).For example, when the upper numerical value recorded of some in coded markings byte serial is first pre- If numerical value, it is determined that byte serial is the data for not encoded (i.e. Hofmann coding) in the corresponding compressed package of this.Work as coding The upper numerical value recorded of some in flag byte string is the second default value, it is determined that byte serial in the corresponding compressed package of this To be encoded the data after (i.e. Hofmann coding).
Further, in order to improve write efficiency, and the occupancy to hardware store resource is reduced as far as possible.Preferably, originally Embodiment can be recorded by binary coded label byte serial (i.e. 01 string), specifically, the first default value is 1, the Two default values be 0 or first default value be 0, the second default value be 1.It can be obtained by only 0 He in this way 1 coded markings byte serial.
Specifically, the position in the present embodiment in coded markings byte serial and byte serial in compressed package are sequentially corresponding.Encode A position in flag byte string corresponds to a byte serial in compressed package.Such as the first character section string in compressed package is corresponding First position in coded markings byte serial.User can determine in coded markings byte serial when unziping it in this way Which specific byte serial in each corresponding compressed package.
The present embodiment does not limit specific how that position in coded markings byte serial and byte serial in compressed package is sequentially corresponding Mode.As long as can be realized in coded markings byte serial in position and compressed package byte serial sequentially corresponding record.Such as it can With by first determine currently to compressed package be added corresponding byte length after data change number n (such as by current compression bag data it is long Degree subtracts the byte length that the difference that previous compressed package data length obtains obtains compressed package divided by 8 again and changes number n), then Coded markings byte serial is increased into n position backward at last registration position, and records corresponding number on increased each position It is worth (the first default value or the second default value).Coded markings byte is either updated according to current compressed package data length String length (for recording the current length of coded markings byte serial) and index bit (indicate that the last character is saved in compressed package To which position), wherein it is volume that corresponding update mode, which can be the integer part obtained using compressed package data length divided by 8, Digit (i.e. which position in coded markings byte serial) in code labeling byte serial, remainder are index bit value;And according to update after (i.e. current) coded markings byte string length and index bit can determine and current need to remember in coded markings byte serial Then the position of the position of record records corresponding numerical value (the first default value or the second default value) in this position again.
Preferably, in order to improve the reliability of decompression, everybody is corresponded in the present embodiment in coded markings byte serial The first default value, which is written, may include:
Coded markings byte string length and index bit are updated according to the byte length of compressed package, and according to updated volume Code labeling byte string length and index bit correspond to everybody in coded markings byte serial and the first default value are written;
Everybody is corresponded in coded markings byte serial the second default value is written may include:
Coded markings byte string length and index bit are updated according to the byte length of compressed package, and according to updated volume Code labeling byte string length and index bit correspond to everybody in coded markings byte serial and the second default value are written.
Specifically, being determined in coded markings byte serial according to updated coded markings byte string length and index bit Need to be written the specific location of the position of numerical value, (i.e. the first default value or second is in advance for numerical value needed for being then written in this position If numerical value).Wherein, when a byte serial has eight, the index that index bit is 0 to 7, the 0th is lowest order, and the 7th is Highest order.
Based on the above-mentioned technical proposal, a kind of method of data compression provided by the embodiments of the present application, this method pass through The mode that Hofmann coding and wavelet transformation combine reduces computation complexity, realizes the number under ultralow operational capability system According to compression;And treated data separation to be compressed by fluctuation threshold, to improve compression ratio.
Further, it needs to initialize compression header file before carrying out data compression, such as obtains initially Hofmann tree and coded markings byte serial.The present embodiment does not limit the mode of specific initialization compression header file It is fixed, also the content in compression header file is not defined.User can carry out compression header file content according to actual needs It determines and carries out corresponding initialization.Based on the above embodiment, the utilization of hardware resource is further increased in the present embodiment Rate, when compressing in header file comprising Hofmann tree, coded markings byte serial, coded markings byte string length and index bit, Preferably, the Hofmann tree for including in header file will be compressed and coded markings byte serial is stored in the ROM, by coded markings Byte string length and index bit are stored in memory.
Wherein, ROM is the abbreviation of read-only memory (Read-Only Memory), is that one kind can only read deposited number in advance According to solid state semiconductor memory.Its characteristic be once storing data can not again by change or delete.It is generally used for being not required to In electronics or the computer system for often changing data, and data will not disappear because power supply is closed.Memory (Memory) Referred to as built-in storage, effect is exchanged for temporarily storing the operational data in CPU, and with external memories such as hard disks Data.As long as computer is in operation, CPU will be transferred to the data for needing operation in memory and carry out operation, when operation is complete Result is sent out again at rear CPU, the operation of memory also determines the stable operation of computer.
Specifically, Hofmann tree and coded markings byte serial are extremely important, and Hofmann tree is not required to become substantially Change, therefore Hofmann tree and coded markings byte serial are placed in ROM, and coded markings byte string length and index bit It needs often to update during operation and use, therefore coded markings byte string length and index bit are placed on operation speed It spends in higher memory.Wherein, coded markings byte string length and index bit can be realized by two registers.
Further, when the method for the data compression in the present embodiment is applied in ultralow operational capability system, in order to guarantee The normal operation of ultralow operational capability system can add data compression in the present embodiment in ultralow operational capability system and appoint Business, and set minimum for the priority of data compression task.
Specifically, chip (such as microprocessor) is low-power consumption in operational capability system ultralow first, computing capability is poor Chip, and priority is that high content is relatively more in ultralow operational capability system, data compression is not comparatively urgent, because It is minimum that this can be set to priority.Further, due to when executing data compression, needing to carry out the behaviour such as data buffering Make, therefore be also required to wait certain time, so also not needing that it is high to set its priority to.
The data compression process under above-mentioned ultralow operational capability system is exemplified below:
1, data compression task is added, and sets minimum for the priority of data compression task.
2, initialize compressed file head: a Hofmann tree is located at ROM, and a coded markings byte serial is located at ROM;One A coded markings byte string length and position index are located at memory.
3, for the signal source of data to be compressed, current 2 are sequentially taken from ROMNIt is small that a data to be compressed carry out integer Wave conversion obtains wavelet coefficient.
4, judge whether wavelet coefficient is greater than fluctuation threshold.
5, if more than fluctuation threshold, then wavelet coefficient is added to compressed package tail portion, and make in coded markings byte serial Label: N number of position (referred to as update position) juxtaposition 1 is successively increased in coded markings byte serial, N is the word of the last compressed package It saves length and changes number, if updating the lowest order that position reaches used byte, dynamic increases the length of byte serial, and more newly organized The counting of code labeling byte string length.
If 6, being not more than fluctuation threshold, the corresponding Hofmann of wavelet coefficient is encoded and is added to compressed package tail portion, and It marks in coded markings byte serial: successively increasing N number of juxtaposition 0 in coded markings byte serial, N is the last compressed package Length change number.
It is situated between below to the device of data compression provided by the embodiments of the present application, terminal and computer readable storage medium It continues, device, terminal and the computer readable storage medium of data compression described below and the side of above-described data compression Method can correspond to each other reference.
Referring to FIG. 2, Fig. 2 is the structural block diagram of the device of data compression provided by the embodiment of the present application;The device can To include:
Wavelet transformation module 100, for 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain small Wave system number;
Judgment module 200, for judging whether wavelet coefficient is greater than fluctuation threshold;
Wavelet coefficient is then added to compressed package tail portion for if more than fluctuation threshold by the first execution module 300, and Everybody is corresponded in coded markings byte serial, and the first default value is written;Wherein, in coded markings byte serial in position and compressed package Byte serial sequentially corresponds to, and the first default value indicates that byte serial is uncoded data in the corresponding compressed package of this;
Second execution module 400, if for being not more than fluctuation threshold, by the corresponding Huffman Hofmann of wavelet coefficient Coding is added to compressed package tail portion, and corresponds to everybody in coded markings byte serial and the second default value is written;Wherein, second Default value indicates that byte serial in the corresponding compressed package of this is the data after coding.
Based on the above embodiment, the first execution module 300 may include:
First writing unit, for updating coded markings byte string length and rope according to the byte length of the compressed package Draw position, and everybody is corresponded in the coded markings byte serial according to updated coded markings byte string length and index bit First default value is written;
Second execution module 400 may include:
Second writing unit, for updating coded markings byte string length and rope according to the byte length of the compressed package Draw position, and everybody is corresponded in the coded markings byte serial according to updated coded markings byte string length and index bit Second default value is written.
Based on the above embodiment, which can also include:
Initialization module, for initializing compression header file;Wherein, the compression header file includes stored in ROM Huffman Hofmann tree and the coded markings byte serial, the coded markings byte string length being stored in memory with And the index bit.
Based on above-mentioned any embodiment, which can also include:
Priority setup module is arranged for adding data compression task, and by the priority of the data compression task It is minimum.
Based on above-mentioned any embodiment, which can also include:
Fluctuation threshold determining module, for obtaining the sample data to be compressed of preset quantity;Determine sample data to be compressed Maximum value and minimum value difference;The presupposition multiple of difference is chosen as fluctuation threshold.
It should be noted that being based on above-mentioned any embodiment, described device can be to be realized based on programmable logic device , programmable logic device includes FPGA, CPLD, single-chip microcontroller etc..These programmable logic device can be set in microprocessor In.
The embodiment of the present application also provides a kind of terminal, comprising: memory, for storing computer program;Processor is used for The step of realizing the method such as above-mentioned any embodiment data compression when executing computer program.If processor is for executing calculating It realizes when machine program to 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet coefficient;Judge small echo Whether coefficient is greater than fluctuation threshold;If more than wavelet coefficient being then added to compressed package tail portion, and in coded markings byte serial It is corresponding that the first default value is written in everybody;Wherein, position and byte serial in compressed package are sequentially corresponding in coded markings byte serial, the One default value indicates that byte serial is uncoded data in the corresponding compressed package of this;If being not more than, by wavelet coefficient pair The Hofmann coding answered is added to compressed package tail portion, and corresponds to everybody in coded markings byte serial and the second present count is written Value;Wherein, the second default value indicates that byte serial in the corresponding compressed package of this is the data after coding.
Specifically, the processor in the present embodiment can be microprocessor, naturally it is also possible to be PC, server, intelligent hand The higher processor of performance used in the equipment such as machine, camera.
Based on the above embodiment, terminal is specially wearable device.Such as smartwatch, Intelligent bracelet, intelligent cap, intelligence Earphone etc..
The application also provides a kind of computer readable storage medium, and computer journey is stored on computer readable storage medium Sequence, when computer program is executed by processor the step of the realization such as method of above-mentioned any embodiment data compression.Such as computer It realizes when program is executed by processor to 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet systems Number;Judge whether wavelet coefficient is greater than fluctuation threshold;If more than wavelet coefficient being then added to compressed package tail portion, and encoding Everybody is corresponded in flag byte string, and the first default value is written;Wherein, position and byte in compressed package in coded markings byte serial String sequentially corresponds to, and the first default value indicates that byte serial is uncoded data in the corresponding compressed package of this;If being not more than, The corresponding Hofmann coding of wavelet coefficient is added to compressed package tail portion, and corresponds to everybody in coded markings byte serial and writes Enter the second default value;Wherein, the second default value indicates that byte serial in the corresponding compressed package of this is the data after coding.
The computer readable storage medium may include: USB flash disk, mobile hard disk, read-only memory (Read-OnlyMemory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. are various can store program The medium of code.
Each embodiment is described in a progressive manner in specification, the highlights of each of the examples are with other realities The difference of example is applied, the same or similar parts in each embodiment may refer to each other.For device disclosed in embodiment Speech, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is referring to method part illustration ?.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered Think beyond scope of the present application.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
Device, terminal and the computer readable storage medium of a kind of data compression provided herein are carried out above It is discussed in detail.Specific examples are used herein to illustrate the principle and implementation manner of the present application, above embodiments Illustrate to be merely used to help understand the present processes and its core concept.It should be pointed out that for the common skill of the art For art personnel, under the premise of not departing from the application principle, can also to the application, some improvement and modification can also be carried out, these change Into in the protection scope for also falling into the claim of this application with modification.

Claims (10)

1. a kind of method of data compression, which is characterized in that the described method includes:
To 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet coefficient;
Judge whether the wavelet coefficient is greater than fluctuation threshold;
If more than the wavelet coefficient being then added to compressed package tail portion, and correspond to everybody in coded markings byte serial and write Enter the first default value;
If being not more than, the corresponding Huffman Hofmann of the wavelet coefficient is encoded and is added to the compressed package tail portion, and Everybody is corresponded in the coded markings byte serial, and the second default value is written.
2. the method according to claim 1, wherein corresponding to everybody in coded markings byte serial is written first Default value, comprising:
Coded markings byte string length and index bit are updated according to the byte length of the compressed package, and according to updated volume Code labeling byte string length and index bit correspond to everybody in the coded markings byte serial and first present count are written Value;
Everybody is corresponded in the coded markings byte serial, and the second default value is written, comprising:
Coded markings byte string length and index bit are updated according to the byte length of the compressed package, and according to updated volume Code labeling byte string length and index bit correspond to everybody in the coded markings byte serial and second present count are written Value.
3. according to the method described in claim 2, it is characterized in that, to 2 currently read inNIt is small that a data to be compressed carry out integer Wave conversion, before obtaining wavelet coefficient, further includes:
Initialization compression header file;Wherein, the compression header file include Huffman Hofmann tree stored in ROM and The coded markings byte serial, the coded markings byte string length being stored in memory and the index bit.
4. according to the method described in claim 3, it is characterized in that, before initialization compression header file, further includes:
Data compression task is added, and sets minimum for the priority of the data compression task.
5. method according to claim 1-4, which is characterized in that described to judge whether the wavelet coefficient is greater than Before fluctuation threshold, the method also includes:
Obtain the sample data to be compressed of preset quantity;
Determine the maximum value of the sample data to be compressed and the difference of minimum value;
The presupposition multiple of the difference is chosen as the fluctuation threshold.
6. a kind of device of data compression characterized by comprising
Wavelet transformation module, for 2 currently read inNA data to be compressed carry out integer wavelet transformation, obtain wavelet coefficient;
Judgment module, for judging whether the wavelet coefficient is greater than fluctuation threshold;
The wavelet coefficient is then added to compressed package tail portion for if more than the fluctuation threshold by the first execution module, and Everybody is corresponded in coded markings byte serial, and the first default value is written;
Second execution module, if for being not more than the fluctuation threshold, by the corresponding Huffman Hofmann of the wavelet coefficient Coding is added to the compressed package tail portion, and corresponds to everybody in the coded markings byte serial and the second default value is written.
7. device according to claim 6, which is characterized in that further include:
Initialization module, for initializing compression header file;Wherein, the compression header file includes Hough stored in ROM ManHofmannShu and the coded markings byte serial, the coded markings byte string length being stored in memory and institute State index bit.
8. device according to claim 6 or 7, which is characterized in that further include:
Fluctuation threshold determining module, for obtaining the sample data to be compressed of preset quantity;Determine the sample data to be compressed Maximum value and minimum value difference;The presupposition multiple of the difference is chosen as the fluctuation threshold.
9. a kind of terminal characterized by comprising
Memory, for storing computer program;
Processor realizes the method for the data compression as described in any one of claim 1 to 5 when for executing the computer program The step of.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program, realizing the method for data compression as described in any one of claim 1 to 5 when the computer program is executed by processor Step.
CN201810844131.6A 2018-07-27 2018-07-27 Data compression method, device, terminal and computer readable storage medium Active CN109067405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810844131.6A CN109067405B (en) 2018-07-27 2018-07-27 Data compression method, device, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810844131.6A CN109067405B (en) 2018-07-27 2018-07-27 Data compression method, device, terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109067405A true CN109067405A (en) 2018-12-21
CN109067405B CN109067405B (en) 2022-10-11

Family

ID=64835927

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810844131.6A Active CN109067405B (en) 2018-07-27 2018-07-27 Data compression method, device, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109067405B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110113618A (en) * 2019-06-11 2019-08-09 苏州泓迅生物科技股份有限公司 A kind of image storage method, read method, storage device and reading device
CN110446124A (en) * 2019-08-19 2019-11-12 深圳市双翼科技股份有限公司 Unit remote management method, storage medium and device based on ONT Optical Network Terminal
CN111181568A (en) * 2020-01-10 2020-05-19 深圳花果公社商业服务有限公司 Data compression device and method, data decompression device and method
CN113542225A (en) * 2021-06-17 2021-10-22 深圳市合广测控技术有限公司 Data compression method and device, terminal equipment and storage medium
CN113630124A (en) * 2021-08-10 2021-11-09 优刻得科技股份有限公司 Method, system, device and medium for processing time sequence integer data
CN113672575A (en) * 2021-07-16 2021-11-19 深圳智慧林网络科技有限公司 Data compression method and device and storage medium
CN115173865A (en) * 2022-03-04 2022-10-11 上海玫克生储能科技有限公司 Battery data compression processing method for energy storage power station and electronic equipment

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5748786A (en) * 1994-09-21 1998-05-05 Ricoh Company, Ltd. Apparatus for compression using reversible embedded wavelets
US5836003A (en) * 1993-08-26 1998-11-10 Visnet Ltd. Methods and means for image and voice compression
CN1322442A (en) * 1999-07-20 2001-11-14 皇家菲利浦电子有限公司 Encoding method for compression of video sequence
US20030118241A1 (en) * 1994-09-21 2003-06-26 Ricoh Company, Ltd. Method and apparatus for compression using reversible wavelet transforms and an embedded codestream
CN1438767A (en) * 2002-02-16 2003-08-27 三星电子株式会社 Method and apparatus for changing compressed audio frequency signal using small wave packet
CN1471312A (en) * 2002-07-26 2004-01-28 包头钢铁学院 Selective medical image compression method
CN101038303A (en) * 2007-02-07 2007-09-19 深圳市双合电脑系统股份有限公司 Compression method for electric power waveform recording date
CN101448158A (en) * 2008-12-19 2009-06-03 中国海洋大学 Underwater video compression method
CN101488214A (en) * 2008-01-15 2009-07-22 中国科学院软件研究所 Method for expanding anti-fake digital watermark and electronic seal information content
CN101924562A (en) * 2010-06-24 2010-12-22 北京师范大学 Compression-type coding scheme of curve vector data based on integer wavelet transformation
CN101984666A (en) * 2010-11-19 2011-03-09 南京邮电大学 Image lossless compression and decompression method based on lifting wavelet transform
US20150113220A1 (en) * 2013-10-21 2015-04-23 International Business Machines Corporation Efficient one-pass cache-aware compression
CN105187071A (en) * 2015-09-29 2015-12-23 东北大学 Pipeline millisecond online data compound compression/decompression method
CN108322220A (en) * 2018-02-08 2018-07-24 华为技术有限公司 Decoding method, device and coding/decoding apparatus

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5836003A (en) * 1993-08-26 1998-11-10 Visnet Ltd. Methods and means for image and voice compression
US5748786A (en) * 1994-09-21 1998-05-05 Ricoh Company, Ltd. Apparatus for compression using reversible embedded wavelets
US20030118241A1 (en) * 1994-09-21 2003-06-26 Ricoh Company, Ltd. Method and apparatus for compression using reversible wavelet transforms and an embedded codestream
CN1322442A (en) * 1999-07-20 2001-11-14 皇家菲利浦电子有限公司 Encoding method for compression of video sequence
CN1438767A (en) * 2002-02-16 2003-08-27 三星电子株式会社 Method and apparatus for changing compressed audio frequency signal using small wave packet
CN1471312A (en) * 2002-07-26 2004-01-28 包头钢铁学院 Selective medical image compression method
CN101038303A (en) * 2007-02-07 2007-09-19 深圳市双合电脑系统股份有限公司 Compression method for electric power waveform recording date
CN101488214A (en) * 2008-01-15 2009-07-22 中国科学院软件研究所 Method for expanding anti-fake digital watermark and electronic seal information content
CN101448158A (en) * 2008-12-19 2009-06-03 中国海洋大学 Underwater video compression method
CN101924562A (en) * 2010-06-24 2010-12-22 北京师范大学 Compression-type coding scheme of curve vector data based on integer wavelet transformation
CN101984666A (en) * 2010-11-19 2011-03-09 南京邮电大学 Image lossless compression and decompression method based on lifting wavelet transform
US20150113220A1 (en) * 2013-10-21 2015-04-23 International Business Machines Corporation Efficient one-pass cache-aware compression
CN105187071A (en) * 2015-09-29 2015-12-23 东北大学 Pipeline millisecond online data compound compression/decompression method
CN108322220A (en) * 2018-02-08 2018-07-24 华为技术有限公司 Decoding method, device and coding/decoding apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
S A CHOUAKRI: ""Wavelet transform and Huffman coding based electrocardiogram compression algorithm: Application to telecardiology"", 《24TH IUPAP CONFERENCE ON COMPUTATIONAL PHYSICS》 *
许晓飞: ""应用整数小波变换的LZ77电力数据压缩算法"", 《西安工程大学学报》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110113618A (en) * 2019-06-11 2019-08-09 苏州泓迅生物科技股份有限公司 A kind of image storage method, read method, storage device and reading device
CN110113618B (en) * 2019-06-11 2021-09-03 苏州泓迅生物科技股份有限公司 Image storage method, reading method, storage device and reading device
CN110446124A (en) * 2019-08-19 2019-11-12 深圳市双翼科技股份有限公司 Unit remote management method, storage medium and device based on ONT Optical Network Terminal
CN110446124B (en) * 2019-08-19 2021-10-12 深圳市双翼科技股份有限公司 Unit remote management method, storage medium and device based on optical network terminal
CN111181568A (en) * 2020-01-10 2020-05-19 深圳花果公社商业服务有限公司 Data compression device and method, data decompression device and method
CN113542225A (en) * 2021-06-17 2021-10-22 深圳市合广测控技术有限公司 Data compression method and device, terminal equipment and storage medium
CN113542225B (en) * 2021-06-17 2023-08-22 深圳市合广测控技术有限公司 Data compression method and device, terminal equipment and storage medium
CN113672575A (en) * 2021-07-16 2021-11-19 深圳智慧林网络科技有限公司 Data compression method and device and storage medium
CN113630124A (en) * 2021-08-10 2021-11-09 优刻得科技股份有限公司 Method, system, device and medium for processing time sequence integer data
CN113630124B (en) * 2021-08-10 2023-08-08 优刻得科技股份有限公司 Method, system, equipment and medium for processing time sequence integer data
CN115173865A (en) * 2022-03-04 2022-10-11 上海玫克生储能科技有限公司 Battery data compression processing method for energy storage power station and electronic equipment

Also Published As

Publication number Publication date
CN109067405B (en) 2022-10-11

Similar Documents

Publication Publication Date Title
CN109067405A (en) A kind of method, apparatus of data compression, terminal and computer readable storage medium
CN103236847B (en) Based on the data lossless compression method of multilayer hash data structure and Run-Length Coding
CN102694554B (en) Data compression device, its operating method and the data processing equipment including the equipment
CN103916131B (en) The method and apparatus for carrying out the process of compressed data
US6122378A (en) Data compression/encryption method and system
CN104331269B (en) A kind of embedded system executable code compression method and code decompression compression system
CN103280221B (en) A kind of audio lossless compressed encoding, coding/decoding method and system of following the trail of based on base
JP6692448B2 (en) Storage device and storage device control method
CN108768403A (en) Lossless data compression, decompressing method based on LZW and LZW encoders, decoder
CN106549673A (en) A kind of data compression method and device
US7999704B2 (en) Low complexity compression of short messages
CN111262587B (en) Data compression method, device, equipment and computer readable storage medium
CN106374933A (en) Data compression device and method
CN107423397A (en) A kind of self-adapting compressing storage and decompression extracting method towards multitask micro-system
CN110021369B (en) Gene sequencing data compression and decompression method, system and computer readable medium
CN110008192A (en) A kind of data file compression method, apparatus, equipment and readable storage medium storing program for executing
CN104410424B (en) The fast and lossless compression method of embedded device internal storage data
JP2000323993A (en) Mpeg1 audio layer iii decoding processor and computer- readable recording medium storing program allowing computer to function as mpeg1 audio layer iii decoding processor
CN116244313B (en) JSON data storage and access method, device, computer equipment and medium
CN108769694A (en) A kind of method and device of the Alpha channel codings based on FPGA
CN117040539B (en) Petroleum logging data compression method and device based on M-ary tree and LZW algorithm
CN108053034A (en) Model parameter processing method, device, electronic equipment and storage medium
CN113222159A (en) Quantum state determination method and device
CN108932315A (en) A kind of method and relevant apparatus of data decompression
CN108259515A (en) A kind of lossless source compression method suitable for transmission link under Bandwidth-Constrained

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20190625

Address after: 518057 Yuanzheng Industrial Park, 4012 North Fifth Avenue, Bantian Street, Longgang District, Shenzhen City, Guangdong Province

Applicant after: LAUNCH TECH Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: HESVIT HEALTH TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant