Abstract:
A print data method includes a slicing step, a compressing step and decompressing step. The slicing step divides a swatch of data to be printed and required by each motor movement into a plurality of slices, each having m bits to represent printed pixels and further divided into n segments, where m, n are integers. The compressing step uses an inter-slice compression to represent an (i+1)-th slice of data on a basis of an i-th slice of data for generating a compressed (i+1)-th slice of data and an (i+1)-th control character. The decompressing step uses an inter-slice decompression with respect to the inter-slice compression to restore the (i+1)-th slice of data from the compressed (i+1)-th slice of data for further printing.

Description:
BACKGROUND OF THE INVENTION  
       [0001]     1. Field of the Invention  
         [0002]     The invention relates to a data compression method and, more particularly, to a print data compressing method suitable for a printer.  
         [0003]     2. Description of Related Art  
         [0004]     Typical In-Line technologies firstly process print data through a host and then the host sends the processed data to a printer for printing, which only performs motor movement and ink spraying operations at this point. However, the amount of print data increases more and more as increasing print resolution. For example, for a 600 dpi (dot per inch) resolution, required data amount for printing on an A4 paper is 600 (dpi)×8 (inch)×600 (dpi)×1 (inch)/8=3.96 Mbytes. Accordingly, print data must be compressed and subsequently sent to the printer, thereby reducing data transmission amount between the host and the printer. A conventional method applies PCL algorithm to an image file to be printed for first compression and then transmission to a printer to interpret and final print. However, such a method requires more complicated hardware to interpret the PLC data.  
         [0005]     To overcome this, U.S. Pat. No. 5,930,466 uses the features of an image file to be printed to compress the transmitting image file. This is achieved by defining a compressed unit as required print data by all nozzles on a printhead. For example, there are 192 nozzles on the printhead and accordingly required print data is 192 bits, which form a slice, or 192/8=24 segments.  
         [0006]     Each slice can be compressed by two ways. First way is shown in  FIG. 1 , which uses a feature of no ink ejection on blank regions in a picture frame to thus achieve data compression purpose. In this case, a segment of data with “0” is deleted and represented by a 1-bit status flag. Namely, when the 1-bit status flag is “1”, it indicates a corresponding segment of data with “0”; conversely, when the 1-bit flag is “0”, it indicates that a corresponding segment of data is not compressed. In  FIG. 1 , after an uncompressed data such as {10111111, 00000000, 00000000, 11100111, . . . } is compressed, corresponding second and third bits of the status flag are “1” respectively to indicate the second and the third segments of data with “0”, thereby reducing data amount. An optimal situation is that a  24 -byte data can be recorded by only 24 bits for a slice of data with 0. However, such a way can obtain effective compression only for a segment of data with “00000000”.  
         [0007]     Second way is shown in  FIG. 2 , wherein when a segment of data is not recorded when it has the same data as a previous segment of data. Namely, if the status flag is “1”, it indicates that the corresponding segment has the same data as a previous segment and, conversely, it indicates that the corresponding segment of data is not compressed. In  FIG. 2 , for an uncompressed data such as {10101010, 10101010, 10101010, 11100111, . . . }, the first to third segments have the same data so that after compressed, corresponding second and third bits of the status flag are “1” to indicate the second and the third segments having the same data as the first segment. Thus, the data transmission amount is decreased. Likely, an optimal situation is that all segments of a slice have the same data so that a 24-byte data can be recorded by only 4 bytes (24 bits+1 byte). However, such a way can obtain effective compression only for a slice with a single data pattern. For a slice with two or more data patterns, only one of the data patterns can be compressed and the other cannot. Therefore, such a way cannot have satisfactory compression efficiency even through it can overcome the cited complicated hardware.  
         [0008]     Therefore, it is desirable to provide an improved method to mitigate and/or obviate the aforementioned problems.  
       SUMMARY OF THE INVENTION  
       [0009]     The object of the invention is to provide a print data compressing method, which can have satisfactory compression efficiency.  
         [0010]     In accordance with one aspect of the present invention, there is provided a print data compressing method. The method includes a slicing step, a compressing step and decompressing step. The slicing step divides a swatch of data to be printed and required by each motor movement into plural slices of data, each slice having m bits to represent printed pixels and being divided into n segments of data, where m, n are integers. The compressing step uses an inter-slice compression to represent a (x+1)-th slice of data on a basis of a x-th slice of data for generating a compressed (x+1)-th slice of data and a (x+1)-th control character. The decompressing step uses an inter-slice decompression with respect to the inter-slice compression to restore the (x+1)-th slice of data from the compressed (x+1)-th slice of data for further printing.  
         [0011]     In accordance with another aspect of the invention, there is provided a print data compressing method. An j-th segment of a slice is represented by one of pre-stored k segments of data patterns. The method includes a slicing step, a compressing step and decompressing step. The slicing step divides a swatch of data to be printed and required by each motor movement into plural slices of data, each slice having m bits to represent printed pixels and being divided into n segments, where m, n are integers. The compressing step uses an intra-slice compression to represent data of an j-th segment of a x-th slice by an k-th segment of data pattern for generating a compressed x-th slice of data and a x-th control character. The decompressing step uses an intra-slice decompression with respect to the intra-slice compression to restore the x-th slice of data from the compressed x-th slice of data for further printing.  
         [0012]     Other objects, advantages, and novel features of the invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings. 
     
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0013]      FIG. 1  is a schematic drawing of a conventional print data compressing method;  
         [0014]      FIG. 2  is a schematic drawing of another conventional print data compressing method;  
         [0015]      FIG. 3  is a schematic view of a typical A4 size of print data;  
         [0016]      FIG. 4  is a schematic view of an embodiment of a print data compressing method in accordance with the invention;  
         [0017]      FIG. 5  is a schematic view of another embodiment of a print data compressing method in accordance with the invention;  
         [0018]      FIG. 6  is a flowchart of a further embodiment of a print data compressing method in accordance with the invention; and  
         [0019]      FIG. 7  is a flowchart of a print data decompressing method in accordance with the invention. 
     
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT  
       [0020]     With reference to  FIG. 3 , there is shown a schematic view of printing a given A4 size of print data for description. The A4 size of print data can be divided into a plurality of swatches  310 , each swatch  310  having a plurality of slices  320 , each slice  320  further having m bits to represent printed pixels, wherein m indicates a number of nozzles of printhead  330 . Each slice is further divided into n segments, each segment having 8M bits, wherein n and M are positive integers.  
         [0021]      FIG. 4  is a schematic view of an embodiment of a print data compressing method in accordance with the invention. As shown, if j-th segment of (x+1)-th slice has the same data as j-th segment of x-th slice, the j-th segment of print data in the (x+1)-th slice is not recorded and j-th bit of a status flag is set as “1” to represent having the same data in both j-th segments of the x-th and (x+1)-th slices. If j-th bit of a status flag is “0”, it indicates data of the j-th segment of (x+1)-th slice different from that of x-th slice.  
         [0022]     For convenience, this embodiment is given by a printer with a printhead having 192 nozzles. In this case, one slice  320  has 192 bits to represent printed pixels, or 24 (192/8) segments in a unit of byte. In  FIG. 4 , if a source data in a x-th slice to be printed is as {00000001, 00000011, 00000111, 00001111, . . .}, a (x+1)-th slice of data as {10000001, 00000011, 00000111, 00001111, . . . }, when compressing the x-th and the (x+1)-th slices, it is obvious that same contents appear on second, third and fourth segments of the x-th and the (x+1)-th slices. Thus, second, third and fourth bits of a flag are set to “1” to represent the same contents and also the second, the third and the fourth segments are omitted and not added to a content of compressed data for the (x+1)-th slice. In addition, since first and fifth segments of the x-th and the (x+1)-th slices have different contents, first and fifth bits of the flag are set to “0”, and the first and the fifth segments of the (x+1)-th slice are recorded after the flag.  
         [0023]     The compressed data is then sent from a host to a printer. Thus, the printer can obtain the (x+1)-th slice of data after decompression in accordance with the x-th slice of data and the flag and the compressed data for the (x+1)-th slice. In this case, the first bit of the flag is “0”, which indicates that the first segment is not omitted but follows the flag. The second, the third and the fourth bits of the flag are “1”, which indicates that the second, the third and the fourth segments are omitted due to the same contents as those of the x-th slice, thus the aforementioned segments are copied from the x-th slice to the (x+1)-th slice in place. The fifth bit of the flag is “0”, which indicates that the fifth segment is not omitted but follows the first segment or located at the second segment after the flag.  
         [0024]     Such a compression, which keeps the different contents and omits the same contents in the (x+1)-th slice on a basis of the x-th slice, can have relative effects on lines or shape-fixed patterns.  
         [0025]      FIG. 5  is a schematic view of another embodiment of a print data compressing method in accordance with the invention, which is an intra-slice compression. If a k-th segment of a slice has a same content as an i-th segment of the slice, the intra-slice compression is achieved by omitting the k-th segment of data, setting k-th bit of a repeat flag to “1” to indicate that the k-th segment is omitted, and setting k-th bit of a repeat selection flag to “1” to indicate that the k-th and the i-th segments have the same content. If the k-th segment is identical to an j-th segment of the slice, the intra-slice compression is achieved by omitting the k-th segment, setting k-th bit of the repeat flag to “1” to indicate that the k-th segment is omitted, and setting k-th bit of the repeat selection flag to “0” to indicate that the k-th and the j-th segments have the same content.  
         [0026]     In  FIG. 5 , a source data to be printed has a x -th slice of data as {01010101, 00000011, 00000011, 01010101, 01010101, 10001000, . . . }. If the first and the second segments of data in the x-th slice are regarded as data patterns  0  and  1 , when compressing the x-th slice, first and second bits of the repeat flag are set to “1”, and first and second bits of the repeat selection flag are set to “0” and “1” to indicate using the data patterns  0  and  1  respectively. Since the data patterns  0  and  1  are not defined, the first and the second segments are added after the repeat selection flag for provision of the data patterns  0  and  1 . When the i-th bit of the repeat flag is “1”, it indicates that an i-th segment of a slice in a compressed data is omitted. When the i-th bit of the repeat flag is “0”, it indicates that the i-th segment of the slice in the compressed data is saved completely. When the i-th bit of the repeat selection flag is “1”, it indicates that the i-th segment of the slice has a content the same as the data pattern  1 . When the i-th bit of the repeat selection flag is “0”, it indicates that the content of the i-th segment of the slice is same as the data pattern  0 . For decompressing, when the i-th bit of the repeat flag is “0”, it indicates that the i-th segment of the slice in the compressed data is saved completely, thus the i-th bit of the repeat selection flag is not referred.  
         [0027]     The aforementioned method is based on that the first and the second segments are regarded as data patterns  0  and  1  respectively. Alternately, based on the statistics, the highest two probabilities of segments appearing on the i-th slice can be regarded as the data patterns  0  and  1 .  
         [0028]     Referring again to  FIG. 5 , since the third segment is identical to the data pattern  1 , the third bit of the repeat flag is set to “1”, the third bit of the repeat selection flag is set to “1”, and the third segment is omitted. Since the fourth and the fifth segments are identical to the data pattern  0 , the fourth and the fifth bits of the repeat flag are set to “1” respectively, the fourth and the fifth bits of the repeat selection flag are set to “0” respectively, and the fourth and the fifth segments are omitted. Since the sixth segment has a content different from the data patterns  0  and  1 , the sixth bit of the repeat flag is set to “0”, the sixth bit of the repeat selection flag is set to “0”, the sixth segment is added after the data pattern  1 . Thus, a compressed data is formed.  
         [0029]     The compressed data is sent from a host to a printer. Thus, the printer can obtain the x-th slice of data after decompression based on the repeat flag, the repeat selection flag, the data pattern  0 , the data pattern  1  and the non-omitted data. In this case, the first bit of the repeat flag is “1”, which indicates that the first segment is omitted, and the first bit of the repeat selection flag is “0”, which indicates that the first segment can be restored by copying the data pattern  0 . The second bit of the repeat flag is “1”, which indicates that the second segment is omitted, and the second bit of the repeat selection flag is “1”, which indicates that the second segment can be restored by copying the data pattern  1 . Accordingly, the third segment can be restored by copying the data pattern  1  respectively, and the fourth and the fifth segments can be restored by copying the data pattern  0  respectively. The sixth bit of the repeat flag is “0”, which indicates that the sixth segment is not omitted and can be restored by extracting from the compressed data.  
         [0030]     Such a compression uses both a repeat flag to record if a segment of data uses a data pattern and a repeat selection flag to record which data pattern is used by the segment of data. In addition, both pattern data and source data are applied respectively to record repeatable data patterns and non-repeated data in a source slice.  
         [0031]      FIG. 6  is a flowchart of a further embodiment of a print data compressing method in accordance with the invention. As shown, this embodiment combines the two compressions methods described above. First, step S 605  executes a compressing initialization to determine a slice number of a swatch and a nozzles number of an inkjet printer. Step S 610  determines if Y-th slice of the swatch is the first slice; if yes, step S 620  is executed; and if not, step S 615  is executed.  
         [0032]     Step S 615  checks repeat numbers of segments and accordingly determines a compressing method for the Y-th slice; if the number of repeated segments is over a predetermined value, step S 620  is executed; otherwise, step S 655  is executed. In this case, the predetermined value is set to  3 .  
         [0033]     Step S 620  sets a flag of the Y-th slice to 1, which indicates that a predetermined second compression is applied to the Y-th slice, and two segments having the highest two repeat numbers in the Y-th slice are selected as data pattern  0  and data pattern  1  respectively. Step S 625  determines if I-th segment of the Y-t Y-th h slice has different content from the data patterns  0  and  1 ; if yes, step S 645  is executed; and if not, step S 630  is executed. Step S 645  sets a respective repeat flag to 0 and a respective repeat selection flag to 0 for the I-th segment, which indicates that the I-th segment is not compressed but is completely added to a respective compressed data.  
         [0034]     Step S 630  determines if the I-th segment has content the same as the data pattern  0 ; if yes, step S 635  is executed; and if not, step S 640  is executed. Step S 635  sets the respective repeat flag to 1 and the respective repeat selection flag to 0 for the I-th segment, which indicates that the I-th segment is omitted due to its content identical to the data pattern  0 . Step S 640  sets the respective repeat flag to 1 and the respective repeat selection flag to 1 for the I-th segment, which indicates that the I-th segment is omitted due to its content identical to the data pattern  1 . Step S 650  determines if all segments of the Y-th slice are processed completely; if not, step S 625  is executed; and if yes, step S 675  is executed.  
         [0035]     Alternately, step S 655  sets the flag of the Y-th slice to 0, which indicates that a predetermined first compression is applied to the Y-th slice, and determines if I-th segments of the Y-th and the (Y−1)-th slices has identical contents; if yes, step S 665  is executed; and if not, step S 660  is executed. Step S 665  sets the respective repeat flag to 1, which indicates that the I-th segment of the Y-th slice has a content the same as the I-th segment of the (Y−1)-th slice, thus the I-th segment of the Y-th slice is omitted. Step S 660  sets the respective repeat flag to 0, which indicates that the I-th segment of the Y-th slice has a content different from the I-th segment of the (Y−1)-th slice, thus the I-th segment of the Y-th slice is not compressed but is completely added in a compressed data for the Y-th slice. Step S 670  determines if all segments of the Y-th slice are processed completely; if not, step S 655  is executed; and if yes, step S 675  is executed.  
         [0036]     Step S 675  stores the Y-th slice for next slice to use and outputs the compressed data for the Y-th slice. Step S 680  determines if entire swatch is compressed complete to thus obtain a compressed swatch of data; if yes, step S 685  is executed; and if not, step S 610  is executed. Step S 685  outputs the compressed swatch of data for the entire swatch.  
         [0037]      FIG. 7  is a flowchart of a print data decompressing method in accordance with the invention. Step S 705  executes a decompressing initialization to find both a slice number of a swatch and a nozzle number of an inkjet printer in accordance with a head of each compressed swatch of data. Step S 710  finds a compressing method used in a Y-th slice of the swatch by checking its flag; if the flag is set to 1, it indicates that a predetermined second compression is used in the Y-th slice and step S 715  is executed; and if the flag is set to 0, it indicates that a predetermined first compression is used in the Y-th slice and step S 745  is executed.  
         [0038]     Step S 715  determines if a repeat flag corresponding to an I-th segment of the Y-th slice is 1; if yes, step S 725  is executed; and if not, step S 720  is executed. Step S 720  extracts the I-th segment of data completely from the compressed swatch of data because the I-th segment of data is not compressed in this case. Step S 725  determines if a repeat selection flag corresponding to the I-th segment of the Y-th slice is 1; if not, step S 730  is executed; and if yes, step S 735  is executed. Step S 730  copies the data pattern  0  as the I-th segment of data because the repeat selection flag as  0  indicates that the I-th segment is identical to the data pattern  0 . Step S 735  copies the data pattern  1  as the I-th segment of data because the repeat selection flag as  1  indicates that the I-th segment is identical to the data pattern  1 . Step S 740  determines if all segments of the Y-th slice are processed completely; if not, S 715  is executed; and if yes, S 765  is executed.  
         [0039]     Step S 745  determines if the repeat flag corresponding to the I-th segment of the Y-th slice is  1 ; if yes, step S 755  is executed; and if not, step S 750  is executed. Step S 750  extracts the I-th segment of data completely from the compressed swatch of data because the repeat flag as  0  indicates that the I-th segment of the Y-th slice is different from that of the (Y−1)-th slice and thus not compressed. Step S 755  extracts the I-th segment of the (Y−1)-th slice as the I-th segment of the Y-th slice from the compressed swatch of data because the repeat flag as  1  indicates that the I-th segment is identical in the two slices. Step S 760  determines if all segments of the Y-th slice are processed completely; if not, S 745  is executed; and if yes, S 765  is executed.  
         [0040]     Step S 765  saves the Y-th slice for next slice to use and outputs a decompressed data for the Y-th slice. Step S 770  determines if entire swatch is decompressed completely; if yes, step S 775  is executed; and if not, step S 710  is executed. Step S 775  outputs a decompressed swatch of data for the entire swatch.  
         [0041]     In view of the foregoing, it is known that the invention only records differences between a (x+1)-th slice and a x-th slice on a basis of the x-th slice, thereby achieving inter-slice data compression, or applies a repeat flag and a repeat selection flag for recording if a segment of data uses a data pattern, thereby achieving intra-slice data compression. Therefore, the invention can overcome the prior problems that only a segment of data as “00000000” can be compressed and a slice can apply only a single data pattern to compression in a successive arrangement.  
         [0042]     Although the present invention has been explained in relation to its preferred embodiment, it is to be understood that many other possible modifications and variations can be made without departing from the spirit and scope of the invention as hereinafter claimed.