Abstract:
A sliding window with big gap data compression system is simple to implement and gives good compression over a wide variety of bilevel images. A sliding window compressor with a very small window size is utilized in conjunction with a storage buffer which is large enough to hold at least an entire scan line of data symbols. Coupled to the storage buffer is circuitry that checks for a match between the incoming data symbol and a symbol stored in one specific programmable location. This programmable location is preferably exactly one scan line length away. Match locations are either within the range of the small window or exactly equal to the specific programmable location. The entire compressor can be viewed as a sliding window with a big gap (SWBG). This sliding window is of a length corresponding to the length of the scan line, comprised of the small window followed by a big gap and then the one specific programmable location, at the end of the scan line.

Description:
FIELD OF THE INVENTION 
     The present invention relates to the field of data compression and decompression. More particularly, the present invention relates to data compressors which compress data using an adaptive and lossless scheme, and that work well on bilevel image data. 
     BACKGROUND OF THE INVENTION 
     The goal of data compression is to decrease the transmission time or storage space required for the data being compressed. Data compression is useful on a variety of data types, including text and image data. Many compression schemes have been developed for both text and image data. The books Managing Gigabytes by Witten, Moffat and Bell, and Image and Text Compression, edited by Storer, describe such compression schemes. 
     The efficiency of a data compressor is measured in a quantity called a compression ratio which is calculated by dividing the number of uncompressed characters by the number of compressed characters. The higher the compression ratio the greater the density of the compressed data. A compression ratio of 2 denotes that the number of characters after compression is half of the number of characters before compression. 
     Another important characteristic of a data compressor is how closely the output from the decompressor matches the original input. Compression techniques can be divided into two subdivisions, lossless and lossy. Lossless methods allow the exact reconstruction of the original data from the compressed data. Lossless methods are most appropriate for text compression applications or other applications where it is essential that the data be fully restored to its original condition. Lossy methods allow for some error to occur during compression and decompression. These types of methods are used where a good approximation is sufficient, such as on digitally sampled analog data. 
     Dictionary-based compression schemes are quite popular for text compression. In these lossless compression systems, the incoming text is used to build a dictionary that will be used to compress future data. In particular, a sliding dictionary, or sliding window compressor uses the last N text symbols as the dictionary. This is an adaptive scheme, since every new symbol updates the compression dictionary. Data is encoded by searching for a match between incoming symbols and the contents of the dictionary. If no match is found, the incoming symbol is sent &#34;raw&#34; or as is. If a match is found between a string of incoming symbols and a string with its first byte in the window when the first byte is input, a code pair is sent instead of sending the individual symbols. The code pair consists of the location in the window of the match relative to the incoming data and the length of the matching string. Compression is achieved in such a system when the number of bits required to represent a code pair is smaller than the number of bits required to represent the individual symbols. One implementation for a sliding window compressor is disclosed in U.S. Pat. No. 5,532,693, issued on Jul. 2, 1996, and entitled &#34;Adaptive Data Compression System With Systolic String Matching Logic,&#34; which is hereby incorporated by reference. 
     The sliding window text compressor relies on the assumption that certain strings of symbols occur repeatedly, and that symbols are like their neighbors. Because this is often true of text files, this type of compressor can be used to compress such files quite effectively. On the other hand, this assumption is not a good one for certain types of image data, such as grayscale or color images. In this type of application, adjacent areas of the image may appear similar (e.g., slightly different shades of gray) but not exactly the same. The dictionary-based compressors require exact matches between symbols, as described above, and would not work well on such an image. A more effective approach for this type of image data is to use one of a family of lossy schemes, such as the JPEG standard, described in the reference paper &#34;The JPEG Still Picture Compression Standard&#34; by Gregory Wallace, Communications of the ACM, April 1991 or a lossless compression algorithm which has differential encoding, such as the Rice algorithm, described in &#34;Algorithms for a Very High Speed Universal Noiseless Coding Module&#34; by Rice, Yeh, and Miller, JPL Publication 91-1. 
     Certain types of image data, such as bilevel or black-and-white images included in facsimile or computer printer documents, are compressed effectively using a sliding window or other dictionary-based compressor. These images are most often represented using one bit per pixel, e.g. either black or white, and therefore exact matches between strings are much more likely than in grayscale or color images, where there is more than one bit used to represent a single pixel. To maximize compression of bilevel two-dimensional data, data correlations in both the horizontal and vertical directions need to be taken into account. Both correlations can be detected by making the sliding window large enough to contain at least an entire scan line. However, a scan line can contain a large number of symbols if the scanning or printing density is very high. This large window size complicates the sliding window compressor implementation. 
     Many simpler image compressors have been developed for bilevel data. An obvious choice for this application is a runlength compression code. The basic idea behind a runlength code is that runs of 0&#39;s and 1&#39;s are encoded in terms of the length of the run, usually using a variable length code. The runs can be either bit-wise or byte-wise. For example, the CCITT Group 3 and Group 4 standards for facsimile transmission, as described in the reference Managing Gigabytes by Witten, Moffat and Bell, describe runlength coding schemes that also incorporate comparisons of incoming data with the previous scan line. These types of schemes will generally do very well for the simplest data, whereas a sliding window compressor will do better for more complicated bilevel data since it takes into account more complicated patterns than just runs of 0&#39;s and 1&#39;s. A runlength coder can be considered to be a subset of a sliding window compressor, since a sliding window compressor takes runs into account by allowing matches with the previously compressed symbol. In this manner, not only runs of 0&#39;s and 1&#39;s are compressed, but also runs of other byte patterns. 
     For bilevel image compression, what is needed is a compression scheme that is both simple to implement and that will achieve good compression results on more complicated images. 
     SUMMARY OF THE PRESENT INVENTION 
     A sliding window with big gap data compression system is simple to implement and gives good compression over a wide variety of bilevel images. A sliding window compressor with a very small window size is utilized in conjunction with a storage buffer which is large enough to hold at least an entire scan line of data symbols. Coupled to the storage buffer is circuitry that checks for a match between the incoming data symbol and a symbol stored in one specific programmable location. This programmable location is preferably exactly one scan line length away. Match locations are either within the range of the small window or exactly equal to the specific programmable location. The entire compressor can be viewed as a sliding window with a big gap (SWBG). This sliding window is of a length corresponding to the length of the scan line, comprised of the small window followed by a big gap and then the one specific programmable location, at the end of the scan line. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates a block diagram schematic of the sliding window with big gap (SWBG) compressor according to the present invention. 
     FIG. 2a illustrates a conceptual illustration of the sliding window with big gap. 
     FIG. 2b illustrates a two-dimensional interpretation of the sliding window. 
     FIG. 3a illustrates a block diagram schematic of the M-byte CAM utilized for the small sliding window of the present invention. 
     FIG. 3b illustrates a block diagram schematic of a string match module used within the M-byte CAM. 
     FIG. 3c illustrates a state transition diagram which controls the operation of the string match modules within the M-byte CAM. 
     FIG. 3d illustrates a block diagram schematic of the logic circuitry used to generate the CAM write address and write enable signals. 
     FIG. 3e illustrates a block diagram schematic of the logic circuitry used to generate the CAM match address. 
     FIG. 4a illustrates a block diagram schematic of the match selection module. 
     FIG. 4b illustrates a state transition diagram which controls the operation of the match selection state machine. 
     FIG. 4c illustrates a block diagram schematic of the logic circuitry of the postcode encoder. 
     FIG. 5 illustrates a block diagram schematic of the decompressor of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The present invention is a hardware adaptive data compression system known as a sliding window with big gap (SWBG) compressor. A block diagram of the SWBG compressor is illustrated in FIG. 1. The data bus carrying the incoming symbol to be compressed CHARIN 101 is coupled to the M-byte Content Addressable Memory (CAM) sliding window compressor 103 and to the scan line buffer 105. The programmable scan line value S signal line 119 is also coupled as an input to the scan line buffer 105. The M-byte CAM-based sliding window compressor 103 has four outputs: a CAM match signal line GMAT 107; a CAM match address bus CADD 109; a write address bus WADD 111; and a current byte data bus B O  113. All of the outputs 107, 109, 111 and 113 are coupled as inputs to the match selection module 115. The scan line buffer 105 has two outputs: a signal line VALID 123 which indicates whether a whole scan line has been entered since the last dictionary reset; and a data bus B S  121 which transmits the symbol stored in the scan line buffer at a memory location which is exactly a scan line length away from the incoming symbol. Both of the outputs 121 and 123 from the scan line buffer 105 are also coupled as inputs to the match selection module 115. The match selection module 115 decides whether to output a scan line or a CAM match when both are occurring. The outputs of the match selection module 115 include the scan line match signal line SM 411, the CAM match signal line CM 409, and the raw data signal line RD 429 are coupled as inputs to the variable length postcode encoder 127 which in turn outputs compressed data to the storage system on the signal line 129. 
     As illustrated in FIG. 1, an incoming symbol or byte to be compressed CHARIN on the data bus 101 follows two parallel paths. The first path is through the M-byte CAM-based sliding window compressor 103 where it is compared to M previous symbols contained within the sliding window. The compressor 103 may be implemented using any appropriate type of sliding window compressor. Preferably, the compressor 103 is of a type as described in the U.S. Ser. No. 05/532,693, referred to above. The operation of this compressor 103 will be described in detail below. In the preferred embodiment, the CAM-based sliding window compressor is of a size where the window size M is equal to 16. The sliding window compressor 103 compares the incoming symbol to the symbols stored in the CAM 103 and outputs the appropriate information to the match selection module 115. 
     The second path followed by the incoming symbol or byte to be compressed CHARIN is through the scan line buffer 105. The scan line buffer 105 first stores the incoming symbol in the next available memory location for retrieval later. The programmable scan line value S is equal to the scan line length in bytes. Preferably, the scan line buffer 105 is capable of storing 2048 bytes. In this embodiment the scan line length value S could be any number in the range from 1 to 2047 inclusive and therefore 11 bits are required to specify the scan line length value S. 
     Using the scan line length value S, the scan line buffer 105 outputs the symbol B S  on the data bus 121. The symbol B S  is the symbol which is stored in the scan line buffer exactly the scan line length value S symbols away from the incoming symbol. The scan line buffer 105 also outputs a signal on the signal line VALID 123 which notifies the match selection module 115 that at least S values have entered the scan line buffer since the last dictionary reset. The signal on the signal line VALID 123 therefore notifies the match selection module 115 that the value B S  on the data bus 121 is valid. 
     Using the information from the CAM-based sliding window compressor 103 and the scan line buffer 105, the match selection module 115 determines which match to choose if more than one has occurred, or decides on a raw byte if no match has occurred. The variable length postcode logic block 127 uses the signals from the match selection module 115 to determine the length of any matches and then encodes scan line matches, CAM matches, or raw bytes into variable bit-length codewords. The variable bit-length codewords are then concatenated, divided into bytes and sent on the output signal lines 129 to the storage or transmission system. 
     The CAM-based sliding window compressor 103 and the scan line buffer 105 can be considered conceptually as a sliding window with a big gap as illustrated in FIG. 2a. FIG. 2a is presented to illustrate the concept of the present invention only and does not represent a practical implementation of the invention. The sliding window shown in FIG. 2a includes S+1 cells 201. The M cells on the right numbered 0 through M-1 represent the sliding window of the sliding window compressor 103 where the last M bytes of incoming symbols in the data stream, including the incoming byte, are stored. In each of these cells, except the cell 0 which stores the incoming byte, matches between the incoming byte and the bytes stored within this sliding window are checked. 
     The gap section 203 follows the first M cells. The cells within the gap section 203 are used for storage but no matching with the incoming byte is checked. There are S+1-M cells within the gap. The gap section 203 represents the scan line buffer where the bytes of incoming data are stored. The final cell 205 represents the symbol B S  and contains the byte that is exactly one scan line length S away from the current incoming byte. Matching is checked within this cell by the match selection module 115 as will be described below. 
     With the value of the scan line length S programmable, the sliding window of FIG. 2a is a variable length sliding window with a gap. The illustration of FIG. 2a implies that incoming bytes are shifted into the right side of the window and previously stored bytes shift to the left, with the byte stored in the cell 205 shifting out of the window each time a new byte enters. In the actual implementation of the present invention, the sliding window is a circular queue with the data held stationary and the write address pointer and state information moving. 
     A second conceptual representation of the sliding window of the present invention is illustrated in FIG. 2b. This figure is also included for illustrative purposes only and does not represent the actual implementation of the present invention. In FIG. 2b, the position of the sliding window 211 is shown with respect to the current scan line 213 being compressed and the previously compressed scan line 215. The cell 217 which is exactly a scan line length away from the incoming data byte is shown positioned above the cell 219 which stores the incoming data byte. 
     The sliding window compressor 103 is comprised of the chain of string match modules (SMM) 301 with the required control circuitry, as illustrated in FIG. 3a. The current input symbol is written to the current string match module, symbolized as SMM(j) 301, by enabling the write enable signal line WREN(j) 321. On the following clock cycle, the next input is written to the next string match module in the array SMM(j+1). 
     The value of j starts at 0 and is incremented by 1 a maximum of once every clock cycle. While data is stationary in the array, state information is shifted between the adjacent SMMs on the state signal lines ST(j). The state signal lines ST(j) indicate that either no match is occurring, that the SMM 301 is at the beginning of a match, or that the SMM 301 is in the middle of a match. 
     A single global match (GMAT) signal 107 is used to indicate when any SMM 301 is in the middle of a match. The signal line GMAT 107 is an input to each of the SMMs. The signal line GMAT 107 provides two functions. The global match signal GMAT 107 indicates the CAM has detected a matching string of at least two characters. Secondly, the global match signal GMAT 107 provides a mechanism to ensure only the longest matching string is reported. The global match signal GMAT 107 provides the second mechanism by controlling the state machines 363 inside the SMM 301 modules described later. The global match signal GMAT 107 is activated by the OR-gate 309 and the AND gate 310 when any of the string match signal lines STRMAT(j) 307 are active and the signal ENABLE 130 is active. The signal line ENABLE 130 is used in the preferred embodiment for better compression and is described with the match selection module 115. 
     Each SMM 301 has a near-match-enable signal NMEN(j). The near-match-enable signals NMEN(j) are daisy-chained between the SMMs to determine which of the SMMs reporting the longest current string match is nearest to the head of the queue. The head of the queue is considered to be the SMM 301 in the array where the current input symbol is being written, which is where the write enable signal line WREN 321 is active. 
     Each SMM 301 also has a nearest-word-match signal NWMAT(j) 323. No more than one nearest-word-match signal NWMAT(j) 323 may be asserted during each clock cycle, indicating the location of the SMM 301 containing the last symbol of the longest current string match nearest to the active write enable signal WREN(j) 321. 
     The structure of a string match module is illustrated in FIG. 3b. Each SMM 301 consists of a CAM word 361, a string match state machine 363 and an address logic module 365. 
     Each CAM word 361 stores a one byte symbol from the Input bus CHARIN 101 when the write enable signal line WREN 321 for that SMM 301 is active. When the write enable signal line WREN 321 is inactive and the CAM word 361 is not being written to, it is being searched for the input symbol that is currently being written at the head of the queue. The character match signal line CHMAT 367 is asserted by the CAM word 361 when the contents of the CAM word 361 matches the symbol on the input bus CHARIN 101. This character match signal is then passed on to the string match state machine (SMSM) 363. The character match signal line CHMAT 367 is disabled when the write enable signal line 321 is active in the SMM 301. 
     The function of the SMSM 363 is to track the status of the buffer string whose last symbol resides in the associated CAM word 361 of the present SMM 301. Each SMM 301 has a pair of signal lines STOUT 369 which assert that the buffer string does not match the current input string, is at the beginning of a match or is in the middle of a match. This pair of signal lines STOUT 369 is coupled to the next SMSM 363 in the array as a pair of signal lines STIN 371. This state information is shifted between the SMSMs once, each time a new character is input from the input bus CHARIN 101. The state information is passed in the same direction as the write enable signal WREN 321. 
     Each SMM 301 includes a string match signal line STRMAT 307 which is coupled between the SMSM 363 and the address logic module 365. The signal line STRMAT 307 is asserted by the SMSM 363 when the buffer string matches at least the last two characters of the current input string, e.g. is in the middle of a match. State information is shifted right, in the direction of the active write enable signal WREN 321, on each clock cycle that a new input symbol is accepted. 
     The address logic module (ALM) 365 is a module that outputs the near word match signal line NWMAT 323 and the near match enable out signal line NMENOUT 373. The ALM 365 is a combinational logic block that determines whether a match in the SMM 301 is nearest to the active write enable signal line WREN 321. This is required when multiple string matches occur. The ALM 365 asserts the near word match signal line NWMAT 323 when the SMM 301 is indeed the nearest match. The signal line NWMAT 323 is derived from the signal line STRMAT 307 in the present SMM 301 and the near match enable in signal line NMENIN 375 which is input from the adjacent SMM. When the near match enable in signal line NMENIN 375 is active there are no SMMs containing active STRMAT signal lines 307 between the present SMM 301 and the head of the queue. Therefore, the near word match signal line NWMAT 323 asserts that the present SMM 301 contains the last symbol of the most recent instance of the longest buffer string matching the current input string. If the signal line NMENIN 375 is active and the signal line STRMAT 307 is also active, then the present SMM 301 contains the nearest match. If the signal line NMENIN 375 is inactive the nearest match is closer to the previous active write enable signal line WREN 321. The ALM 365 also produces an output signal NMENOUT 373 which is the signal NMENIN 375 for the adjacent SMM. The basic functions of the signal lines NWMAT 323 and NMENOUT 373 are given by the following equations: 
     
         NMENOUT=WREN+NMENIN*STRMAT 
    
     
         NWMAT=WREN*NMENIN*STRMAT 
    
     The near match enable signals NMENOUT 373 and NMENIN 375 are passed in the direction opposite to the movement of the write enable signal WREN 321. 
     A state transition diagram for the string match state machine (SMSM) 363 is shown in FIG. 3c. The SMSM 363 resembles a Moore style state machine in that its output, the string match signal line STRMAT 307, is only a function of the present state of the previous SMM 301 and is not combinationally dependent upon any inputs to the previous SMM 301. This has the advantage of allowing greater clock speeds in applications such as the present invention. 
     Unlike ordinary state machines, the present state variables are not fed back as inputs to the next state logic, rather they are shifted to the SMSM 363 in the adjacent SMM 301 in the array. Therefore, the SMSM modules 363 may be thought of as synchronous logic array elements. It should be noted that the SMSM function and the global match protocol presented here would provide clock rate improvements to a Whiting style compression architecture as well, where the input data physically shifts within the buffer and the SMSM state information remains stationary. Thus, in a Whiting style architecture, the SMSMs would appear as ordinary Moore style state machines. 
     In order to facilitate a fast initialization of the SMSMs, upon dictionary reset, all SMSMs are forced into the reset state R 381. The reset state R 381 signifies that the buffer word has not yet been written to, and therefore the SMSM 363 cannot assert the global match signal GMAT 107. The CAM word 361 is considered to be empty and no matches can occur during the reset state R 381. The SMSM 363 leaves the reset state R 381 only after the CAM word 361 for that SMM has been written to. When the write enable signal line WREN 321 is asserted for a given buffer word, its SMSM 363 goes to the state X 383 and begins to look for a match string. To prevent the reset state of the last module (module n-1) from being passed onto the first module (module 0), a simple logic circuit is used. This circuit will always pass a state of X if the module n-1 is in the reset state R 381. 
     The SMSM 363 determines whether the contents of the CAM word 361 does not match the current input string, is at the beginning of a match, or is within a match string which matches at least the last two characters of the current input string. When the SMSM 363 has moved from the reset state R 381 to the state X 383, this signifies that the system is beginning to receive data to compress, but the word stored in the CAM word 361 for the SMM 301 does not match the current input symbol being stored at the head of the queue. When the signal line CHMAT 367 is activated signalling that the word stored in the CAM word 361 does match the current input symbol being stored at the head of the queue, the SMSM 363 moves to the state Y 385, indicating that only the last input symbol was matched. 
     If the SMSM 363 is already in the state Y 385, a second matching character will move the SMSM 363 from the state Y 385 to the state Z 387. The state Z 387 denotes that the present SMM 301 has detected a compressible match string of the greatest known length. Here the signal line STRMAT 307 is activated, for the SMM 301 whose SMSM 363 has moved to the state Z 387, which activates the signal line GMAT 107. Since more than one instance of the longest match may occur, more than one SMM 301 may assert the signal line STRMAT 307 and move to the state Z 387 in the same clock cycle, indicating that multiple instances of the current longest match string have been detected. 
     Since the string match state machines SMSM 363 must transition to state Y and then to state Z, the global match signal GMAT 107 will not go active until the second byte of a match. Once active, the global match signal GMAT 107 will remain active until the character on the input bus CHARIN 101 fails to match all of the cells 361 whose adjacent state machines 363 are in the Z (matching) state. Back to back CAM matches at different displacements are possible. The global match signal GMAT 107 will simply de-assert for the first byte of the second match. 
     When a string match occurs within the sliding window compressor 103, the global match signal GMAT 107 is activated and the match selection module 115 is notified. The address of the CAM word 361 which was matched is also transmitted to the match selection module 115 on the address bus 109. 
     FIG. 3d illustrates the counter 341 required to compute the CAM write address WADD which is transmitted to the match selection module 115 on the address bus 111. In the preferred embodiment, the sliding window compressor 103 contains 16 cells and thus a four-bit write address counter 341 will suffice. Correspondingly, in alternate embodiments if the sliding window compressor 103 includes additional cells then the write address counter 341 must be expanded to include additional bits. The write address counter 341 is coupled to the address decoder 343, by the write address bus WADD 111 which is used to convert the write address on the write address bus 111 to the appropriate value for the write enable signal WREN(j) 321 required by the SMM array as illustrated in FIG. 3a. 
     FIG. 3e illustrates the address encoder 351 which computes the CAM match address CADD to be transmitted on the address bus 109. The near word match signals NWMAT(j) 323 from each of the ALMs 365 are input to the address encoder 351 and used to compute the CAM match address CADD which is output on the address bus 109. The hardware illustrated in both FIGS. 3d and 3e is included within the sliding window compressor 103. 
     The parallel data path to the CAM-based sliding window compressor 103 is the scan line buffer 105. The scan line buffer 105 accepts an incoming symbol from the data bus CHARIN 101, stores that symbol within the buffer and outputs the symbol B S  that was stored S bytes previously, on the data bus 121. The scan line buffer 105 operates as a programmable length first-in first-out (FIFO) buffer. In addition to outputting the symbol B S , the scan line buffer 105 also outputs the signal VALID on the signal line 123. The signal VALID is active when at least S bytes have been stored in the scan line buffer 105 since the last dictionary reset. After a dictionary reset, the signal VALID is activated after exactly a scan line of S bytes has been stored in the scan line buffer 105. 
     A block diagram schematic of the match selection module 115 is illustrated in FIG. 4a. The signal lines 113 and 121 which transmit the current input byte B O  and the previous input byte B S  which is one scan line length away, respectively, are coupled as inputs to the comparator 401. It should be noted that the two bytes B O  and B S  are exactly a scan line length of S bytes apart in the scan line buffer 105. The comparator 401 will compare the two bytes B O  and B S  and output the result CMP on the signal line 403. The signal CMP is active only when the two bytes B O  and B S  are equal. The signal line 403 is coupled as an input to the AND gate 405. The signal line 123 which transmits the signal VALID is coupled as the other input to the logical AND gate 405. The logical gate 405 performs a logical AND operation on the signal CMP and the signal VALID and outputs the result SMAT on the signal line 407. 
     The scan line match signal 407 is coupled as an input to the match select state machine 408. The signal line 107 which transmits the global match signal GMAT is also coupled as an input to the match select state machine 408. As will be explained in detail below, the match select state machine 408 arbitrates between matches on the two parallel paths giving precedence to the CAM matches when there is both a CAM match and when the comparator 401 signals that the two bytes B O  and B S  are equal. The match state machine outputs the CAM match signal CM on the signal line 409 when a CAM match is selected and the scan line match signal SM on the signal line 411 when a scan line match is selected. 
     The terminate logic block 420 generates a match terminate signal TERM when the CAM match length is limited to a programmable maximum value. The signal TERM is transmitted on the signal line 440 which is coupled as an input to the match select state machine 408. In the preferred embodiment the signal TERM is activated when the CAM length of match value CLOM is equal to 256. In the preferred embodiment, the postcoder limits scan line matches to a maximum of 256. For example, a scan line match of length 257 can be broken into codewords for a scan line match of length 256 followed by another of length 1. However, a CAM match of length 257 cannot be broken up the same way because CAM matches of length 1 are not allowed. The termination logic forces a codeword of length 256 followed by a single raw byte. Hence the termination logic is necessary to break CAM matches longer than 256 into a series of smaller ones. 
     The CAM match address CADD address bus 109 and the write address WADD address bus 111 are coupled as inputs to the displacement calculation circuit 422. The displacement calculation circuit 422 calculates a displacement value DISP which relates the CAM match location with respect to the byte being written in the CAM when the match ended. This match location or displacement value DISP is output on the signal lines 424. 
     The current input byte B O  signal line 113 is coupled to the delay block 450 where it is delayed an appropriate amount of time. The output 428 of the delay block 450 is coupled as an input to the multiplexer 426. The multiplexer 426 outputs a raw byte 428 onto the raw data signal line RD 427 whenever the CAM match signal CM 409 and the scan line match signal SM 411 are both inactive. The multiplexer 426 outputs a CAM match displacement DISP 424 onto the raw data signal line RD 427 whenever the CAM match signal CM 409 is active. In the preferred embodiment, the multiplexer 426 outputs a raw byte 428 when the scan line match signal SM 411 is active, but the value is never needed or used. 
     The match select state machine 408 is governed by the state transition diagram illustrated in FIG. 4b. The state A 421 corresponds to no match, the state B 423 corresponds to a scan line match of at least one byte and the state C 425 corresponds to a CAM match of at least two bytes. In the preferred embodiment of the present invention a CAM match of at least two bytes takes precedence over a scan line match of one byte when the match select state machine 408 is in the state A 421. Therefore, when the match select state machine 408 is in the state A 421 and there is a CAM match of at least two bytes the match select state machine 408 will move to the state C 425 and the CAM match signal CM will be activated. From either the state A 421 or the state C 425, if there is no CAM match but there is a scan line match, the match select state machine 408 will move to the state B 423 and the scan line match signal SM will be activated. If a CAM match reaches the maximum length, the signal TERM will be activated and the match terminated, thereby moving the match select state machine back to the state A 421. The enable signal ENABLE 130 is used in the preferred embodiment to improve compression. The CAM and scan line match circuitry can operate completely in parallel letting the match selection state machine 408 arbitrate. However the compressor would be less efficient in the following scenario: A scan line match SMAT 407 and CAM match signal GMAT 107 are both currently active and the match selection state machine 408 is outputting the scan line match. Furthermore, the data stream contains a string that matches at a smaller displacement, is shorter than the CAM match(es) that first asserted the match signal GMAT 107, and starts during the scan line match. If the CAM match signal GMAT 107 is still active when the scan line match terminates, the compressor would switch to a CAM match but one with a longer than optimal displacement. In the preferred embodiment, when the match selection state machine is in the state C, the enable signal ENABLE 130 is de-asserted, suppressing the global match signal GMAT 107, and thus preventing CAM matches. Doing this ensures that when a scan match ends, any subsequent CAM match will have the smallest possible displacement. 
     The outputs of the match selection state machine, the scan line match signal SM 411 and the CAM match signal CM 409, are coupled along with the raw data signal line RD 427 to the postcode module. The postcode module 127 determines the lengths of any matches by how many clocks the scan line match signal SM 411 and the CAM match signal CM 409 are active. For a scan line match the length is the number of clocks the scan line match signal SM 411 is active. For a CAM match the length is one more than the number of clocks the CAM match signal CM 409 is active because the CAM match signal CM 409 is inactive for the first clock of a CAM match. Since the scan line match signal SM and the CAM match signal CM are mutually exclusive, a single length of match counter 450 can determine the lengths of matches. The length of match count LOM 451 is output from the counter 451 to the encode logic 454. The register outputs SM2, CM2, and RD2 are simply the scan line match signal SM 411, the CAM match signal CM 409, and the raw data signal RD 427, respectively, delayed to correspond to the length of match counter output LOM 451. The encode logic 454 outputs a codeword CW 455 corresponding to a scan match of length LOM when the register output SM2 462 transitions inactive. The encode logic 454 outputs a codeword CW 455 corresponding to a CAM match of length LOM and the displacement output RD2 453 when the output CM2 461 transitions inactive. The encode logic 454 outputs a codeword CW 455 corresponding to a raw byte RD2 453 when the output SM2 462 and the output CM2 461 are inactive for the current and previous clock. The shifter 456 accepts entire codewords CW 455 and divides them into individual compressed bytes which are then output on the signal line 129. 
     Table I illustrates the postcode of the preferred embodiment with the sliding window length M equal to 16, a CAM match length range from 2 to 256, and a scan line match length range from 1 to 256. The postcode is shown in Backus-Naur format. 
     A block diagram schematic of a decompressor according to the present invention is illustrated in FIG. 5. The compressed data is transmitted on the signal lines 501 from the storage or transmission system to the decompressor. The signal lines 501 are coupled as an input to the postcode decoder logic block 503. The postcode decoder logic block 503 converts the incoming variable length codewords to either a CAM match code pair (DISP, CLOM), a scan line length of match value SLOM or a raw byte RAW, according to the codeword and the preceding flag bits, as described above. 
     The output of the postcode decoder logic block 503 is transmitted on the signal lines 505. The signal lines 505 are coupled as an input to the read/write random access memory (RAM) control logic block 507. The RAM control logic block 507 is coupled to the random access memory (RAM) 513 by the signal lines 509 and 511. Preferably, the RAM 513 is capable of storing 2048 bytes. Using the information from the postcode decoder logic block 503, the RAM control logic block 507 writes and reads the appropriate bytes to and from the RAM 513. The RAM control logic block 507 then outputs the decompressed bytes on the signal lines 515 to the host. Specifically, if the postcode decoder logic block 503 is reporting a raw byte, RAW, the RAM control logic block 507 will write that byte to the RAM 513 using the signal lines 509 and will also output the raw byte, RAW, on the output signal lines 515. If the postcode decoder logic block 503 is reporting a scan line length of match value SLOM, then the RAM control logic block 507 will read the appropriate address in the RAM 513, e.g. one scan line length previous to the current RAM write address, write that byte to the RAM 513 at the current write address and output that byte on the output signal lines 515. This will occur for a number of bytes equal to the value specified by the scan line length of match value SLOM, incrementing the RAM 513 write address for each byte. If the postcode decoder logic block 503 is reporting a CAM match code pair (DISP, CLOM), the RAM control logic block 507 will read the byte from the appropriate address in the RAM 513, specified by subtracting the display value DISP from the current RAM write address, write that byte to the RAM 513 at the current write address and output that byte on the output signal lines 515. This will occur for a number of bytes equal to the value specified by the CAM length of match value CLOM, incrementing the RAM 513 write address for each byte. 
     To illustrate the compression and decompression processes, the following example is presented and described. Consider the sequence of bytes, expressed in hexadecimal, given below. ##STR1## This stream of data is input on the data bus 101 to the data compressor of the present invention, with a CAM sliding window size M equal to 16 and a scan line length S equal to 20. If the bytes are encoded from left to right and then top to bottom, the resulting sequence of compressed data will be output from the data compressor of the present invention, where raw bytes are expressed in hexadecimal, CAM match code pairs are expressed in decimal as (DISP, CLOM) and scan line match lengths are expressed in decimal as (SLOM). ##STR2## 
     When the above information is output from the postcode logic block 127, it will be encoded with the appropriate preceding flag bits, as described above, for transmission to the storage or transmission system. 
     Since the first 20 bytes form the first scan line, no matches to the previous scan line can occur due to the signal VALID 123 being active. The first byte is output as a raw. The second byte starts a CAM match with a displacement of one and a length of match of nine (1,9). The byte 11 is output as a raw byte since it does not match any previous bytes. The byte 12, while matching the tenth, is still output as a raw byte because two consecutive bytes must match before the global match signal GMAT 107 goes active. The byte 13 generates character matches at displacements 3 through 12 causing the corresponding string match state machines 363 to enter the first match state 385. The byte 14 continues matching at displacements 4 through 12 causing all nine string match state machines 363 to enter the string match state 387 at which point the global match signal GMAT 107 is asserted. With the bytes 15 through 22, progressively fewer string match state machines 363 continue to match. During this process the displacement indicated by the CAM increases from 4 to 12 as each new byte builds a string matching earlier in the data stream. The byte 23 ends the CAM match as we cannot have a displacement going past the beginning of the data stream. Note that while the bytes 21 and 22 match the line above and cause the scan line match signal SMAT 407 to go active, the match selection state machine 408 will continue reporting the CAM match until it terminates. The bytes 23 matches the line above (byte 3) and begins a scan line match that lasts through byte 29. The byte 30 matches nothing and hence is a raw byte. The bytes 31 and 32 match the scan line above and form a two byte scan match. The byte 33 is a raw byte. The byte 34 (00) matches both the line above and a previous byte stored within the CAM. Since the global match signal GMAT 107 will not go active until the second byte of a match while the scan match signal SMAT 407 goes active on the first, the match selection state machine 408 picks the scan line match which then runs for ten bytes. The bytes 44 through 47 match the bytes 33 through 36 forming a 4 byte CAM match (B,4). The bytes 48 through 50 do not match the line above or any of the 15 previous bytes and are therefore output as raw bytes. The bytes 51 and 52 match the line above forming a two byte scan line match (2). The byte 53 matches the byte 52 and the byte 54 matches the byte 53 forming a two byte CAM match with a displacement of two (2,2). The byte 55 does not match the line above or the last 15 bytes so it is output as a raw byte. The byte 56 matches the byte 48 and the byte 57 matches the byte 49 forming a two byte CAM match with a displacement of eight (8,2). The bytes 58 and 59 match both the bytes 48 and 49 as well as the bytes 56 and 57. The address logic module 365 always reports the match with the smallest displacement. Therefore, because the bytes 56 and 57 are closer, a CAM match of displacement two with length of two is output (2,2). The last byte matches the line above and is output as a one byte scan line match (1). The last symbol output by the postcode encoder 127 is an end of record marker which specifies that the data stream is complete. 
     As should be apparent to one skilled in the art, in order to decompress this compressed data stream, the compressed values and raw bytes are input to the decompressor, as illustrated in FIG. 5. The decompressor then reverses the above described process, outputting raw bytes and using the previous bytes of data to decompress the code pairs and scan line length of match values SLOM. When the decompression is complete, the original stream of data will be recovered. 
     As should be further apparent to those skilled in the art, the system of the present invention could include multiple previous scan line match locations, in addition to the one location included in the preferred embodiment. The sliding window compressor 103 could also be designed to include a larger or smaller CAM. 
     It will be readily apparent to one reasonably skilled in the art that other various modifications may be made to the preferred embodiment without departing from the spirit and scope of the invention as defined by the appended claims. 
     
                                           TABLE I__________________________________________________________________________Encode B2 Format Definition__________________________________________________________________________&lt;compressed.sub.-- data&gt;    ::= &lt;codeword&gt;      &lt;compressed.sub.-- data&gt;&lt;codeword&gt;&lt;codeword&gt;  :: = &lt;scan.sub.-- code&gt;    &lt;lz.sub.-- code&gt;    &lt;raw.sub.-- 00.sub.-- code&gt;    &lt;raw.sub.-- ff.sub.-- code&gt;    &lt;raw.sub.-- byte.sub.-- code&gt;    &lt;eor.sub.-- code&gt;&lt;scan.sub.-- code&gt;   ::= &lt;scan.sub.-- marker&gt; &lt;scan.sub.-- lom&gt;&lt;scan.sub.-- marker&gt;   ::= 10&lt;scan.sub.-- lom&gt;   ::=lengthcodeword__________________________________________________________________________ 1   00      010     0110    0111 5   1000    1001    10100   101100 9   101101  101110  101111  110000 13  110001  1101000 1101001 1101010 17  1l01011 1101100 1101101 1101110 21  1101111 11100000                11100001                        11100010 25  11100011        11100100                11100101                        11100110 29  11100111        111010000                111010001                        111010010 33  111010011        111010100                111010101                        111010110 37  111010111        111011000                11101100l                        111011010 41  111011011        111011100                111011101                        111011110 45  111011111        1111000000                1111000001                        1111000010 49  1111000011        1111000100                l111000l01                        1111000110 53  1111000111        1111001000                11ll001001                        1111001010 57  1111001011        1111001100                1111001101                        1111001110 61  1111001111        11110100000                11110100001                        11110100010 65  11110100011        11110100100                11110100101                        11110100110 69  11110100111        11110101000                11110101001                        11110101010 73  11110101011        11110101100                11110101l0l                        11110101110 77  11110101111        11110110000                11110110001                        11110110010 81  11110110011        11110110100                11110110101                        11110110110 85  11110110111        11110111000                11110111001                        11110111010 93  11110111111        111110000000                111110000001                        111110000010 97  111110000011        111110000100                111110000101                        111110000110101  111110000111        111110001000                111110001001                        111110001010105  111110001011        111110001100                111110001101                        111110001110109  111110001111        111110010000                111110010001                        111110010010113  111110010011        111110010100                111110010101                        111110010110117  111110010111        111110011000                111110011001                        111110011010121  111110011011        111110011100                111110011101                        111110011110125  111110011111        111110100000                111110100001                        111110100010129  010111011111        100111011111                000111011111                        111011011111133  011011011111        101011011111                001011011111                        110011011111137  010011011111        100011011111                000011011111                        111101011111141  011101011111        101101011111                001101011111                        110101011111145  010101011111        100101011111                000101011111                        111001011111149  011001011111        101001011111                001001011111                        110001011111153  111110111011        111110111100                111110111101                        111110111110157  111110111111        111111000000                111111000001                        111111000010161  111111000011        111111000100                111111000101                        111111000110165  111111000111        111111001000                111111001001                        111111001010169  111111001011        111111001100                111111001101                        111111001110173  111111001111        111111010000                111111010001                        111111010010177  111111010011        111111010100                111111010101                        111111010110181  1111110101110        1111110101111                1111110110000                        1111110110001185  1111110110010        1111110110011                1111110110100                        1111110110101189  1111110110110        1111110110111                1111110111000                        1111110111001193  1111110111010        1111110111011                1111110111100                        1111110111101197  1111110111110        1111110111111                1111111000000                        1111111000001201  1111111000010        1111111000011                1111111000100                        1111111000101205  1111111000110        1111111000111                1111111001000                        1111111001001209  1111111001010        1111111001011                1111111001100                        1111111001101213  1111111001110        1111111001111                1111111010000                        1111111010001217  1111111010010        1111111010011                1111111010100                        1111111010101221  1111111010110        1111111010111                1111111011000                        1111111011001225  1111111011010        1111111011011                1111111011100                        1111111011101229  1111111011110        1111111011111                1111111100000                        1111111100001233  1111111100010        1111111100011                1111111100100                        1111111100101237  1111111100110        1111111100111                1111111101000                        1111111101001241  1111111101010        1111111101011                1111111101100                        1111111101101245  1111111101110        1111111101111                1111111110000                        1111111110001249  1111111110010        1111111110011                1111111110100                        1111111110101253  1111111110110        1111111110111                1111111111000                        10101__________________________________________________________________________&lt;lz.sub.-- code&gt;  ::= &lt;lz.sub.-- marker &gt; &lt;lz.sub.-- disp&gt; &lt;lz.sub.-- lom&gt;&lt;lz.sub.-- marker&gt;  ::= 11&lt;lz.sub.-- disp&gt;  ::=value   codeword__________________________________________________________________________ 1 00 2 010 3 011 4 100 5 101 6 110 7 11100 8 111010 9 11101110 11110011 11110112 111110013 111110114 111111015 1111111__________________________________________________________________________&lt;lz.sub.-- lom&gt;::=lengthcodeword__________________________________________________________________________ 1           00      010     0110 5   0111    1000    1001    10100 9   101100  101101  101110  101111 13  110000  110001  1101000 1101001 17  1101010 1101011 1101100 1101101 21  1101110 1101111 11100000                        11100001 25  11100010        11100011                11100100                        11100101 29  11100110        11100111                111010000                        111010001 33  111010010        111010011                111010100                        111010101 37  111010110        111010111                111011000                        111011001 41  111011010        111011011                111011100                        111011101 45  111011110        111011111                1111000000                        1111000001 49  1111000010        1111000011                1111000100                        1111000101 53  1111000110        1111000111                1111001000                        1111001001 57  1111001010        1111001011                1111001100                        1111001101 61  1111001110        1111001111                11110100000                        11110100001 65  11110100010        11110100011                11110100100                        11110100101 69  11110100110        11110100111                11110101000                        11110101001 73  11110101010        11110101011                11110101100                        11110101101 77  11110101110        11110101111                11110110000                        11110110001 81  11110110010        11110110011                11110110100                        11110110101 85  11110110110        11110110111                11110111000                        11110111001 89  11110111010        11110111011                11110111100                        11110111101 93  11110111110        11110111111                111110000000                        111110000001 97  111110000010        111110000011                111110000100                        111110000101101  111110000110        111110000111                111110001000                        111110001001105  111110001010        111110001011                111110001100                        111110001101109  111110001110        111110001111                111110010000                        111110010001113  111110010010        111110010011                111110010100                        111110010101117  111110010110        111110010111                111110011000                        111110011001121  111110011010        111110011011                111110011100                        111110011101125  111110011110        111110011111                111110100000                        111110100001129  111110100010        111110100011                111110100100                        111110100101133  111110100110        111110100111                111110101000                        111110101001137  111110101010        111110101011                111110101100                        111110101101141  111110101110        111110101111                111110110000                        111110110001145  111110110010        111110110011                111110110100                        111110110101149  111110110110        111110110111                111110111000                        111110111001153  111110111010        111110111011                111110111100                        111110111101157  111110111110        111110111111                111111000000                        111111000001161  111111000010        111111000011                111111000100                        111111000101165  111111000110        111111000111                111111001000                        111111001001169  111111001010        111111001011                111111001100                        111111001101173  111111001110        111111001111                111111010000                        111111010001177  111111010010        111111010011                111111010100                        111111010101181  111111010110        1111110101110                1111110101111                        1111110110000185  1111110110001        1111110110010                1111110110011                        1111110110100189  1111110110101        1111110110110                1111110110111                        1111110111000193  1111110111001        1111110111010                1111110111011                        1111110111100197  1111110111101        1111110111110                1111110111111                        1111111000000201  1111111000001        1111111000010                1111111000011                        1111111000100205  1111111000101        1111111000110                1111111000111                        1111111001000209  1111111001001        1111111001010                1111111001011                        1111111001100213  1111111001101        1111111001110                1111111001111                        1111111010000217  1111111010001        1111111010010                1111111010011                        1111111010100221  1111111010101        1111111010110                1111111010111                        1111111011000225  1111111011001        1111111011010                1111111011011                        1111111011100229  1111111011101        1111111011110                1111111011111                        1111111100000233  1111111100001        1111111100010                1111111100011                        1111111100100237  1111111100101        1111111100110                1111111100111                        1111111101000241  1111111101001        1111111101010                1111111101011                        1111111101100245  1111111101101        1111111101110                1111111101111                        1111111110000249  1111111110001        1111111110010                1111111110011                        1111111110100253  1111111110101        1111111110110                1111111110111                        10101__________________________________________________________________________&lt;raw.sub.-- 00.sub.-- code&gt;    ::= &lt;scan.sub.-- marker&gt; &lt;raw.sub.-- 00.sub.-- marker&gt;&lt;raw.sub.-- 00.sub.-- marker&gt;    ::= 110010&lt;raw.sub.-- ff.sub.-- code&gt;    ::= &lt;scan.sub.-- marker&gt; &lt;raw.sub.-- ff.sub.-- marker&gt;&lt;raw.sub.-- ff.sub.-- marker&gt;    ::= 110011&lt;raw.sub.-- byte.sub.-- code&gt;    ::= &lt;raw.sub.-- marker&gt; &lt;raw.sub.-- byte&gt;&lt;raw.sub.-- marker&gt;    ::= 0&lt;raw.sub.-- byte&gt;    :: = 00000000 | 00000001 | 00000010 ....    | 11111110 | 11111111&lt;eor.sub.-- code&gt;    ::= &lt;scan.sub.-- marker&gt; &lt;eor.sub.-- marker&gt; &lt;eor.sub.-- pad&gt;&lt;eor.sub.-- marker&gt;    ::= 1111111111001&lt;eor.sub.-- pad&gt;    ::=      | &lt;bit&gt;      | &lt;bit&gt; &lt;eor.sub.-- pad&gt;&lt;bit&gt;    ::= 0      | 1__________________________________________________________________________