Image encoding method and apparatus

Abstract: This invention relates to an image encoding method and apparatus and, more particularly, to determination of an encoding parameter. According to this invention, a method of determining a parameter for encoding an image to be encoded in accordance with an encoding parameter of the already encoded image is disclosed.

Description: BACKGROUND OF THE INVENTION Field of the Invention The present invention relates to an image encoding method of encoding image data to obtain a predetermined code quantity and, more particularly, to a method which is suitably applied to a solid-state electronic still camera, an image communication, and the like. Related Background Art Conventionally, as one of compression encoding methods, variable-length encoding which varies the quantity of encoded data depending on image data is known. For example, an ADCT (Adaptive Discrete Cosine Transform) method examined by the so-called JPEG (Joint Photographic Expert Group) is known as described in the publication "ISO Adaptive discrete cosine transform coding scheme for still image telecommunication services" issued on January 25 1988 by ISO/TC97/SC2/WG8-ADCTG. This encoding method requires a technique for changing a quantization parameter to converge a code quantity to a predetermined value. However, when a plurality of images are input, a correlation of these images is not utilized to set a quantization parameter. For this reason, when a continuous photographing mode is set in, e.g., a solid-state electronic still camera, an arithmetic operation for setting a quantization parameter for one frame requires much time, and a continuous photographing speed is limited. A technique for dividing one frame of a dynamic image to be transmitted into a plurality of blocks, changing a sampling density in units of blocks in accordance with a correlation among frames, and transmitting the image is proposed in U.S. Patent Nos. 4,947,448, 4,755,878, and 4,916,537. However, with the above-mentioned technique, there is room for improvement about a compression ratio of an image. A paper entitled "A Motion Picture Coding Algorithm Using Adaptive DCT Encoding Based on Coefficient Power Distribution Classification" by Kato et al published in the IEEE Journal on Selected Areas in Communications, Vol. 5, No. 7, August 1987 at pages 1090 to 1099 describes a technique in which high coding efficiency is obtained by an adaptive DCT encoding technique in which encoding parameters are fitted to widely varying characteristics of the interframe differential signal with segmented DCT sub-blocks of interframe prediction error being classified into categories based on their coefficient power distribution characteristics. Each DCT coefficient is uniformly quantized and then a variable word length code is assigned to the quantization index. Adaptivity is provided by changing the variable word length code set to suit the probability density function of each quantization index. Control logic determines both the input frame dropping rate and the quantization step value. The quantization step value is estimated based on the current frame characteristics using a feed-forward arrangement rather than a simple estimation method which determines the information rate versus quantization step value characteristics based on the coding results of the previous frame. A paper entitled "Adaptive Cosine Transform Coding of Images in Perceptual Domain" by Ngan et al published in the IEEE Transactions on Acoustics, Speech and Signal Processing, Vol. 37, No. 11, November 1989 at pages 1743 to 1749 describes a coding scheme for colour images which incorporates human visual properties into the coding scheme and employs adaptive quantization to exploit the statistical nature of the coefficients. To account for varying bit rates, the quantizer range is dynamically adjusted by a multiplication range scale factor fed back from a rate buffer so that the bit rate varies in response to the buffer status and activity in the block. According to one aspect of the present invention, there is provided an image encoding method as set out in claim 1. The present invention also provides an image encoding apparatus as set out in claim 12. Other aspects and features of the present invention will become apparent from the following description taken in conjunction with the accompanying drawings and the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram showing the overall arrangement of the first embodiment of the present invention; Fig. 2 is a graph for explaining the principle of setting a quantization parameter according to the present invention; Fig. 3 is a block diagram showing an arrangement of a variable-length encode unit according to the present invention; Fig. 4 is a block diagram showing an arrangement of the third embodiment of the present invention; Fig. 5 is a flow chart showing processing according to the first embodiment of the present invention; Figs. 6 and 7 are graphs for explaining the principle of setting a quantization parameter according to the present invention; Fig. 8 is a block diagram showing an arrangement of the fourth embodiment of the present invention; Fig. 9 is a block diagram showing an arrangement of the fifth embodiment of the present invention; and Fig. 10 is a block diagram showing an arrangement of the sixth embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS <First Embodiment> Fig. 1 is a view for explaining the first embodiment of the present invention. In Fig. 1, an image input unit 101 comprises a CCD line sensor, an area sensor, an input interface for a computer, and the like, and is connected to a frame memory 102 for storing one frame of an input image. The frame memory 102 is connected to a variable-length encode unit 103 for performing variable-length encoding. The unit 103 is connected to a selector 104 for selecting a destination of encoded data. The selector 104 is connected to a memory unit 105 for storing encoded data. The selector 104 is also connected to a quantization parameter calculation unit 106 for calculating a quantization parameter for the encode unit 103. The unit 106 is connected to a memory unit 107 for storing a quantization parameter of a previous frame, and a mode signal generation unit 108 for setting a continuous photographing mode, and the like, and generating a mode signal. The memory unit 105 is connected to a decode unit 109 for decoding the encoded data stored in the memory unit 105. The decode unit 109 is connected to an image display unit 110 for displaying the decoded image data using, e.g., a display. Image data of one frame input from the image input unit 101 is stored in the frame memory 102. The variable-length encode unit 103 reads out image data from the frame memory 102, and encodes it. In this case, since the image data encoded by the encode unit 103 does not always have a predetermined code length, when a fixed length code is to be finally obtained, a quantization parameter F of the encode unit 103 must be set to be an appropriate value. The quantization parameter calculation unit 106 calculates the quantization parameter F. More specifically, the quantization parameter calculation unit 106 connects the selector 104 to an A-side to sequentially perform encoding operations using different quantization parameters F until the code quantity is converged to a predetermined value. When the code quantity is converged, the unit 106 connects the selector 104 to a B-side. Encoding is performed again in the variable-length encode unit 103 using a value Fa of the quantization parameter F at that time. The parameter Fa is stored in the memory unit 105 together with encoded data output from the encode unit 103. As a result, data encoded into a predetermined code quantity is output to an output terminal. The variable-length encode unit 103 will be described below with reference to Fig. 3. Image data input to the variable-length encode unit 103 is divided into blocks each consisting of 8 x 8 pixels by a block formation unit 301. Data of each block are subjected to DCT (discrete cosine transform) by a DCT unit 302, thus obtaining 8 x 8 transform coefficients. The transform coefficients are quantized by a quantization unit 303. In this case, the coarseness of quantization can be adjusted based on the quantization parameter F. When the quantization parameter F is adjusted, a code length can be adjusted. The quantized transform coefficients are converted into variable-length codes by an entropy encode unit 304 in accordance with entropy encoding such as Huffman encoding, MH encoding, MR encoding, arithmetic encoding, or the like, and are output as compression codes. When the value of the quantization parameter F is increased, quantization is performed by coarse quantization steps, an information quantity (redundancy) is decreased, and a compression code quantity is decreased. In contrast to this, when the value F is decreased, quantization is performed by fine quantization steps, an information quantity (redundancy) is increased, and a compression code quantity is increased. Fig. 6 is a graph showing the relationship between the quantization parameter F and a compression code quantity B. Although this curve varies depending on each image, it can be commonly expressed by a monotonically decreasing function. Thus, the ADCT method of the JPEG adopts the Newton-Raphson method to obtain a value F x for defining a setup code quantity B x by repetition processing. The value F is adjusted by a quantization parameter calculation unit 106 shown in Fig.10 so as to converge a compression code quantity B to B x . When encoding is repeated, an initial value of a quantization parameter is defined by a predetermined value F 0 regardless of the images. For example, in an image having an F - B curve shown in Fig. 6, a quantization parameter is converged from the initial value F 0 to F 1 and F x in turn. However, since the initial parameter F 0 of the quantization parameter in repetitive encoding is set to be a constant value regardless of images, the number of times of repetitions until a code quantity is converged to the setup code quantity B x becomes very large in some images. More specifically, as shown in Fig. 7, images normally have different curves representing the relationship between the quantization parameter F and the compression code quantity B. For example, in Fig. 7, quantization parameters for defining setup code quantities B x of images 1 ○ and 2 ○. are respectively represented by F x and F x ', and an error of the initial value F 0 of the image 1 ○ is larger than that of the image 2 ○. For this reason, the image 1 ○. requires extra repetitions. When the present invention is applied to image compression of a solid-state electronic still camera, a high-speed continuous photographing operation (e.g., 10 frames/sec) requires compression within a short period of time. However, in the above-mentioned circumstances, it is very difficult to attain the high-speed continuous photographing operation in consideration of an arithmetic speed of existing ICs. The present invention can solve this problem on the basis of the concept described below. More specifically, when a plurality of images are to be photographed using a given photographing means, a photographed image, and images photographed before and after it usually include a similar background, and a similar object. Therefore, since the information quantity of the image is almost equal to those of images photographed before and after the image, it can be expected that the F - B curves representing the relationship between the quantization parameter and the compression code quantity may be similar to each other. Especially, in a continuous photographing mode of a solid-state electronic still camera, this tendency is outstanding. For example, in the continuous photographing mode, as shown in Fig. 2, if (n-1)th and n-th photographed images have similar F - B curves, quantization parameters for defining the setup code quantity B x have close values like F (n-1)x and F (n)x . Therefore, if a quantization parameter F (n-1) for defining the setup code quantity in encoding of the (n-1)th image is used as an initial value for obtaining a quantization parameter in encoding of the n-th image, the number of times of repetitions of encoding for determining the quantization parameter can be decreased. According to the present invention, an initial value F n of the quantization parameter in encoding of the n-th image is determined by using the quantization parameter F (n-1) (using in encoding of (n-1)th image) or with reference to it. With this method, a code quantity can be converged to a target code quantity by a small number of times of repetitions of encoding. The algorithm and the arrangement for realizing the algorithm will be described below. The previous image quantization parameter memory unit 107 stores a quantization parameter for defining a setup code quantity F (n-1) of a previously encoded image, and comprises, e.g., a RAM. An initial value F (n)0 of a quantization parameter of an n-th image is determined by the quantization parameter calculation unit 106 with reference to a value F (n-1)x stored in the previous image quantization parameter memory unit 107. A calculation method of this embodiment can be selected from three modes A, B, and C, which are given by the following equations: A : F ( n )0 = F ( n -1) x B : F ( n )0 = ( F ( n -1) x + F 0 )/2 C : F ( n )0 = F 0 (where F 0 is a constant which is stored in advance as a default value for calculating a quantization parameter) The modes are selected as follows in, e.g., a solid-state electronic still camera. The mode A is used in the continuous photographing mode, and the mode B is used when a predetermined time T or more has not elapsed from previous encoding. In addition, the mode C is used in other cases. In particular, when there is no information of a previous image, e.g., when an encode unit performs first encoding, the mode C is used. In this embodiment, three initial value calculation methods are available. However, the number of modes may be increased or decreased. Fig. 5 is a flow chart for explaining the operation of the quantization parameter calculation unit 106 described above. In step S1, an n-th image is read out from the frame memory 102, and is encoded by the encode unit 103. In this case, the selector 104 is connected to the A-side (S2). If the mode C is selected (S3), a quantization parameter in first quantization is set to be F (n)0 = F 0 (F 0 is the initial value) (S4). On the other hand, if the mode B is selected (S5), the quantization parameter is set to be F (n)0 = (F (n-1)x + F 0 )/2, i.e., an average value of the initial value F 0 and the parameter F (n-1)x of the previous frame (S6). In contrast to this, if the mode A is selected, the quantization parameter is set to be F (n)0 = F (n-1)x (S7). Then, a quantization parameter F (n)x having a predetermined code length is calculated using a feedback loop (S8). The selector 104 is connected to the B-side (S9) to output codes (S10). In the continuous photographing mode, the above-mentioned operations are repeated for a predetermined number of sheets (S11). In this embodiment, the previous image quantization parameter memory unit 107 for storing the quantization parameter is specially arranged. However, since a system for recording compression data on a given recording medium records a value F x as additional information of the compression data, the value may be read out from the recording medium. The variable-length encode unit may employ orthogonal transform methods other than the DCT, such as the Hadamard transform. The block size is not limited to 8 x 8 pixels, but may be other sizes. The encode unit need not always employ entropy encoding, but may employ other encoding methods such as vector quantization. If an increase in error of the compression code quantity is permitted, next input image data may be directly encoded using the initial value of the quantization parameter determined according to the present invention without performing repetition by the Newton-Raphson method. <Second Embodiment> As one of the ADCT methods, a method of calculating a high-frequency intensity of an image, and estimating a quantization parameter for defining a setup code quantity on the basis of the calculation value is known. In this method, a method which refers to a quantization parameter of a previous image according to the present invention is effective. For example, in a continuous photographing mode of a solid-state electronic still camera, a quantization parameter of only a first image is estimated based on a high-frequency intensity, and can be used for the following images without calculating the high-frequency intensity. Thus, a total processing time can be shortened by a time required for calculating the high-frequency intensity. In the method of estimating a quantization parameter for defining a predetermined code quantity on the basis of a high-frequency intensity, an estimated value generally has an error. For this reason, estimation based on the high-frequency intensity is required for each quantization. In this case, an average value of an estimated value of a previous image, and an estimated value of a new image to be encoded may be used to allow more precise estimation. <Third Embodiment> In the first embodiment, the DCT unit performs the DCT by reading out image data from the frame memory 102 every time encoding is repeated, as shown in Fig. 3. Alternatively, as shown in Fig. 4, a memory unit 305 for storing a transform coefficient after the DCT may be arranged, thus omitting the repetitive DCT operations. As a result, a processing speed can be greatly improved. <Fourth Embodiment> In each of the above embodiments, the present invention is applied to a setup operation of a quantization parameter in encoding of a still image. However, the concept of the present invention can be applied to, e.g., an image of a video camera. More specifically, when an arrangement shown in Fig. 8 is adopted, an encoding method of the present invention can be applied to a dynamic image (or animation). In Fig. 8, an image input unit, e.g., a TV camera 101 comprises a CCD area sensor, and is connected to frame memories 102-1 to 102-n used for delaying a dynamic image by a time necessary for an arithmetic operation for setting a quantization parameter. In the case of a dynamic image, since images for 30 frames (60 fields) are input per second in the NTSC method, the number of input images becomes large as compared to a time for repeating encoding. In order to compensate for the time difference, the arrangement having the plurality of frame memories is employed. The frame memories are connected to a selector 111 for selecting image data. When a first image is input, a B-side is selected. After the quantization parameter of the first image is set, a delayed image at the A-side is used for the second and subsequent images. In this embodiment, since quantization parameters for the second and subsequent images are calculated on the basis of the quantization parameter of the first image, parameter calculation times of the second and subsequent images can be shortened. With the above arrangement, the present invention can be applied to encoding in a storage apparatus such as a dynamic image filing system. The type of signal is not limited to NTSC but may be other methods such as PAL, HD, ED, and the like. <Fifth Embodiment> The present invention can be applied to an image data transmission apparatus such as a facsimile, as shown in Fig. 9. In Fig. 9, a transmission unit 112 transmits encoded data to a reception unit 113. The reception unit 113 is connected to a decode unit 114. The decode unit 114 is connected to an image reproduction unit 115 for reproducing a decoded image as a hard copy or a soft copy. <Sixth Embodiment> In Fig. 10, the present invention is applied to transmission of dynamic images of, e.g., a video telephone or a television. In Fig. 10, components 101 to 111 are the same as those in Fig. 8, and components 112 to 115 are the same as those in Fig. 9. Note that each of the first to sixth embodiments can be applied to encoding of a color image. More specifically, the above-mentioned encoding can be performed for various color images including luminance components and chromatic components such as (Y, I, Q), (L*, a*, b*), (L*, u, v), (R, G, B), (Y, M, C), (X, Y, Z), and the like in units of components. In this case, for, e.g., (Y, I, Q) signals, when I and Q sampling widths are increased as compared to that of Y, a compression ratio can be increased, and degradation of image quality is not so visually outstanding. In each of the above embodiments, a method of setting a quantization parameter to be a proper value has been exemplified. For example, another quantization condition such as quantization bit assignment may be set in accordance with a quantization condition of a frame which is already quantized. In each of the above embodiments, an image of a previous frame is encoded. However, for the image of the previous frame, only a quantization parameter need only be set. For example, in a still video camera for performing pre-exposure, a quantization parameter may be calculated in the pre-exposure, and encoding may be performed in main exposure based on the parameter or a parameter calculated with reference to the parameter. In this manner, a time required for calculating a quantization parameter in main exposure can be greatly shortened. As described above, according to the above embodiments, a quantization parameter used for a previously encoded image is referred to determine an initial value of a quantization parameter of an image to be encoded next, so that data can be compressed to a predetermined code quantity by a smaller number of times of repetitions of encoding, i.e., within a shorter time than in a conventional apparatus. In particular, when the present invention is applied to a solid-state electronic still camera for a still image, high-speed continuous photographing operations can be attained while compressing data to a predetermined code quantity. In addition, since a compression time can be shortened, power consumption can be saved. Furthermore, each of the above embodiments can be applied to an apparatus for compressing and storing a still image, e.g., an electronic filing system, a copying machine, and the like. In particular, a copying machine which has a plurality of drums in units of colors, and in which distances among the drums cannot be ignored requires image compression, and the present invention is effective. The present invention is not limited to a still image, but may be applied to a dynamic image of, e.g., a video tape recorder, a video television, or the like. As described above, according to the present invention, a compression code having a predetermined code quantity can be obtained at high speed. The present invention is not limited to the above embodiments, and various changes and modifications may be made within the scope of claims.

Claims: An image encoding method, comprising the steps of: receiving image data representing an image; storing the input image data in storing means (102); carrying out a first encoding step by encoding the stored image data using an initial encoding parameter (f n(0) ); measuring the amount of encoded image data; and repeating the encoding and measuring steps varying the encoding parameter to cause the amount of encoded image data to converge towards a desired amount of encoded image data, characterised by determining the encoding parameter used to obtain the desired amount of encoded image data for an image and storing that encoding parameter (F (n-1)X ) in encoding parameter storing means (107), using a predetermined default encoding parameter (F 0 ) as the initial encoding parameter for the first of the encoding and measuring steps for a succeeding one of successive images when the interval between the succeeding image and the previous image is equal to or greater than a predetermined period of time (T), and using an encoding parameter set according to the stored encoding parameter (F (n-1)X ) used for encoding the previous one of the successive images as the initial encoding parameter for the first of the encoding and measuring steps for a succeeding one of the successive images when the interval between the succeeding and the previous images is less than the said predetermined period of time. A method according to claim 1, which comprises using a weighted combination of the stored encoding parameter (F (n-1)x ) used for encoding the previous image and the default encoding parameter (F 0 ) to determine the initial encoding parameter (f n(0) ) when the interval between the images is less than the said predetermined period of time and the images are not received as a continuous stream. A method according to claim 1 or 2, wherein said encoding step includes a step of frequency-transforming an image in units of predetermined blocks of image data. A method according to claim 3, which comprises using an orthogonal transform to frequency transform the image. A method according to claim 4, wherein said orthogonal transform is a DCT. A method according to claim 3, 4 or 5, wherein said encoding step includes the step of quantizing a frequency-transformed transform coefficient. A method according to claim 6, wherein said encoding parameter is a parameter associated with the quantizing step. A method according to claim 6 or 7, further comprising the step of Huffman-encoding the quantized transform coefficient. A method according to any one of the preceding claims, further comprising the step of storing encoded images in a memory for a predetermined number of image frames. A method according to any one of the preceding claims, which comprises using a CCD sensor to supply input image data. A method of operating a still electronic camera which comprises carrying out an imaging encoding method in accordance with any one of the preceding claims to determine the required encoding parameter during a pre-exposure operation of the camera. An image encoding apparatus, comprising: input means (101) for receiving image data representing an image; storing means (102) for storing input image data representing an image; encoding parameter storing means (107) for storing an encoding parameter; encoding means (106) for reading image data from the storing means and for encoding the stored image data using an encoding parameter; measuring means (106) for measuring the amount of encoded image data; control means (106, 104) for causing the encoding means (103) to carry out a first encoding step by encoding the stored image using an initial encoding parameter (f n(0) ) read from the encoding parameter storing means (107), for causing the measuring means to carry out a first measurement step by measuring the resulting amount of encoded image data and for causing the encoding and measuring means to carry out further encoding and measuring steps varying the encoding parameter until the amount of encoded image data converges towards a desired amount of encoded image data, characterised by means (106) for determining the encoding parameter used to obtain the desired amount of encoded image data for an image and for causing that encoding parameter (F (n-1)x ) to be stored in the encoding parameter storing means (107) ; and the control means (106, 104) being arranged to cause the encoding means (103) to use a predetermined default encoding parameter (F 0 ) as the initial encoding parameter for the first of the encoding and measuring steps for a succeeding one of successive images when the interval between the succeeding image and the previous image is equal to or greater than a predetermined period of time (T) and to cause the encoding means (103) to use an encoding parameter set according to the stored encoding parameter (F (n-1)X ) used for encoding the previous one of the successive images as the initial encoding parameter for the first of the encoding and measuring steps for a succeeding one of the successive images when the interval between the succeeding and the previous images is less than the said predetermined period of time. An apparatus according to claim 12, wherein the control means (106,104) is arranged to cause the encoding means (103) to use a weighted combination of the stored encoding parameter (F (n-1)x ) used for encoding the previous image and the default encoding parameter (F 0 ) to determine the initial encoding parameter (f n(0) ) when the interval between the images is less than the said predetermined period of time and the images are not received as a continuous stream. An apparatus according to claim 12 or 13, wherein the encoding means (103) includes transform means (302) for frequency-transforming the input images in units of predetermined blocks. An apparatus according to claim 14, wherein the frequency transforming means (302) is an orthogonal transform means. An apparatus according to claim 14 or 15, wherein the encoding means (103) includes quantization means (303) for quantizing a frequency-transformed transform coefficient. An apparatus according to claim 16, wherein said encoding parameter is a quantization parameter (F) of said quantization means (303). An apparatus according to any one of claims 14 to 17, further comprising memory means (305) for storing a frequency-transformed image. An apparatus according to any one of claims 12 to 18, further comprising memory means (105) for storing the encoded images for a predetermined number of image frames. An apparatus according to any one of claims 12 to 19, which comprises a CCD sensor (101) for supplying the input image data. An electronic camera comprising an image encoding apparatus in accordance with any one of claims 12 to 20. An electronic still camera comprising an image encoding apparatus in accordance with any one of claims 12 to 20. An electronic still camera according to claim 22, comprising means for determining the required encoding parameter during a pre-exposure operation of the camera. A video recorder/receiver comprising an image encoding apparatus in accordance with any one of claims 12 to 20 and a plurality of frame memories (102-1 to 102-n) for delaying a dynamic image to enable operation of the image encoding apparatus. An electronic filing system having an image encoding apparatus in accordance with any one of claims 12 to 20. A copying machine having an image encoding apparatus in accordance with any one of claims 12 to 20.

Inventors: HORIUCHI IZURU, JINNAI SHIGERU, YAMAGAMI TAKU, HORIUCHI, IZURU, JINNAI, SHIGERU, YAMAGAMI, TAKU, HORIUCHI, IZURU, C/O CANON KABUSHIKI KAISHA, Jinnai, Shigeru, c/o Canon Kabushiki Kaisha, YAMAGAMI, TAKU, C/O CANON KABUSHIKI KAISHA
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1991
Main classification: H04N7
IPC codes: H04N7