CN114866091A - Differential coding compression and decompression method based on grouping reference numbers - Google Patents
Differential coding compression and decompression method based on grouping reference numbers Download PDFInfo
- Publication number
- CN114866091A CN114866091A CN202210458157.3A CN202210458157A CN114866091A CN 114866091 A CN114866091 A CN 114866091A CN 202210458157 A CN202210458157 A CN 202210458157A CN 114866091 A CN114866091 A CN 114866091A
- Authority
- CN
- China
- Prior art keywords
- bit
- run
- data
- value
- length
- 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
Links
- 230000006837 decompression Effects 0.000 title claims abstract description 48
- 238000007906 compression Methods 0.000 title claims abstract description 28
- 230000006835 compression Effects 0.000 title claims abstract description 27
- 238000000034 method Methods 0.000 title claims abstract description 27
- 238000012360 testing method Methods 0.000 claims description 26
- 101150047356 dec-1 gene Proteins 0.000 claims description 3
- 238000005192 partition Methods 0.000 claims description 3
- 238000007781 pre-processing Methods 0.000 claims description 3
- 238000013144 data compression Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 101100023120 Arabidopsis thaliana MFDR gene Proteins 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion 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/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/46—Conversion to or from run-length codes, i.e. by representing the number of consecutive digits, or groups of digits, of the same kind by a code word and a digit indicative of that kind
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention provides a differential coding compression scheme and a decompression scheme based on a reference number of a division group, which are particularly suitable for a circuit with more long runs and more average run length distribution. According to the method, when the reference difference is equal to the current run length, the difference value is 0, and when the difference value is 0, the coding length of the current group is shortest; in the invention, the mode in the group is selected as a reference value, so that the probability that the difference length is 0 is improved, and the compression efficiency is further improved.
Description
Technical Field
The invention relates to the field of computer information, in particular to a test data compression and decompression method.
Background
With the continuous development of integrated circuits, the amount of data integrated on one chip is exponentially and explosively increased every year. The problem of the chip test is faced with a lot of problems due to the excessive data volume, so how to solve the contradiction between the exponentially multiplied test data volume and the limited transmission bandwidth of the automatic test equipment is concerned by the integrated circuit industry.
In order to solve the problem of the sharp increase of the test data volume, a test data compression technology is generally adopted at present. Run length coding is a kind of test data compression technology, and its features are lossless compression, and the compressed data can be decompressed by extra decoding circuit. Foreign scholars have proposed some classical run-length coding-based test data compression methods, such as Golomb codes, FDR codes, etc. The international and foreign scholars have been innovated in the run length coding in the last two decades, and have proposed many new schemes, such as AFDR code, MFDR code, EFDR code, Variable-Tail code, coding based on continuous and alternate sequences, comprehensive test compression scheme based on symmetric coding, mixed prefix coding, mixed coding compression method based on one-bit identification, etc. which are proposed by the international scholars. The above scheme is lossless coding only for run lengths, ignoring possible associations between each run length. Therefore, on the basis of run length coding, the correlation between runs is considered, the run length is subjected to appropriate reduction processing, and the compression rate is improved.
After test data run in the circuit is averagely divided into a plurality of groups, each group is subjected to centralized trend analysis, and a representative value in the run length of the group is selected as a reference number, such as the average value, the mode, the median and the like of the run length of each group. The length of each run is differentiated from the reference number of the division group where the run is located, and then coding is carried out, so that the number of short runs in the data to be coded can be effectively increased under the condition of not increasing the number of runs, and the length of the test data to be coded is reduced, therefore, shorter code words can be obtained after coding compared with the code words obtained when the original data is used for coding, and a good compression effect is obtained.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a test data compression and decompression method based on the grouping reference number difference coding, which can improve the compression efficiency and reduce the hardware overhead.
In order to solve the above technical problem, the present invention provides a method for compressing and decompressing differential code based on reference numbers of a partition group, comprising the following steps:
A. constructing a difference length coding table:
(A1) the difference length coding table comprises the following fields:
group number: expressed as a decimal number i;
length of difference: expressed in one decimal L;
prefix: binary code representation consisting of a number of 1's and a 0's;
suffix: represented by a set of binary codes;
and (3) encoding the difference length: the prefix and suffix cascade connection is formed;
records in the difference length coding table are arranged in an increasing mode according to the difference length L and grouped, the group numbers i are arranged in an increasing mode, the difference length is 0 at minimum, and the group numbers are 1 at minimum;
(A2) in the difference length coding table, the i-th group includes 2 i The prefix of the ith group consists of (i-1) 1 s and a 0, and the suffix of the ith group is sequentially ordered from the minimum i-bit binary number to the maximum i-bit binary number;
(A3) definition and description:
the 0 run refers to a binary code consisting of several consecutive 0 plus 1, where 1 is the 0 run end mark and its run length L y Number of fingers 0; a1 run refers to a binary code consisting of several consecutive 1 s plus 10 s, 0 being the end of the 1 run mark, the run length L of which y The number of fingers 1;
B. raw test data preprocessing
(B1) Filling irrelevant bits in original test data, and filling irrelevant bits 'X' in the data into binary numbers '0' or '1', so as to obtain a data packet to be compressed;
(B2) carrying out run-length division on the data packet to be compressed obtained in the step (B1) according to a dual-run-length mode to obtain a corresponding total run-length sequence; obtaining the total run number x at the same time; the total run length sequence records the length of each run in sequence;
(B3) dividing the obtained x runs into a plurality of groups to obtain a run quantity grouping sequence, wherein the run quantity grouping sequence is used for recording the run quantity in each group;
(B4) selecting one of the modes of the run length in each group as a reference number of the group for the plurality of groups obtained in the step (B3); the reference number is a decimal number;
C. step of compression
(C1) Reading the run quantity grouping sequence obtained in the step (B3) to obtain the run quantity in the group of the current group; converting the obtained data into a binary code with p bits, and adding the obtained code into a compressed code word; the p is a self-defined fixed constant;
converting the decimal reference number obtained in step (B4) to a q-bit binary code, adding the resulting code to the compressed progeny codeword; the q is a self-defined fixed constant;
(C2) compressing a current group
(C20) Reading the current run from the data packet to be compressed obtained in the step (B1), calculating the current run length, and comparing the obtained run length with the current group reference number obtained in the step (B4) to obtain a difference value; if the difference value between the current run length and the reference number is a positive value or 0, adding 0 into the compressed code word; otherwise, 1 is added to the compressed code word; meanwhile, if the read current run is 0 run, 0 is added to the compressed code word, otherwise, 1 is added to the compressed code word; b, taking the absolute value of the difference as the difference length, looking up a table according to the difference length coding table obtained in the step A to obtain a difference length code, and storing the difference length code into a compressed code word;
(C21) grouping the run number in the current group recorded by the sequence according to the run number, and repeating the step (C20) until the compression of the current group is completed;
(C3) and (4) grouping the sequence according to the run number, shifting to the next group, and repeating the step (C1) and the step (C2) until the data packet to be compressed obtained in the step (B1) is completely compressed.
The method further comprises a decompression step:
(D0) transmitting a predefined parameter p representing the binary digit number of the trip number in the group to the decompression program, and transmitting a predefined parameter q representing the binary digit number of the reference number to the decompression program;
(D1) reading data to be decompressed according to the digits, firstly reading the front p bits of a code word to obtain the current group run length number in a binary form, and storing the current group run length number in an m-bit register II as a cycle mark;
reading a q-bit binary number from the data to be decompressed according to bits, and calculating to obtain a decimal number lq of the q-bit binary number, wherein the decimal number lq is a current group reference number; storing a 0 run into the m-bit register one, wherein the 0 run has a run length = lq; the register one is used as a decompression intermediate value;
(D2) current group decompression
(D20) Continuously reading 1-bit data from the data to be decompressed, and assigning ope a positive mark and a negative mark;
(D21) continuously reading 1-bit data from the data to be decompressed, and assigning a value to a flag as a run type;
(D22) continuously reading 1-bit data from the data to be decompressed, and if the read data is 0, continuously reading the 1-bit data as a suffix; if the read data is 1, continuously reading a plurality of bit data until a1 run is obtained, taking the 1 run as a prefix, recording the prefix length, and continuously reading the data with the same bit number as a suffix according to the obtained prefix length; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number, converting the new binary number into a decimal number, and subtracting 2 from the decimal number to obtain an absolute value | X | of the difference value between the current run length to be decoded and the reference number;
(D23) if ope obtained in step (D20) is 0, the upper bits of the m-bit register one are padded with 0 in the increased number of bits with respect to the increment-X-bits in step (D1); otherwise, the upper bits of the m-bit register one are reduced by | X-bits with respect to step (D1); carrying out XOR operation on the obtained data of the m-bit register I and the flag obtained in the step (D21) bit by bit, and adding the obtained data into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II; resetting the data in the m-bit register one as a result of the step (D1);
(D25) repeating the steps (D20) to (D24) until the value in the m-bit register II is 0;
(D3) repeating the steps (D1) and (D2) until all data decompression is completed.
Preferably, the program implementation method of the decompression step includes:
(E1) configuration decoder
The decoder comprises two (k + 1) bit counters, one log 2 The system comprises a k-bit counter, an FSM, an exclusive OR gate, a first m-bit register and a second m-bit register;
(E2) and (3) decompression flow:
(a) placing en as 1 and placing v as 1; the FSM receives data b _ in 1;
(b) continuously receiving p-bit data of b _ in1, and transmitting the data from the FSM to a second m-bit register through c _ in 3;
(c) continuously receiving q-bit data of b _ in1, storing the q-bit data into a first (k + 1) -bit counter, and carrying out 1 subtraction on the data, wherein each time the value is subtracted by 1, a 0 is stored in a first m-bit register; when the value in the counter 1 is 0, storing a 01 in the register, and finishing inputting the reference number;
(d) continuously receiving one-bit data of b _ in1, and setting inc2 to be high level when the value is 0; when the value is 1, dec3 is set to high level;
(e) continuously receiving one-bit data of b _ in1 and outputting the data to a flag;
(f) continuing to receive the data from b _ in1, if the data is 1, log 2 Adding 1 to a k-bit counter; until the value of the b _ in1 input is 0, the prefix part input ends;
(g) continuing to receive the data coming in from b _ in1, setting shift1 and dec1 to high level, and entering one bit of data into one (k + 1) bit counter one, log 2 The k bit counter value is decremented by 1 until log 2 The k bit counter is 0, rs1 is set to 1, and the suffix part input ends;
(h) copying the value of the m-bit register I into a (k + 1) -bit counter II through dload, setting shift2 to be at a high level, executing the step (i) if dec3 is at the high level, and executing the step (j) if inc2 is at the high level;
(i) at this time, dec3 is at high level, the value of the (k + 1) bit counter one is decremented by 1, and each time the value is decremented by 1, the 0 at the end of the run of the (k + 1) bit counter two is shifted one bit high together with the least significant bit 1 until the value of the (k + 1) bit counter one is 2;
(j) at this time inc2 is high, the value of the (K + 1) bit counter one is decremented by 1, and each time the value is decremented by 1, the 0 at the end of the run of the (K + 1) bit counter two is shifted down by one bit together with the least significant bit 1 until the value of the (K + 1) bit counter one is 2;
(k) the value of the (K + 1) bit counter II is subjected to XOR operation with the flag and output out; subtracting 1 from the value in the m-bit register II; if the value is not 0, executing d) ~k); if the time value is 0, the decompression of the group of data is finished;
(l) Repeating the steps a) to k) until all the incoming data are decompressed.
The technical advantages of the method are embodied in that: A. after the run sequence is averagely divided into a plurality of groups, representative data of the current group is selected as a reference number, the run length in the group is differentiated from the reference number, and coding is carried out by positive and negative marks, the run type and the difference length, so that the length of the data to be compressed is effectively shortened, the compression efficiency is obviously improved, and the hardware cost is obviously reduced. B. According to the method, when the reference difference is equal to the current run length, the difference value is 0, and when the difference value is 0, the coding length of the current group is shortest; in the invention, the mode in the group is selected as a reference value, so that the probability that the difference length is 0 is improved, and the compression efficiency is further improved. C. The invention has simple and convenient program realization.
Drawings
FIG. 1 is a flow chart of the encoding involved in the compression step of the present invention;
fig. 2 is a diagram of the decoding circuit involved in the decompression step of the present invention.
Detailed Description
The following describes the embodiments of the present invention with reference to the accompanying drawings.
As can be seen from fig. 1 and 2, the present invention comprises the following steps:
A. constructing a difference length coding table:
(A1) the difference length coding table comprises the following fields:
group number: expressed as a decimal number i;
length of difference: expressed in one decimal L;
prefix: binary code representation consisting of a number of 1's and a 0's;
suffix: represented by a set of binary codes;
and (3) encoding the difference length: the prefix and suffix cascade connection is formed;
records in the difference length coding table are arranged in an increasing mode according to the difference length L and grouped, the group numbers i are arranged in an increasing mode, the difference length is 0 at minimum, and the group numbers are 1 at minimum;
(A2) in the difference length coding table, the i-th group includes 2 i The prefix of the ith group consists of (i-1) 1 s and a 0, and the suffix of the ith group is sequentially ordered from the minimum i-bit binary number to the maximum i-bit binary number;
the difference length coding table is obtained:
(A3) definition and description:
the 0 run refers to a binary code consisting of several consecutive 0 plus 1, 1 is the 0 run end mark, and its run length L y Number of fingers 0; a1 run refers to a binary code consisting of several consecutive 1 s plus 10 s, 0 being the end of the 1 run mark, the run length L of which y The number of fingers 1;
as can be seen from the above definition rules: in the difference length coding table, in the same group record, the prefix digit is the suffix digit which is the group number, and when the difference length is more than or equal to 2, the prefix is a1 run which can be read by a computer and the run length can be calculated; therefore, suffixes can be continuously read according to the prefixes, difference length codes are obtained through cascading, and decimal difference lengths are obtained through table lookup. When the difference length =0, the code is 00; when the difference length =1, the code is 01, the two data start with 0, and the prefix digit is equal to the suffix digit and the group number is equal to 1, so that the data can still be read and distinguished.
B. Raw test data preprocessing
(B1) Filling irrelevant bits in original test data, and filling irrelevant bits 'X' in the data into binary numbers '0' or '1', so as to obtain a data packet to be compressed;
the independent bits are commonly present in the original test data, and the values thereof do not affect the test results. In order to improve the compression efficiency, the irrelevant bits can be filled according to a certain strategy; in the present invention, the don't care bits are filled with the closest determination bits from the original test data header.
(B2) Carrying out run-length division on the data packet to be compressed obtained in the step (B1) according to a double-run-length mode to obtain a corresponding total run-length sequence; obtaining the total run number x at the same time; the total run length sequence records the length of each run in sequence;
special case processing: when the original test data is run-length divided, the last segment may have a full 0 or full 1 sequence, and in order not to affect the reading of the run length, a run end mark 1 is usually added after the last segment of the full 0 sequence, and a run end mark 0 is usually added after the full 1 sequence. For example, the last run is 0000, and after the run division, a bit 1 is added to become 00001. After processing, the invention can continuously work to complete compression coding. During decompression, because the test set data has a fixed length, the last additional run end flag bit cannot be written in, and therefore the chip test result cannot be influenced.
(B3) Dividing the obtained x runs into a plurality of groups to obtain a run quantity grouping sequence, wherein the run quantity grouping sequence is used for recording the run quantity in each group;
as one implementation manner, in this step, an integer y is first defined as a group number, and y is used to divide the total run number x obtained in step (B2) by integer to obtain a quotient z; if the remainder is 0, y z at this time form the run number grouping sequence; if the remainder is not 0, increasing the group number by 1 bit, and forming the run number grouping sequence by y remainders z and 1;
in the method, the number of the runs in each group is possibly equal or unequal, but the lossless compression and decompression of the test data are not influenced; also, the length of the run-number packet sequence is variable.
(B4) Selecting one of the modes of the run length in each group as a reference number of the group for the plurality of groups obtained in the step (B3); the reference number is a decimal number;
C. step of compression
As can be seen from fig. 1, the compressing step specifically includes:
(C1) reading the run quantity grouping sequence obtained in the step (B3) to obtain the run quantity in the group of the current group; converting the obtained data into a binary code with p bits, and adding the obtained code into a compressed code word; the p is a self-defined fixed constant;
converting the decimal reference number obtained in step (B4) to a q-bit binary code, adding the resulting code to the compressed progeny codeword; the q is a self-defined fixed constant;
(C2) compressing a current group
(C20) Reading the current run from the data packet to be compressed obtained in the step (B1), calculating the current run length, and comparing the obtained run length with the current group reference number obtained in the step (B4) to obtain a difference value; if the difference value between the current run length and the reference number is a positive value or 0, adding 0 into the compressed code word; otherwise, 1 is added to the compressed code word; meanwhile, if the read current run is 0 run, 0 is added to the compressed code word, otherwise, 1 is added to the compressed code word; b, taking the absolute value of the difference as the difference length, looking up a table according to the difference length coding table obtained in the step A to obtain a difference length code, and storing the difference length code into a compressed code word;
(C21) grouping the run number in the current group recorded by the sequence according to the run number, and repeating the step (C20) until the compression of the current group is completed;
(C3) and (4) grouping the sequence according to the run number, shifting to the next group, and repeating the step (C1) and the step (C2) until the data packet to be compressed obtained in the step (B1) is completely compressed.
D. A decompression step:
according to the method and the coding table, the compressed packet actually contains several groups according to the compression steps (C1), (C2), and (C3). In the code words of each group, the first p bits are binary codes of the run number of the group, and the first q bits of the rest codes are binary codes of the reference number of the current group, and the first q bits are the public part of the group; the rest is the difference length coding data of a plurality of groups, and the intra-group coding sequentially comprises the following steps: the difference between the current run length and the reference number is coded by positive and negative identification bits (1 bit), the current run type (1 bit) and the difference length.
As can be seen from table 1, when the prefix of the difference length coding starts with 0, both the prefix and the suffix have only 1 bit; when the prefix of the difference length coding starts with 1, the prefix must be formed into a1 run, and the prefix and the suffix have equal lengths. Therefore, since the prefix and the suffix of the differential length code can be distinguished, the prefix and the suffix can be read by the number of bits and decompressed and restored.
The method comprises the following specific steps:
(D0) a predefined parameter p representing the number of binary bits of the run number in the group is transmitted to the decompression routine and a predefined parameter q representing the number of binary bits of the reference number is transmitted to the decompression routine.
(D1) Reading data to be decompressed according to the number of bits, firstly reading the front p bits of a code word to obtain the current group run length number in a binary form, and storing the current group run length number in an m-bit register II as a cycle mark.
Reading a q-bit binary number from the data to be decompressed according to bits, and calculating to obtain a decimal number lq of the q-bit binary number, wherein the decimal number lq is a current group reference number; storing a 0 run into the m-bit register one, wherein the 0 run has a run length = lq; the register one is used as a decompression intermediate value;
(D2) current group decompression
(D20) Continuously reading 1-bit data from the data to be decompressed, and assigning ope a positive mark and a negative mark;
(D21) continuously reading 1-bit data from the data to be decompressed, and assigning a value to a flag as a run type;
(D22) continuously reading 1-bit data from the data to be decompressed, and if the read data is 0, continuously reading the 1-bit data as a suffix; if the read data is 1, continuously reading a plurality of bit data until a1 run is obtained, taking the 1 run as a prefix, recording the prefix length, and continuously reading the data with the same bit number as a suffix according to the obtained prefix length; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number, converting the new binary number into a decimal number, and subtracting 2 to obtain an absolute value X of the difference value between the current run length to be decoded and the reference number.
(D23) If ope obtained in step (D20) is 0, the upper bits of the m-bit register one are padded with 0 in the increased number of bits with respect to the increment-X-bits in step (D1); otherwise, the upper bits of the m-bit register one are reduced by | X-bits with respect to step (D1); carrying out XOR operation on the obtained data of the m-bit register I and the flag obtained in the step (D21) bit by bit, and adding the obtained data into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II; resetting the data in the m-bit register one as a result of the step (D1);
(D25) the above steps (D20) to (D24) are repeated until the value in the m-bit register two is 0.
(D3) Repeating the steps (D1) and (D2) until all data decompression is completed.
Example one
The following illustrates the compression process, and this embodiment provides only a short set of data, which corresponds to only one packet obtained in step B.
Assume that the packet to be compressed is 0000000000111111110000000011111111100000000001, for a total of 43 bits. The method of the present invention is used for calculating the original data, firstly, the data is divided according to the double run, the corresponding division result is 0000000000111111110000000011111111100000001, and the total number of the run is 5. The lengths of these 5 runs are 10, 7, 8, 6, respectively. The mode 7 of the set is used as a reference for encoding.
Firstly, setting the number of the run sequence of the group as a 3-bit binary number, namely p =3, the number of runs is 5, converting the run sequence into a p-bit binary number and then obtaining 101, and writing compressed code words; then, the reference number codes of the group are also set to be 3-bit binary numbers, namely q =3, the reference number is 7, the reference number is converted into the 3-bit binary number to obtain 111, and the compressed code words are written in; and then respectively calculating the difference between each run and the reference number.
If the difference value between the length of the first run and the reference number is 3 and the run type is 0 run, the positive and negative identification bits can be obtained to be 0, the run type is 0, and the difference value code can be obtained to be 1001 according to the code table, so that the final code of the first run is 001001;
the difference value between the second run length and the reference number is 0, and the run type is 1 run, then the positive and negative identification bits are 0, the run type is 1, the difference value coding is 00 according to the code table, therefore the final coding of the second run is 0100;
fourthly, if the difference value between the length of the third run and the reference number is 0 and the run type is 0 run, the positive and negative identification bits are 0, the run type is 0, and the difference value code is 00 according to the code table, so that the final code of the third run is 0000;
the difference value between the run length of the fourth segment and the reference number is 1, and the run type is 1 run, so that the positive and negative identification bits are 0, the run type is 1, and the difference value code is 01 according to the code table, so that the final code of the fourth run is 0101;
sixthly, if the difference value between the length of the fifth run and the reference number is-1 and the run type is 0 run, the positive and negative identification bits are 1, the run type is 0, and the difference value coding is 01 according to the code table, so that the final coding of the fifth run is 1001;
after data is completely compressed, the final code is obtained as a reference number binary code, then run-length number coding is carried out, and difference value coding is carried out to obtain 1011110010010100000001011001, wherein 28 bits are obtained, and 15 bits are reduced compared with original data.
Example two
The following demonstrates the decompression process with the data obtained in example one; assuming that under the condition that the p value and the q value are both set to be 3, the compressed data is obtained as follows:
1011110010010100000001011001, the decompression process is:
(D0) informing the decompression program that p is 3 and q is 3;
(D1) reading the first 3 bits to obtain the binary number of the run sequence of the current group as 101, and storing the binary number into the m-bit register two because p is 3; the register is used as a subsequent circulation mark;
reading 3 bits again to obtain a reference number binary code 111 of the current group, subtracting one bit of the reference number binary code from the reference number binary code, outputting 0 bit after subtracting 1 until the value is 0, outputting 01, and storing the output value into a first m-bit register, namely storing the value into 00000001; the m-bit register one stores a decompressed intermediate value expressed in a 0-run form, and the run length of the decompressed intermediate value = the reference number lq of the current group; in this embodiment, lq is 7;
the remaining codes are the difference length codes of a plurality of small groups, and the subsequent decompression process is as follows:
group one decompression: analog read 001001
(D20) Continuously reading 1-bit data, obtaining the positive and negative type 0 of the difference value between the current run and the reference number, and assigning to ope;
(D21) and continuously reading one bit, marking as the run type of the current run, and assigning a value of 0 to a flag.
(D22) Continue reading a bit to get 1, 1<>0, so reading is continued until a run 10 is obtained and is used as a current prefix, the prefix digit =2, 2-bit data is read continuously, and a suffix 01 of the current run to be decoded is obtained; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number 101, converting the new binary number into decimal number, and subtracting 2 to obtain the difference value between the current run length to be decoded and the reference number. (101) 2 =(5) 10 5-2 ═ 3, i.e., the current difference is 3.
(D23) Controlling the m-bit register I to increase 3 bits of 0 before the high bit of the m-bit register I because ope is 0 and the difference value is 3, so as to obtain shifted data 00000000001, and performing exclusive OR operation on the shifted data bit by bit and the flag obtained in the step (D21) to obtain decompressed data 00000000001; adding 00000000001 into the decompressed codeword;
(D24) subtracting 1 from the data in the m-bit register II, wherein the numerical value in the m-bit register II is 100; resetting the data in the m-bit register one as a result of the step (D1);
(D25) if the value in the m-bit register II is not 0, the above steps (D20) to (D24) are repeated.
Group two decompression: simulated read 0100
(D20) Continuously reading 1-bit data, obtaining the positive and negative type 0 of the difference value between the current run and the reference number, and assigning to ope;
(D21) and continuously reading one bit, marking as the run type of the current run, and assigning a value of 1 to a flag.
(D22) Continuously reading one bit to obtain 0, taking the 0 as a current prefix, and continuously reading 1-bit data to obtain a suffix of the current run to be decoded as 0, wherein the prefix bit = 1; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number 10, converting the new binary number into decimal number, and subtracting 2 to obtain the difference value between the current run length to be decoded and the reference number. (10) 2 =(2) 10 And 2-2 is 0, i.e. the current difference is 0.
(D23) Since ope is 0 and the difference is 0, the m-bit register one is unchanged from step (D1) and is 00000001, and the decompressed data is 11111111110 by bitwise exclusive-or operation of the data of the m-bit register one and the flag obtained in step (D21); adding the obtained 11111110 into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II, wherein the numerical value in the m-bit register II is 011; resetting the data in the first m-bit register as a result of step (D1);
(D25) if the value in the m-bit register II is not 0, the above steps (D20) to (D24) are repeated.
Group three decompresses: analog read 0000
(D20) Continuously reading 1-bit data, obtaining the positive and negative type 0 of the difference value between the current run and the reference number, and assigning to ope;
(D21) and continuously reading one bit, recording the bit as the run type of the current run, and assigning a value of 0 to a flag.
(D22) Continuously reading one bit to obtain 0, taking the 0 as a current prefix, and continuously reading 1-bit data to obtain a suffix of the current run to be decoded as 0, wherein the prefix bit = 1; adding a1 bit before the most significant bit of the resulting suffix to obtain a new binary number 10, newAnd converting the obtained binary number into a decimal number, and subtracting 2 to obtain the difference value between the current run length to be decoded and the reference number. (10) 2 =(2) 10 And 2-2 is 0, i.e. the current difference is 0.
(D23) Since ope is 0 and the difference is 0, the m-bit register one is unchanged from step (D1) and is 00000001, and the decompressed data is 00000001 by bitwise exclusive-or operation of the data of the m-bit register one and the flag obtained in step (D21); adding the obtained 00000001 into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II, wherein the numerical value in the m-bit register II is 010; resetting the data in the m-bit register one as a result of the step (D1);
(D25) if the value in the m-bit register II is not 0, the above steps (D20) to (D24) are repeated.
Group four decompression: simulated read 0101
(D20) Continuously reading 1-bit data, obtaining the positive and negative type 0 of the difference value between the current run and the reference number, and assigning to ope;
(D21) and continuously reading one bit, marking as the run type of the current run, and assigning a value of 1 to a flag.
(D22) Continuously reading one bit to obtain 0, taking the 0 as a current prefix, and continuously reading 1-bit data to obtain a suffix of the current run to be decoded as 1; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number 11, converting the new binary number into decimal number, and subtracting 2 to obtain the difference value between the current run length to be decoded and the reference number. (11) 2 =(3) 10 3-2 ═ 1, i.e., the current difference is 1.
(D23) Since ope is 0 and the difference is 1, the high order of the m-bit register one is increased by 1 bit 0 to 000000001 with respect to step (D1), and the decompressed data is 111111110 by bitwise xoring the data of the m-bit register one with the flag obtained in step (D21); adding 111111110 into the decompressed codeword;
(D24) subtracting 1 from the data in the m-bit register II, wherein the numerical value in the m-bit register II is 001; resetting the data in the m-bit register one as a result of the step (D1);
(D25) if the value in the m-bit register II is not 0, the above steps (D20) to (D24) are repeated.
Decompression by group five: analog read 1001
(D20) Continuously reading 1-bit data, obtaining the positive and negative type 1 of the difference value between the current run and the reference number, and assigning to ope;
(D21) and continuously reading one bit, marking as the run type of the current run, and assigning a value of 0 to a flag.
(D22) Continuously reading one bit to obtain 0, taking the 0 as a current prefix, and continuously reading 1-bit data to obtain a suffix of the current run to be decoded as 1; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number 11, converting the new binary number into decimal number, and subtracting 2 to obtain the difference value between the current run length to be decoded and the reference number. (11) 2 =(3) 10 3-2 ═ 1, i.e., the current difference is 1.
(D23) Since ope is 1 and the difference is 1, the high bit of the m-bit register one is reduced by 1 bit 0 to 0000001 with respect to the high bit in step (D1), and the decompressed data is 0000001 by bitwise xoring the data of the m-bit register one with the flag obtained in step (D21); adding the obtained 0000001 into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II, wherein the numerical value in the m-bit register II is 000; resetting the data in the m-bit register one as a result of the step (D1);
(D25) the value in the m-bit register two is 0, and the decompression of the current group is completed.
The final decompressed data is obtained as 0000000000111111110000000011111111100000001.
EXAMPLE III
The following describes the program implementation method of the decompression process
(E1) Configuration decoder
In designing the circuit, a two (k + 1) -bit counter, one log, may be used 2 k-bit counter, a FSM (FInite State Machine)Machine) and an exclusive or gate and two m-bit registers. The decoder is independent of the circuit under test and is variable in size. The structure block diagram of the decoder is shown in fig. 2, and table 2 shows specific decoder signals and their corresponding functions.
(E2) The decompression process of the present invention is described with reference to fig. 2 (taking p =8 and q =5 as an example):
(a) placing en as 1 and placing v as 1; the FSM receives data for b _ in 1;
(b) continuously receiving 8-bit data (number binary coding of each group of runs) of b _ in1, and transmitting the data from the FSM to the m-bit register two through c _ in 3;
(c) continuously receiving 5-bit data (the reference number binary code of the current group) of b _ in1, storing the data into a first (k + 1) -bit counter, and performing 1 subtraction operation on the data, wherein each time the value is subtracted by 1, a 0 is stored in a first m-bit register; when the value in the counter 1 is 0, storing a 01 in the register, and finishing inputting the reference number;
(d) continuously receiving one-bit data (positive and negative type marks of the difference value) of the b _ in1, and setting inc2 to be high level when the value is 0; when the value is 1, dec3 is set to high level;
(e) continuously receiving one bit of data (run type flag) of b _ in1, and outputting the one bit of data to flag;
(f) continue to receive the data (prefix portion) coming in from b _ in1, if the data is 1, log 2 Adding 1 to a k-bit counter; until the value of the b _ in1 input is 0, the prefix part input ends;
(g) continuing to receive incoming data (suffix portion) for b _ in1, setting shift1, dec1 high, entering a (k + 1) bit counter one, log, for each incoming bit of data 2 The k bit counter value is decremented by 1 until log 2 The k bit counter is 0, rs1 is set to 1, and the suffix part input ends;
(h) copying the value of the m-bit register I into a (k + 1) -bit counter II through dload, setting shift2 to be at a high level, executing the step (i) if dec3 is at the high level, and executing the step (j) if inc2 is at the high level;
(i) at this time, dec3 is at high level, and the value of the (k + 1) bit counter one is decremented by 1, and every time the value is decremented by 1, the 0 at the end of the run of the (k + 1) bit counter two is shifted one bit higher together with the least significant bit 1 until the value of the (k + 1) bit counter one is 2 (i.e., binary number "10");
(j) at this time inc2 is high, the value of the (K + 1) bit counter one is decremented by 1, and every time the value is decremented by 1, the 0 at the end of the run of the (K + 1) bit counter two is shifted down by one bit together with the least significant bit 1 until the value of the (K + 1) bit counter one is 2 (i.e., binary number "10");
(k) the value of the (K + 1) bit counter II is subjected to XOR operation with the flag and output out; and subtracting 1 from the value in the m-bit register II. If the value is not 0, executing d) ~k); if the time value is 0, the decompression of the group of data is finished;
(l) Repeating the steps a) to k) until all the incoming data are decompressed.
It should be noted that, those skilled in the art can design many decompression methods according to the compression method provided by the present invention, and the embodiments of the present invention include but are not limited to the above embodiments, and those skilled in the art can make various changes and modifications according to the present invention without departing from the spirit and the spirit of the present invention, and still fall into the protection scope of the present invention.
Claims (3)
1. A difference coding compression and decompression method based on a reference number of a division group comprises the following steps:
A. constructing a difference length coding table:
(A1) the difference length coding table comprises the following fields:
group number: expressed as a decimal number i;
length of difference: expressed in one decimal L;
prefix: binary code representation consisting of a number of 1's and a 0's;
suffix: represented by a set of binary codes;
and (3) encoding the difference length: the prefix and suffix cascade connection is formed;
records in the difference length coding table are arranged in an increasing mode according to the difference length L and grouped, the group numbers i are arranged in an increasing mode, the difference length is 0 at minimum, and the group numbers are 1 at minimum;
(A2) in the difference length coding table, the i-th group includes 2 i The prefix of the ith group consists of (i-1) 1 s and a 0, and the suffix of the ith group is sequentially ordered from the minimum i-bit binary number to the maximum i-bit binary number;
(A3) definition and description:
the 0 run refers to a binary code consisting of several consecutive 0 plus 1, 1 is the 0 run end mark, and its run length L y Number of fingers 0; a1 run refers to a binary code consisting of several consecutive 1 s plus 10 s, 0 being the end of the 1 run mark, the run length L of which y The number of fingers 1;
B. raw test data preprocessing
(B1) Filling irrelevant bits in original test data, and filling irrelevant bits 'X' in the data into binary numbers '0' or '1', so as to obtain a data packet to be compressed;
(B2) carrying out run-length division on the data packet to be compressed obtained in the step (B1) according to a double-run-length mode to obtain a corresponding total run-length sequence; obtaining the total run number x at the same time; the total run length sequence records the length of each run in sequence;
(B3) dividing the obtained x runs into a plurality of groups to obtain a run quantity grouping sequence, wherein the run quantity grouping sequence is used for recording the run quantity in each group;
(B4) selecting one of the modes of the run length in each group as a reference number of the group for the plurality of groups obtained in the step (B3); the reference number is a decimal number;
C. step of compression
(C1) Reading the run quantity grouping sequence obtained in the step (B3) to obtain the run quantity in the group of the current group; converting the obtained data into a binary code with p bits, and adding the obtained code into a compressed code word; the p is a self-defined fixed constant;
converting the decimal reference number obtained in step (B4) to a q-bit binary code, adding the resulting code to the compressed progeny codeword; the q is a self-defined fixed constant;
(C2) compressing a current group
(C20) Reading the current run from the data packet to be compressed obtained in the step (B1), calculating the current run length, and comparing the obtained run length with the current group reference number obtained in the step (B4) to obtain a difference value; if the difference value between the current run length and the reference number is a positive value or 0, adding 0 into the compressed code word; otherwise, 1 is added to the compressed code word; meanwhile, if the read current run is 0 run, 0 is added to the compressed code word, otherwise, 1 is added to the compressed code word; b, taking the absolute value of the difference as the difference length, looking up a table according to the difference length coding table obtained in the step A to obtain a difference length code, and storing the difference length code into a compressed code word;
(C21) grouping the run number in the current group recorded by the sequence according to the run number, and repeating the step (C20) until the compression of the current group is completed;
(C3) and (4) grouping the sequence according to the run number, shifting to the next group, and repeating the step (C1) and the step (C2) until the data packet to be compressed obtained in the step (B1) is completely compressed.
2. The partition group reference number-based differential encoding compression and decompression method of claim 1, wherein: also comprises
D. A decompression step:
(D0) transmitting a predefined parameter p representing the binary digit number of the trip number in the group to the decompression program, and transmitting a predefined parameter q representing the binary digit number of the reference number to the decompression program;
(D1) reading data to be decompressed according to the digits, firstly reading the front p bits of a code word to obtain the current group run length number in a binary form, and storing the current group run length number in an m-bit register II as a cycle mark;
reading a q-bit binary number from the data to be decompressed according to bits, and calculating to obtain a decimal number lq of the q-bit binary number, wherein the decimal number lq is a current group reference number; storing a 0 run into the m-bit register one, wherein the 0 run has a run length = lq; the register one is used as a decompression intermediate value;
(D2) current group decompression
(D20) Continuously reading 1-bit data from the data to be decompressed, and assigning ope a positive mark and a negative mark;
(D21) continuously reading 1-bit data from the data to be decompressed, and assigning a value to a flag as a run type;
(D22) continuously reading 1-bit data from the data to be decompressed, and if the read data is 0, continuously reading the 1-bit data as a suffix; if the read data is 1, continuously reading a plurality of bit data until a1 run is obtained, taking the 1 run as a prefix, recording the prefix length, and continuously reading the data with the same bit number as a suffix according to the obtained prefix length; adding a digit 1 in front of the highest bit of the obtained suffix to obtain a new binary number, converting the new binary number into a decimal number, and subtracting 2 from the decimal number to obtain an absolute value | X | of the difference value between the current run length to be decoded and the reference number;
(D23) if ope obtained in step (D20) is 0, the upper bits of the m-bit register one are padded with 0 in the increased number of bits with respect to the increment-X-bits in step (D1); otherwise, the upper bits of the m-bit register one are reduced by | X-bits with respect to step (D1); carrying out XOR operation on the obtained data of the m-bit register I and the flag obtained in the step (D21) bit by bit, and adding the obtained data into the decompressed code word;
(D24) subtracting 1 from the data in the m-bit register II; resetting the data in the m-bit register one as a result of the step (D1);
(D25) repeating the steps (D20) to (D24) until the value in the m-bit register II is 0;
(D3) repeating the steps (D1) and (D2) until all data decompression is completed.
3. The partition group reference number-based differential encoding compression and decompression method according to claim 2, wherein said decompression step is implemented by a program comprising:
(E1) configuration decoder
The decoder comprises two (k + 1) bit counters, one log 2 The system comprises a k-bit counter, an FSM, an exclusive OR gate, a first m-bit register and a second m-bit register;
(E2) and (3) decompression flow:
(a) placing en as 1 and placing v as 1; the FSM receives data for b _ in 1;
(b) continuously receiving p-bit data of b _ in1, and transmitting the data from the FSM to a second m-bit register through c _ in 3;
(c) continuously receiving q-bit data of b _ in1, storing the q-bit data into a first (k + 1) -bit counter, and carrying out 1 subtraction on the data, wherein each time the value is subtracted by 1, a 0 is stored in a first m-bit register; when the value in the counter 1 is 0, storing a 01 in the register, and finishing inputting the reference number;
(d) continuously receiving one-bit data of b _ in1, and setting inc2 to be high level when the value is 0; when the value is 1, dec3 is set to high level;
(e) continuously receiving one-bit data of b _ in1 and outputting the data to a flag;
(f) continuing to receive the data from b _ in1, if the data is 1, log 2 Adding 1 to a k-bit counter; until the value of the b _ in1 input is 0, the prefix part input ends;
(g) continuing to receive the data coming in from b _ in1, setting shift1 and dec1 to high level, and entering one bit of data into one (k + 1) bit counter one, log 2 The k bit counter value is decremented by 1 until log 2 The k bit counter is 0, rs1 is set to 1, and the suffix part input ends;
(h) copying the value of the m-bit register I into a (k + 1) -bit counter II through dload, setting shift2 to be at a high level, executing the step (i) if dec3 is at the high level, and executing the step (j) if inc2 is at the high level;
(i) at this time, dec3 is at high level, the value of the (k + 1) bit counter one is decremented by 1, and each time the value is decremented by 1, the 0 at the end of the run of the (k + 1) bit counter two is shifted one bit high together with the least significant bit 1 until the value of the (k + 1) bit counter one is 2;
(j) at this time inc2 is high, the value of the (K + 1) bit counter one is decremented by 1, and each time the value is decremented by 1, the 0 at the end of the run of the (K + 1) bit counter two is shifted down by one bit together with the least significant bit 1 until the value of the (K + 1) bit counter one is 2;
(k) the value of the (K + 1) bit counter II is subjected to XOR operation with the flag and output out; subtracting 1 from the value in the m-bit register II; if the value is not 0, executing d) ~k); if the time value is 0, the decompression of the group of data is finished;
(l) Repeating the steps a) to k) until all the incoming data are decompressed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210458157.3A CN114866091A (en) | 2022-04-28 | 2022-04-28 | Differential coding compression and decompression method based on grouping reference numbers |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210458157.3A CN114866091A (en) | 2022-04-28 | 2022-04-28 | Differential coding compression and decompression method based on grouping reference numbers |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114866091A true CN114866091A (en) | 2022-08-05 |
Family
ID=82633227
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210458157.3A Pending CN114866091A (en) | 2022-04-28 | 2022-04-28 | Differential coding compression and decompression method based on grouping reference numbers |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114866091A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116170027A (en) * | 2023-04-26 | 2023-05-26 | 北京索斯克科技开发有限公司 | Data management system and processing method for poison detection equipment |
-
2022
- 2022-04-28 CN CN202210458157.3A patent/CN114866091A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116170027A (en) * | 2023-04-26 | 2023-05-26 | 北京索斯克科技开发有限公司 | Data management system and processing method for poison detection equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7965207B2 (en) | Variable length integer encoding system and method | |
US5045852A (en) | Dynamic model selection during data compression | |
US7770091B2 (en) | Data compression for use in communication systems | |
US7907069B2 (en) | Fast compression method for scientific data | |
US7737869B2 (en) | Symbol based data compression | |
US7872598B2 (en) | Accelerated decompression | |
US7545291B2 (en) | FIFO radix coder for electrical computers and digital data processing systems | |
US7511639B2 (en) | Data compression for communication between two or more components in a system | |
US20090015442A1 (en) | Data coding buffer for electrical computers and digital data processing systems | |
JPH0253329A (en) | Compressed encoding method and decoding method | |
US20090019128A1 (en) | Lifo radix coder for electrical computers and digital data processing systems | |
US12010352B2 (en) | Coding method and related device | |
US6225922B1 (en) | System and method for compressing data using adaptive field encoding | |
CN114614833A (en) | Test data compression and decompression method for self-adaptive run-length coding | |
US7176815B1 (en) | Video coding with CABAC | |
CN114866091A (en) | Differential coding compression and decompression method based on grouping reference numbers | |
JPH05241777A (en) | Data compression system | |
EP0304608A2 (en) | Multi-mode dynamic code assignment for data compression | |
US6617985B1 (en) | Method and/or apparatus for implementing constraint codes with low error propagation | |
JP2001036410A (en) | Encoding method | |
CN114614832A (en) | Test data compression and decompression method based on front and back run length coding | |
US6778107B2 (en) | Method and apparatus for huffman decoding technique | |
US6762700B2 (en) | NEO method and system for lossless compression and decompression | |
US20090256730A1 (en) | Advanced Lossless Bit Coding | |
CN113346913A (en) | Data compression using reduced number of occurrences |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20220805 |