Image processing apparatus, data processing apparatus and method therefor

Abstract: For achieving the encoding operation with optimum encoding methods in optimum encoding units according to the property of image, there is provided an image processing apparatus division means for dividing an image into plural encoding target blocks, selection means for selecting one of plural prepared encoding modes, for each of the encoding target blocks divided by the division means, and encoding means for encoding each encoding target block according to the encoding mode selected by the selection means, wherein the division by the division means enables existence of the encoding target blocks of different sizes within the image.

Description: BACKGROUND OF THE INVENTION Field of the Invention The present invention relates to an image processing apparatus for processing an image, a data processing apparatus and a method therefor. Related Background Art For reversible encoding of a multi-value image, there is already known DPCM (differential pulse code modulation). In general, the encoding by DPCM is achieved by calculating the predicted value (plane prediction) of an encoding target pixel, utilizing already encoded pixels around the encoding target pixel, for example a pixel (value a) at the left side, a pixel (value b) at the upper side and a pixel (value c) at the upper left position, for example according to a calculation formula (a + b - c), and encoding the difference between thus calculated predicted value and the value of the encoding target pixel. The multi-value gradation image, represented by image data obtained scanning a natural image such as a photograph, show significant difference in the statistical property depending on the position within the image. Such statistical difference arises from the difference in the local image structure, such as the presence of an edge in the image or the direction of inclination of the luminance. The above-mentioned prediction of the pixel value according to the DPCM method is only effective, among such local structures, for those that can be approximated partially to a two-dimensional plane, and is detrimental to other structures because of an increase in the dynamic range. For complementing such encoding method, there can be conceived an encoding method of effecting the encoding in the unit of a block, employing an encoding method effective for the structure prevailing in the block and attaching an index, indicating such encoding method, as additional information. However the local structure within the image generally occupies a large area in a flat (low frequency structure) portion but becomes as small as several pixels in an edge portion or a fine line portion with steep change in the luminance. Consequently, in case of encoding in the unit of a block, a larger block size is more efficient in such flat portion and a smaller block size is more efficient in the fine structure portion. However, even such flat portion may have a complex shape, and even the high frequency structure may extend uniformly over a wire area. Conventionally it has not been possible to effect encoding with the optimum encoding method, utilizing the optimum encoding unit according to the property of the image as explained above. Also in case of switching the encoding method in the unit of a block, there is conventionally conducted the Huffman encoding, utilizing a predetermined Huffman table for all the blocks. Consequently the efficiency of encoding is undesirably low, as the encoding with optimum entropy cannot be executed for each of the encoding methods used for such encoding block units. In consideration of the foregoing, a concern of the present invention is to enable encoding with an optimum encoding method in an optimum encoding unit, according to the property of the image. United States Patent Specification No. 4,922,340 discloses apparatus for compressing multilevel digital data which determines difference values between the gradation values of adjacent picture cells, stores such values and counts the number of occurrences of the various values so that high frequency occurrences can be encoded with smaller bit numbers than low frequency occurrences. According to the present invention there is provided an image processing apparatus as set out in claim 1 and an image processing method as set out in claim 6. In order that the present invention may be more readily understood embodiments thereof will now be described by way of example and with reference to the accompanying drawings, in which: Fig 1 is a block diagram of an encoding circuit of first and second embodiments of the present invention; Fig. 2 shows a pixel region cut out by a block cut-out circuit 111; Fig. 3 shows the encoded data format finally released from the encoding circuit of Fig. 1; Fig. 4 is a flow chart showing an encoding sequence of a second embodiment of the present invention; and ' Fig. 5 shows the encoded data format finally released by the second embodiment. Turning now to the accompanying drawings, Fig. 1 is a block diagram of an encoding apparatus constituting a first embodiment of the present invention. Figure 1 shows an image input device 100; an image memory 101; a block cut-out circuit 111; difference generating circuits 102, 103; buffers 112, 113; a Huffman encoding unit 104; a code amount comparator 105; a memory 106; a selector 108; a difference memory 114; a frequency counter 107; a Huffman encoding unit 109; and a code generator 110. A CPU 1 controls the above-mentioned circuits, based on a program stored in a ROM 2 and utilizing a RAM 3 as a work area. In the following there will be given a detailed explanation on the method of the encoding image information in the first embodiment. As an example, there will be explained the encoding of a monochromatic multi-value image of 8 bits (0 to 255). In the Huffman encoding circuit 104, there is set, in advance, a reference Huffman table, based on the statistics of prediction error. The frequency counter 107 counts the frequency of occurrence of the values from -255 to 255, the frequencies being initially set at 0. At first, image data entered from the image input device 100 are stored in the image memory 101. The block cut-out circuit 111 reads and stores the image data from the image memory 101, in the unit of a block of 8 × 8 pixels. In this operation, there are also read and stored the pixel data of 8 pixels positioned at the left and those at the top of the 8 × 8 block, as shown in Fig. 2. The difference generating circuit 102 generates, for each of the 8 × 8 pixels in the block, the difference from a pixel adjacent to the left, and stores thus generated 8 × 8 differences in the buffer 112. Similarly the difference generating circuit 103 generates, for each of the 8 × 8 pixels in the block, the difference from a pixel positioned thereabove, and stores the thus generated 8 × 8 differences in the buffer 113. The Huffman encoder 104 effects Huffman encoding of the difference data trains stored in the buffers 112, 113 according to predetermined Huffman tables, for output to the respectively different signal lines. The code amount comparator 105 compares the amounts of codes of the two Huffman encoded data trains released from the Huffman encoder 104 by each block, and releases "0" in case the amount of the Huffman encoded data released from the difference generating circuit 102, or the amount of the Huffman encoded data of the block when the differences are calculated with the pixels at the left, is less than the other, or releases "1" in case the amount of the Huffman encoded data released from the difference generating circuit 103, or the amount of the Huffman encoded data of the block when the differences are calculated with the pixels positioned above. The memory 106 stores the 1-bit output value released from the code amount comparator 105, in the unit of each block of 8 × 8 pixels. The selector 108 releases the difference data train stored in the buffer 112 or 113 respectively if the output of the code amount comparator 105 is "0" or "1". The difference frequency counter 107 counts the frequency of occurrence of each difference in the difference data train released from the selector 108. The memory 114 stores, for the entire image frame, the difference data train in the units of block of 8 × 8 pixels, released from the selector 108. After the process from the block cut-out circuit 114 to the difference memory 114 and the difference frequency counter 107 is completed for the entire image frame, the Huffman encoder 109 prepares a presumably optimum Huffman table, based on the statistics of the differences taken in the difference frequency counter 107. In the present embodiment, the table is so prepared in such a manner that the Huffman codes of progressively increasing length are assigned in the order of decreasing frequency. Then the difference data train of an image frame, stored in the memory 114, is Huffman encoded in the unit of a block of 8 × 8 pixels, based on the Huffman table prepared in the Huffman encoder 109. As shown in Fig. 3, the code generator 110 adds, to the Huffman encoded data of each block of 8 × 8 pixels released from the Huffman encoder 109, 1-bit information (difference mode information) indicating the pixels on which the differences are calculated in the block, and releases such information in the unit of an image frame. In this operation, the Huffman table prepared in the difference frequency counter 107 is attached to each image frame, for use in the decoding operation. In the embodiment explained above, the Huffman encoding may be replaced by other entropy encoding methods such as arithmetic encoding. Also the encoding may be conducted, instead of the difference between the pixels, on the run-lengths of the pixel values. Also the block size may be 4 × 4, 16 × 16 or 32 × 32 pixels instead of 8 × 8 pixels. The difference generating circuits 102, 103 employ two different difference generating methods, but such circuits may be so constructed as to utilize three or more difference generating methods. Also the present embodiment has been explained in case of processing an 8-bit multi-value monochromatic image, but it is applicable also to a binary image or to a color image. In the encoding operation of the first embodiment, the Huffman encoder 104 predicts, utilizing the reference Huffman table, whether the difference generating circuit 102 or 103 generates a smaller amount of codes, and the difference calculating mode, or the method of calculating the difference between the pixels, is determined according to the result of such prediction. However, since the actual encoding operation utilizes a Huffman table different from the reference Huffman table prepared by the Huffman encoder 109, the difference mode determined in advance may not be optimum for reducing the amount of the encoded data. Fig. 14 is a flow chart of a second embodiment which avoiding the above-mentioned drawback. The circuit configuration is basically same as that in the first embodiment. In the following the second embodiment will be explained in detail, with reference to Figs. 11 and 14. Steps S401 and S402 execute the block cut-out and the generation of the difference data train in the same manner as in the first embodiment. Then a step S403 prepares the reference Huffman table, for the first time, the Huffman table prepared in advance and same as that in the first - embodiment is set as the reference Huffman table. Then Huffman encoding is conducted with such reference Huffman table, and the code amounts of the Huffman encoded data trains are compared between the different difference modes (difference calculation with the pixel at the left, and that with the pixel above). Thus the difference mode is determined for each block of 8 × 8 pixels, and the result of determination is stored as 1-bit data in the memory 106 (S404 - S406). The selector 108 selects the difference data train according to the output of the code amount comparator 105, and thus released difference data train is stored, in the unit of a block of 8 × 8 pixels, in the difference memory 114. The process up to this point is same as in the first embodiment. In the second embodiment, when the optimum Huffman table is prepared by the Huffman encoder 109, it is compared, in a step S409, with the reference Huffman table employed by the Huffman encoder in the step S404. If the comparison of the step S409 identifies that the two Huffman tables are same, the determination of the difference mode in the step S406 is based on the optimum Huffman table to be used in the final encoding consequently the encoding process thereafter is same as that in the first embodiment, and the encoded data are released from the code generator in the order shown in Fig. 15. If the step S409 identifies that the two Huffman tables are mutually different, the CPU 1 stores the data of the optimum Huffman table, generated in the Huffman encoder 109, in the RAM 103, then resets the process from the block cut-out circuit to the code generator 104, and repeats the process of the steps S401 to S408, for preparing the optimum Huffman table. This repeated process is different from the initial cycle in the setting of the reference Huffman table in the step S403. The second or subsequent process of the steps S401 to S408 employs the optimum Huffman table prepared in the step S403 of the preceding cycle (stored in the RAM 3) as the reference Huffman table. This encoding process is conducted until the two Huffman tables (reference Huffman table and optimum Huffman table) mutually coincide at the preparation of the optimum Huffman table in the step S408. The process thereafter is same as that in the second embodiment. The control may also be so designed that the sequence proceeds from the step S409 to S410 in case the process of the steps S401 to S408 is executed by a predetermined number of times or the Huffman table prepared in the step S408 satisfies a predetermined encoding efficiency, even if the two Huffman tables do not mutually coincide. The Huffman tables employed in the first and second embodiments may be replaced by other entropy encoding tables, such as Golomb-Rice encoding tables. In the first and second embodiments, in case of switching the encoding method for each block unit of the encoding target data, the actual entropy encoding method is determined after the determination of the efficient encoding method for each block, so that the entropy encoding can be executed in optimal manner, matching the encoding method for each block unit. Also in the second embodiment, the entropy (Huffman) encoding table used as the reference is renewed to obtain the entropy encoding table, the encoding method for each block and the encoding efficiency, in the optimal manner.

Claims: An image processing apparatus comprising: means (111) for dividing pixel image data into plural similar data streams; coding means (102, 103) for encoding differently each of said plural similar data streams to generate plural target data streams which are different from each other; first entropy encoding means (104) for entropy encoding said plural target data streams using a first entropy encoding table to generate plural encoded target data streams; and comparison means (105) for comparing the data amounts of said encoded target data streams; and characterised by : selection means (108) for selecting one of said encoded target data streams in response to the output of said comparison means; table generating means (1) for generating a second entropy encoding table in accordance with the content of the encoded target data stream selected by said selection means; and second entropy encoding means (109) for entropy encoding the target data stream selected by said selection means utilising the second entropy encoding table so that the selected target data stream is not entropy encoded by said first entropy encoding means. Apparatus according to claim 1, wherein said coding means (102,103) for coding the plural similar data streams are adapted to generate said target data streams as difference data. Apparatus according to claim 2, wherein said difference data is generated for each target data stream by the comparison of adjacent pixels, the relationship between pixels being compared being different in each of said coding means (102,103). Apparatus according to claim 3, wherein said table generating means generates the second entropy encoding table in accordance with the frequency of occurrence of differences in the selected target data stream. Apparatus according to any preceding claim, wherein the first and second entropy encoding means are Huffman encoders. An image processing method comprising: a step of dividing pixel image data into plural simi-lar data streams; a step of encoding differently each of said plural similar data streams to generate plural target data streams which are different from each other; a step of utilising first entropy encoding means (104) to entropy encode said plural target data streams using a first entropy encoding table so as to generate plural encoded target data streams; and a step of comparing the data amounts of said encoded target data streams; a step of selecting one of said encoded target data streams in response to the output of said comparison step; a step of generating a second entropy encoding table in accordance with the content of the encoded target data stream selected by said selection step; and a step of utilising second entropy encoding means (109) to entropy encode the target data stream selected by said selection step utilising the second entropy encoding table so that the selected target data stream is not entropy encoded by said first entropy encoding step. A method according to claim 6, wherein said coding step for coding the plural similar data streams generates said target data streams as difference data. A method according to claim 7, wherein said difference data is generated for each target data stream by the comparison of adjacent pixels, the relationship between pixels being compared in a target data stream being different. A method according to claim 8, wherein the second entropy encoding table is generated in accordance with the frequency of occurrence of differences in the selected target data stream. A method according to any one of claims 6 to 9, wherein the first and second entropy encoding means are Huffman encoders.

Inventors: HIRABAYASHI YASUJI, KAJIWARA HIROSHI, YOSHIDA TADASHI, HIRABAYASHI, YASUJI, KAJIWARA, HIROSHI, YOSHIDA, TADASHI
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1996
Main classification: H04N7
IPC codes: H04N1, H04N7