DIGITAL IMAGE INFORMATION COMPRESSION AND DECOMPRESSION METHOD AND APPARATUS

Abstract: One-dimensional compression is effected by addressing a first ROM (62) with information in respect of the length and the type of run. One-dimensional decompression is effected by addressing with the compressed code, a second ROM, bearing the information in respect of the runs and the length of the code. That is provided by a shift register controlled by a logic unit capable of recognising a group of least significant bits, to permit additional shifting of the register, and addressing of the second ROM with a bit number less than the maximum length of the codes. For two-dimensional compression or decompression, there is provided a pair of RAMS for temporarily storing a reference line which, together with the current line, actuates a logic means (38), for controlling coding and decoding of the latter. For compression of the medium tones, besides the runs of the two colours, coding is effect in respect of the runs of the alternations of the two colours defined on the basis of the colour of the initial pixel, and the type of the successive run is defined. Besides the coding and decoding for two-­ colour images, the two ROMs also carry the coding and decoding for images with the half-tones. Finally, the appar­ atus comprises an archive memory which can be connected to the compression module for achival storage of the images with the maximum degree of compression. By instead connecting the decompression module between the archive memory and the compression module, the image can be transmitted with a type of compression compatible with the receiving station.

Description: The present invention relates to a method and apparatus for the compression and decompression of digital image information as set forth in the precharacterizing parts of claims 1 and 5 respectively. A compression-decompression apparatus is known from US-A 3 668 685 in which a scanning head scans image and supplies a run length counter with black and white signals to determine the run length of runs of black or white pixels. The run length counter transfers the run length data to a Huffman encoder, which converts the data of the black runs or of white runs into compressed run length codes. When the scanner detects a picture formed of half-tone dots, the half-tone signals are converted into half-tone run length codes by an A/D circuit and the Huffman encoder. An object of the present invention is to provide a method and an apparatus for compression and decompression of digital images in which the medium tone definition is greatly improved. The invention accordingly provides a method as defined in claim 1 and apparatus as defined in claim 5. Advantageous developments of the method and apparatus are defined in the dependent claims. Having two separate codings in respect of a medium tone black white black ... run and a white black white ... run, respectively, permits the definition at the start of a medium tone run to be preserved correctly. Moreover, it permits grey areas to be correctly reproduced as a chequerboard of black and white pixels, rather than possibly alternating vertical black and white lines. The invention will now be described in more detail, by way of example, with reference to the accompanying drawings, in which: Figure 1 shows a diagram of a digital image information compression and decompression apparatus in accordance with the invention, embodied in a document facsimile processing apparatus, Figure 2 is a diagram illustrating two-dimensional coding, Figure 3 is a block diagram of the compression module of the apparatus, Figure 4 is a detailed view of some blocks shown in Figure 3, Figure 5 is a diagram of the address of the ROM of the compression module, Figure 6 is a block diagram of the decompression module of the apparatus, Figure 7 is a diagram of the address of the ROM of the decompression module, Figures 8 and 9 are two detailed diagrammatic views of some blocks shown in Figure 6, Figure 10 shows the representation of some degrees of medium tones, Figure 11 shows the runs of two types of medium tones, Figure 12 shows coding of the runs of the two types shown in Figure 11, Figure 13 shows a detailed diagrammatic view of a module in Figure 3 for coding the medium tones. INTRODUCTION The document facsimile processing apparatus essentially comprises an input unit formed by a device 15 for optically scanning the document, which is arranged to generate binary signals corresponding to the individual elements of the images read, hereinafter referred to as pixels. The binary signals which are generated in that way are coded and compressed in a compression module 16 from which they can be selectively passed either to a mass or archive memory 17 for future use or, by way of a modem 18, to a transmission line 19 for a remote station. The apparatus further comprises one or more output units which may be a video unit 21 or a high-definition dot-type printer 22, for example a laser printer. The output unit is controlled by a decompression module 23 which is arranged to receive the compressed signals from the memory 17 or from a remote station by way of the line 19 and a modem 24. Finally, the compression module 16 may be locally connected directly to the decompression module by way of two interface units 20 and a connecting cable 25. The apparatus is particularly adapted to operate in accordance with the standards set by the CCITT for the facsimile transmission in group G3, whereby a sheet of A4 size is to be transmitted over a telephone line in about one minute. The proposed standard T4 in regard to such transmissions provides that the document is read in successive elementary lines, each being read from left to right with a definition of 1728 pixels over a line of 215 mm, that is to say, with a definition of 8 pixels/mm. Black and white (B/W) coding is effected by coding the length of sequences of the pixels or run of the same colour. That can be effected by using two separate compression methods. The first method, which is referred to as one-dimensional compression, comprises reading only one elementary line at a time and allotting the Huffman codes prescribed by proposed standard T4 to the various black pixel and white pixel runs. Those codes are represented by words of variable length of from 2 to 13 bits, such that no code may represent the least significant part of another code. In particular, in accordance with that code, runs of a length of from 0 to 63 pixels are represented by corresponding code words which are referred to as the terminating code or TC, while the sequences of multiples of 64 pixels, that is to say 64, 128...1728, are represented by other code words and are referred to as make-up or MK codes. Therefore, runs larger than 63 pixels require two code words, an MK and a TC. Also provided is an extension of the common MK codes for black runs and white runs, which are multiples of 64 greater than 1728. Those common codes are of a length of 12 or 13 bits and seven most significant bits all at zero. The white codes from 0 to 63 are of a maximum length of 8 bits, while the white MK codes are of a length of up to 9 bits. In contrast, the black TC codes from 0 to 63 are of a length of up to 12 bits and the black MK codes are of a length of up to 13 bits. In addition, the black TC codes from 7 to 63 and all the black MK codes have at least the three most significant bits equal to zero, while the black TC codes from 1 to 6 have at least a 1 in the first three least significant bits. Finally, the MK codes of the black runs from 320 to 1728, between which are contained all those of thirteen bits, always have the six least significant bits equal to zero. The second compression method, referred to as two-dimensional compression, comprises first defining the pixels b1 and b2 of a previously read elementary line, referred to as reference line R (see Figure 2), in which a white run or a black run begins in that line. The method then comprises defining the length of the runs of the black line which is actually being read, referred to as the current line C, from the initial run pixels ao, a1, a2 of that line, in dependence on the pixels b1 and b2 of the reference line, thereby achieving a greater degree of compression. In particular, the following situations are defined, being designated by corresponding mode codes: Pass mode (P) if b2 is to the left of a1 (see Figure 2a), in which case the pixel a'o below b2 is defined as a fresh pixel ao; horizontal mode (H) if a1 is spaced from b1 by more than 3 pixels, that is to say, a1 b1>3 (see Figure 2b); vertical mode if a1 is spaced from b1 by not more than 3 pixels (a1 b1⋞3); in particular, the mode is referred to as V(O) if a1 is below b1, VR(Vertical Right) followed by the number indicating the pixels a1 b1 if a1 is to the right of b1 (see Figure 2c), and VL(Vertical Left) followed by the number of pixels a1 b1 if a1 is to the left of b1. The associated mode codes are given by the following table 1 wherein the codes H expressed by M(ao a1) and M(a1 a2) are the respective one-dimensional codes: That coding takes place in two phases: in the first, it is established if a mode P is involved, while in the second it is established if a1b1 is > 0 and < 3. It should be noted that the codes of above-indicated Table 1 are of Huffman type as between themselves, but not with the one-dimensional codes. It should also be noted that normally scanning of a document is effected by alternating a line which is coded with the one-dimensional method, with K-1 lines coded by the two-dimensional method, wherein K indicates the number of lines of a cycle and represents a parameter indicating the vertical resolution of the reading operation. Normally, K = 2 for standard resolution of 3.75 pixels/mm and K = 4 for better resolution. To indicate the beginning of the first run of a line, the device 15 (Figure 1) generates a white imaginary pixel ao to the left of the actual beginning of the line. To indicate the end of a line, the device 15 generates an end-of-line code EOL. COMPRESSION MODULE The compression module 16 comprises two reading and writing random access memories (RAM) 26 and 27 (see Figure 3), each being capable of temporarily storing a line of pixels. By way of example, each memory 26 and 27 may comprise a 1Kx4 bit RAM. Alternatively, the two memories 26 and 27 may be formed by the two halves of a single 2 Kx4 bit RAM. In both cases, each RAM 26 and 27 has the capacity to store the maximum length of line prescribed by the proposed standard, up to 2623 pixels. Each RAM 26 and 27 is controlled by a corresponding bus control circuit 28 and 29 in such a way as to establish the direction of information flow, that is to say, whether the respective RAM 26, 27 is in the reading or writing mode. The two control circuits 28 and 29 are controlled by a read-write select circuit 31 comprising a flip-flop which is switched over at the end of each line. The two control circuits 28 and 29 are so arranged as to effect writing of one of the two RAMs 26 and 27 simultaneously with reading of the other RAM. Therefore, the operation of reading a reference line is effected from one of the two memories 26 and 27 at the same time as the current line is written in the other memory 26, 27. The two memories 26 and 27 are addressed by an address counter 32 which, at the end of the operation of scanning each elementary line, is automatically loaded in parallel with a value depending on the number of pixels in the line, that is to say, the width of the document. It is decremented during the operation of scanning the line by an input clock CLK and, when it reaches zero, it switches over the circuit 31. The inputs of the two control circuits 28 and 29 are connected to the output in parallel of a first shift circuit 33. The circuit 33 serially receives the bits produced by a circuit 34 for defining the signals corresponding to the pixels which are read in the current line, which is included in the scanning unit 15 (see Figure 1). The circuit 33 (see Figure 3) comprises a shift register through which the bits of the current line pass and a latch circuit which staticises those bits in groups of four to pass them in parallel to the circuits 28 and 29. The register in the circuit 33 is also connected to a logic circuit 35 for examining a sequence of at least three bits to detect the end of each run, producing a signal FR at one of its outputs. The circuit 35 is also arranged to indicate the current colour with a staticised signal on an output B/W which is at 0 to indicate black and at 1 to indicate white. The FR signal output is connected to a counter 36 which is arranged to be set to zero by each signal FR and to count the pixels of the same colour, which are received by the circuit 33 after each run end. In contrast, the output of the two circuits 28 and 29 is connected to the input in parallel of a second shift circuit 37. The circuit 37 is arranged to receive from the memories 26 and 27, the bits of the reference line, in parallel in groups of four, to apply them to a logic circuit 38. The circuit 38 at the same time receives the bits which pass through the circuit 33. The circuit 38 essentially comprises EX-OR gates (see Figure 4) controlled by the signal B/W and by the signals coming from the outputs 2a, 3a and 2a of the shift circuit 33 of the current line and by the signals coming from the outputs 2b, 3b and 4b of the shift circuit 37 of the reference line, in order to detect all the transitions 0 → 1 and 1 → 0 on the current line and on the reference line. The various configurations of such signals are recognised by a logic circuit 39 (see Figure 3) for detecting the type of mode for two-dimensional compression. The circuit 39 is arranged to condition a circuit 41 for forming the address for producing the associated mode code. The two circuits 38 and 39 are both controlled by the signal FR produced by the circuit 35. In particular, the circuit 39 comprises a group of three flip-flops 42, 43 and 44 (see Figure 4) which can be activated when the circuit 38 respectively detects the transitions b1, b2 and a1 (see Figure 2). The flip-flops 42, 43 and 44 (see Figure 4) give the corresponding signals and the associated inverted values b1 , b2 and a1 . A fourth flip-flop 46 connected to the circuit 33 (see Figure 3) is arranged to store the colour of the bit ao ( that is to say, the last bit of the current line, as considered upon individualisation of the various modes). Such colour is white when the flip-flop 46 is set and black when it is reset, and conditions recognition of the mode subsequent to the one detected. The circuit 39 also comprises two groups of three NAND gates 47 and 48 which are controlled by the signals issuing from the outputs of the serialising circuits 33 and 37 indicated in Fig. 4 and the signal from an AND gate 49. Therefore, when a1 is present, the NAND gates 47 and 48 recognise the various bit configurations which determine the VL. When any one of the NAND gates 47 and 48 is activated, in combination with the signal of the flip flop 46 indicating whether there is ao black or ao white it outputs at another NAND gate 51 a signal VL which is applied to the circuit 41. That circuit essentially comprises a counter 52 which is enabled to count up to 3 by setting to b1 of the flip-flop 42 and a multiplexer 54 (MUX) which is arranged to output an address corresponding to the two-dimensional compression mode. In particular, the signal VL from the gate 51 enables the multiplexer 54 to give, in response to the information from the register 37, the address corresponding to three vertical modes: V(O), VL, VR. If the flip-flop 42 is set to b1 before the flip-flop 44 is set to a1, the AND gate 49 disables the NAND gates 47 and 48, whereby the items of information coming from the counter 52 when it is set to a1, which give the number of bits a1 b1 are enabled in the multiplexer 54. If however the flip-flop 43 is also set to b2 before a1, the AND gate 56 enables the multiplexer 54 to produce the mode P address. If a1 is set before b1 and the counter 52 has a configuration 0 or a configuration from 0 to 3, it conditions the multiplexer 54 to emit the mode V(O) address, or the address of one of the three VR modes respectively. If however, with a1 before b2, the counter 52 exceeds its capacity, the associated signal by way of an AND gate 50 enables the multiplexer to produce the mode H address. The circuits 39 and 41 are reset on each occasion, after the address given by the multiplexer is used. The production of that address however is inhibited by a signal M issued by an OR gate 57 (see Figure 3) either in the case of one-dimensional functioning i.e. if it is MOD= Oor in the case of forming a pair of addresses represented by the signal H in Fig.3 after using the mode H address. The signal M is produced by a logic means 58 for varying the parameter K of two-dimensional compression. The logic means 58 essentially comprises a counter which can be set to a state, according to the parameter K. The counter is then incremented by the end-of-line signals EOL and, when it exceeds its capacity, by way of the OR gate 57, it generates the zeroing signal M. Finally, the logic means 58 is arranged to recognise in known manner the sequence of codes which indicate the end of the page, as provided by the standards of the scanning unit 15. The signal M is arranged to enable a multiplexer 59 (see Figure 3) to produce an address corresponding to the value reached by the counter 36 at the end of the corresponding run. In particular, the multiplexer 59 is operative to form a code TC if the counter 36 has counted a number of bits < 64. In the opposite case, it accumulates in a counter the number of integral multiples of 64, on the basis of which it first produces the code MK, and it then produces the code TC corresponding to the number of bits exceeding that multiple. The addresses issued by the multiplexer 59 and the circuit 41 are staticised from time to time by a latch circuit 61 which is operative to maintain it constant during a predetermined period required to access a read only memory 62 in such a way as to permit the logic means which precedes it to develop for the subsequent address. The ROM 62 is recorded with the Huffman codes and may have a capacity of 1Kx16 bits, whereby it may be formed by two standard chips 63 and 64, each with a capacity of 1K byte, which are addressed in a parallel mode. In particular, the memory 62 is addressed by the latch circuit 61 with a 10 bit address, as illustrated in Figure 5. It comprises six bits A0-5 relating to the length of the run, a bit A6 which specifies if it is a code TC or a code MK, a bit A7 which specifies if white or black pixels are involved, a bit A8 which specifies if end-of-line is involved, and a bit A9 which specifies if a mode code (MOD=1) or one-dimensional coding (MOD=0) is involved. The overflow from the counter of the logic means 58 (Figure 3) adds to the code EOL applied to the memories 63 and 64 by the latch 61, a bit=0 which indicates that the subsequent line will be coded using the one-dimensional method, while for the other K-1 lines, the bit added to the end-of-line code is 1. The compression module 16 further comprises a timing circuit or timer 66 which is controlled by each signal FR produced by the circuit 35, and which is capable of outputting a first signal MEM for enabling the latch 61 to staticise the address and a second signal AC which has a delay relative to the first, equal to the access time of the memory 62. The modules 63 and 64 thereof are operative to load in parallel an output shift register 67 under the control of a logic circuit 68 enabled by the signal AC. The circuit 68 also generates a clock signal for controlling the serial output of the code loaded from time to time into the register 67. After output of the last bit of the code, the length of which is known to be variable, the register 67 produces a signal FIN to signal to circuit 68 the end of the output of the code. In the situation of one-dimensional operation, the signal MOD=0, by way of the OR gate 57, inhibits the circuit 41, whereby all the logic means relating to the comparison with the reference line, comprising the blocks from 26 to 32 and 37 to 39 remain excluded from operation. The signal M from the OR gate 57 however enables the multiplexer 59. Therefore, the bits coming in serial mode from the circuit 34 reach the circuit 33 and pass from that to the circuit 35 in which the colour transitions are recognised. Starting from the end of each run, the staticised signal FR enables the counter 36 to compute the length of the current run. If that computation is less than 64, the multiplexer 59 applies to the latch 61 only the address of the memory 62 relating to the code TC of the corresponding number of bits. That code will have the bit A6=0 and the bit A9=0 (see also Figure 5). Under the control of the circuit 68, that code is now loaded in parallel in the register 67, from which it is read serially for storage in the memory 17 (see Figure 1), or to the interface unit 20 or to the modem 18 for transmission. If however the count of the bits in the run is higher than 64, the multiplexer 59 (see Figure 3) produces two addresses in succession. The first address which will have bit A6=1 identifies the code MK at the memory 62 while the second address which will have bit A6=0 identifies the code TC. In both cases, the bit A9 is equal to zero. The two codes produced by the memory 62 on the basis of the two addresses are then issued in succession by the register 67 in a similar manner to the procedure described above. When dealing with two-dimensional compression, the factor K is suitably set in the counter of the logic means 58, while the signal MOD = 0 at the input of the OR gate 57 goes false. In that case, the runs of each elementary line are copied alternately at the two memories 26 and 27 under the control of the counter 32 and the circuit 31. Obviously, since during the operation of reading the first line, the logic means 58 is in the overflow condition, the OR gate 57 inhibits the circuit 41 and activates the multiplexer 59. Therefore, the runs of the first line are coded by the ROM 62 under the control of the multiplexer 59 in accordance with the one-dimensional compression method. The same occurs during the operation of reading the subsequent lines, in which the logic means 58 repeats its overflow condition, whereby it will be clear that, in two-dimensional compression, a line is periodically coded using the one-dimensional compression method. During reading of the other lines however, the bits of the current line which are produced by the circuit 33 are processed by the circuit 38 together with the bits of the reference line which are produced by the circuit 37 to permit the circuit 39 to detect the type of mode of each run. If the circuit 39, by way of the AND gate 50 (see Figure 4), detects the mode H, it will cause the multiplexer 54 of the circuit 41 to generate the associated address for extracting the corresponding code 001 from the ROM 62 (see Figure 3). The signal H is of a duration such that, by way of the OR gate 57, the multiplexer 59 is permitted to address the ROM 62 for coding two subsequent runs ao a1 and a1 a2, in accordance with one-dimensional coding. Similarly, if the circuit 39, by way of the AND gate 56 (see Figure 4), detects the mode p, it causes the multiplexer 54 of the circuit 41 to generate the associated address for extracting the corresponding code 0001 from the ROM 62 (see Figure 3), whereby the flip-flop 46 now defines the code of the pixel a'o of the current line, which is aligned with b2. After that coding operation, the circuit 39 re-examines the situation for subsequently detecting the type of mode. Finally, when the circuit 39, by way of the NAND gates 47, 48 and 51 (see Figure 4) and the flip-flops 42-46, detects a mode V(O), VL or VR, in combination with the value supplied by the counter 52, it addresses the multiplexer 54 in such a way as to output the address in the ROM 62 of the corresponding mode V(O), VR(1-3) or VL(1-3). The ROM 62 then directly supplies the register 67 with the corresponding code indicated in Table I. DECOMPRESSION MODULE The decompression module 23 (see Figure 1) also comprises two random access memories 71 and 72 (RAM) (Figure 6) addressed by an address counter 73 and controlled by two bus control circuits 74 and 76 which in turn are controlled by a read-write select circuit 77. Since those, components are entirely similar to the corresponding components 26-32 (see Figure 3) of the compression module, there is no need for the detailed description thereof to be repeated here. The decompression module 23 (see Figure 6) essentially comprises a read only memory 75 in which are recorded the runs of bits corresponding to the Huffman codes. Since those codes may be of a length of up to 13 bits, whenever a 14th white/black bit is added to the address, it would be necessary to have two 8Kx8 bit ROMs for the white codes and another two 8Kx8 bit ROMs for the black codes to permit unequivocal addressing. However, it is possible to use two ROM modules 78 and 79 which each have a capacity of 2 Kx8 bits, which are addressed with a word of 11 bits which are referred to hereinafter as A0-A10, in accordance with the diagram shown in Figure 7. The ROM 78 contains a series of words of six bits (0-5), which give a length of the run associated with the code addressed, and a bit T which, if it is 1, indicates a code TC, while if it is 0, it indicates a code MK. At its four outputs, the ROM 79 gives the information relating to the length of the one-dimensional code, that is to say, the number of bits forming that code. In particular, for reasons which will be apparent hereinafter, for the codes of the white runs and for the codes of the black runs which are less than seven pixels, the ROM 79 gives the effective length of the code, which is always less than nine. However for black runs which are greater than or equal to seven pixels, which have the three least significant bits equal to zero, the ROM 79 gives the length of the code increased by three. The four outputs 0-3 of the ROM 79 are connected to a multiplexer (MUX-latch) 81 (see Figure 6) which loads the corresponding bits into a counter 82. The ROM 79 also produces at three outputs 1, 2, 3 the mode codes which are applied to a mode decoder 80. The codes are also applied to the MUX-latch 81 where they give the length of the mode code. The second input of the MUX-latch 81 is enabled by a signal MOD=1 produced by the decoder 80 to indicate whether a mode code is involved. The address of the ROMs 78 and 79 is provided in part by a twelve bit shift register 83 which is operative to receive in series the bits of the codes from the memory 17 (Figure 1) or the interface unit 20 or the receiving modem 24. The register 83 (see Figure 6) is connected in parallel to a logic input circuit 84 having mainly the function of controlling addressing and reading of the ROMs 78 and 79 and shifting of the register 83 under the control of the counter 82. In particular, the logic circuit 84 comprises a circuit 85 (see Figure 8) for recognising a run code in which the three least significant bits are zero. That involves a black run of greater than six and the circuit 85 enables a circuit 94 to examine the subsequent three bits of the register 83 to establish if they are also three zeros, that is to say, if the black run is greater than 320. In addition, the circuit 85 is operative to condition a circuit 86 to generate a bit A9=0 if there is at least one bit =1 in the three least significant bits of the code, or a bit A9=1 if the above-mentioned three bits are equal to zero. The bit A9=0 always constitutes the tenth bit of the address of the ROMs 78 and 79. The bit A9=1 however constitutes the tenth address bit only if the circuit 94 recognises at least one 1 in the three subsequent bits of the code. In that case, the black run code is properly defined even without taking account of the three least significant bits. If however the circuit 94 recognises three subsequent bits equal to zero, it produces at a NAND gate 95 the thirteenth bit, that is to say, the most significant bit of the code for the black run which is greater than 512 produced by the counter 83 which would otherwise be lost, outputting the signal A'9. The output of the NAND gate 95 representing such most significant bits is now used as the tenth bit of the memories 78 and 79 (Figure 7) whereby in that case also the code remains perfectly well defined. In addition, the logic circuit 84 comprises a circuit 87 (see Figure 8) which is capable of recognising the run codes in which the seven least significant bits are zero (MK beyond 178, being common for white and black) to produce at the output of the NAND gate 88 a signal A10=1 of the address of the memories 78 and 79 (see Figure 7). A circuit 89 (see Figure 8) of the logic circuit 84 is in turn arranged to recognise the code EOL and to issue a line synchronisation signal U. The circuit 89 also recognises the most significant bit which is additional in the compression process in dependence on the type of coding (one-dimensional or two-dimensional) of the subsequent elementary line. The circuits 85, 87 and 89 are enabled to recognise the three zeros or the seven zeroes by a signal from the counter 82 when it is zeroed. A stop circuit 90 is controlled in an OR mode by the circuits 85, 87 and 89 to produce a signal SD for blocking the input of the bits to the register 83 for the period of reading the memories 78 and 79 (see Figures 6 and 7) when the counter 82 is zeroed. In particular, the signal SD controls a timing circuit or timer 91 which generates a signal LM for enabling reading of the memories 78 and 79, blocking the shift of the register 83 for a period of time equal to the reading time. The timer 91 also produces a pulse CL for enabling loading in respect of the length of the run supplied by the ROM 78 on six outputs into a latch circuit 92 when the item of data represents a code MK (bit T=0) while in the absence of that pulse CL, it enables loading of the length of the run into a counter 93 when the item of data represents a code TC (bit T=1). The signal LM from the circuit 91 also simultaneously enables loading of the four bits of length code given by the ROM 79 to the MUX-latch 81 and the three bits of the mode code, to the decoder 80. The counter 93 also receives the length of the code MK which is staticised by the circuit 92 in such a way as to add together the length of the code MK and the code TC. The counter 93 is operative to enable an output circuit 96 to issue the decompressed bits until, in the decrementing mode, it reaches zero, whereby the circuit 96 issues a number of bits equal to the value of the data initially contained in the counter 93. Those bits are thus passed for use, that is to say, to the video unit 21 (Figure 1) or the printer 22. The bits from the circuit 96 (Figure 6) are also passed to a shift register 97 from which they are passed in parallel in groups of four to the control circuits 74 and 76, in a similar manner to that described above in relation to the circuit 33 (see Figure 3). The decoder 80 is connected to a logic circuit 98 which, depending on the decoded mode, controls the output circuit 96. In particular, the circuit 98 comprises a latch circuit 99 (see Figure 9) of the decoder and is operative to produce the signals corresponding to the various modes P, H, V(O), VL and VR. A circuit 100 is operative to define, in dependence on the succession of the mode codes, the colour of the current run and the colour of the subsequent run. The circuit 100 outputs the signal B/W for controlling the circuit 84 and the circuit 96 (see Figure 6). In addition, the circuit 98 comprises a counter 101 (see Figure 9) which can be impressed by the mode H code issued by the latch circuit 99 to control the circuit 96 in such a way as successively to issue the two runs provided by the mode H. Finally, the circuit 98 comprises a flip-flop 102 which can be set by the latch circuit 99 when it recognises the mode codes except for the mode H to condition the circuit 96 for issuing the bits of the run subsequent to the mode code. In Figure 6, the various connections of the circuit 98 with the circuit 96, 96, excepting the connection B/W, are indicated by a multiple bus 124. The circuit 98 is also connected to another logic circuit 103 (see Figure 6) which can be conditioned by the bits of the reference line to signal to signal to the circuit 98, by a signal FM, the end of the dispatch of the bits of the current run in the two-dimensional decompression process. The signal Fm can therefore reset the flip-flop 102 (see Figure 9) of the circuit 98. The bits of the reference line are supplied in series by a shift register 104 (see Figure 6) connected to the output of the two bus control circuits 74 and 76 associated with the memories 71 and 72, the register 104 being capable of being enabled by the signal U from the circuit 89 (see Figure 8). In particular, the circuit 103 comprises a gate circuit 105 (Figure 9) for recognising the transitions of colour in the reference line whereby it can supply the signals b1 and b2, and a decoding circuit 106 (Figure 9) for the transition bits of the reference line, which are supplied by the register 104 when the latch circuit 99 produces a mode VL code signal for generating the signal FM. A second decoding circuit 107 generates the same signal FM in dependence on the signal b1 of the reference line, which is supplied by the circuit 105, and the mode VR supplied by the latch circuit 99. An AND gate 108 generates the same signal FM when the latch circuit 99 supplies the mode V(O) and the signal b1 of the reference line is verified. Another AND gate 109 generates the signal FM when the mode P is supplied by the latch circuit 99, when it receives the signal b2 from the reference line. The bits forming a compressed code serially reach the register 83 (Figure 6), beginning from the least significant bit, for addressing the memories 78 and 79 (ROM). There is no separation at the input between one code and the subsequent code, whereby the memories 78 and 79 are continuously addressed by the bits A0-A10 (see Figure 7). In order to recognise the outputs of the individual codes, use is made of the property of Huffman codes, whereby, both in respect of codes in one-dimensional compression, as among each other, and in respect of mode codes in two-dimensional compression, as among each other, no code may be the least significant part of another code, whereby an incomplete code cannot be recognised by the memories 78 and 79. It will first be assumed for the sake of simplicity that the compressed codes arriving at the register 83 (see Figure 6) are of one-dimensional type. Shifting of the register 83 continues until the first bit of the code reaches the end of the register 83, in which case a part of the subsequent code will have entered the most significant part of the register 83. At that time, the memories 78 and 79 will be identified by a set of bits formed in the least significant part of the code, under consideration and in the most significant part of the beginning of another code. By virtue of the characteristic that no Huffman code is the least significant part of a code of the same colour, whatever the subsequent code may be, addressing is thus effected in respect of an unequivocally defined area in the memories 78 and 79, that area containing in each eight bit word therein, the information relating to the current code. At the beginning of each elementary line, the counter 82 is loaded in such a way as to carry the first code of a pixel which is certainly white, to the end of the register 83, while the circuit 100 (see Figure 9)of the logic circuit 98 is set into a state for the colour white. The circuit 90 (see Figure 8) therefore automatically supplies the signal SD which blocks shift of the register 83 (see Figure 6) and causes the timer 91 to generate the signal LM for reading the ROMs 78 and 79 whereby the code is immediately decoded. In particular, the ROM 78 supplies the bit T (see Figure 7) associated with the number of decompressed bits representing the code. That number is loaded into the counter 93 (see Figure 6) which permits the output circuit 96 to issue an equal number of bits of the colour indicated by the circuit 100 (see Figure 9). At the same time, the ROM 79 (see Figure 6) supplies the MUX-latch 81 with the length recorded therein of the code generated by the address, while in the absence of a mode code, where a one-dimensional code is involved, the decoder 80 receives all zeroes and enables the circuit 100 (see Figure 9) to generate the signal B/W in accordance with one-dimensional logic, that is to say, inverting the signal B/W after each run. The MUX-latch 81 (see Figure 6) loads the counter 82 which, by way of the logic circuit 84, enables the register 83 to resume shifting and to shift out the least significant bit of the code used. When the code represents any white run, as for the first run, or a black run less than seven, the circuit 85 (see Figure 8) recognises at least one 1 in the three least significant bits, whereby it generates the bit A9=0. That causes the circuit 90 to generate the signal SD when the counter 82 returns to zero, thus stopping the shift of the code with the least significant bit at the end of the register 83 (see Figure 6). That code can now be formed either by another code TC or a code MK. In the former case, relative decompression is effected in the manner described above. In the second situation, under the control of the timer 91, the length of the run is staticised in the latch circuit 92. It is then added in the counter 93 to the length given by the subsequent code, which is a TC, whereby the circuit 96 shifts out a number of bits equal to that sum. If a code represents a run in which the three least significant bits are three zeroes, the circuit 85 (Figure 8) on the one hand conditions the circuit 94 to examine the subsequent three bits and on the other hand the register 82 is registered with the length of the code increased by three and causes shift of the register 83 (Figure 6) to continue, to shift out in each case the three least significant bits. If the circuit 94 recognises at least one 1 in the three subsequent bits, the tenth bit of the address will be the bit A9=1. If however the circuit 94 recognises another three zeroes, the tenth bit A'9 of the address will be the thirteenth bit of the code, produced at the NAND gate 95. In both cases, the address of the ROMs 78 and 79 (see Figure 7), with the aid of the bit A9 or A'9, is always properly defined, whereby the circuits 81, 92 and 93 (see Figure 6) receive the decompression data represented by the compressed code which is extracted in that way, without the possibility of confusion. For the codes MK which are common to the whites and to the blacks, the circuit 87 (see Figure 8) which recognises the sequence of seven least significant 0 produces the signal A10=1 which permits addressing of the memories 78 and 79 in the region of said common codes MK. The colour however is defined by the subsequent code TC and thus controls the production by the circuit 96 of the decompressed bits corresponding to the two codes MK and TC. When one-dimensional coding is employed, the associated end-of-line code recognised by the circuit 89 excludes control of the preceding decompressed line (reference line), which is registered alternatively in the RAMs 71 and 72. In general, the codes arriving at the register 83 may be both of one-dimensional and two-dimensional type. In the second case, the codes relating to the length of the runs are variably interleaved with the mode codes. At that time, under the control of the associated end-of-line code, the register 104 is enabled progressively to pass to the logic circuit 103 the decompressed reference line which is already registered in one of the memories 71 and 72. When the register 83 addresses a mode code, the ROM 78 does not produce any output while the ROM 79 loads into the decoder 80 the three bits which define the mode corresponding to the code, which are staticised by the latch circuit 99 (see Figure 9). It also loads into the MUX-latch 81 (see Figure 6) the length of the code read, to preset expulsion thereof from the register 83. In that case, the circuit 100 (see Figure 9) defines the colour of the subsequent run in dependence on the mode code, as provided by the two-dimensional code. From the comparison of the decoded mode and the reference line, the circuit 98 generates the instructions for the output circuit 96. In particular, if the latch circuit 99 has staticised the mode H, it sets the counter 101 in such a way as to condition, in combination with the signal B/W from the circuit 100, the output circuit 96 to produce the pulses provided by the subsequent two codes which represent the runs aoa1 and a1a2 (see Figure 2b). If however the latch circuit 99 (see Figure 9) has staticised the mode P, when the circuit 105 generates b2, the AND gate 109 outputs the signal FM which conditions the flip-flop 102 to stop the issue of the decompressed bits from the circuit 96, thus defining the run ao a'o (see Figure 2a). If the latch 99 (see Figure 9) staticises one of the three modes VR, when the circuit 99 sets the flip-flop 102 it causes emission of the decompressed bits to begin, while when the circuit 105 generates the signal b1, the circuit 107 causes issue of the signal FM which resets the flip-flop 102, correspondingly stopping the issue of the decompressed bits by the circuit 96. Similarly, if the latch 99 staticises the mode V(O), the AND gate 108 immediately generates the signal FM, stopping issue of the bits. Finally, if the latch 99 staticises one of the modes VL, the flip-flop 102 is immediately set, initiating the issue of the decompressed bits. The circuit 106 then generates the signal FM after a corresponding number of clock pulses for resetting the flip-flop 102 and stopping the issue of the bits by the circuit 96. It will be clearly apparent from the foregoing that, both in the compression and in the decompression mode, each code has a single ROM access, whereby the associated decoding operation takes place at maximum speed. It will also be clear that, in the compression mode, three runs are processed simultaneously, one being present in the latch 61 (see Figure 3), one coming from the register 37 and the third being that whose bits are being counted in the counter 36. Finally, it will be clear that, in the decompression mode, two one-dimensional codes are processed simultaneously, even if they are in different phases. A first code is that whose decoding has been loaded into the counter 93 (see Figure 6) and the other is that which is addressing the ROMs 78 and 79. The two phases are asynchronous and one thereof could even be omitted for certain codes (EOL, zero run length), whereby they would be processed more rapidly, In the case of two-dimensional codes, the control exerted by the counter 93 on the issue of the bits may be replaced by the control of the circuit 98, while the circuit 103 simultaneously deals with the decoding from the code of the previous line. PROCESSING OF THE HALF-TONES As is known, in the digital processing of images, the medium tone colours, known as half - tones or greys are stored as an alternation, based on suitable matrices, of black and white pixels. Figure 10 shows by way of example five degrees of grey indicated by 1^to 5^ which range from 25% of black at 1^ to 75% of black at 5^ . It can be easily seen that the various degrees are represented by a combination of completely white lines, completely black lines and lines formed by a succession of white and black pixels. According to the invention, for the purpose of distinguishing between the black pixels, as between one line and the subsequent line, two series of codes are distinguished: one is represented by a succession which begins with a white pixel which will be referred to hereinafter as grey-white (GW) (Figure 11) while the other is represented by a succession which begins with a black pixel which will be referred to hereinafter as grey-black (GB) (Figure 11). Each series will always have a length or run given by an equal number of pixels. The runs of the above-indicated types of grey GW and GB may be paired with the runs W and B respectively to construct two sets of terminating codes TC similar to the Huffman codes for the runs W and B, while for the codes MK of the two greys, it is possible to use the same for W and B respectively, leaving the code TC to distinguish between the two cases. Introducing the two greys does not permit automatic alternation of the colours, as in the case of B/W. In fact, the alternation situations may be ascertained from Table 2. Of the two alternations in each case shown in Table 2, the first alternation always denotes the transfer from a pixel of one colour to the opposite. In the second alternation, in cases 2 and 3, transfer from the grey takes place after a pixel of the same colour of the subsequent run. In order to be able to select the colour of the subsequent run, in the compression process a bit is coded in all the grey codes, this bit being referred to as TAG (see Figure 7) which is 1 if the subsequent run is B or GB, whereas it is 0 if the subsequent run is W or GW. The preselected codes TC for the two types of grey are shown in Figure 12 where the TAG is indicated by T. They enjoy the characteristic of Huffman codes, whereby no least significant part of one code is equal to another code. For the purposes of making the codes in Figure 12 compatible with the codes TC for whites and blacks, slight modifications have been made in the standard Huffman codes TC for the white runs from 1 to 17 and 63 and those for the black runs 1, 8, 9 and 14. Coding in accordance with those codes which include processing of greys will be referred to hereinafter as 'non-standard coding' while coding of just the white and black pixels, as referred to in the previous sections of this text, which takes place in accordance with the proposed CCITT standard will be referred to as 'standard coding'. For processing greys, the compression module 16 may include two ROMs 63' and 64' (Figure 3) which are similar to the ROMs 63 and 64 but which carry the codes TC and MK modified as indicated hereinbefore in respect of the white and black runs and the codes GW and GB in Figure 12 for the grey runs. Similarly, in the decompression module 23, the group of ROMs 75 may include two ROMs 78' and 79' (see Figure 6) which are similar to the ROMs 78 and 79 but which carry the decodings from the codes of the ROMs 63' and 64'. In practice, the compression process uses only two ROMs 63, 63' and 64, 64', each having a capacity of 2K bytes, while the decompression process uses only two ROMs 78, 78' and 79, 79', each with a capacity of 4K bytes. The two parts of each of the memories 63, 63', 64, 64', 78, 78' and 79, 79' are discriminated by a free address input and a free output respectively. In the compression process, the above-mentioned free input receives a grey address code ADG (Figure 5) which, together with the input B/W, suffices to discriminating all the possible cases, in accordance with Table 3. In addition, bearing in mind that the grey runs are intrinsically even in length, the least significant bit of the address, that is to say, of the binary number which is staticised in the latch 61 (see Figure 3) is constant and can be suppressed. It is then substituted at the output of the ROMs 63, 63' and 64, 64' by the TAG bit which is introduced into the register 67 of the circuit 68. In addition, to permit recognition of all the colour transitions, the logic circuit 35 of the compression module comprises a logic gate circuit 112 (see Figure 13) which can recognise the transitions from white to black and vice-versa, giving a signal W or B as described hereinbefore in regard to standard coding. Those signals provide control of a first flip-flop 113 which thus stores from time to time the colour W or B of the current run. The circuit 35 further comprises a logic gate circuit 114 for recognising the grey runs, which is also controlled by the circuit 33 (see Figure 3) and is controlled by a non-standard coding selection instruction 116. A flip-flop 117 which is controlled by the signals from the circuit 114 stores from time to time if the current run is a grey run. A third logic gate circuit 118 of the circuit 35 is conditioned by the circuit 112 to provide the white or black colour of the subsequent run, which is stored by a flip-flop 119. The logic circuit 118 is also conditioned by the circuit 114 to provide the grey colour of the subsequent run, which is stored by another flip-flop 120. Now added to the formation of the ROM address effected by the circuit 59 are the run colour bits which are provided by the flip-flops 113 and 117 and the TAG bit which is provided by a circuit 121 controlled by the two flip-flops 113 and 117. In two-dimensional compression, the instruction 116 now conditions the circuit 41 (Figure 3) in such a way that, each time that a grey occurs in the MUX 54 (Figure 4), the mode H is produced, and there is disregard of the transitions b1 and b2 which would be verified for the alternations 01 and 10 in respect of the greys, thereby eliminating the correlations of the reference line which are generated by the greys. It will be clear therefore that the grey runs are compressed by the module 16 (see Figure 1) substantially as occurred with runs of pixels of the same colour. In the decompression process, the ROM 78, 78' (see Figure 7) gives the information ADG at its one output G, while the ROM 79, 79' gives at another output the TAG which serves for addressing the subsequent code. In addition, the circuit 85 (see Figure 8) recognises the three least significant bits of the GBs and causes shift of the register 83 (see Figure 6) by three additional bits, as in the standard situation in respect of black runs, generating the tenth bit A9 of the address of the read only memories. The circuit 84 further comprises a logic gate circuit 123 which can be rendered active by the instruction 116, for recognising when the counter 82 is zeroed if the three least significant bits of the codes GW (Figure 12) are 1. In the positive case, the circuit 123 produces a bit A" 9=1 which constitutes the tenth bit of the address of the read only memories. The bit A"9 acts on the circuit 90 to cause it to produce the signal SD, whereby the register 83 (see Figure 6) is also shifted by three added bits, suppressing the above-mentioned three bits = 1. In addition, under the control of the signals G and TAG of the memories 78-78' and 79-79', the circuit 100 (see Figure 9) is capable of recognising the four colours. When it recognises the two greys, it conditions a circuit formed by a JK-flip-flop 122 to alternate the instruction of black and white for the output circuit 96 (see Figure 6), whereby the half - tones are also decompressed by the module 23 (see Figure 1), as occurred with runs of a single colour.

Claims: A method for the compression and decompression of digital image information, for indicating at least two basic colours and a medium-tone colour, wherein separate run length codes can be formed for representing the length of a run of pixels of a line which are all of one or all of the other of the basic colour or of the medium-tone colour formed by alternation of pixels of the two basic colours, characterized in that a first medium-tone run beginning with a pixel of one basic colour and a second medium-tone run beginning with a pixel of the other basic colour are separately coded, to improve the definition of the medium-tone images. A method according to claim 1, characterized in that both the medium-tone runs are of a length given by an even number of pixels and in that the run length codes of the first and second medium tone runs terminate with a TAG bit indicating one of the two basic colour by which a subsequent pixel run begins in the line. A method according to claim 1 or 2, characterized in that the first and the second medium-tone length runs are coded with codes of a modified Huffman type. A method according to claim 3, characterized in that the medium-tone runs in subsequent lines of pixels are coded alternately according to the coding of the first medium-tone run and of the second medium tone run, so that each column of pixel is represented by an alternation of pixels of the two basic colours. Apparatus for the compression and the decompression of digital information indicating runs of pixels of at least two separate basic colours and a medium-tone colour represented by an alternation of pixels of the two basic colours, comprising a scanner (15) for sequentially scanning the pixels of a line of image, a colour recognizing circuit (35) for recognizing the colour of the scanned pixels, a compression coding circuit (36, 59, 61, 62) jointly controlled by the scanner and by the colour recognizing circuit for separately coding the runs of pixels of each one of colours, a medium-tone recognizing circuit (35, 114) for recognizing the scanned medium-tone colours, and a read only memory (62) for storing the coded pixel runs, characterized by a transition defining circuit (38) jointly controlled by the colour recognizing circuit (35) and by the scanner for defining the colour transitions of a first medium-tone run beginning with one basic colour and a second medium-tone run beginning with the opposite colour, the compression coding circuit also being conditioned by the colour recognizing circuit and by a medium tone address code (ADG) for separately storing in the memory the run codes of two basic colours and of two medium tone colours. Apparatus according to claim 5, characterized in that the compression coding circuit (36, 59, 61, 62) includes an address forming circuit (59, 61) controlled by the recognizing circuit (35) and by the transition defining circuit (38) for addressing the read only memory (62), and in that it comprises an output register (67) for temporarily storing the compression run length code addressed in the read only memory, and circuit means (35, 112, 118, 121) for recognizing the colour of a run subsequent to a medium-tone run to replace in the output register (67) the least significant bit of the compression medium-tone run length code with an additional bit (TAG) according to the colour of the initial pixel of the subsequent run. Apparatus according to claim 6, characterized by a decoding circuit (83, 75) for decoding compressed run length codes received from the output register (67), the decoding circuit including a second read only memory (75) formed by a first portion (78, 79) carrying the decompressed run length codes of only the two basic colour runs and a second portion (78', 79') carrying the decompressed run length codes of the two basic colour runs and of the two medium-tone runs, the two portions being selectively addressed by an input logic circuit (84) responsive both to the said additional bit (TAG) and to a medium tone address code. Apparatus according to claim 7, characterized in that the first memory (62) comprises two portions, one (63, 64) for compression of run length codes of only two types and the other (63', 64') for compression of run length codes of four different types and in that the second memory (75) also comprises two portions, one (78, 79) for decompression of run length codes of only two types and the other (78', 79') for decompression of run length codes of four different types, each portion of the memories being discriminated by a grey address code (ADG) supplied to a free address input (A10) of the first memory (62) or from a free address output (G) of the second memory (75).

Inventors: CANESCHI, MARIO, TADINI, GIORGIO
Applicants: ING. C. OLIVETTI & C., S.P.A.
Application year: 1983
Main classification: H04N1
IPC codes: H03M7, H04N1