Irreversible compression system and method for bit map images

Abstract: An irreversible compression system and method, wherein cells (C) of bit map data are fetched from first and second adjacent blocks (B) of bit map data, each of the fetched cells having a predetermined cell size, and each of the fetched cells is converted to compressed code. When the size of the first block of bit map data is indivisible by the predetermined cell size, a first incomplete cell having a first reduced size is fetched from the first block and a second incomplete cell is fetched from the second block, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size.

Description: The present invention generally relates to an irreversible compression system and method for a bit map image, and more particularly, but not exclusively, to an irreversible compression system and method for obtaining uniform picture quality. In the field of bit map image data processing using printers or the like, there is a known method employing irreversible compression for storing data of an entire image in a memory by reducing the size of bit map data when the quantity of the bit map data of the entire image exceeds the capacity of the memory. In general, the method involves dividing a bit map into small cells, each having a fixed size, for example, 4 x 4 pixels, and converting the dot pattern of each cell into compressed data. When a host computer transmits one page of bit map data to a printer, the data for the entire page are not necessarily transmitted together. In particular, when a one page image comprises a large volume of data, such as a graphics image, the data is divided into blocks according to the quantity of data that the host computer can process at one time, and the image data are transmitted block by block to the printer. In such a case, the host computer determines the method of dividing the data into blocks, making it possible for the printer to control the division. Where bit map image data are sent in blocks to the printer, if it becomes necessary for the printer to perform irreversible compression of the transmitted bit map image data, cells will be separated one after the other from the end of the received block, and the thus separated cells will then be converted into a compressed code in the conventional printer. However, each block may have a slightly different tone in a printed image if the irreversibly compressed data are restored to the original bit map in accordance with the conventional irreversible compression method. Since the block usually has a long narrow band shape, a band-shaped uneven tone eventually appears in the printed image when each block has a different tone. For example, assume that the original bit map image is similar to that shown in Fig. 1A. A ruled line in each direction shows a boundary between pixels. A black pixel is represented by a printed dot, while a white pixel is represented by a nonprinted dot. Assume that an external device transmitted this image to a printer after having divided the image into two blocks as shown in Fig. 1B. As shown in Fig. 1B, the printer has divided each of the first and second blocks into cells as indicated by a bold solid line, each cell consisting of 4 x 4 pixels, beginning from the upper left corner of each block. In this example, the number of pixels in the vertical direction of each block is indivisible by four, and hence cells having incomplete sizes, i.e., less than 4 x 4 pixels, will arise in the bottom row of each block. The printer then converts each cell into a compressed code (sixteen stages in this example), as shown in Fig. 1C. The compressed codes are next restored to dot patterns, whereby the bit map image is printed. Fig. 2A shows a print obtained as a result of restoring the compressed codes of Fig. 1C, and Fig. 2B shows a print obtained as a result of directly printing the original image shown in Fig. 1A. As can be seen from a comparison of Figs. 2A and 2B, the image of Fig. 2A, i.e., the image obtained as a result of restoring the compressed codes of Fig. 1C, is slightly deformed with respect to the direct printing of the original image as shown in Fig. 2B. This is a result of the irreversible compression. It should be noted that each of the first and second blocks of Fig. 2A has differently deformed dot patterns. In other words, the original image shown in Fig. 2B has the repetition of the same dot patterns in the vertical direction of the image, namely, a continuous even tone in the vertical direction. On the other hand, such a vertical continuity disappears along the border between the first and second blocks in the expanded image shown in Fig. 2A, thereby resulting in different tones. As a result of this, the previously mentioned band-shaped uneven tones appear in the image of Fig. 2A. One of the reasons for this is the presence of the incomplete cells. Specifically, when the positional relationship (phase) between the dot patterns and the cells of the original image is reviewed, there is a phase difference between the first and second blocks. This is attributed to the fact that the starting position of cells in the second block is shifted with respect of the original dot patterns by the number of incomplete cells produced in the bottom row of the first block (two pixels in this example). As a result of this phase difference, the deformation of the original dot patterns resulting from the compression and expansion differs from block to block, so that each block has a different tone. JP 05-130585A relates to an encoding device which makes deterioration at a border of image data inconspicuous. An object of the present invention is to make it possible to obtain even picture quality throughout the entire image by preventing each block from having different picture quality in an expanded image when blocked bit map image data are subjected to irreversible compression block by block and the thus compressed data are again expanded. Another object of the present invention is to provide a printer for carrying out irreversible compression of blocked image data block by block upon receipt of the blocked image data, which provides even picture quality throughout the entire image by preventing a difference in picture quality in each block of a printed image when the compressed data are expanded to print. According to one aspect of the present invention, there is provided an irreversible compression system comprising: fetching means for fetching cells of bit map data from first and second adjacent blocks of bit map data, each of the fetched cells having a predetermined cell size; and converting means for converting each of the fetched cells to compressed code, characterised in that: when the size of the first block of bit map data is indivisible by the predetermined cell size, the fetching means fetches from the first block a first incomplete cell having a first reduced size and fetches from the second block a second incomplete cell, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. According to a further aspect of the present invention, there is provided an irreversible compression method comprising the steps of: fetching cells of bit map data from first and second adjacent blocks of bit map data, each of the fetched cells having a predetermined cell size; and converting each of the fetched cells to compressed code, characterised in that: when the size of the first block of bit map data is indivisible by the predetermined cell size, a first incomplete cell having a first reduced size is fetched from the first block, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. According to another aspect of the present invention, there is provided a data compression device, comprising: means for receiving bit map data divided into blocks; means for dividing each block into cells having a predetermined cell size; and means for providing a compressed representation of the data in each cell, characterised in that: when the size of a first block of bit map data is indivisible by the predetermined cell size, the means for dividing is adapted to divide from the first block a first incomplete cell having a first reduced size and to divide from a second block a second incomplete cell, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. In one aspect of the system according to the invention, the fetching means includes means for calculating horizontal and vertical offsets when the size of the first block of bit map data is indivisible by the predetermined cell size, and means for calculating the second reduced size in accordance with the horizontal and vertical offsets. In another aspect of the system according to the invention, the means for calculating the second reduced size includes means for calculating a leading address of the second reduced cell by subtracting the vertical and horizontal offsets from an address of a leading end pixel of the second block. Also according to the present invention an irreversible compression method is provided, comprising the steps of fetching cells of bit map data from first and second adjacent blocks of bit map data, each of the fetched cells having a predetermined cell size, and converting each of the fetched cells to compressed code, wherein when the size of the first block of bit map data is indivisible by the predetermined cell size, a first incomplete cell having a first reduced size is fetched from the first block and a second incomplete cell is fetched from the second block, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. In one aspect of the method according to the invention, the fetching step includes the steps of calculating horizontal and vertical offsets when the size of the first block of bit map data is indivisible by the predetermined cell size, and calculating the second reduced size in accordance with the horizontal and vertical offsets. In another aspect of the method according to the invention, the step of calculating the second reduced size includes the step of calculating a leading address of the second reduced cell by subtracting the vertical and horizontal offsets from an address of a leading end pixel of the second block. In the irreversible compression system and method of an embodiment of the present invention, cells associated with a cell arrangement positioned only in one way with respect to the entire image are fetched from each block of the image, and the cells are respectively subjected to irreversible compression. In the conventional system, as previously described, since cells are fetched one after the other from the end of each block, each block has a different cell array. Therefore, the cells are not positioned only in one way with respect to the entire image. As a result of this, each block has a different phase between the original dot patterns and the cells, and therefore each block has a different tone. Because in an embodiment of the present invention the cells are positioned only in one way with respect to the entire image, the phase between the original dot patterns and the cells becomes the same. Hence, the original identical tone is reproduced as the same tone. In one embodiment, upon receipt of one block of blocked image data from a host computer, a printer divides coordinates X and Y of the leading end pixel of that block on print paper by the number of pixels in one side of a cell, i.e., four, the cell serving as a unit of irreversible compression. The resultant remainders RX and RY are taken as horizontal and vertical offsets of that block B. An address, obtained by subtracting the offsets RX and RY from an address ADD of the leading end pixel of that block, is set to become the leading address of the first cell, and then cells are fetched from the block. A dot pattern of each cell is converted into a compressed code. In other words, each block is divided into cells relative to the position of the block on print paper, and each cell is subjected to irreversible compression. Additional objects and advantages of the invention will be set forth in part in the description which follows and in part will be obvious from the description, or may be learned by practice of the invention. The objects and advantages of the invention may be realized and attained by means of the instrumentalities and combinations particularly pointed out in the appended claims. For a better understanding of the invention, embodiments will now be described by way of example with reference to the accompanying drawings, in which: Figs. 1A-1C are explanatory diagrams of a compression of a blocked image in a conventional printer; Figs. 2A and 2B are explanatory diagrams of a print image obtained after being compressed and expanded by the conventional printer and the original image, respectively; Fig. 3 is a block diagram of a configuration of a page printer to which a compression method according to one embodiment of the present invention is applied; Fig. 4 is a flow chart of the steps executed when a host computer transmits a bit image to a printer according to the embodiment of Fig. 3; Fig. 5 is a flow chart of the steps executed when the printer processes the data from the host computer according to the embodiment of Fig. 3; Figs. 6A-6B are explanatory diagrams showing the generation of parameters in step S18 of Fig. 5; Fig. 7 is a flow chart of the steps of the irreversible compression executed in step S22 of Fig. 5; Fig. 8 is an explanatory diagram of an example of the cell fetching executed in step S32 of Fig. 7; Fig. 9 is a flow chart of the output processing flow executed in step S20 of Fig. 5; Fig. 10 is an explanatory diagram of examples of expansion dot patterns; Figs. 11A-11B are explanatory diagrams of an irreversible compression carried out according to the embodiment of Fig. 3; and Fig. 12A-12B are explanatory diagrams of a printed image and an original image, respectively, according to the embodiment of Fig. 3. Fig. 3 shows one embodiment of a page printer 1 employing an irreversible compression system and method according to the present invention. As shown in Fig. 3, the printer 1 comprises an interface 5 for receiving image data from a host computer 3; a CPU 7 for processing the received image data; a ROM 9 for storing an operation program 91 of the CPU 7, dot patterns 93 for use in expanding compressed data (which will be described later), and font data 95, such as characters and symbols; a RAM 11 having an image storage area 111 for storing bit map image data (hereinafter referred to as a bit image) for one page, an image management area 113 for storing parameters (which will be described later) for the management of images, and a work area 115; a print engine 15 having a mechanism for carrying out a printing process; and an image output circuit 13 for outputting a bit image to the print engine 15. The steps executed by the host computer 3 when it produces and transmits a bit image to the printer 1 will now be described with reference to Fig. 4. First, a printer driver included within the host computer 3 determines the size of an image block to be processed at one time based on the capacity of the host computer's RAM (S1). Next, a bit image of the image block is produced by the host computer 3 and stored in an image expansion memory located within the host computer 3 (S2). Then, the bit image of the image block, the position of the image block on print paper, and the size of the image block are transferred to the printer 1 by the host computer 3 (S3). Finally, the foregoing steps are repeated for all data to be processed (S4). The steps executed by the printer 1 when it processes the data received from the host computer 3 will now be described with reference to Fig. 5. Upon receipt of data from the host computer 3 (S11), the printer 1 analyzes a command included in the data (S12), and determines whether or not the command is a page break command (S13). If the command is not a page break command, the printer 1 determines whether or not the received data are bit image data (S14). If the received data are not bit image data, the printer 1 processes commands other than the bit image, prepares intermediate codes relating to characters and symbols, or executes other processes (S15), and continues to receive additional data from the host computer 3. When bit image data are received, however, the printer 1 determines whether or not both the image management area 113 and the image storage area 111 of the RAM 11 have sufficient capacity to handle the processing of the data, i.e., whether or not the image management area 113 and the image storage area 111 can be "ensured" (S16 and S17). If these areas are ensured, parameters (which will be described later) are generated based on the data received from the host computer 3 and are stored in the image management area 113 (S18). In addition, the received bit image data are stored in the image storage area 111 (S19). The foregoing steps are repeated until the transfer of all data from the host computer 3 to the printer 1 is finished, and the processing will proceed to an output processing step when a page break command is received (S20) at which point processing of a subsequent page will be further continued. In the above process, if at least one of the image management area 113 and the image storage area 111 is determined to not have sufficient capacity, i.e., cannot be ensured, because, for example, a large quantity of data is received from the host computer (S16, S17), the bit image data stored in the image storage area 111 will be subjected to irreversible compression (S22). As a result of this irreversible compression, the volume of data of the previously produced image is compressed, whereby a free area of memory is obtained. This allows subsequent data to be received. Figs. 6A and 6B show the generation of parameters executed in step S18 of Fig. 5. As previously explained, when the host computer 3 transmits a bit image to the printer 1 in blocks, information relating to the position of the block on paper as well as the size of the block is also transmitted, together with the bit image. As shown in Fig. 6A, based on this information, the printer 1 obtains an address ADD (leading address) of the upper left pixel (head end) of the block 3, a horizontal position X and a vertical position Y of the head end of the block B with respect to the upper left edge of the paper, and a horizontal width W and a vertical height H of the block B. These data are stored as parameters in the image management area 113 as shown in Fig. 6B. Fig. 7 shows the steps performed during execution of the irreversible compression processing executed in step S22 of Fig. 5. The horizontal position X and the vertical position Y of the block to be compressed are read out from the image management area 113, and the positions are divided by the selected number of pixels (four in this embodiment) in both the vertical and horizontal directions. Each group of pixels thus divided constitutes a cell serving as a unit of compression. Remainders RX and RY are obtained when the positions are not divisible by the selected number of pixels, and these remainders are set as horizontal and vertical offsets (S31). The positional relationship (phase) between the first cell and the block is determined such that an address obtained as a result of the subtraction of the offsets RX and RY from the leading address ADD of the block matches the leading address of the first cell of that block. Each cell is fetched from the bit image of that block within the image storage area 111 (S32). An example of the fetching of a cell will be described more specifically with reference to Fig. 8. As shown in Fig. 8, the horizontal offset RX of the block B is one pixel, the vertical offset RY is three pixels, the horizontal width W is 26 pixels, and the vertical height H is 14 pixels. In this case, the positional relationship between the cell C and the block B is determined such that the first cell starts from the position shifted leftward from the leading address ADD of the block B by only RX = one pixel, and upward by only RY = three pixels. Eventually, the sizes of the cells located along the upper, lower, left, and right edges of the block B do not form complete 4 x 4 pixels cells and are, therefore, incomplete. If there is another block adjoining any one of the upper, lower, left, and right sides of the block B, however, cells within the block B and cells within the adjoining block will be matched in position with each other to complete any incomplete cells. In other words, the cell arrangement positioned only in one way with respect to the entire image is applied to all of the blocks. After the cells have been fetched in this way, each cell is converted into a compressed code. The compressed code is again stored in the image storage area 111 (S33). The cell is then converted into the compressed code by directly using the number of black pixels in the cell as a compressed code. For example, if the number of black pixels within the cell is zero, its compressed code (decimal notation) is 0. In this way, a compressed code of 1 is obtained for one black pixel, a compressed code of 2 is obtained for two black pixels, ..., a compressed code of 15 is obtained for fifteen black pixels and for sixteen black pixels. In the case of cells having incomplete sizes, the number of black pixels is obtained by proportional calculation on the assumption that the size of the cells is 4 x 4 pixels. The thus obtained number of black pixels is used as a compressed code. By virtue of such compression, the volume of data of the image is reduced almost to a quarter of the original volume. Fig. 9 shows the steps executed during the output processing executed in step S20 of Fig. 5. First, it is ascertained that all image data for one page are complete (S41). In this embodiment, the image data are in the form of intermediate codes, a bit image, or the foregoing compressed codes. Even if there is a partially uncompressed bit image in the image data, the uncompressed image is once subjected to irreversible compression to be matched with compressed portions when the bit image includes the compressed and coded portions. The image data are expanded to a bit image for one page or for each band while the intermediate codes of these portions are interpreted (S42). At this time, when the image is a compressed code, the compressed code is restored co a dot pattern using the dot pattern for expansion 93 located within the ROM 9. The dot image obtained through expansion and restoration is output to the print engine iS (S43), and the dot image is then printed (S44). Fig. 10 shows several examples of the expansion dot pattern 93 used in restoring the compressed code to a dot pattern. As shown in the Fig. 10, 16 types of dot patterns, each consisting of 4 x 4 pixels and each having a different number of black pixels, are set with respect to a compressed code of 16 stages (hexadecimal notation). These dot patterns are not necessarily matched with the original dot patterns before compression in terms of the arrangement of black pixels, but they are set to be matched with each other in terms of the number of black pixels. If the sizes of the cells obtained after compression are not 4 x 4 pixels, the pixels within the dot patterns corresponding to the incomplete cells will be used. Figs. 11A and 11B show the irreversible compression carried out in the above embodiment. In this example, a printer receives a dot pattern, which is the same as that shown in Fig. 1A, as an original dot pattern. Assume the upper left end (top end) of the first block corresponds to the top end of the paper on which the image is to be printed. As shown in Fig. 11A, the horizontal and vertical offsets RX and RY of the first block are zero and the leading end of the first cell is positioned at the head end of this block. Cells, each having a size of 4 x 4 pixels, are fetched one after the other from the first block. As a result, incomplete cells of 4 x 2 pixels are fetched from the bottom row of the first block. In the second block, the horizontal and vertical offsets RX and RY are respectively set to 0 and 2, and hence the leading end of the first cell of the second block is positioned at the position shifted by only two pixels from the head end of the second block. Thereafter, cells are fetched one after the other from the second block. Namely, the cells of the second block are positioned so as to be matched with the incomplete cells of the first block. In other words, in accordance with the cell arrangement positioned only in one way with respect to the entire image, cells associated with this cell arrangement are fetched from each block. Accordingly, the phase between the dot patterns and the cells is consistent throughout the entire image, thereby preventing each block from having a different phase. Fig. 11B shows a compressed code (in decimal notation) obtained as a result of irreversible compression of each of the cells fetched in the manner as previously mentioned. For the cells which are incomplete the number of black pixels may, for example, be represented in compressed codes as: the no. of black pixels in the incomplete cell x the no. of pixels in a complete cell the no. of pixels in the incomplete cell The data may be expanded such that the number of black pixels in the relevant part of the reproduced image corresponds to the average value of the compressed codes corresponding to two adjacent incomplete cells. Fig. 12A shows a print result obtained by the expansion of the compressed code, and Fig. 12B shows the original image. As can be seen from the drawings, the print result shown in Fig. 12A has deformations resulting from compression and expansion when compared with a dot pattern of the original image shown in Fig. 12B. However, the first and second blocks have similar deformations, and there is no difference in deformation between the blocks. Hence, the tone of the original image remains vertically even in the print result, and there is no uneven tone due to the division of the image into blocks. It is possible to carry out the present invention in various forms other than the illustrative embodiment described above. For example, the present invention is applicable not only to printers, but also to computers and various other devices which process bit map images. According to an embodiment of the present invention described, there arises no difference in picture quality between blocks in an expanded image, and an even picture quality is obtained throughout the entire image when blocked image data are subjected to irreversible compression block by block, and the compressed data are expanded again. The invention may be particularly advantageous when used with a data compression system in which the encoded data, when expanded, produces a pattern of pixels of each cell which does not necessarily correspond to the original pattern of the pixels, but which gives an indication of the tone thereof. The invention may be particularly advantageous when applied to irreversibly compressed data. However, it may be applied to data of other types. The foregoing description of preferred embodiments of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and modifications and variations are possible in light of the above teachings or may be acquired from practice of the invention. The embodiments were chosen and described in order to explain the principles of the invention and its practical application to enable one skilled in the art to utilize the invention in various embodiments and with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention can be defined by the claims appended hereto, and their equivalents.

Claims: An irreversible bitmap data compression system (1) comprising: fetching means (7,9,11) for fetching cells of bit map data from first and second adjacent blocks of bit map data, each of the fetched cells having a predetermined cell size; and converting means (7,9,11) for converting each of the fetched cells to compressed code in order to reduce its storage space, characterised in that : when the size of the first block of bit map data is indivisible by the predetermined cell size, the fetching means fetches from the first block a first incomplete cell having a first reduced size and fetches from the second block a second incomplete cell, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. The irreversible compression system of claim 1, wherein the fetching means includes: means for calculating horizontal and vertical offsets; and means for calculating the second reduced size in accordance with the horizontal and vertical offsets when the size of the first block of bit map data is indivisible by the predetermined cell size. The irreversible compression system of claim 2, wherein the means for calculating the second reduced size includes means for calculating a leading address of the second reduced cell by subtracting the vertical and horizontal offsets from an address of a leading end pixel of the second block. An irreversible bitmap data compression method comprising the steps of: fetching cells of bit map data from first and second adjacent blocks of bit map data (531, 532), each of the fetched cells having a predetermined cell size; and converting each of the fetched cells to compressed code in order to reduce its storage space (533), characterised in that : when the size of the first block of bit map data is indivisible by the predetermined cell size, a first incomplete cell having a first reduced size is fetched from the first block, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. The irreversible compression method of claim 4, wherein the fetching step includes the steps of: calculating horizontal and vertical offsets (531), and calculating the second reduced size in accordance with the horizontal and vertical offsets when the size of the first block of bit map data is indivisible by the predetermined cell size (532). The irreversible compression method of claim 5, wherein the step of calculating the second reduced size (532) includes the step of calculating a leading address of the second reduced cell by subtracting the vertical and horizontal offsets from an address of a leading end pixel of the second block. An irreversible bitmaps data compression device, comprising: means (5,9) for receiving bit map data divided into blocks; means (7,9,11) for dividing each block into cells having a predetermined cell size; and means (7,9,11) for providing a compressed representation of the data in each cell, in order to reduce its storage space characterised in that : when the size of a first block of bit map data is indivisible by the predetermined cell size, the means for dividing is adapted to divide from the first block a first incomplete cell having a first reduced size and to divide from a second block a second incomplete cell, the second incomplete cell being adjacent the first incomplete cell and having a second reduced size such that the sum of the first reduced size and the second reduced size is equal to the predetermined cell size. A printer (1) including the compression system of any one of claims 1 to 3 or the data compression device of claim 7.

Inventors: IWASAKI TAKUMI, IWASAKI, TAKUMI
Applicants: SEIKO EPSON CORP, SEIKO EPSON CORPORATION
Application year: 1995
Main classification: G06T9
IPC codes: H04N1, B41J2, G06T9