Nothing Special   »   [go: up one dir, main page]

CN109428603A - 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
CN109428603A
CN109428603A CN201710766636.0A CN201710766636A CN109428603A CN 109428603 A CN109428603 A CN 109428603A CN 201710766636 A CN201710766636 A CN 201710766636A CN 109428603 A CN109428603 A CN 109428603A
Authority
CN
China
Prior art keywords
encoded
current
character
coding
coefficient
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
CN201710766636.0A
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 CN201710766636.0A priority Critical patent/CN109428603A/en
Priority to KR1020187017277A priority patent/KR20190038747A/en
Priority to PCT/CN2018/088753 priority patent/WO2019041919A1/en
Publication of CN109428603A publication Critical patent/CN109428603A/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
    • H03M7/4006Conversion to or from arithmetic code
    • H03M7/4012Binary arithmetic codes
    • 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/3068Precoding preceding compression, e.g. Burrows-Wheeler transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • 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
    • 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/60General implementation details not specific to a particular type of compression
    • H03M7/6011Encoder aspects
    • 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/60General implementation details not specific to a particular type of compression
    • H03M7/6064Selection of Compressor
    • H03M7/6082Selection strategies
    • 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/70Type of the data to be coded, other than image and sound
    • H03M7/705Unicode

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (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 not 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 lossy 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 not 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 not 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 this second The maximum times that preset characters continuously occur in character string to be encoded determine coefficient critical value, later, from predetermined coefficient list In select the code coefficient not less than the coefficient critical value, and determine that this is first default according to the siding-to-siding block length and code coefficient It is later, long using the section between the corresponding first coding section of character and the corresponding second code area of the second preset characters The character string to be encoded is encoded between degree, code coefficient, the first coding section and second code area, obtains encoded radio, root Coding result is generated according to the encoded radio, and exports the coding result, damages pressure so as to preferably realize binary data Contracting, 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 lossy coding method 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 not less than the coefficient critical value is selected from predetermined coefficient list Coefficient;The corresponding first coding section of first preset characters and second is determined in advance according to the siding-to-siding block length and code coefficient If between the corresponding second code area of character;It is right between section and second code area to be encoded using the siding-to-siding block length, code coefficient, first The 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 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.It, can be in actual application Go out continuous 1 several relationship in coefficient value and sample by the computation induction to great amount of samples, it is later that the number of difference continuous 1 is corresponding Coefficient critical value be stored on a table, when needing, respective value is directly obtained from table according to continuous 1 number, In, which 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).
S103, the code coefficient not 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, can first determine predetermined coefficient when needing to select code coefficient It is greater than or equal to the coefficient value of current coefficient critical value in list, is then therefrom selected by random or other setting means One is used as code coefficient.The code coefficient being typically chosen is bigger, and the data volume reduced after compression is bigger, and compressed capability is stronger, But opposite, the distortion factor of data is higher after decompression.
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).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, Len is 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, 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, and each character to be encoded is for, and when encoding completion, which may be used also To 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, for Next 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, in exports coding as a result, decoding operate (decompression operation) is also related to after realizing compression, that is, should Data-encoding scheme can also include:
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, 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 010101001000100110001, the preset siding-to-siding block length R0= 1000000000000, 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 not less than the coefficient critical value is selected from predetermined coefficient list.
For example, the maximum times continuously occurred for 010101001000100110001,1 are 2, are determined from table Coefficient critical value can be 1.153133 ... 3, so as to from predetermined coefficient list obtain be greater than or equal to 1.153133 ... 3 Any coefficient as code coefficient α0, such as selection α0=1.18.
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=1180000000000, later by way of equal part, obtain the first coding section U '0(0)=[0, 589999999999], U between second code area1' (0)=[590000000000,1180000000000].
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.18, LS=2, fk=1, k ∈ [1, LS], character string to be encoded is 010101001000100110001, entire cataloged procedure is as follows:
Obtain the 1st character 0 to be encoded, R '1=696200000000, use simultaneously adjusts section U '0(0), U ' is obtained0(1) =[0,348099999999], U1' (1)=[348100000000,696200000000].
Obtain the 2nd character 1 to be encoded, R '2=410758000000;Using and adjust section U1' (1), obtains U '0(2) =[348100000000,553478999999], U1' (2)=[553479000000,758858000000]
Obtain the 3rd character 0 to be encoded, R '3=242347220000;Using and adjust section U '0(2), U ' is obtained0(3) =[348100000000,469273609999], U1' (3)=[469273610000,5904472200000].
Obtain the 4th character 1 to be encoded, R '4=142984859800;Using and adjust section U1' (3), obtain U '0(4) =[469273610000,540766039899], U1' (4)=[540766039900,612258469800],
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 U1' (21)=[521534163813,521543257589], the target number of output include 5,2, 1,5.
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 21, and the second quantity Count is 8, is arranged according to output sequence target number After sequence, encoded radio V is 5215, coding result V, Count, Len, and compared with traditional coding result, few 2 numerical value are improved 25% compression ratio, compressed capability are significantly improved, and 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=8, Len=21, then the first quantity is 13, and the length of the reference character string is also 21 words Symbol, and initial character is 1, the initiation sequence of trailing character all 1 namely the reference character string is 100000000000001111111。
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, during to encoding, y (n)=1 namely T can be takennY (n)=tnOr V/y (n)=v, when So, the coding method of the reference character string may refer to the coding method of character string to be encoded, and details are not described herein again, unique different , section D ' is encoded finally obtaining character 0 corresponding first0The D ' between the corresponding second code area of character 11When, the reference The reference encoder value of character string is not high-order identical numerical value, should directly take D '0Minimum endpoint value as Tn, then root According to TnY (n)=tnObtain reference encoder value tn.Entire decoding process is as follows:
Count=8, Len=21 and V=5215 are obtained, reference character string 100000000000001111111 is obtained.
Its reference encoder value t is obtained according to 1000000000000011111110=590000000000, encoded radio V's Tail portion supplement 0, obtains V '=52150000000, finds V'< t0, so output decoding character 0;
Count=Count-0 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 100000000000001111111 are adjusted, and obtain reference character string 010000000000001111111, according to 010000000000001111111 obtains its reference encoder value t1=348100000000, find V'> t1, output 1;
Count=Count-1 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 010000000000001111111 is adjusted, and obtains reference character string 01100000000000111111, obtains t2= 553479000000, find V'< t2, output symbol 0;
Count=Count-0 (just subtracts 1 when only decoding symbol 1), Len=Len-1.At this point, right 01100000000000111111 is adjusted, and obtains reference character string 01010000000000111111, according to 01010000000000111111 obtains t3=469273610000.V'> t3, output symbol 1;
And so on, it is adjusted to 01010000000000111111, obtains reference character string 01011000000000011111, continue to decode using 01011000000000011111.Decoding as Len=0 terminates.It please join It see the table below table 2, it is resulting as a result, its decoding result known to following table is for above-mentioned decoding process 010101001000100100000, and original character string to be encoded 010101001000100110001 is distinct, has The variation of two positions, cannot correctly restore namely above-mentioned coding method is lossy compression, in general, this compression method It is mainly used in the data type that the needs such as video, image carry out big intensity compressions.
tn V' Decode character
590000000000 521500000000 0
348100000000 521500000000 1
553479000000 521500000000 0
469273610000 521500000000 1
540766039900 521500000000 0
511454143641 521500000000 1
536340658489 521500000000 0
526137187401 521500000000 0
520117139460 521500000000 1
525228306993 521500000000 0
523132728304 521500000000 0
521896336878 521500000000 0
521166865936 521500000000 1
521786204558 521500000000 0
521532275723 521500000000 0
521382457710 521500000000 1
521509656857 521500000000 0
521584704354 521500000000 0
521553934880 521500000000 0
521535780891 521500000000 0
521525070037 521500000000 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- If selecting the code coefficient not less than the coefficient critical value in coefficient list, then, according to the siding-to-siding block length and code coefficient It determines between the corresponding first coding section of first preset characters and the corresponding second code area of the second preset characters, then, It obtains 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 squeeze 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 damaging for string of binary characters Decompression, 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
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.
(3) selecting module 30
Selecting module 30, for selecting the code coefficient not 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, can first determine predetermined coefficient when needing to select code coefficient It is greater than or equal to the coefficient value of current coefficient critical value in list, is then therefrom selected by random or other setting means One is used as code coefficient.The code coefficient being typically chosen is bigger, and the data volume reduced after compression is bigger, and compressed capability is stronger, But opposite, the distortion factor of data is higher after decompression.
(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).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, Len is 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, in exports coding as a result, decoding operate (decompression operation) is also related to after realizing compression, that is, should Data coding device can also include decoder module, be 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 not less than the coefficient critical value, the second determining module from predetermined coefficient list 40 determine the corresponding first coding section of first preset characters and the second predetermined word according to the siding-to-siding block length and code coefficient Between according with corresponding second code area, later, coding module 50 utilizes the siding-to-siding block length, code coefficient, the first coding section and the Two coding sections encode the character string to be encoded, obtain encoded radio, and generation module 60 is generated according to the encoded radio and encoded As a result, and export the coding result, so as to preferably realize the lossy compression of binary data, compressed capability is strong, compression Effect 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 not 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 not 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 not 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.
CN201710766636.0A 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium Pending CN109428603A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201710766636.0A CN109428603A (en) 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium
KR1020187017277A KR20190038747A (en) 2017-08-30 2018-05-28 DATA ENCODING METHOD, DEVICE AND STORAGE MEDIUM
PCT/CN2018/088753 WO2019041919A1 (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
CN201710766636.0A CN109428603A (en) 2017-08-30 2017-08-30 A kind of data-encoding scheme, device and storage medium

Publications (1)

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

Family

ID=65504320

Family Applications (1)

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

Country Status (3)

Country Link
KR (1) KR20190038747A (en)
CN (1) CN109428603A (en)
WO (1) WO2019041919A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414728A (en) * 2020-03-05 2020-07-14 金蝶蝶金云计算有限公司 Numerical data display method and device, computer equipment and storage medium

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2727540C1 (en) * 2019-11-22 2020-07-22 федеральное государственное автономное образовательное учреждение высшего образования "Казанский (Приволжский) федеральный университет" (ФГАОУ ВО КФУ) Application of membrane vesicles of multipotent stromal cells induced by b cytochalasin, for restoration and increase of mitochondrial function
CN113746599B (en) * 2021-08-24 2024-03-22 湖南遥昇通信技术有限公司 Encoding method, decoding method, terminal, electronic device, and storage medium
CN114759929B (en) * 2022-05-09 2024-03-29 东软睿驰汽车技术(大连)有限公司 Compression method and device for time sequence data of Internet of vehicles and electronic equipment
CN116738471B (en) * 2023-08-10 2023-10-20 陕西昕晟链云信息科技有限公司 Block chain-based decentralization data analysis method
CN116827350B (en) * 2023-08-29 2023-11-07 众科云(北京)科技有限公司 Flexible work platform intelligent supervision method and system based on cloud edge cooperation
CN117216023B (en) * 2023-11-07 2024-01-26 陕西长瑞安驰信息技术集团有限公司 Large-scale network data storage method and system
CN118282412B (en) * 2024-05-31 2024-08-02 山东汉方自动化有限公司 Automatic data storage management system based on artificial intelligence
CN118677573B (en) * 2024-08-21 2024-10-29 湖北中科能能源技术有限公司 Remote monitoring management method and system for power station

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070080832A1 (en) * 2005-10-12 2007-04-12 Huawei Technologies Co., Ltd. Decoding system and method based on context-based adaptive binary arithmetic coding
US20070146173A1 (en) * 2005-04-14 2007-06-28 Sony Corporation Coding apparatus, decoding apparatus, coding method, decoding method and program
US8078640B1 (en) * 2007-08-02 2011-12-13 Amazon Technologies, Inc. High efficiency binary encoding
CN106445890A (en) * 2016-07-07 2017-02-22 湖南千年华光软件开发有限公司 Data processing method
CN106484753A (en) * 2016-06-07 2017-03-08 湖南千年华光软件开发有限公司 Data processing method
CN106788993A (en) * 2016-12-02 2017-05-31 乐视控股(北京)有限公司 A kind of encryption communication method, device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651795B (en) * 2012-05-15 2014-10-01 上海大学 Run-length reduced binary sequence compressed encoding method
CN103974066B (en) * 2014-05-14 2017-02-01 华为技术有限公司 Video coding method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070146173A1 (en) * 2005-04-14 2007-06-28 Sony Corporation Coding apparatus, decoding apparatus, coding method, decoding method and program
US20070080832A1 (en) * 2005-10-12 2007-04-12 Huawei Technologies Co., Ltd. Decoding system and method based on context-based adaptive binary arithmetic coding
US8078640B1 (en) * 2007-08-02 2011-12-13 Amazon Technologies, Inc. High efficiency binary encoding
CN106484753A (en) * 2016-06-07 2017-03-08 湖南千年华光软件开发有限公司 Data processing method
CN106445890A (en) * 2016-07-07 2017-02-22 湖南千年华光软件开发有限公司 Data processing method
CN106788993A (en) * 2016-12-02 2017-05-31 乐视控股(北京)有限公司 A kind of encryption communication method, device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414728A (en) * 2020-03-05 2020-07-14 金蝶蝶金云计算有限公司 Numerical data display method and device, computer equipment and storage medium
CN111414728B (en) * 2020-03-05 2023-07-07 金蝶蝶金云计算有限公司 Numerical data display method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
KR20190038747A (en) 2019-04-09
WO2019041919A1 (en) 2019-03-07

Similar Documents

Publication Publication Date Title
CN109428603A (en) A kind of data-encoding scheme, device and storage medium
CN109428602A (en) A kind of data-encoding scheme, device and storage medium
CN104283567B (en) A kind of compression of name data, decompression method and equipment
US9223765B1 (en) Encoding and decoding data using context model grouping
CN107565971B (en) Data compression method and device
CN102970043B (en) A kind of compression hardware system based on GZIP and accelerated method thereof
US20120130965A1 (en) Data compression method
WO2010044100A1 (en) Lossless compression
CN103236847A (en) Multilayer Hash structure and run coding-based lossless compression method for data
JP2003218703A (en) Data coder and data decoder
CN100576753C (en) The system and method for static Huffman decoding
WO2021130754A1 (en) Systems and methods of data compression
CN110868223B (en) Numerical operation implementation method and circuit for Huffman coding
CN109379598A (en) A kind of Lossless Image Compression Algorithm method realized based on FPGA
CN116016606B (en) Sewage treatment operation and maintenance data efficient management system based on intelligent cloud
JP5656593B2 (en) Apparatus and method for decoding encoded data
JP6835285B1 (en) Data compression method, data compression device, data compression program, data decompression method, data decompression device and data decompression program
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
KR20180067956A (en) Apparatus and method for data compression
CN103746701A (en) Rapid encoding option selecting method applied to Rice lossless data compression
JP2016052046A (en) Compression device, decompression device and storage device
TW202044129A (en) Computing system and compressing method thereof for neural network parameters
CN108932315A (en) A kind of method and relevant apparatus of data decompression
CN116529705A (en) System, method and apparatus for utilizing value similarity in computer memory

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