CN109428602A - A kind of data-encoding scheme, device and storage medium - Google Patents

A kind of data-encoding scheme, device and storage medium Download PDF

Info

Publication number
CN109428602A
CN109428602A CN201710765880.5A CN201710765880A CN109428602A CN 109428602 A CN109428602 A CN 109428602A CN 201710765880 A CN201710765880 A CN 201710765880A CN 109428602 A CN109428602 A CN 109428602A
Authority
CN
China
Prior art keywords
encoded
current
character
coefficient
coding
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.)
Pending
Application number
CN201710765880.5A
Other languages
Chinese (zh)
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.)
Qianhai Zhongke Chip Holdings (shenzhen) Co Ltd
Original Assignee
Qianhai Zhongke Chip Holdings (shenzhen) 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 Qianhai Zhongke Chip Holdings (shenzhen) Co Ltd filed Critical Qianhai Zhongke Chip Holdings (shenzhen) Co Ltd
Priority to CN201710765880.5A priority Critical patent/CN109428602A/en
Priority to KR1020187017276A priority patent/KR20190038746A/en
Priority to PCT/CN2018/088746 priority patent/WO2019041918A1/en
Publication of CN109428602A publication Critical patent/CN109428602A/en
Pending legal-status Critical Current

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a kind of data-encoding scheme, device and storage medium, which includes: to obtain character string to be encoded and preset siding-to-siding block length, includes multiple first preset characters and the second preset characters in the character string to be encoded;Coefficient critical value is determined according to the maximum times that second preset characters continuously occur in character string to be encoded;The code coefficient less than the coefficient critical value is selected from predetermined coefficient list;It is determined between the corresponding first coding section of first preset characters and the corresponding second code area of the second preset characters according to the siding-to-siding block length and code coefficient;The character string to be encoded is encoded using between the siding-to-siding block length, code coefficient, the first coding section and second code area, obtains encoded radio;Coding result is generated according to the encoded radio, and exports the coding result, so as to preferably realize the lossless compression of binary data, compressed capability is strong, and compression effectiveness is good.

Description

A kind of data-encoding scheme, device and storage medium
Technical field
The present invention relates to field of computer technology more particularly to a kind of data-encoding schemes, device and storage medium.
Background technique
Data compression refers under the premise of not losing information, reduces data volume to reduce memory space, improve its transmission, Store and process a kind of technical method of efficiency.
Existing data compression technique includes lossy compression and lossless compression, for compressed data convert, nothing Damage compression refers to that (or being called reduction, decompress) is reconstructed using compressed data, the data after reconstruct with originally Data are identical, and lossy compression is referred to and is reconstructed using compressed data, the data after reconstruct and original data It is different, but not lead to the misunderstanding for the information expressed firsthand information.Currently, the mode of data compression is very more, it is different The data of feature have different data compression schemes (namely coding mode), but are directed to the relatively low data of redundancy, Such as binary stream, after the compression of existing compression method, the data volume of reduction is limited, and compression effectiveness is poor.
Summary of the invention
The purpose of the present invention is to provide a kind of data-encoding scheme, device and storage mediums, to solve available data The data volume of compression method reduction is limited, the technical problem of compression effectiveness difference.
In order to solve the above technical problems, the embodiment of the present invention the following technical schemes are provided:
A kind of data-encoding scheme, comprising:
Character string to be encoded and preset siding-to-siding block length are obtained, includes multiple first pre- in the character string to be encoded If character and the second preset characters;
Coefficient critical value is determined according to the maximum times that second preset characters continuously occur in character string to be encoded;
The code coefficient less than the coefficient critical value is selected from predetermined coefficient list;
According to the siding-to-siding block length and code coefficient determine first preset characters it is corresponding first coding section and Between the corresponding second code area of second preset characters;
It is encoded between section and second code area using the siding-to-siding block length, code coefficient, first to the character to be encoded String is encoded, and encoded radio is obtained;
Coding result is generated according to the encoded radio, and exports the coding result.
In order to solve the above technical problems, the embodiment of the present invention also the following technical schemes are provided:
A kind of data coding device, comprising:
Module is obtained to wrap in the character string to be encoded for obtaining character string to be encoded and preset siding-to-siding block length Include multiple first preset characters and the second preset characters;
First determining module, the maximum time for continuously being occurred in character string to be encoded according to second preset characters Number determines coefficient critical value;
Selecting module, for selecting the code coefficient less than the coefficient critical value from predetermined coefficient list;
Second determining module, for determining that first preset characters are corresponding according to the siding-to-siding block length and code coefficient Between first coding section and the corresponding second code area of the second preset characters;
Coding module, for being encoded between section and second code area using the siding-to-siding block length, code coefficient, first to institute It states character string to be encoded to be encoded, obtains encoded radio;
Generation module for generating coding result according to the encoded radio, and exports the coding result.
Further, the coding module specifically includes:
First acquisition submodule, for obtain current character to be encoded, present encoding coefficient, current first coding section, Between current second code area and current interval length;
Submodule is determined, for encoding between section and current second code area according to current character to be encoded from current first Middle determining target interval;
Submodule is updated, for encoding according to current interval length, present encoding coefficient and target interval to current first It is updated between section and current second code area, to be encoded to current character to be encoded;
Return module, for encoding section and updated second code area for updated first when encoding completion Between as it is current first coding section and current second code area between, will next character to be encoded as currently character to be encoded, And return execution obtain between current character to be encoded, present encoding coefficient, current first coding section, current second code area and The operation of current interval length, until all character codes to be encoded finish.
Further, the update submodule is specifically used for:
Next siding-to-siding block length is calculated according to current interval length and present encoding coefficient;
The encoded character of history is obtained, and is calculated among the encoded character of the history and current character to be encoded, it is described The ratio of first preset characters and the second preset characters;
To current first coding section and worked as according to the minimum endpoint value of the ratio, next siding-to-siding block length and target interval It is updated between preceding second code area.
Further, the update submodule is specifically used for:
According to next siding-to-siding block length and minimum endpoint value computation interval upper limit value;
The section between the minimum endpoint value and section upper limit value is divided using the ratio, obtains two sons Section;
Current first coding section is updated using subinterval lesser after division, using biggish after division Subinterval is updated between current second code area.
Further, the return module is also used to:
When encoding completion, the number of the encoded character of the history is counted;
Next code coefficient is calculated according to the number of the encoded character of history and present encoding coefficient;
Using next code coefficient as present encoding coefficient, using next siding-to-siding block length as current interval length.
Further, the coding module further include:
Second acquisition submodule, for when all character codes to be encoded finish, obtaining between current second code area Two endpoint values;
Judging submodule, for judge described two endpoint values to each other current highest order number it is whether identical;
Output sub-module, it is if being for judging result instruction, the identical number is defeated as target number progress Out, it and using the next bit adjacent with the highest order as current highest order, returns execute the current second code area of acquisition later Between two endpoint values the step of, until judging result indicate it is no;
Sorting sub-module obtains encoded radio for being ranked up according to output sequence to the target number.
Further, the generation module is specifically used for:
Count the second quantity of the total quantity and the second preset characters of character in the character string to be encoded;
Using the encoded radio, the second quantity and total quantity as the coding result of the character string to be encoded.
Further, which further includes decoder module, is used for:
After exports coding result, decoding request is obtained, the decoding request carries the coding result;
It is requested to generate reference character string according to the decoding, includes first quantity first in the reference character string The second preset characters of preset characters and the second quantity, first quantity are equal to the difference of the sum and the second quantity, institute The most significant character for stating reference character string is second preset characters;
The encoded radio is decoded according to the reference character string.
Further, which is specifically used for:
Current reference character string is encoded, reference encoder value is obtained;
Decoding character is determined according to the reference encoder value and encoded radio, and according to the decoding character to current reference word The permutation and combination of character is updated in symbol string;
Using updated reference character string as current reference character string, and returns to execution and current reference character string is carried out The step of coding, until the aggregate-value of coding number is equal to the total quantity;
Decoding result is generated according to all decoding characters.
Further, which is specifically used for:
The first preset characters are supplemented in the tail portion of the encoded radio, so that the encoded radio and reference encoder value are with equal The character of quantity;
Whether the encoded radio after judging supplement is not less than reference encoder value;
If so, the second preset characters are determined as to decode character;
If it is not, then the first preset characters are determined as to decode character.
In order to solve the above technical problems, the embodiment of the present invention also the following technical schemes are provided:
A kind of storage medium, the storage medium are stored with a plurality of instruction, and described instruction is suitable for processor and is loaded, with Execute the step in data-encoding scheme described in any of the above embodiments.
Data-encoding scheme, device and storage medium provided by the invention, by acquisition character string to be encoded and in advance If siding-to-siding block length, include multiple first preset characters and the second preset characters in the character string to be encoded, and according to described The maximum times that second preset characters continuously occur in character string to be encoded determine coefficient critical value, later, from predetermined coefficient The code coefficient less than the coefficient critical value is selected in list, and according to the siding-to-siding block length and code coefficient determination Between the corresponding first coding section of first preset characters and the corresponding second code area of the second preset characters, later, institute is utilized It states and the character string to be encoded is encoded between siding-to-siding block length, code coefficient, the first coding section and second code area, obtain Encoded radio generates coding result according to the encoded radio, and exports the coding result, so as to preferably realize binary system The lossless compression of data, compressed capability is strong, and compression effectiveness is good.
Detailed description of the invention
With reference to the accompanying drawing, by the way that detailed description of specific embodiments of the present invention, technical solution of the present invention will be made And other beneficial effects are apparent.
Fig. 1 a is the flow diagram of data-encoding scheme provided in an embodiment of the present invention;
Fig. 1 b is the flow diagram of step S105 provided in an embodiment of the present invention;
Fig. 1 c is another flow diagram of step S105 provided in an embodiment of the present invention;
Fig. 2 is another flow diagram of data-encoding scheme provided in an embodiment of the present invention;
Fig. 3 a is the structural schematic diagram of data coding device provided in an embodiment of the present invention;
Fig. 3 b is the structural schematic diagram of coding module provided in an embodiment of the present invention;
Fig. 3 c is another structural schematic diagram of coding module provided in an embodiment of the present invention;
Fig. 4 is the structural schematic diagram of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, those skilled in the art's every other implementation obtained without creative efforts Example, shall fall within the protection scope of the present invention.
The embodiment of the present invention provides a kind of data-encoding scheme, device, storage medium and electronic equipment, below will be respectively It is described in detail.
A kind of data-encoding scheme, comprising: obtain character string to be encoded and preset siding-to-siding block length, the word to be encoded It include multiple first preset characters and the second preset characters in symbol string;Connected in character string to be encoded according to second preset characters The continuous maximum times occurred determine coefficient critical value;The coding system less than the coefficient critical value is selected from predetermined coefficient list Number;The corresponding first coding section of first preset characters and second default is determined according to the siding-to-siding block length and code coefficient Between the corresponding second code area of character;It is encoded between section and second code area using the siding-to-siding block length, code coefficient, first to this Character string to be encoded is encoded, and encoded radio is obtained;Coding result is generated according to the encoded radio, and exports the coding result.
As shown in Figure 1a, the detailed process of the data-encoding scheme can be such that
S101, character string to be encoded and preset siding-to-siding block length are obtained, includes multiple first in the character string to be encoded Preset characters and the second preset characters.
In the present embodiment, which includes string of binary characters, which can be 0, this Two preset characters can be 1.The preset siding-to-siding block length is mainly used for the initial space size of restricted code, can be artificial The 100000000000 of setting, or bigger, specifically can according to actual needs depending on.
S102, determine that coefficient is critical according to the maximum times that second preset characters continuously occur in character string to be encoded Value.
In the present embodiment, coefficient critical value corresponding with the maximum times, size can be obtained by way of tabling look-up Usually only related in the character string to be encoded continuous 1 number, continuous 1 number is more, and critical value is smaller.Practical application mistake Cheng Zhong can go out continuous 1 several relationship in coefficient value and sample, later by different companies by the computation induction to great amount of samples The continuous 1 corresponding coefficient critical value of number is stored on a table, when needing, directly according to continuous 1 number from table Obtain respective value, wherein the calculating mainly passes through formula
It realizes, wherein i, j, n ∈ [1, Len], Len are the character total length of each sample, and p (n) > 1, T are in each sample Total statistical value of all symbols, f are the statistical value of some symbol oneself in each sample, and O is all symbols before some symbol Number cumulative statistics value, α is coefficient value, determines continuous 1 several relationship in coefficient value and sample by the variation of p (n).
S103, the code coefficient less than the coefficient critical value is selected from predetermined coefficient list.
In the present embodiment, the predetermined coefficient list can be it is pre-set, can according to continuous 1 different numbers Corresponding coefficient critical value is calculated in advance, then using these coefficient critical values as coefficient value according to from small to large or from big It is stored sequentially in predetermined coefficient list to small, in this way, when needing to select code coefficient, it can be first from predetermined coefficient list In select the coefficient value less than current coefficient critical value, if the coefficient value selected be it is single, can directly as code coefficient, If the coefficient value selected be it is multiple, can by random or other setting means from it is multiple it is middle select one as encoding system Number.
S104, determined according to the siding-to-siding block length and code coefficient first preset characters it is corresponding first coding section, with And second between the corresponding second code area of preset characters.
In the present embodiment, formula R ' can be first passed through0=R00Siding-to-siding block length is initialized, wherein R '0After initialization Siding-to-siding block length, R0For preset siding-to-siding block length, α0For code coefficient, if than α0It is 1.1, R0It is 100000000000, then just Siding-to-siding block length R ' after beginningization0It is 110000000000, at this point, initialization section can be [0,110000000000], later, The initialization section is divided, is obtained between lesser first coding section and second code area.Typically for binary word Symbol string, division mode can be equal part namely first coding section U '0=[0,54999999999], the second code area Between U '1=[55000000000,110000000000], and U '0For the corresponding section of character 0, U '1For the corresponding section of character 1, Wherein, U '0With U '1Siding-to-siding block length be R '0/2。
S105, it is encoded between section and second code area using the siding-to-siding block length, code coefficient, first to the character to be encoded String is encoded, and encoded radio is obtained.
For example, b, above-mentioned steps S105 can specifically include referring to Figure 1:
S1051, current character to be encoded, present encoding coefficient, current first coding section, current second code area are obtained Between and current interval length.
In the present embodiment, code coefficient αnIt can be continually changing, be also possible to definite value, when for definite value, It can be α0, when for non-definite value, K can be passed through(αn)nn-1, wherein K(αn)It can be a specified qualitative function, such as Add, multiply, logic (important or inessential) etc..The character S to be encodedn, first coding section U '0(n), U ' between second code area1 (n) and siding-to-siding block length R 'nBe it is continually changing, encoded a character as soon as every, update it is primary, should be to and if encoding for the first time Code character is usually the initial character of the character string to be encoded, at this point, the code coefficient is α0, which is U '0 It (0), is U ' between the second code area1(0), the siding-to-siding block length (namely U '0(0) and U '1(0) total length) it is R '0
S1052, middle determining mesh between section and current second code area is encoded from current first according to current character to be encoded Mark section.
For example, above-mentioned steps S1052 can specifically include:
Judge whether current character to be encoded is first preset characters;
If so, current first coding section is determined as target interval;
If it is not, then target interval will be determined as between current second code area.
In the present embodiment, in an encoding process, need to find current character S to be encodednCorresponding coding section, for example, If current character S to be encodednIt is 0, then target interval is U '0If current character S to be encodednIt is 1, then target interval is U '1
S1053, according to current interval length, present encoding coefficient and target interval to current first coding section and current It is updated between second code area, to be encoded to current character to be encoded.
For example, above-mentioned steps S1053 can specifically include:
1-1, next siding-to-siding block length is calculated according to current interval length and present encoding coefficient.
In the present embodiment, N ∈ [1, Len], Len are the total length of character string to be encoded, LSFor sign pattern number in character string to be encoded.For example, for String of binary characters, since its symbol only includes 0 and 1, therefore LSIt is 2, at this point, Etc..
1-2, the encoded character of history is obtained, and calculated among the encoded character of the history and current character to be encoded, it should The ratio of first preset characters and the second preset characters.
In the present embodiment, dynamic ratio f can be calculated by adaptive probability statistical modelkNamely the moment calculates The ratio between first preset characters and the second preset characters among the encoded character of history and current character to be encoded, fk≠fk-1, than Such as, for symbol sebolic addressing 1010000110010101000100010, if present encoding character is third character, the ratio It is 1/2.
It is of course also possible to calculate static ratio f by static statistics modelk, namely be directly defined as the ratio Quiescent value (such as fk=1), fk=fk-1
1-3, according to the minimum endpoint value of the ratio, next siding-to-siding block length and target interval to current first coding section and It is updated between current second code area.
For example, above-mentioned steps 1-3 can specifically include:
According to next siding-to-siding block length and minimum endpoint value computation interval upper limit value;
The section between the minimum endpoint value and section upper limit value is divided using the ratio, obtains two sub-districts Between;
Current first coding section is updated using subinterval lesser after division, using biggish after division Subinterval is updated between current second code area.
In the present embodiment, section upper limit value H 'n=L 'n-1+R′n, L 'n-1For the minimum endpoint of target interval, adaptive general In rate statistical model, U '0(n)=[L 'n-1, L 'n-1+(fk/(fk+1))*R′n- 1], U '1(n)=[L 'n-1+(fk/(fk+1))*R ′n, H 'n].In static probability statistical model, U '0(n)=[L 'n-1, L 'n-1+R′n/ 2-1], U '1(n)=[L 'n-1+R′n/ 2, H′n]。
S1054, when encode complete when, by between updated first coding section and updated second code area as working as Between preceding first coding section and current second code area, using next character to be encoded as current character to be encoded, and returns and hold Row above-mentioned steps S1051, until all character codes to be encoded finish.
In the present embodiment, as n=Len, entire string encoding to be encoded is finished, at this point, U ' can be obtained1(n) and U '0 (n)。
Certainly, it is directed to the encoding operation of each character to be encoded, coding process is identical namely the word to be encoded The cataloged procedure of symbol string is the process constantly recycled, can be normally carried out to make to recycle, be related to code coefficient for recycling every time Should be constantly updated with siding-to-siding block length, be for each character to be encoded, when encode complete when, which can be with Include:
Count the number of the encoded character of the history;
Next code coefficient is calculated according to the number of the encoded character of history and present encoding coefficient;
Using next code coefficient as present encoding coefficient, using next siding-to-siding block length as current interval length.
In the present embodiment, code coefficient αnIt can be quiescent value, such as αn0, it is also possible to dynamic value, when for dynamically When value, K(αn)nn-1, wherein n-1 is the number of the encoded character of history, when this encoding operation is completed, under Secondary encoding operation, code coefficient αn, siding-to-siding block length is R 'n
Further, since that obtain is U ' when all character codes to be encoded finish1(n) and U '0(n), the word to be encoded The encoded radio of symbol string can be U '1(n) and U '0(n) any one value in, therefore, c referring to Figure 1, above-mentioned steps S105 is also May include:
S1055, when all character codes to be encoded finish, obtain two endpoint values between current second code area;
S1056, judge two endpoint values to each other current highest order number it is whether identical;
If the instruction of S1057, judging result is, which is exported as target number, and will be with this The adjacent next bit of highest order returns execute S1055 later as current highest order, until judging result instruction is no;
S1058, the target number is ranked up according to output sequence, obtains encoded radio.
In the present embodiment, if U '1(n)=[73042919870,73042952160], then encoded radio V is 730429.
S106, coding result is generated according to the encoded radio, and exports the coding result.
For example, above-mentioned steps S106 can specifically include:
Count the second quantity of the total quantity and the second preset characters of character in the character string to be encoded;
Using the encoded radio, the second quantity and total quantity as the coding result of the character string to be encoded.
In the present embodiment, if character string to be encoded is 1010000110010101000100010, total quantity Len is 25, Second quantity Count is 9, coding result V, Count, Len.
In addition, decoding operate is also related to after exports coding result, that is, the data-encoding scheme can also wrap It includes:
2-1, decoding request is obtained, decoding request carries the coding result;
2-2, it is requested to generate reference character string according to the decoding, includes that first quantity first is pre- in the reference character string If the second preset characters of character and the second quantity, first quantity are equal to the difference of the sum and the second quantity, the reference word The most significant character of symbol string is second preset characters.
In the present embodiment, for Count=9, Len=25, then the first quantity is 16, the length of the reference character string It also is 25 characters, and initial character is 1, the initiation sequence of trailing character all 1 namely the reference character string is 1000000000000000011111111。
2-3, the encoded radio is decoded according to the reference character string.
For example, above-mentioned steps 2-3 can specifically include:
Current reference character string is encoded, reference encoder value is obtained;
Decoding character is determined according to the reference encoder value and encoded radio, and according to the decoding character to current reference character string The permutation and combination of middle character is updated;
Using updated reference character string as current reference character string, and returns to execution and current reference character string is carried out The step of coding, until the aggregate-value of coding number is equal to the total quantity;
Decoding result is generated according to all decoding characters.
It, can be according to above-mentioned coding method in reference character string for each reference character string in the present embodiment Each character is encoded, and preset siding-to-siding block length is also R0, initial code coefficient is also α0, when in reference character string Alphabet all encode when finishing, finally obtain character 0 corresponding first and encode section D '0It is compiled with character 1 corresponding second Code section D '1, unlike, the encoded radio (namely reference encoder value) of the reference character string is not high-order identical numerical value, It can be and first directly take D '0Minimum endpoint value as Tn, then according to specified function tn=TnY (n) calculates reference encoder value tn, wherein function y (n) is obtained by test, with αnIt is related, later, according to reference encoder value tnIt is determined with encoded radio V Character is decoded, which mainly includes 1 and 0.It, can be by all decoding characters according to true when coding number reaches Len Fixed sequence arranges, finally obtained character string namely decoding result.
It should be noted that the current reference character string be it is continually changing, every time variation be according to a upper reference character String and its reference encoder value tnDepending on, namely according to upper reference character string and its reference encoder value tnTo current reference character string The arrangement position of middle character 1 and 0 is readjusted.The adjustment relates generally to the movement of character 1, for example, an if upper reference word Symbol string be 1100000000000000001111111, when decode character be 1 when, need by The character 1 of tail portion highest order is moved to behind the character 1 of front end lowest order in 1100000000000000001111111, is obtained To 1110000000000000000111111 (namely updated reference character strings), when decoding character is 0, need by The character 1 of front end lowest order moves one backward in 1100000000000000001111111, obtains 1010000000000000001111111 (namely updated reference character strings).
Further, above-mentioned " determining decoding character according to the reference encoder value and encoded radio " can specifically include:
The first preset characters are supplemented in the tail portion of the encoded radio, so that the encoded radio and reference encoder value have equal amount Character;
Whether the encoded radio after judging supplement is not less than reference encoder value;
If so, the second preset characters are determined as to decode character;
If it is not, then the first preset characters are determined as to decode character.
In the present embodiment, as V=730429, for n-th encoding operation, if reference encoder value tn= 85252570554, then V can become V '=73042900000 after mending 0, at this point, tn> V ', obtained decoding character are 0, If reference encoder value tn=55004691494, at this point, tn≤ V ', obtained decoding character are 1.
Citing, is described in further detail by the method according to described in above-described embodiment below.
In the present embodiment, will be integrated in the electronic device with data coding device, which is static general Rate statistical model, the code coefficient be quiescent value for be described in detail.
As shown in Fig. 2, a kind of data-encoding scheme, detailed process can be such that
S201, electronic equipment obtain character string to be encoded and preset siding-to-siding block length, include in the character string to be encoded Multiple first preset characters and the second preset characters.
For example, which can be 1010000110010101000100010, the preset siding-to-siding block length R0 =100000000000, which is 0, which is 1.
S202, electronic equipment are determined according to the maximum times that second preset characters continuously occur in character string to be encoded Coefficient critical value, and the code coefficient less than the coefficient critical value is selected from predetermined coefficient list.
For example, the maximum times continuously occurred for 1010000110010101000100010,1 are 2, are determined from table Coefficient critical value out can be 1.153133 ... 3, and so as to belong in predetermined coefficient list, (0,1.153133 ... 3) Any coefficient is as code coefficient α0, such as selection α0=1.1.
S203, electronic equipment determine corresponding first coding of first preset characters according to the siding-to-siding block length and code coefficient Between section and the corresponding second code area of the second preset characters.
For example, formula R ' can be first passed through0=R00Siding-to-siding block length is initialized, the siding-to-siding block length after being initialized R′0=110000000000, later by way of equal part, obtain the first coding section U '0(0)=[0,54999999999], U ' between second code area1(0)=[55000000000,110000000000].
S204, electronic equipment obtain current character to be encoded, present encoding coefficient, current first coding section, current the Two coding sections and current interval length.
If S205, current character to be encoded are first preset characters, electronic equipment determines current first coding section For target interval, if current character to be encoded is second preset characters, electronic equipment will be determined as between current second code area Target interval.
S206, electronic equipment calculate next siding-to-siding block length according to current interval length and present encoding coefficient, and according to this The minimum endpoint value computation interval upper limit value of next siding-to-siding block length and target interval.
S207, electronic equipment carry out equal part to the section between the minimum endpoint value and section upper limit value, obtain two sons Section, biggish subinterval is as current after subinterval lesser after division will be divided as current first coding section Between second code area.
S208, electronic equipment judge whether the character string to be encoded encodes and finish, if it is not, then making next character to be encoded For current character to be encoded, using next siding-to-siding block length as current interval length, and returns and execute above-mentioned steps S204, if so, Then execute following step S209.
For example, αn0=1.1, LS=2, fk=1, k ∈ [1, LS], character string to be encoded is 1010000110010101000100010, entire cataloged procedure is as follows:
Obtain the 1st character 1 to be encoded, R '1/ 2=30250000000, use simultaneously adjust section U '1(0), U ' is obtained0 (1)=[55000000000,85249999999], U '1(1)=[85250000000,115500000000].
Obtain the 2nd character 0 to be encoded, R '2/ 2=16637500000;Using and adjust section U '0(1), U ' is obtained0 (2)=[55000000000,71637499999], U '1(2)=[71637500000,88275000000]
Obtain the 3rd character 1 to be encoded, R '3/ 2=9150625000;Using and adjust section U '1(2), U ' is obtained0(3) =[71637500000,80788124999], U '1(3)=[80788125000,89938750000].
Obtain the 4th character 0 to be encoded, R '4/ 2=5032843750;Using and adjust section U '0(3), U ' is obtained0(4) =[71637500000,76670343749], U '1(4)=[76670343750,81703187500],
And so on, obtain following table table 1:
Table 1
S209, electronic equipment obtain two endpoint values between current second code area, and judge two endpoint values each other Between current highest order number it is whether identical, if so, following step S210 is executed, if it is not, then executing following step S211.
S210, electronic equipment export the identical number as target number, and will be adjacent with the highest order Next bit returns execute above-mentioned steps S209 later as current highest order.
For example, for U '1(25)=[73042919870,73042952160], the target number of output include 7,3,0, 4,2,9.
S211, electronic equipment are ranked up the target number according to output sequence, obtain encoded radio, and statistics should be to later Second quantity of the total quantity of character and the second preset characters in coded string, and by the encoded radio, the second quantity and total Coding result of the quantity as the character string to be encoded.
For example, the total quantity Len counted is 25, and the second quantity Count is 9, is arranged according to output sequence target number After sequence, encoded radio V is 730429, coding result V, Count, Len.It should be noted that compared with traditional coding result 63118085, V=730429 only have 6 numerical value, and few 2 numerical value improve 25% compression ratio, compressed capability has obtained obviously It improves, compression effectiveness is good.
S212, electronic equipment obtain decoding request, and decoding request carries the coding result.
S213, electronic equipment request to generate reference character string according to the decoding, include first number in the reference character string Measure the second preset characters of first preset characters and the second quantity, first quantity be equal to the sum and the second quantity it Difference, the most significant character of the reference character string are second preset characters.
For example, for Count=9, Len=25, then the first quantity is 16, and the length of the reference character string is also 25 characters, and initial character is 1, the initiation sequence of trailing character all 1 namely the reference character string is 1000000000000000011111111。
S214, electronic equipment encode current reference character string, obtain reference encoder value, and in the tail of the encoded radio Portion supplements the first preset characters, so that the encoded radio and reference encoder value have the character of equal amount, later after judgement supplement Encoded radio whether be not less than reference encoder value, if so, the second preset characters are determined as to decode character, if it is not, then by the One preset characters are determined as decoding character.
S215, electronic equipment are updated according to permutation and combination of the decoding character to character in current reference character string, And using updated reference character string as current reference character string, return execute above-mentioned steps S214 later, until coding Until several aggregate-values is equal to the total quantity;Decoding result is generated according to all decoding characters later.
For example, due to being learnt by experiment, α0When=1.1, y (n) ≈ 1, so, it, can during to encoding To take y (n)=1 namely TnY (n)=tnOr V/y (n)=v, certainly, the coding method of the reference character string may refer to wait compile The coding method of code character string, details are not described herein again, uniquely the difference is that, is finally obtaining corresponding first code area of character 0 Between D '0The D ' between the corresponding second code area of character 11When, the reference encoder value of the reference character string is not high-order identical number Value, should directly take D '0Minimum endpoint value as Tn, then according to TnY (n)=tnObtain reference encoder value tn.Entire solution Code process is as follows:
Count=9, Len=25 and V=730429 are obtained, reference character string 1000000000000000011111111 is obtained.
Its reference encoder value t is obtained according to 10000000000000000111111110=55004691494, in encoded radio The tail portion supplement 0 of V, obtains V '=73042900000, finds V' > t0, so output decoding character 1;
Count=Count-1 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 1000000000000000011111111 are adjusted, and obtain reference character string 1100000000000000001111111, root Its reference encoder value t is obtained according to 11000000000000000011111111=85252570554, find V' < t1, output 0;
Count=Count-0 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 1100000000000000001111111 are adjusted, and obtain reference character string 1010000000000000001111111, obtain T out2=71640070554, find V' > t2, output symbol 1;
Count=Count-1 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 1010000000000000001111111 are adjusted, and obtain reference character string 1011000000000000000111111, root T is obtained according to 10110000000000000001111113=80789529037.V'<t3, output symbol 0;
And so on, it is adjusted to 1011000000000000000111111, obtains reference character string 1010100000000000000111111, continue to decode using 1010100000000000000111111.It is solved as Len=0 Code terminates.Following table table 2 is referred to, it is resulting as a result, its decoding result known to following table is for above-mentioned decoding process 1010000110010101000100010, it also can completely obtain sequence to be encoded namely above-mentioned coding method is lossless Compression method, this compression method are mainly used in the data type more demanding to reduction degree such as word.
tn V' Decode character
55004691494 73042900000 1
85252570554 73042900000 0
71640070554 73042900000 1
80789529037 73042900000 0
76671747787 73042900000 0
74406968100 73042900000 0
73161339271 73042900000 0
72476243416 73042900000 1
72936138490 73042900000 1
73189080781 73042900000 0
73075097958 73042900000 0
73012407405 73042900000 1
73054355308 73042900000 0
73035391416 73042900000 1
73048032622 73042900000 0
73042296045 73042900000 1
73046093591 73042900000 0
73044358276 73042900000 0
73043403853 73042900000 0
73042878920 73042900000 1
73043181742 73042900000 0
73043022950 73042900000 0
73042935615 73042900000 0
73042887580 73042900000 1
73042937629 73042900000 0
Table 2
It can be seen from the above, data-encoding scheme provided in this embodiment, the wherein available character to be encoded of electronic equipment String and preset siding-to-siding block length include multiple first preset characters and the second preset characters in the character string to be encoded, connect , coefficient critical value is determined according to the maximum times that second preset characters continuously occur in character string to be encoded, and from pre- It is then, true according to the siding-to-siding block length and code coefficient if selecting the code coefficient less than the coefficient critical value in coefficient list Fixed first preset characters corresponding first encode between section and the corresponding second code area of the second preset characters, then, obtain It takes between current character to be encoded, present encoding coefficient, current first coding section, current second code area and current interval is long Degree, next, it is determined that whether current character to be encoded is first preset characters, if so, current first coding section is determined Then, according to current interval length and work as target interval if it is not, then target interval will be determined as between current second code area Preceding code coefficient calculates next siding-to-siding block length, and according to the minimum endpoint value computation interval of next siding-to-siding block length and target interval Upper limit value then carries out equal part to the section between the minimum endpoint value and section upper limit value, obtains two subintervals, will draw Biggish subinterval is as current second coding after/rear lesser subinterval will be divided as current first coding section Section, using next character to be encoded as current character to be encoded, using next siding-to-siding block length as current interval length, later, It returns to execute and obtains between current character to be encoded, present encoding coefficient, current first coding section, current second code area and work as The operation of preceding siding-to-siding block length, when all character codes to be encoded finish, electronic equipment obtains two between current second code area A endpoint value, and judge two endpoint values to each other current highest order number it is whether identical, if so, by the identical number It is exported as target number, and using the next bit adjacent with the highest order as current highest order, returns to execute later and obtain The operation of two endpoint values between current second code area is taken, if it is not, then the target number is ranked up according to output sequence, Encoded radio is obtained, counts the second quantity of the total quantity and the second preset characters of character in the character string to be encoded later, and Using the encoded radio, the second quantity and total quantity as the coding result of the character string to be encoded, so as to preferably realize two The encoding operation of system character string, compressed capability is strong, and later, the available decoding request of electronic equipment, decoding request carries The coding result then requests to generate reference character string according to the decoding, includes first quantity the in the reference character string The second preset characters of one preset characters and the second quantity, first quantity are equal to the difference of the sum and the second quantity, the ginseng The most significant character for examining character string is that second preset characters then encode current reference character string, is obtained with reference to volume Code value then supplements the first preset characters in the tail portion of the encoded radio, so that the encoded radio and reference encoder value have equal numbers The character of amount, and judge whether the encoded radio after supplement is not less than reference encoder value, if so, the second preset characters are determined as Character is decoded, if it is not, being then determined as the first preset characters to decode character, then, according to the decoding character to current reference word The permutation and combination of character is updated in symbol string, and using updated reference character string as current reference character string, is returned later Receipt row encodes current reference character string, obtains the operation of reference encoder value, until the aggregate-value of coding number is equal to Until the total quantity, finally decoding result can be generated according to all decoding characters, to realize the lossless of string of binary characters Compression, method is simple, and flexibility is high.
The method according to described in above-described embodiment, the present embodiment will be retouched from the angle further progress of data coding device It states, which can be used as independent entity specifically to realize, also can integrate in the electronics such as terminal or server It is realized in equipment, which may include smart phone, tablet computer and personal computer etc..
Fig. 3 a is please referred to, it may include: to obtain that data coding device provided in an embodiment of the present invention, which has been described in detail, in Fig. 3 a Modulus block 10, the first determining module 20, selecting module 30, the second determining module 40, coding module 50 and generation module 60, In:
(1) module 10 is obtained
Module 10 is obtained to wrap in the character string to be encoded for obtaining character string to be encoded and preset siding-to-siding block length Include multiple first preset characters and the second preset characters.
In the present embodiment, which includes string of binary characters, which can be 0, this Two preset characters can be 1.The preset siding-to-siding block length is mainly used for the initial space size of restricted code, can be artificial The 100000000000 of setting, or bigger, specifically can according to actual needs depending on.
(2) first determining modules 20
First determining module 20, the maximum time for continuously being occurred in character string to be encoded according to second preset characters Number determines coefficient critical value.
In the present embodiment, coefficient critical value corresponding with the maximum times can be obtained by way of tabling look-up, size is usual Only related in the character string to be encoded continuous 1 number, continuous 1 number is more, and critical value is smaller.In actual application, Continuous 1 several relationship in coefficient value and sample can be gone out by the computation induction to great amount of samples, later by of difference continuous 1 The corresponding coefficient critical value of number is stored on a table, and when needing, respective value is directly obtained from table according to continuous 1 number , wherein the calculating mainly passes through formula It realizes, wherein i, j, n ∈ [1, Len], Len are the character total length of each sample, and p (n) > 1, T are to own in each sample Total statistical value of symbol, f are the statistical value of some symbol oneself in each sample, and O is all symbols before some symbol Cumulative statistics value, α are coefficient value, determine continuous 1 several relationship in coefficient value and sample by the variation of p (n).
(3) selecting module 30
Selecting module 30, for selecting the code coefficient less than the coefficient critical value from predetermined coefficient list.
In the present embodiment, the predetermined coefficient list can be it is pre-set, can according to continuous 1 different numbers Corresponding coefficient critical value is calculated in advance, then using these coefficient critical values as coefficient value according to from small to large or from big It is stored sequentially in predetermined coefficient list to small, in this way, when needing to select code coefficient, it can be first from predetermined coefficient list In select the coefficient value less than current coefficient critical value, if the coefficient value selected be it is single, can directly as code coefficient, If the coefficient value selected be it is multiple, can by random or other setting means from it is multiple it is middle select one as encoding system Number.
(4) second determining modules 40
Second determining module 40, for determining first preset characters corresponding according to the siding-to-siding block length and code coefficient Between one coding section and the corresponding second code area of the second preset characters.
In the present embodiment, formula R ' can be first passed through0=R00Siding-to-siding block length is initialized, wherein R '0After initialization Siding-to-siding block length, R0For preset siding-to-siding block length, α0For code coefficient, if than α0It is 1.1, R0It is 100000000000, then just Siding-to-siding block length R ' after beginningization0It is 110000000000, at this point, initialization section can be [0,110000000000], later, The initialization section is divided, is obtained between lesser first coding section and second code area.Typically for binary word Symbol string, division mode can be equal part namely first coding section U '0=[0,54999999999], the second code area Between U '1=[55000000000,110000000000], and U '0For the corresponding section of character 0, U '1For the corresponding section of character 1, Wherein, U '0With U '1Siding-to-siding block length be R '0/2。
(5) coding module 50
Coding module 50, for being encoded between section and second code area using the siding-to-siding block length, code coefficient, first to this Character string to be encoded is encoded, and encoded radio is obtained.
For example, referring to Fig. 3 b, which be can specifically include:
First acquisition submodule 51, for obtaining current character to be encoded, present encoding coefficient, current first code area Between, between current second code area and current interval length.
In the present embodiment, code coefficient αnIt can be continually changing, be also possible to definite value, when for definite value, It can be α0, when for non-definite value, K can be passed through(αn)nn-1, wherein K(αn)It can be a specified qualitative function, such as Add, multiply, logic (important or inessential) etc..The character S to be encodedn, first coding section U '0(n), U ' between second code area1 (n) and siding-to-siding block length R 'nBe it is continually changing, encoded a character as soon as every, update it is primary, should be to and if encoding for the first time Code character is usually the initial character of the character string to be encoded, at this point, the code coefficient is α0, which is U '0 It (0), is U ' between the second code area1(0), the siding-to-siding block length (namely U '0(0) and U '1(0) total length) it is R '0
Submodule 52 is determined, for encoding section and current second code area from current first according to current character to be encoded Between middle determining target interval.
For example, determining that submodule 52 specifically can be used for:
Judge whether current character to be encoded is first preset characters;
If so, current first coding section is determined as target interval;
If it is not, then target interval will be determined as between current second code area.
In the present embodiment, in an encoding process, need to find current character S to be encodednCorresponding coding section, for example, If current character S to be encodednIt is 0, it is determined that the target interval that submodule 52 determines is U '0If current character S to be encodednIt is 1, Then determine that the target interval that submodule 52 determines is U '1
Submodule 53 is updated, for compiling according to current interval length, present encoding coefficient and target interval to current first It is updated between code section and current second code area, to be encoded to current character to be encoded;
For example, the update submodule 53 specifically can be used for:
1-1, next siding-to-siding block length is calculated according to current interval length and present encoding coefficient.
In the present embodiment, N ∈ [1, Len], Len are the total length of character string to be encoded, LSFor sign pattern number in character string to be encoded.For example, for String of binary characters, since its symbol only includes 0 and 1, therefore LSIt is 2, at this point, Etc..
1-2, the encoded character of history is obtained, and calculated among the encoded character of the history and current character to be encoded, it should The ratio of first preset characters and the second preset characters.
In the present embodiment, dynamic ratio f can be calculated by adaptive probability statistical modelkNamely the moment calculates The ratio between first preset characters and the second preset characters among the encoded character of history and current character to be encoded, fk≠fk-1, than Such as, for symbol sebolic addressing 1010000110010101000100010, if present encoding character is third character, the ratio It is 1/2.
It is of course also possible to calculate static ratio f by static statistics modelk, namely be directly defined as the ratio Quiescent value (such as fk=1), fk=fk-1
1-3, according to the minimum endpoint value of the ratio, next siding-to-siding block length and target interval to current first coding section and It is updated between current second code area.
For example, above-mentioned steps 1-3 can specifically include:
According to next siding-to-siding block length and minimum endpoint value computation interval upper limit value;
The section between the minimum endpoint value and section upper limit value is divided using the ratio, obtains two sub-districts Between;
Current first coding section is updated using subinterval lesser after division, using biggish after division Subinterval is updated between current second code area.
In the present embodiment, section upper limit value H 'n=L 'n-1+R′n, L 'n-1For the minimum endpoint of target interval, adaptive general In rate statistical model, U '0(n)=[L 'n-1, L 'n-1+(fk/(fk+1))*R′n- 1], U '1(n)=[L 'n-1+(fk/(fk+1))*R ′n, H 'n].In static probability statistical model, U '0(n)=[L 'n-1, L 'n-1+R′n/ 2-1], U '1(n)=[L 'n-1+R′n/ 2, H′n]。
Return module 54, for when encoding completion, updated first coding section and updated second to be encoded Section encodes between section and current second code area as current first, using next character to be encoded as current word to be encoded Symbol, and return to execution and obtain current character to be encoded, present encoding coefficient, current first coding section, current second code area Between and current interval length operation, until all character codes to be encoded finish.
In the present embodiment, as n=Len, entire string encoding to be encoded is finished, at this point, U ' can be obtained1(n) and U '0 (n)。
Certainly, be directed to the encoding operation of each character to be encoded, coding process be identical namely this this it is to be encoded The cataloged procedure of character string is the process constantly recycled, to be normally carried out circulation can, is related to coding system for recycling every time Several and siding-to-siding block length should be constantly updated, that is, the return module 54 can be also used for:
When encoding completion, the number of the encoded character of the history is counted;
Next code coefficient is calculated according to the number of the encoded character of history and present encoding coefficient;
Using next code coefficient as present encoding coefficient, using next siding-to-siding block length as current interval length.
In the present embodiment, code coefficient αnIt can be quiescent value, such as αn0, it is also possible to dynamic value, when for dynamically When value, K(αn)nn-1, wherein n-1 is the number of the encoded character of history, when this encoding operation is completed, under Secondary encoding operation, code coefficient αn, siding-to-siding block length is R 'n
Further, since that obtain is U ' when all character codes to be encoded finish1(n) and U '0(n), the word to be encoded The encoded radio of symbol string can be U '1(n) and U '0(n) therefore any one value in refers to Fig. 3 c, the coding module 50 is also May include:
Second acquisition submodule 55, for when all character codes to be encoded finish, obtaining between current second code area Two endpoint values;
Judging submodule 56, for judge two endpoint values to each other current highest order number it is whether identical;
Output sub-module 57, it is if being for judging result instruction, the identical number is defeated as target number progress Out, it and using the next bit adjacent with the highest order as current highest order, is returned between executing the current second code area of acquisition later Two endpoint values the step of, until judging result indicate it is no;
Sorting sub-module 58 obtains encoded radio for being ranked up according to output sequence to the target number.
In the present embodiment, if U '1(n)=[73042919870,73042952160], then encoded radio V is 730429.
(6) generation module 60
Generation module 60 for generating coding result according to the encoded radio, and exports the coding result.
For example, the generation module 60 specifically can be used for:
Count the second quantity of the total quantity and the second preset characters of character in the character string to be encoded;
Using the encoded radio, the second quantity and total quantity as the coding result of the character string to be encoded.
In the present embodiment, if character string to be encoded is 1010000110010101000100010, total quantity Len is 25, Second quantity Count is 9, coding result V, Count, Len.
In addition, decoding operate is also related to after exports coding result, that is, the data coding device can also wrap Decoder module is included, is used for:
After exports coding result, decoding request is obtained, decoding request carries the coding result;
It is requested to generate reference character string according to the decoding, includes the first predetermined word of first quantity in the reference character string The second preset characters of symbol and the second quantity, first quantity are equal to the difference of the sum and the second quantity, the reference character string Most significant character be second preset characters;
The encoded radio is decoded according to the reference character string.
2-1, decoding request is obtained, decoding request carries the coding result;
2-2, it is requested to generate reference character string according to the decoding, includes that first quantity first is pre- in the reference character string If the second preset characters of character and the second quantity, first quantity are equal to the difference of the sum and the second quantity, the reference word The most significant character of symbol string is second preset characters.
In the present embodiment, for Count=9, Len=25, then the first quantity is 16, and the length of the reference character string is also 25 characters, and initial character is 1, the initiation sequence of trailing character all 1 namely the reference character string is 1000000000000000011111111。
2-3, the encoded radio is decoded according to the reference character string.
For example, the decoder module may further be used for:
Current reference character string is encoded, reference encoder value is obtained;
Decoding character is determined according to the reference encoder value and encoded radio, and according to the decoding character to current reference character string The permutation and combination of middle character is updated;
Using updated reference character string as current reference character string, and returns to execution and current reference character string is carried out The step of coding, until the aggregate-value of coding number is equal to the total quantity;
Decoding result is generated according to all decoding characters.
It, can be according to above-mentioned coding method in reference character string for each reference character string in the present embodiment Each character is encoded, and preset siding-to-siding block length is also R0, initial code coefficient is also α0, when in reference character string Alphabet all encode when finishing, finally obtain character 0 corresponding first and encode section D '0It is compiled with character 1 corresponding second Code section D '1, unlike, the encoded radio (namely reference encoder value) of the reference character string is not high-order identical numerical value, It can be and first directly take D '0Minimum endpoint value as Tn, then according to specified function tn=TnY (n) calculates reference encoder value tn, wherein function y (n) is obtained by test, with αnIt is related, later, according to reference encoder value tnIt is determined with encoded radio V Character is decoded, which mainly includes 1 and 0.It, can be by all decoding characters according to true when coding number reaches Len Fixed sequence arranges, finally obtained character string namely decoding result.
It should be noted that the current reference character string be it is continually changing, every time variation be according to a upper reference character String and its reference encoder value tnDepending on, namely according to upper reference character string and its reference encoder value tnTo current reference character string The arrangement position of middle character 1 and 0 is readjusted.The adjustment relates generally to the movement of character 1, for example, an if upper reference word Symbol string be 1100000000000000001111111, when decode character be 1 when, need by The character 1 of tail portion highest order is moved to behind the character 1 of front end lowest order in 1100000000000000001111111, is obtained To 1110000000000000000111111 (namely updated reference character strings), when decoding character is 0, need by The character 1 of front end lowest order moves one backward in 1100000000000000001111111, obtains 1010000000000000001111111 (namely updated reference character strings).
Further, which can be used for:
The first preset characters are supplemented in the tail portion of the encoded radio, so that the encoded radio and reference encoder value have equal amount Character;
Whether the encoded radio after judging supplement is not less than reference encoder value;
If so, the second preset characters are determined as to decode character;
If it is not, then the first preset characters are determined as to decode character.
In the present embodiment, as V=730429, for n-th encoding operation, if reference encoder value tn= 85252570554, then V can become V '=73042900000 after mending 0, at this point, tn> V ', obtained decoding character are 0, If reference encoder value tn=55004691494, at this point, tn≤ V ', obtained decoding character are 1.
When it is implemented, above each unit can be used as independent entity to realize, any combination can also be carried out, is made It is realized for same or several entities, the specific implementation of above each unit can be found in the embodiment of the method for front, herein not It repeats again.
It can be seen from the above, data coding device provided in this embodiment, by obtain module 10 obtain character string to be encoded, And preset siding-to-siding block length, it include multiple first preset characters and the second preset characters in the character string to be encoded, first really Cover half block 20 determines coefficient critical value according to the maximum times that second preset characters continuously occur in character string to be encoded, it Afterwards, selecting module 30 selects the code coefficient less than the coefficient critical value, the second determining module 40 from predetermined coefficient list The corresponding first coding section of first preset characters and the second preset characters are determined according to the siding-to-siding block length and code coefficient Between corresponding second code area, later, coding module 50 utilizes the siding-to-siding block length, code coefficient, the first coding section and second Coding section encodes the character string to be encoded, obtains encoded radio, and generation module 60 generates coding knot according to the encoded radio Fruit, and the coding result is exported, so as to preferably realize the lossless compression of binary data, compressed capability is strong, compression effect Fruit is good.
Correspondingly, the embodiment of the present invention also provides a kind of electronic equipment, as shown in figure 4, it illustrates the embodiment of the present invention The structural schematic diagram of related electronic equipment, specifically:
The electronic equipment may include one or more than one processing core processor 701, one or more The components such as memory 702, power supply 703 and the input unit 704 of computer readable storage medium.Those skilled in the art can manage It solves, electronic devices structure shown in Fig. 4 does not constitute the restriction to electronic equipment, may include more more or fewer than illustrating Component perhaps combines certain components or different component layouts.Wherein:
Processor 701 is the control centre of the electronic equipment, utilizes various interfaces and the entire electronic equipment of connection Various pieces by running or execute the software program and/or module that are stored in memory 702, and are called and are stored in Data in reservoir 702 execute the various functions and processing data of electronic equipment, to carry out integral monitoring to electronic equipment. Optionally, processor 701 may include one or more processing cores;Preferably, processor 701 can integrate application processor and tune Demodulation processor processed, wherein the main processing operation system of application processor, user interface and application program etc., modulatedemodulate is mediated Reason device mainly handles wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 701 In.
Memory 702 can be used for storing software program and module, and processor 701 is stored in memory 702 by operation Software program and module, thereby executing various function application and data processing.Memory 702 can mainly include storage journey Sequence area and storage data area, wherein storing program area can the (ratio of application program needed for storage program area, at least one function Such as sound-playing function, image player function) etc.;Storage data area, which can be stored, uses created number according to electronic equipment According to etc..In addition, memory 702 may include high-speed random access memory, it can also include nonvolatile memory, such as extremely A few disk memory, flush memory device or other volatile solid-state parts.Correspondingly, memory 702 can also wrap Memory Controller is included, to provide access of the processor 701 to memory 702.
Electronic equipment further includes the power supply 703 powered to all parts, it is preferred that power supply 703 can pass through power management System and processor 701 are logically contiguous, to realize management charging, electric discharge and power managed etc. by power-supply management system Function.Power supply 703 can also include one or more direct current or AC power source, recharging system, power failure monitor The random components such as circuit, power adapter or inverter, power supply status indicator.
The electronic equipment may also include input unit 704, which can be used for receiving the number or character of input Information, and generate keyboard related with user setting and function control, mouse, operating stick, optics or trackball signal Input.
Although being not shown, electronic equipment can also be including display unit etc., and details are not described herein.Specifically in the present embodiment In, the processor 701 in electronic equipment can be corresponding by the process of one or more application program according to following instruction Executable file be loaded into memory 702, and the application program being stored in memory 702 is run by processor 701, It is as follows to realize various functions:
Character string to be encoded and preset siding-to-siding block length are obtained, includes multiple first default in the character string to be encoded Character and the second preset characters;
Coefficient critical value is determined according to the maximum times that second preset characters continuously occur in character string to be encoded;
The code coefficient less than the coefficient critical value is selected from predetermined coefficient list;
First preset characters corresponding first coding section and second is determined according to the siding-to-siding block length and code coefficient Between the corresponding second code area of preset characters;
Using the siding-to-siding block length, code coefficient, first coding section and second code area between to the character string to be encoded into Row coding, obtains encoded radio;
Coding result is generated according to the encoded radio, and exports the coding result.
The electronic equipment may be implemented to have achieved by any data coding device provided by the embodiment of the present invention Effect is imitated, is detailed in the embodiment of front, details are not described herein.
It will appreciated by the skilled person that all or part of the steps in the various methods of above-described embodiment can be with It is completed by instructing, or relevant hardware is controlled by instruction to complete, which can store computer-readable deposits in one In storage media, and is loaded and executed by processor.
For this purpose, the embodiment of the present invention provides a kind of storage medium, wherein being stored with a plurality of instruction, which can be processed Device is loaded, to execute the step in any data-encoding scheme provided by the embodiment of the present invention.
Wherein, which may include: read-only memory (ROM, Read Only Memory), random access memory Body (RAM, Random Access Memory), disk or CD etc..
By the instruction stored in the storage medium, any data provided by the embodiment of the present invention can be executed and compiled Step in code method, it is thereby achieved that achieved by any data-encoding scheme provided by the embodiment of the present invention Beneficial effect is detailed in the embodiment of front, and details are not described herein.
The specific implementation of above each operation can be found in the embodiment of front, and details are not described herein.
Be provided for the embodiments of the invention above a kind of data-encoding scheme, device, storage medium and electronic equipment into It has gone and has been discussed in detail, used herein a specific example illustrates the principle and implementation of the invention, the above implementation The explanation of example is merely used to help understand method and its core concept of the invention;Meanwhile for those skilled in the art, according to According to thought of the invention, there will be changes in the specific implementation manner and application range, in conclusion the content of the present specification It should not be construed as limiting the invention.

Claims (13)

1. a kind of data-encoding scheme characterized by comprising
Character string to be encoded and preset siding-to-siding block length are obtained, includes multiple first predetermined words in the character string to be encoded Symbol and the second preset characters;
Coefficient critical value is determined according to the maximum times that second preset characters continuously occur in character string to be encoded;
The code coefficient less than the coefficient critical value is selected from predetermined coefficient list;
First preset characters corresponding first coding section and second is determined according to the siding-to-siding block length and code coefficient Between the corresponding second code area of preset characters;
Using the siding-to-siding block length, code coefficient, first coding section and second code area between to the character string to be encoded into Row coding, obtains encoded radio;
Coding result is generated according to the encoded radio, and exports the coding result.
2. data-encoding scheme according to claim 1, which is characterized in that described to utilize the siding-to-siding block length, coding system The character string to be encoded is encoded between number, the first coding section and second code area, comprising:
Obtain between current character to be encoded, present encoding coefficient, current first coding section, current second code area and work as proparea Between length;
Middle determining target interval between section and current second code area is encoded from current first according to current character to be encoded;
According to current interval length, present encoding coefficient and target interval to current first coding section and current second code area Between be updated, to be encoded to current character to be encoded;
It, will be between updated first coding section and updated second code area as current first coding when encoding completion Between section and current second code area, using next character to be encoded as current character to be encoded, and returns to execution and obtain currently Between character to be encoded, present encoding coefficient, current first coding section, current second code area and the behaviour of current interval length Make, until all character codes to be encoded finish.
3. data-encoding scheme according to claim 2, which is characterized in that described according to current interval length, current volume Code coefficient and target interval are updated between current first coding section and current second code area, comprising:
Next siding-to-siding block length is calculated according to current interval length and present encoding coefficient;
The encoded character of history is obtained, and is calculated among the encoded character of the history and current character to be encoded, described first The ratio of preset characters and the second preset characters;
According to the minimum endpoint value of the ratio, next siding-to-siding block length and target interval to current first coding section and current the Two coding sections are updated.
4. data-encoding scheme according to claim 3, which is characterized in that described long according to the ratio, next section The minimum endpoint value of degree and target interval is updated between current first coding section and current second code area, comprising:
According to next siding-to-siding block length and minimum endpoint value computation interval upper limit value;
The section between the minimum endpoint value and section upper limit value is divided using the ratio, obtains two sub-districts Between;
Current first coding section is updated using subinterval lesser after division, utilizes sub-district biggish after division Between be updated between current second code area.
5. data-encoding scheme according to claim 3, which is characterized in that when encoding completion, further includes:
Count the number of the encoded character of the history;
Next code coefficient is calculated according to the number of the encoded character of history and present encoding coefficient;
Using next code coefficient as present encoding coefficient, using next siding-to-siding block length as current interval length.
6. data-encoding scheme according to claim 2, which is characterized in that described to utilize the siding-to-siding block length, coding system The character string to be encoded is encoded between number, the first coding section and second code area, obtains encoded radio, further includes:
When all character codes to be encoded finish, two endpoint values between current second code area are obtained;
Judge described two endpoint values to each other current highest order number it is whether identical;
If judging result instruction is, the identical number is exported as target number, and will be with the highest order Adjacent next bit returns to the step for executing and obtaining two endpoint values between current second code area as current highest order later Suddenly, until judging result instruction is no;
The target number is ranked up according to output sequence, obtains encoded radio.
7. data-encoding scheme described in any one of -6 according to claim 1, which is characterized in that described according to the coding Value generates coding result, comprising:
Count the second quantity of the total quantity and the second preset characters of character in the character string to be encoded;
Using the encoded radio, the second quantity and total quantity as the coding result of the character string to be encoded.
8. data-encoding scheme described in any one of -6 according to claim 1, which is characterized in that exports coding result it Afterwards, further includes:
Decoding request is obtained, the decoding request carries the coding result;
It is requested to generate reference character string according to the decoding, includes that first quantity first is default in the reference character string The second preset characters of character and the second quantity, first quantity are equal to the difference of the sum and the second quantity, the ginseng The most significant character for examining character string is second preset characters;
The encoded radio is decoded according to the reference character string.
9. data-encoding scheme according to claim 8, which is characterized in that it is described according to the reference character string to described Encoded radio is decoded, comprising:
Current reference character string is encoded, reference encoder value is obtained;
Decoding character is determined according to the reference encoder value and encoded radio, and according to the decoding character to current reference character string The permutation and combination of middle character is updated;
Using updated reference character string as current reference character string, and returns to execution and current reference character string is encoded The step of, until the aggregate-value of coding number is equal to the total quantity;
Decoding result is generated according to all decoding characters.
10. data-encoding scheme according to claim 9, which is characterized in that described according to the reference encoder value and volume Code value determines decoding character, comprising:
The first preset characters are supplemented in the tail portion of the encoded radio, so that the encoded radio and reference encoder value have equal amount Character;
Whether the encoded radio after judging supplement is not less than reference encoder value;
If so, the second preset characters are determined as to decode character;
If it is not, then the first preset characters are determined as to decode character.
11. a kind of data coding device characterized by comprising
Module is obtained, includes more in the character string to be encoded for obtaining character string to be encoded and preset siding-to-siding block length A first preset characters and the second preset characters;
First determining module, the maximum times for continuously being occurred in character string to be encoded according to second preset characters are true Determine coefficient critical value;
Selecting module, for selecting the code coefficient less than the coefficient critical value from predetermined coefficient list;
Second determining module, for determining first preset characters corresponding first according to the siding-to-siding block length and code coefficient It encodes between section and the corresponding second code area of the second preset characters;
Coding module, for using the siding-to-siding block length, code coefficient, first coding section and second code area between to it is described to Coded string is encoded, and encoded radio is obtained;
Generation module for generating coding result according to the encoded radio, and exports the coding result.
12. data coding device according to claim 11, which is characterized in that the coding module specifically includes:
First acquisition submodule, for obtaining current character to be encoded, present encoding coefficient, current first coding section, current Between second code area and current interval length;
Submodule is determined, for true between current first coding section and current second code area according to current character to be encoded Set the goal section;
Submodule is updated, for encoding section to current first according to current interval length, present encoding coefficient and target interval It is updated between current second code area, to be encoded to current character to be encoded;
Return module, for that will make between updated first coding section and updated second code area when encoding completion Between current first coding section and current second code area, using next character to be encoded as current character to be encoded, and return Receipt row obtains between current character to be encoded, present encoding coefficient, current first coding section, current second code area and current The operation of siding-to-siding block length, until all character codes to be encoded finish.
13. a kind of storage medium, which is characterized in that the storage medium is stored with a plurality of instruction, and described instruction is suitable for processor It is loaded, the step in 1 to 10 described in any item data-encoding schemes is required with perform claim.
CN201710765880.5A 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium Pending CN109428602A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201710765880.5A CN109428602A (en) 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium
KR1020187017276A KR20190038746A (en) 2017-08-30 2018-05-28 Data encoding method, device and storage medium
PCT/CN2018/088746 WO2019041918A1 (en) 2017-08-30 2018-05-28 Data coding method and device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710765880.5A CN109428602A (en) 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium

Publications (1)

Publication Number Publication Date
CN109428602A true CN109428602A (en) 2019-03-05

Family

ID=65504156

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710765880.5A Pending CN109428602A (en) 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium

Country Status (3)

Country Link
KR (1) KR20190038746A (en)
CN (1) CN109428602A (en)
WO (1) WO2019041918A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112104441A (en) * 2020-11-05 2020-12-18 广州市玄武无线科技股份有限公司 Method, device and system for encoding and decoding service data packet
CN112330948A (en) * 2021-01-04 2021-02-05 杭州涂鸦信息技术有限公司 Infrared remote control code matching method and device, computer equipment and readable storage medium
CN116610265A (en) * 2023-07-14 2023-08-18 济南玖通志恒信息技术有限公司 Data storage method of business information consultation system

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113098524A (en) * 2021-03-22 2021-07-09 北京达佳互联信息技术有限公司 Information encoding method and device, electronic equipment and storage medium
CN113746599B (en) * 2021-08-24 2024-03-22 湖南遥昇通信技术有限公司 Encoding method, decoding method, terminal, electronic device, and storage medium
CN113766237A (en) * 2021-09-30 2021-12-07 咪咕文化科技有限公司 Encoding method, decoding method, device, equipment and readable storage medium
CN117353751B (en) * 2023-12-06 2024-02-23 山东万辉新能源科技有限公司 Unmanned charging pile transaction data intelligent management system based on big data

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257366B (en) * 2008-03-27 2010-09-22 华为技术有限公司 Encoding and decoding method, communication system and equipment
US7773004B2 (en) * 2008-07-08 2010-08-10 Qualcomm Incorporated CAVLC run-before decoding scheme
CN101409759B (en) * 2008-11-19 2010-08-18 上海大学 Detection method for JPEG image re-encode based on '1'-linking characteristic
CN106445890B (en) * 2016-07-07 2019-06-25 湖南千年华光软件开发有限公司 Data processing method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112104441A (en) * 2020-11-05 2020-12-18 广州市玄武无线科技股份有限公司 Method, device and system for encoding and decoding service data packet
CN112330948A (en) * 2021-01-04 2021-02-05 杭州涂鸦信息技术有限公司 Infrared remote control code matching method and device, computer equipment and readable storage medium
EP4024360A1 (en) * 2021-01-04 2022-07-06 Hangzhou Tuya Information Technology Co., Ltd. Infrared remote control code matching method and apparatus, computer device, and readable storage medium
US20220215746A1 (en) * 2021-01-04 2022-07-07 Hangzhou Tuya Information Technology Co., Ltd. Infrared Remote Control Code Matching Method and Apparatus, Computer Device, and Readable Storage Medium
CN116610265A (en) * 2023-07-14 2023-08-18 济南玖通志恒信息技术有限公司 Data storage method of business information consultation system
CN116610265B (en) * 2023-07-14 2023-09-29 济南玖通志恒信息技术有限公司 Data storage method of business information consultation system

Also Published As

Publication number Publication date
KR20190038746A (en) 2019-04-09
WO2019041918A1 (en) 2019-03-07

Similar Documents

Publication Publication Date Title
CN109428602A (en) A kind of data-encoding scheme, device and storage medium
CN109428603A (en) A kind of data-encoding scheme, device and storage medium
CN104283567B (en) A kind of compression of name data, decompression method and equipment
CN100576753C (en) The system and method for static Huffman decoding
JP3309031B2 (en) Method and apparatus for compressing and decompressing short block data
US8791843B2 (en) Optimized bitstream encoding for compression
US10305512B2 (en) Encoding method and apparatus
CN107565971B (en) Data compression method and device
CN102970043B (en) A kind of compression hardware system based on GZIP and accelerated method thereof
US10044370B1 (en) Lossless binary compression in a memory constrained environment
CN101499048A (en) Bus encoding/decoding method and bus encoder/decoder
CN104331269A (en) Executable code compression method of embedded type system and code uncompressing system
CN103236847A (en) Multilayer Hash structure and run coding-based lossless compression method for data
JP2003218703A (en) Data coder and data decoder
KR20110007865A (en) Data compression method
CN110868223B (en) Numerical operation implementation method and circuit for Huffman coding
WO2021130754A1 (en) Systems and methods of data compression
US8515882B2 (en) Efficient storage of individuals for optimization simulation
US10103747B1 (en) Lossless binary compression in a memory constrained environment
Chen et al. A write-friendly arithmetic coding scheme for achieving energy-efficient non-volatile memory systems
JP6835285B1 (en) Data compression method, data compression device, data compression program, data decompression method, data decompression device and data decompression program
CN103746701A (en) Rapid encoding option selecting method applied to Rice lossless data compression
US20240028510A1 (en) Systems, methods and devices for exploiting value similarity in computer memories
CN108932315A (en) A kind of method and relevant apparatus of data decompression
EP1378999B1 (en) Code compression process, system and computer program product therefor

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190305