CN102651795A - Run-length reduced binary sequence compressed encoding method - Google Patents
Run-length reduced binary sequence compressed encoding method Download PDFInfo
- Publication number
- CN102651795A CN102651795A CN2012101483679A CN201210148367A CN102651795A CN 102651795 A CN102651795 A CN 102651795A CN 2012101483679 A CN2012101483679 A CN 2012101483679A CN 201210148367 A CN201210148367 A CN 201210148367A CN 102651795 A CN102651795 A CN 102651795A
- Authority
- CN
- China
- Prior art keywords
- brigade
- brigade commander
- commander
- subsequence
- critical
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The invention discloses a run-length reduced binary sequence compressed encoding method which comprises the following steps of: firstly, converting a file to be compressed into a binary code sequence consisting of 0 and 1; then converting the binary code sequence into a run length sequence and calculating an arithmetic mean value of a 0 run length and a 1 run length in the run length sequence; acquiring the maximum reduced times of the 0 run length and the 1 run length; generating run-length subsequences after the run lengths are reduced and binary code tables of conversion relations of the run-length subsequences before and after the run lengths are reduced; constructing run-length subsequence length encoding tables after the run-length subsequences are reduced and sequentially splicing the run-length subsequence length encoding tables to generate a length encoding table of the run-length sequence; generating a run-length conversion relation encoding table; and respectively adding file header data into head parts of the length encoding table and the run-length sequence conversion relation encoding table so as to generate a compressed encoding table of the binary code sequence. According to the method, the problem that the number of encoded bits is increased as a short run length is encoded again can be avoided; the encoding and decoding efficiencies are improved; an algorithm is simple; and the run-length reduced binary sequence compressed encoding method is easy to implement.
Description
Technical field
The present invention relates to a kind of brigade commander and reduce the binary sequence compaction coding method, belong to the data lossless compression technique area.
Background technology
In the electronic information technical field now, most information is represented with digitized mode.The digital multimedia information especially data volume of digital video, audio signal is huge especially, brings a lot of problems for storage and transmission, just is not difficult to obtain actual application if data are not effectively compressed.Therefore, data compression technique becomes a key technology in current digital communication, broadcasting and the multimedia.
Bianry image, the literal page, engineering drawing and circuit diagram etc. are a kind of binary sequence after extracting element line by line; Binary in the binary sequence is taken as 0 yuan and 1 yuan respectively; Continuous 0 yuan of with continuous 1 yuan of composition one section in the binary sequence is called one 0 distance of swimming or 1 distance of swimming respectively; 0 run length is called 0 brigade commander, and 1 run length is called 1 brigade commander.The compression method of traditional binary sequence generally adopts the one dimension Run-Length Coding; The basic principle of one dimension Run-Length Coding is to utilize variable length encoding method no matter length is all encoded again to all 0 distances of swimming in the binary sequence and all 1 distances of swimming respectively; To often causing new coding figure place to surpass shorter run length behind the shorter distance of swimming recompile; Cause the expansion of data volume, reduced overall encoding compression usefulness.For example, international fax standard CC ITT.4 (G3) utilizes the Huffman coding that the distance of swimming is encoded, and its compression usefulness is lower.
The present invention proposes a kind of optionally binary sequence compaction coding method of brigade commander's reduction that has; This method is according to the distribution situation of 0 distance of swimming in the binary sequence and 1 distance of swimming; Choose best critical 0 brigade commander and best critical 1 brigade commander respectively; Grown up in all 0 distances of swimming that equal best critical 0 brigade commander in the binary sequence middle reaches; Adopt a bit symbols of length after its brigade commander reduction transformational relation before and after reducing with the brigade commander to encode again, all 1 distances of swimming in the binary sequence are handled the compressed encoding of the longer distance of swimming of realization by same procedure.The brigade commander is represented with its original coding less than all 1 distances of swimming of critical 1 brigade commander of the best less than critical 0 brigade commander's of the best all 0 distances of swimming and brigade commander recompile has not been avoided because of increasing to the 0 short distance of swimming with than the figure place that is caused behind the 1 short distance of swimming recompile.Only need 0 distance of swimming and 1 distance of swimming more than or equal to critical 0 brigade commander of the best and best critical 1 brigade commander during decoding,, can restore the length of original 0 distance of swimming and 1 distance of swimming through brigade commander after brigade commander's reduction and reduction front and back transformational relation code element to the brigade commander.
Summary of the invention
The objective of the invention is to propose to the problem that prior art exists a kind of binary sequence compaction coding method of brigade commander's reduction, this method algorithm is simple, is easy to realize, compression usefulness is higher than traditional one dimension run length encoding method.
The binary sequence compaction coding method of brigade commander's reduction that the present invention proposes may further comprise the steps:
(1), use numerical value " 0 " and " 1 " to represent that binary sequence converts the two-value sign indicating number sequence of 0 and 1 composition into respectively the binary in the binary sequence;
(2), the run length of all 0 distances of swimming and all 1 distances of swimming in the described two-value sign indicating number of calculation procedure (1) sequence; After replacing in the binary sequence all distances of swimming successively with the run length value; Generate brigade commander's sequence; Wherein, the corresponding run length of 0 distance of swimming is 0 brigade commander, and the corresponding run length of 1 distance of swimming is 1 brigade commander;
(3), the run length arithmetic mean of all 0 distances of swimming and all 1 distances of swimming in the said brigade commander's sequence of calculation procedure (2) respectively, choose 0 brigade commander's and 1 brigade commander in brigade commander's sequence maximum critical brigade commander respectively;
(4), the brigade commander's sequence described in the step (2) is divided into groups by every group of 1024 brigade commander unit, obtain each brigade commander subsequence of brigade commander's sequence, the unit number of each the brigade commander subsequence of back that divides into groups is 1024, and the unit number of last subsequence is:
N=1024+(M%1024) (1)
Wherein, N is the unit number of last brigade commander subsequence, and M is the total unit number of brigade commander's sequence, symbol " % " expression complementation;
(5), respectively all 0 brigade commanders and all 1 brigade commanders in the said brigade commander subsequence of calculation procedure (4) is 1,2 in critical brigade commander's value ..., the coding figure place during n, n is the maximum critical brigade commander, confirms best critical 0 brigade commander and best critical 1 brigade commander, and is specific as follows:
Confirm all 0 brigade commanders and the coding figure place of all 1 brigade commanders when critical brigade commander is p in the brigade commander subsequence (5-1), respectively, 1≤p≤n wherein, specific as follows:
(5-1-1), confirm the coding figure place of all 0 brigade commanders when critical brigade commander is p in the brigade commander subsequence
Choosing brigade commander subsequence middle reaches grows up in all 0 brigade commanders that equal p; Divide exactly 2 after each 0 brigade commander's value after choosing added p, obtain 0 brigade commander and reduce 0 afterwards new brigade commander, remainder is 0 or 1; Remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back; 0 new brigade commander's value add 1 for former 0 brigade commander in the coding figure place of critical brigade commander during for p, with all 0 brigade commanders after above-mentioned the choosing in the coding figure place addition of critical brigade commander during for p, itself and be designated as S
0, and with S
0Be worth addition with all 0 brigade commanders in the brigade commander subsequence less than 0 brigade commander of p, obtain all 0 brigade commanders in the brigade commander subsequence in the coding figure place of critical brigade commander during for p;
(5-1-2), confirm the coding figure place of all 1 brigade commanders when critical brigade commander is p in the brigade commander subsequence
Choosing brigade commander subsequence middle reaches grows up in all 1 brigade commanders that equal p; Divide exactly 2 after each 1 brigade commander's value after choosing added p, obtain 1 brigade commander and reduce 1 afterwards new brigade commander, remainder is 0 or 1; Remainder representes that 1 brigade commander reduces a bit symbols of the transformational relation of front and back; 1 new brigade commander's value add 1 for former 1 brigade commander in the coding figure place of critical brigade commander during for p, with all 1 brigade commanders after above-mentioned the choosing in the coding figure place addition of critical brigade commander during for p, itself and be designated as S
1, and with S
1Be worth addition with all 1 brigade commanders in the brigade commander subsequence less than 1 brigade commander of p, obtain all 1 brigade commanders in the brigade commander subsequence in the coding figure place of critical brigade commander during for p;
Confirm 0 brigade commander's and 1 brigade commander in the brigade commander subsequence best critical brigade commander (5-2), respectively, specific as follows:
Choose all 0 brigade commanders coding figure place minimum value in its each corresponding critical brigade commander in the brigade commander subsequence, the corresponding critical brigade commander of this minimum value is best critical 0 brigade commander; Choose all 1 brigade commanders coding figure place minimum value in its each corresponding critical brigade commander in the brigade commander subsequence, the corresponding critical brigade commander of this minimum value is best critical 1 brigade commander;
(6), critical 0 brigade commander of (5-2) described the best and best critical 1 brigade commander set by step; Utilize the said method of step (5) to reduce to described each brigade commander subsequence of step (4); The two-value code table of the transformational relation before and after brigade commander subsequence after the generation brigade commander reduction and brigade commander thereof reduce, specific as follows:
(6-1), choosing brigade commander subsequence middle reaches grows up in all 0 brigade commanders that equal best critical 0 brigade commander; Respectively 0 brigade commander to after choosing divides exactly 2 after adding critical 0 brigade commander of the best; Obtain the brigade commander and reduce 0 new brigade commander of back, remainder is 0 or 1, and remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back; Length value after the 0 brigade commander reduction is 0 brigade commander's a compressed encoding with the transformational relation code element for pairing a string 0 yuan, less than all 0 brigade commanders of critical 0 brigade commander of the best recompile not;
(6-2), choosing brigade commander subsequence middle reaches grows up in all 1 brigade commanders that equal best critical 1 brigade commander; Respectively 1 brigade commander to after choosing divides exactly 2 after adding critical 1 brigade commander of the best; Obtain the brigade commander and reduce 1 new brigade commander of back; Remainder is 0 or 1, and remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back, and the length value after the 1 brigade commander reduction is 1 brigade commander's a compressed encoding with the transformational relation code element for pairing a string 1 yuan; Less than all 1 brigade commanders of critical 1 brigade commander of the best recompile not;
(6-3), will reduce front and back transformational relation code element puts transformational relation two-value code table before and after the reduction of generation brigade commander subsequence successively by the mode that 0 brigade commander and 1 brigade commander replace;
(7), the brigade commander sub-sequence length coding schedule of structure brigade commander subsequence after reduction, splice each brigade commander's sub-sequence length coding schedule successively, generate the length coding table of the said brigade commander's sequence of step (2), specific as follows:
To the brigade commander subsequence after the described brigade commander of step (6) reduction, by 0 and 1 mode that replaces put successively its pairing a string 0 yuan with a string 1 yuan, generate the two-value numeral sequence after the brigade commander subsequence reduces; Two-value numeral sequence is added 2 prefixs, and prefix is all 0 brigade commanders and all 1 a brigade commanders cuttable status indication whether in the brigade commander subsequence, and 0 brigade commander and 1 brigade commander's best critical brigade commander; Wherein, The compressive state mark representes with 0 or 1, and 0 expression can not reduce, all 0 brigade commanders in the pairing brigade commander subsequence or all 1 brigade commanders coding figure place after reduction greater than former brigade commander subsequence in all 0 brigade commanders or all 1 brigade commanders' coding figure place; Then can not recompile; First prefix is that 0, the second prefix is " sky ", and " sky " shows and need not to insert data at this prefix place; 1 expression of compressive state mark can reduce, and first prefix is that 1, the second prefix is best critical brigade commander., being called the length coding table of brigade commander subsequence with inserting two-value numeral sequence after the prefix, the length coding table with the brigade commander subsequence is stitched together successively, generates the length coding table of the said brigade commander's sequence of step (2);
(8), successively splice the transformational relation two-value code table that the described brigade commander subsequence of step (6-1) brigade commander reduces front and back, generate brigade commander's sequence transformational relation coding schedule;
(9), the length coding table and the described brigade commander's sequence of step (8) the transformational relation coding schedule of the said brigade commander's sequence of combining step (7), generate the compressed encoding table of the said two-value sign indicating number of step (1) sequence.
Above-mentioned steps (3) is described chooses 0 brigade commander's and 1 brigade commander in brigade commander's sequence maximum critical brigade commander n respectively, and it is specific as follows: when distance of swimming arithmetic mean less than 16 the time, then confirm maximum critical brigade commander n=8; When distance of swimming arithmetic mean more than or equal to 16 the time, then confirm maximum critical brigade commander n=16.
Utilize the said method of step (5) to reduce to described each brigade commander subsequence of step (4) described in the above-mentioned steps (6), reduced degree is not limited to once, and confirming of the number of times of maximum reduction is specific as follows:
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 2 less than 1.5;
If brigade commander's arithmetic mean more than or equal to 1.5, less than 2, confirms that then maximum reduced degree is 4;
If brigade commander's arithmetic mean more than or equal to 2, less than 16, confirms that then maximum reduced degree is 8;
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 16 more than or equal to 16.The decoding process of the binary sequence compaction coding method of brigade commander's reduction of the present invention is the anti-process of brigade commander's reduction, and in other words, binary sequence is after the inventive method processed compressed; A compressed file can be generated,, original document can be restored through decoding to compressed file; For example; 0 brigade commander's best critical 0 brigade commander is 3 in the brigade commander subsequence, establishes 101 and is one 0 brigade commander's value in this brigade commander subsequence, and then the brigade commander of 0 brigade commander 101 after brigade commander's reduction does
Round ((101+3)/2)=52 transformational relation code element is 0
Wherein, round representes bracket function, and 101 represent with continuous 101 0 that in original two-value sign indicating number sequence take 101 memory spaces, after reduction, its brigade commander's value is 52, adds 1 transformational relation code element, 53 altogether, has saved 48 than original 101.
Brigade commander's recuperation does
2×52+0-3=101
Above step (1)-(9) are binary sequence generates compressed encoding after a brigade commander reduces process, in practical application, can repeatedly reduce through the brigade commander and realize higher compression ratio.
The advantage that the binary sequence compaction coding method of brigade commander's reduction that the present invention proposes has is: this method can be to brigade commander's in the brigade commander subsequence distribution situation; Longer brigade commander is carried out compressed encoding, shorter brigade commander is not reduced, can avoid because of the coding figure place that is caused behind shorter brigade commander's recompile is increased; Improve encoding-decoding efficiency; Algorithm is simple, is easy to realize, compression usefulness is higher than traditional one dimension distance of swimming method.
Description of drawings
Fig. 1 is the binary sequence compaction coding method flow chart of brigade commander's reduction of the present invention;
Fig. 2 is the binary sequence compaction coding method flow chart that brigade commander of the present invention repeatedly reduces;
Fig. 3 is the binary sequence compaction coding method that adopts brigade commander's reduction of the present invention by compression ratio is the bianry image after 10.92 compressions;
Fig. 4 is the binary sequence compaction coding method that adopts brigade commander's reduction of the present invention by compression ratio is the bianry image after 13.85 compressions.
Embodiment
The present invention is a kind of compaction coding method of binary sequence of brigade commander's reduction; Its concrete application is files such as digital picture, bianry image, the literal page, engineering drawing and circuit diagram, and above-mentioned file generates a kind of binary sequence after extracting element line by line, be 0 and 1 with the binary value regulation; Wherein, After 256 grades of gray-scale image are pressed bit plane and decompose, can get 8 binary values and be 0 and 1 bianry image file, to 24 coloured images; After 3 color values are pressed bit plane and decompose, can get 24 binary values and be 0 and 1 bianry image file.To by the binary sequence after the above-mentioned file conversion after the inventive method processed compressed, can generate a compressed file, through decoding, can restore original document to compressed file.
The binary sequence compaction coding method of a kind of brigade commander's reduction that the present invention proposes; As shown in Figure 1, can the brigade commander in the binary sequence repeatedly be reduced in this method, until reaching best compression effectiveness; As shown in Figure 2; Be the two-value sign indicating number sequence of forming by 0 and 1 at first, convert this two-value sign indicating number sequence into the brigade commander sequence again, obtain 0 brigade commander and 1 brigade commander's maximum reduced degree through 0 brigade commander in brigade commander's sequence and 1 brigade commander's arithmetic mean file conversion to be compressed; Confirming of maximum reduced degree, specific as follows:
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 2 less than 1.5;
If brigade commander's arithmetic mean more than or equal to 1.5, less than 2, confirms that then maximum reduced degree is 4;
If brigade commander's arithmetic mean more than or equal to 2, less than 16, confirms that then maximum reduced degree is 8;
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 16 more than or equal to 16.
With brigade commander's sequence (4) said packet transaction of carrying out set by step, generate the brigade commander subsequence, 0 brigade commander and 1 brigade commander in each brigade commander subsequence are repeatedly reduced respectively by maximum reduced degree of 0 brigade commander and the maximum reduced degree of 1 brigade commander; All select critical 0 brigade commander of 1 suboptimum and best critical 1 brigade commander during each the reduction,, respectively all 0 brigade commanders in the brigade commander subsequence and all 1 brigade commanders are carried out brigade commander's reduction by best critical 0 brigade commander and best critical 1 trip; Brigade commander subsequence after repeatedly reducing is pressed brigade commander's attribute; I.e. 0 brigade commander or 1 brigade commander convert the two-value sign indicating number sequence of brigade commander subsequence into, add prefix; Generate brigade commander's sub-sequence length coding schedule; Brigade commander's sub-sequence length coding schedule is merged successively, generate brigade commander's sequence length coding schedule, merge the transformational relation coding schedule that generates in brigade commander's sequence length coding schedule and the repeatedly reduction process of brigade commander; Generate the compressed encoding file of original two-value sign indicating number sequence, realize lossless compress binary sequence.
Decomposition to brigade commander's sequence in the said method is divided into groups with every group of 1024 unit, if the total brigade commander unit number of brigade commander's sequence is less than or equals 1024, does not then divide into groups, and this situation can appear in the less bianry image of size usually,
If brigade commander's sequence must brigade commander unit number greater than 1024, and be not 1024 integral multiple, then the unit number of the group of last after brigade commander's sequence of packets brigade commander subsequence is that following formula provides:
N=1024+(M%1024)
Wherein, N is the unit number of last brigade commander subsequence, and M is the total unit number of brigade commander's sequence, symbol " % " expression complementation.
In the said method 0 brigade commander in the brigade commander subsequence and 1 brigade commander are repeatedly reduced by 0 brigade commander and the maximum reduced degree of 1 brigade commander respectively; In practical implementation; If 0 brigade commander the encode figure place of 0 brigade commander after the coding figure place after k+1 the reduction is greater than the k time reduction in the brigade commander subsequence, wherein k+1 is smaller or equal to the maximum reduced degree of 0 brigade commander, and then 0 brigade commander only carries out k brigade commander and reduces in the brigade commander subsequence; Reduced degree is designated as k, and 1 brigade commander is also handled by same way as.
Said method middle reaches eldest son's sequence length coding schedule is made up of two parts content, and the one, the prefix of code table, prefix is made up of three segment encodes such as the best critical brigade commander unit of compressive state mark, brigade commander's reduced degree, each time brigade commander reduction; The 2nd, the brigade commander subsequence through repeatedly the reduction after, the new pairing two-value numeral of brigade commander subsequence sequence.If be labeled as 0 under the order with the brigade commander subsequence; 1,2 ... Each brigade commander unit in the brigade commander subsequence is called even brigade commander or strange brigade commander respectively by its order subscript; If first brigade commander unit is 1 brigade commander in brigade commander's sequence, first brigade commander unit is 1 brigade commander in then all brigade commander subsequences, and all 1 brigade commanders are even brigade commander in the brigade commander subsequence.With reference to table 1, the sign of first segment encode unit in brigade commander's sub-sequence length coding schedule
oAnd sign
eBe even brigade commander and Qi brigade commander's in the brigade commander subsequence compressive state mark, the S of second segment encode unit in brigade commander's sub-sequence length coding schedule
oAnd S
eBe even brigade commander and strange brigade commander's reduced degree, if the maximum reduced degree of even brigade commander is less than 16 in the subsequence, S then
oFigure place be 3, otherwise S
oFigure place be 4, S
eFigure place confirm the o of the 3rd segment encode unit in brigade commander's sub-sequence length coding schedule by same way as
1, o
2... For even brigade commander in the brigade commander subsequence through S
oThe best critical brigade commander of the even brigade commander of each time after the inferior reduction, e
1, e
2... For strange brigade commander in the brigade commander subsequence through S
eThe best critical brigade commander of the strange brigade commander of each time after the inferior reduction, if the maximum reduced degree of even brigade commander is less than 16 in the brigade commander subsequence, o then
1, o
2... Figure place be 3, otherwise o
1, o
2... Figure place be 4, e
1, e
2... Figure place confirm that by same way as the 4th segment encode unit is the brigade commander subsequence new pairing two-value sign indicating number of brigade commander subsequence sequence after repeatedly reducing in brigade commander's sub-sequence length coding schedule.
If the sign of first segment encode unit in brigade commander's sub-sequence length coding schedule
o=0, sign
e=1, then second segment encode unit is S in brigade commander's sub-sequence length coding schedule
e, the 3rd segment encode unit is e
1, e
2, If the sign of first segment encode unit in brigade commander's sub-sequence length coding schedule
o=1, sign
e=0, then second segment encode unit is S in brigade commander's sub-sequence length coding schedule
o, the 3rd segment encode unit is o
1, o
2... If, the sign of first segment encode unit in brigade commander's sub-sequence length coding schedule
o=0, sign
e=0, then in brigade commander's sub-sequence length coding schedule second section with the 3rd segment encode unit be sky, see table 1.
Table 1 brigade commander sub-sequence length coding schedule
In the said method; To the transformational relation code element that all 0 brigade commanders in the brigade commander subsequence generate in repeatedly reduction process, mode is in reverse order put, the transformational relation code element when promptly putting last the reduction at first successively; Then put second from the bottom time the transformational relation code element in the reduction process successively; Transformational relation code element until putting successively when reducing for the first time generates the transformational relation coding schedule before and after 0 brigade commander reduces in the brigade commander subsequence thus, generates 1 brigade commander in the brigade commander subsequence transformational relation coding schedule before and after reducing by the same manner; The transformational relation coding schedule that merges above-mentioned 0 brigade commander and 1 brigade commander; Generate the transformational relation coding schedule of brigade commander subsequence, splice the transformational relation two-value numeral sequence of each brigade commander subsequence successively, generate the transformational relation coding schedule of brigade commander's sequence.
Be of a size of 256 * 256 bianry image boil down to example with two at present, verify method effect of the present invention.Above-mentioned two are of a size of 256 * 256 bianry image, see Fig. 3 and Fig. 4, in these two bianry images; The binary value is respectively 0 and 255, is 0 and 1 with above-mentioned binary value regulation, and promptly 0 in the binary corresponds to 0; In the binary 255 corresponds to 1, after extracting the bianry image pixel line by line, generates one by the 0 and 1 two-value sign indicating number sequence formed; The two-value sign indicating number sequence length of two width of cloth bianry images is 256 * 256=65536 position, and after the inventive method processed compressed, the file total bit after the compression is seen table 2.
Table 2 bianry image compression back total bit
Shown in Figure 3 256 * 256 bianry image | 5999 | Shown in Figure 4 256 * 256 bianry image | 4732 |
The bianry image that Fig. 3, Fig. 4 represent is after the inventive method compression, and compression ratio is respectively:
65536/5999?=?10.92
65536/4732?=?13.85
Show that from the packed data of Fig. 3, Fig. 4 two width of cloth bianry images the inventive method has higher compression usefulness to the compression of binary sequence.
Above embodiment is only unrestricted in order to technical scheme of the present invention to be described; Although the present invention is specified with reference to preferred embodiment; Those of ordinary skill in the art is to be understood that; Can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit and the scope of technical scheme of the present invention.
Claims (3)
1. the binary sequence compaction coding method of brigade commander's reduction is characterized in that, said method clicks step successively and realizes in computer:
Step (1) is used numerical value " 0 " and " 1 " expression respectively with the binary in the binary sequence, and binary sequence converts the two-value sign indicating number sequence of 0 and 1 composition into;
Step (2); The run length of all 0 distances of swimming and all 1 distances of swimming in the described two-value sign indicating number of calculation procedure (1) sequence; After replacing in the binary sequence all distances of swimming successively with the run length value, generate brigade commander's sequence, wherein; The corresponding run length of 0 distance of swimming is 0 brigade commander, and the corresponding run length of 1 distance of swimming is 1 brigade commander;
Step (3), the run length arithmetic mean of all 0 distances of swimming and all 1 distances of swimming in the said brigade commander's sequence of calculation procedure (2) is respectively chosen 0 brigade commander's and 1 brigade commander in brigade commander's sequence maximum critical brigade commander n respectively;
Step (4); Brigade commander's sequence described in the step (2) is divided into groups by every group of 1024 brigade commander unit; Obtain each brigade commander subsequence of brigade commander's sequence, the unit number of each the brigade commander subsequence of back that divides into groups is 1024, and the unit number of last subsequence is:
N=1024+(M%1024) (1)
Wherein, N is the unit number of last brigade commander subsequence, and M is the total unit number of brigade commander's sequence, symbol " % " expression complementation;
Step (5), all 0 brigade commanders and all 1 brigade commanders in the said brigade commander subsequence of calculation procedure (4) is 1,2 in critical brigade commander's value respectively;, the coding figure place during n, n is the maximum critical brigade commander; Confirm best critical 0 brigade commander and best critical 1 brigade commander, specific as follows:
Step (5-1), confirm all 0 brigade commanders and the coding figure place of all 1 brigade commanders when critical brigade commander is p in the brigade commander subsequence respectively, 1≤p≤n wherein, specific as follows:
Step (5-1-1), confirm that all 0 brigade commanders in the brigade commander subsequence are in the coding figure place of critical brigade commander during for p
Choosing brigade commander subsequence middle reaches grows up in all 0 brigade commanders that equal p; Divide exactly 2 after each 0 brigade commander's value after choosing added p, obtain 0 brigade commander and reduce 0 afterwards new brigade commander, remainder is 0 or 1; Remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back; 0 new brigade commander's value add 1 for former 0 brigade commander in the coding figure place of critical brigade commander during for p, with all 0 brigade commanders after above-mentioned the choosing in the coding figure place addition of critical brigade commander during for p, itself and be designated as S
0, and with S
0Be worth addition with all 0 brigade commanders in the brigade commander subsequence less than 0 brigade commander of p, obtain all 0 brigade commanders in the brigade commander subsequence in the coding figure place of critical brigade commander during for p;
Step (5-1-2), confirm that all 1 brigade commanders in the brigade commander subsequence are in the coding figure place of critical brigade commander during for p
Choosing brigade commander subsequence middle reaches grows up in all 1 brigade commanders that equal p; Divide exactly 2 after each 1 brigade commander's value after choosing added p, obtain 1 brigade commander and reduce 1 afterwards new brigade commander, remainder is 0 or 1; Remainder representes that 1 brigade commander reduces a bit symbols of the transformational relation of front and back; 1 new brigade commander's value add 1 for former 1 brigade commander in the coding figure place of critical brigade commander during for p, with all 1 brigade commanders after above-mentioned the choosing in the coding figure place addition of critical brigade commander during for p, itself and be designated as S
1, and with S
1Be worth addition with all 1 brigade commanders in the brigade commander subsequence less than 1 brigade commander of p, obtain all 1 brigade commanders in the brigade commander subsequence in the coding figure place of critical brigade commander during for p;
Step (5-2), confirm 0 brigade commander's and 1 brigade commander in the brigade commander subsequence best critical brigade commander respectively, specific as follows:
Choose all 0 brigade commanders coding figure place minimum value in its each corresponding critical brigade commander in the brigade commander subsequence, the corresponding critical brigade commander of this minimum value is best critical 0 brigade commander; Choose all 1 brigade commanders coding figure place minimum value in its each corresponding critical brigade commander in the brigade commander subsequence, the corresponding critical brigade commander of this minimum value is best critical 1 brigade commander;
Step (6), critical 0 brigade commander of (5-2) described the best and best critical 1 brigade commander set by step; Utilize the said method of step (5) to reduce to described each brigade commander subsequence of step (4); The two-value code table of the transformational relation before and after brigade commander subsequence after the generation brigade commander reduction and brigade commander thereof reduce, specific as follows:
Step (6-1), choose brigade commander subsequence middle reaches and grow up in all 0 brigade commanders that equal best critical 0 brigade commander; Respectively 0 brigade commander to after choosing divides exactly 2 after adding critical 0 brigade commander of the best; Obtain the brigade commander and reduce 0 new brigade commander of back, remainder is 0 or 1, and remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back; Length value after the 0 brigade commander reduction is 0 brigade commander's a compressed encoding with the transformational relation code element for pairing a string 0 yuan, less than all 0 brigade commanders of critical 0 brigade commander of the best recompile not;
Step (6-2), choose brigade commander subsequence middle reaches and grow up in all 1 brigade commanders that equal best critical 1 brigade commander; Respectively 1 brigade commander to after choosing divides exactly 2 after adding critical 1 brigade commander of the best; Obtain the brigade commander and reduce 1 new brigade commander of back; Remainder is 0 or 1, and remainder representes that 0 brigade commander reduces a bit symbols of the transformational relation of front and back, and the length value after the 1 brigade commander reduction is 1 brigade commander's a compressed encoding with the transformational relation code element for pairing a string 1 yuan; Less than all 1 brigade commanders of critical 1 brigade commander of the best recompile not;
Step (6-3), will reduce before and after the transformational relation code element put successively by the mode that 0 brigade commander and 1 brigade commander replace, generate transformational relation two-value code table before and after the reduction of brigade commander subsequence;
Step (7), the brigade commander sub-sequence length coding schedule of structure brigade commander subsequence after reduction splices each brigade commander's sub-sequence length coding schedule successively, generates the length coding table of the said brigade commander's sequence of step (2), and be specific as follows:
To the brigade commander subsequence after the described brigade commander of step (6) reduction, by 0 and 1 mode that replaces put successively its pairing a string 0 yuan with a string 1 yuan, generate the two-value numeral sequence after the brigade commander subsequence reduces; Two-value numeral sequence is added 2 prefixs, and prefix is all 0 brigade commanders and all 1 a brigade commanders cuttable status indication whether in the brigade commander subsequence, and 0 brigade commander and 1 brigade commander's best critical brigade commander; Wherein, The compressive state mark representes with 0 or 1, and 0 expression can not reduce, all 0 brigade commanders in the pairing brigade commander subsequence or all 1 brigade commanders coding figure place after reduction greater than former brigade commander subsequence in all 0 brigade commanders or all 1 brigade commanders' coding figure place; Then can not recompile; First prefix is that 0, the second prefix is " sky ", and " sky " shows and need not to insert data at this prefix place; 1 expression of compressive state mark can reduce, and first prefix is that 1, the second prefix is best critical brigade commander;
Be called the length coding table of brigade commander subsequence with inserting two-value numeral sequence after the prefix, the length coding table with the brigade commander subsequence is stitched together successively, generates the length coding table of the said brigade commander's sequence of step (2);
Step (8) is spliced the transformational relation two-value numeral sequence that the described brigade commander subsequence of step (6-1) brigade commander reduces front and back successively, generates brigade commander's transformational relation coding schedule;
Step (9), the length coding table of the said brigade commander's sequence of combining step (7) and the described brigade commander's sequence of step (8) transformational relation coding schedule, the compressed encoding table of the said two-value sign indicating number of generation step 1 (1) sequence.
2. the binary sequence compaction coding method of brigade commander according to claim 1 reduction is characterized in that, above-mentioned steps (3) is described chooses 0 brigade commander's and 1 brigade commander in brigade commander's sequence maximum critical brigade commander n respectively, specific as follows:
When distance of swimming arithmetic mean less than 16 the time, then confirm maximum critical brigade commander n=8;
When distance of swimming arithmetic mean more than or equal to 16 the time, then confirm maximum critical brigade commander n=16.
3. the binary sequence compaction coding method of brigade commander's reduction according to claim 1; It is characterized in that: utilize the said method of step (5) to reduce to described each brigade commander subsequence of step (4) described in the above-mentioned steps (6); Reduced degree is not limited to once; Confirming of the number of times of maximum reduction, specific as follows:
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 2 less than 1.5;
If brigade commander's arithmetic mean more than or equal to 1.5, less than 2, confirms that then maximum reduced degree is 4;
If brigade commander's arithmetic mean more than or equal to 2, less than 16, confirms that then maximum reduced degree is 8;
If brigade commander's arithmetic mean, confirms then that maximum reduced degree is 16 more than or equal to 16.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210148367.9A CN102651795B (en) | 2012-05-15 | 2012-05-15 | Run-length reduced binary sequence compressed encoding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210148367.9A CN102651795B (en) | 2012-05-15 | 2012-05-15 | Run-length reduced binary sequence compressed encoding method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102651795A true CN102651795A (en) | 2012-08-29 |
CN102651795B CN102651795B (en) | 2014-10-01 |
Family
ID=46693683
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210148367.9A Expired - Fee Related CN102651795B (en) | 2012-05-15 | 2012-05-15 | Run-length reduced binary sequence compressed encoding method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102651795B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108777583A (en) * | 2018-06-12 | 2018-11-09 | 安庆师范大学 | A kind of data compression method and apparatus |
WO2019041919A1 (en) * | 2017-08-30 | 2019-03-07 | 前海中科芯片控股 (深圳)有限公司 | Data coding method and device, and storage medium |
CN116170027A (en) * | 2023-04-26 | 2023-05-26 | 北京索斯克科技开发有限公司 | Data management system and processing method for poison detection equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6021227A (en) * | 1997-06-30 | 2000-02-01 | Hewlett-Packard Company | Image compression system including encoder having run mode |
CN101197578A (en) * | 2006-09-20 | 2008-06-11 | 英特尔公司 | Data-modifying run length encoder to avoid data expansion |
-
2012
- 2012-05-15 CN CN201210148367.9A patent/CN102651795B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6021227A (en) * | 1997-06-30 | 2000-02-01 | Hewlett-Packard Company | Image compression system including encoder having run mode |
CN101197578A (en) * | 2006-09-20 | 2008-06-11 | 英特尔公司 | Data-modifying run length encoder to avoid data expansion |
Non-Patent Citations (2)
Title |
---|
MAX H. M. COSTA ET AL: "Efficient Run-Length Encoding of Binary Sources with Unknown Statistics", 《MICROSOFT RESEARCH TECH. REPORT》 * |
高健 等: "基于长度减半的二进制码流的压缩算法", 《计算机应用》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019041919A1 (en) * | 2017-08-30 | 2019-03-07 | 前海中科芯片控股 (深圳)有限公司 | Data coding method and device, and storage medium |
CN108777583A (en) * | 2018-06-12 | 2018-11-09 | 安庆师范大学 | A kind of data compression method and apparatus |
CN108777583B (en) * | 2018-06-12 | 2021-08-13 | 安庆师范大学 | Data compression method and device |
CN116170027A (en) * | 2023-04-26 | 2023-05-26 | 北京索斯克科技开发有限公司 | Data management system and processing method for poison detection equipment |
Also Published As
Publication number | Publication date |
---|---|
CN102651795B (en) | 2014-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101795407B (en) | Method and device for encoding a bit sequence | |
CN103858433B (en) | Layered entropy encoding and decoding | |
CN106170921B (en) | It is related to the source code and decoding method and device of the data of sign compression | |
CN100517979C (en) | Data compression and decompression method | |
CN103123720A (en) | Lossless data hiding method based on difference image histogram cycle spinning | |
CN103702133A (en) | Image compression display method and image compression display device | |
CN111464717B (en) | Reversible information hiding method with contrast ratio pull-up by utilizing histogram translation | |
CN112308754B (en) | Multi-decoding-end parallel extraction method for high-capacity robust watermark application | |
CN101222637A (en) | Encoding method with characteristic indication | |
CN105024702A (en) | Floating-point-type data lossless compression method for scientific calculation | |
CN105191145A (en) | Data encoder, data decoder and method | |
CN102651795B (en) | Run-length reduced binary sequence compressed encoding method | |
CN105227962A (en) | A kind of lossless information concealing method based on data difference | |
CN105488822A (en) | Reversible image hiding algorithm based on AMBTC algorithm | |
CN105337617A (en) | Method for efficiently compressing full service network (FSN) files | |
CN102724501A (en) | Digital image lossless compression encoding method represented by first difference prefix derivation | |
CN104904199B (en) | The decoding method and device of depth look-up table | |
CN102547295B (en) | Lossless-compression encoding method of image data | |
CN105141962A (en) | H.264/AVC video bitstream oriented large volume data hiding method | |
KR101575939B1 (en) | Binary data compression and restoration method and apparatus | |
CN101099387B (en) | Method and apparatus for encoding/decoding point sequences on laser binary representation | |
CN104682966A (en) | Non-destructive compressing method for list data | |
CN102456217B (en) | Digital watermarking method capable of resisting cropping attack | |
CN111769837A (en) | Binary information compression structure and infinite compression method thereof | |
Schwartz et al. | An unequal coding scheme for remote sensing systems based on CCSDS recommendations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20141001 Termination date: 20170515 |
|
CF01 | Termination of patent right due to non-payment of annual fee |