Image coding method and apparatus therefor

Abstract: An image coding method includes the steps of producing a complexity normalizing value of respective macro blocks based on a complexity in a space domain with regard to an input image, producing a zero coefficient sum by performing a discrete cosine transform operation on the input image and counting the discrete cosine transform coefficients from -1 to +1, producing a zero coefficient normalizing value for respective macro blocks in accordance with the zero coefficient sum; producing a transient weight for respective macro blocks in accordance with the zero coefficient sum and a predetermined compression ratio, and summing the complexity normalizing value, the zero coefficient normalizing value and the transient weight so as to produce the scale factor. The quantization step size of the discrete cosine transform coefficients is controlled in a macro block unit in accordance with the scale factor. Thus, image frames having various complexities can be encoded at a constant bit rate with no deterioration of the image.

Description: The present invention relates to an image coding method and apparatus therefor, and more particularly, but not exclusively, to an image coding method and apparatus therefor for obtaining a scale factor in accordance with a complexity and then quantizing the image, to encode images having different complexities at a constant bit rate. Storage and communication technologies have rapidly developed due to recent advancements in the fields of computers, semiconductor manufacturing and digital signal processing. Further development requires improved methods for effectively storing image information on a recording medium and for increasing the quality of a reproduced image processed in a digital image apparatus such as a digital videocassette recorder, high-definition television, digital video camera, video phone or television phone set. Here, a digital image signal has a much larger data quantity than that of an analog type, so compression of the image data is necessary in order to effectively use recording media and communication channels. Methods used for image signal compression include a discrete cosine transform (DCT) method and a variable-length coding (VLC) method. Figure 1 is a block diagram illustrating the structure of a conventional image signal coding apparatus. In Figure 1, a DCT unit 11 receives an input time-domain image block having a constant size (e.g., 8×8) and produces 64 discrete cosine coefficients in the frequency domain. A quantizer 12 quantizes the discrete cosine coefficients output from DCT unit 11, at a predetermined quantization step size. Then, a VLC unit 13 produces a variable length of coding data so that data of less quantity (or whose information value is lower) is allotted fewer bits and data of greater quantity (or whose information value is higher) is allotted more bits, thus minimizing the number of bits required for coding. Since the length of the data output from VLC unit 13 is not constant, a buffer 14 temporally stores this data so that encoded data having a constant bit rate can be output. In the prior art, DCT unit 11 divides an input image into smaller images of 8×8 blocks and then independently processes each sub-divided image block. Quantizer 12 quantizes the DCT coefficients at the quantization step size obtained in accordance with the state of buffer 14 and the complexity of the current input image. Therefore, if the difference between the quantization step size of adjacent macro blocks is large, the correlation between adjacent blocks is lost along the borders, which leads to a "block effect" phenomenon. In addition, when quantization is performed for the respective macro blocks at a constant quantization step size, since the complexity of each block is different even within a given frame, errors occur non-uniformly in the frame, resulting in an artifact whereby the image quality of a specific portion is deteriorated. Therefore, it is most important that a proper quantization step size should be determined in order to prevent the generation of the artifact. On the other hand, since the code length generated in the variable length coding is variable, reproducing is difficult when performing special reproducing functions such as a high speed search. Accordingly, the bit quantity must be controlled so as to be constant. Also, the quantization step size of the quantizing unit is determined by a scale factor, which is an important parameter for determining the bit rate, and in turn determines the compression ratio and affects the resolution of the frame. However, as shown in Figure 1, when a buffer is used to provide a constant bit quantity, since the quantization step size is controlled by the fullness ratio of the buffer, there may be difficulty in the bit allocation for a specific region (or macro block) in adaptive to the complexity of a frame. EP-A-0,554,871 (Sony Corporation) discloses forming an encoded digital image by placing an integer number of macro blocks representing orthongonally transformed image data for a certain portion of the image, into a sync block. When a sync block is reproduced at high speed, the reproduced data corresponds to a displayable portion of the image including DC components and both high and low frequency AC components. Further, United States Patent No. 5,253,075 discloses an image signal encoding/decoding system that, after the complexity of a DCT transform block is detected, the quantization step size of the quantizer is adaptively controlled in accordance with the relationship of adjacent DCT transform blocks, so as to alleviate the block effect phenomenon. In such an apparatus, the complexity of an image is detected based on the information in a frequency domain so as to control the quantization step size. However, the image encoding/decoding system of the prior art fails to provide means for encoding a specific block (or macro block) in a constant bit rate. Accordingly, an aim of preferred embodiments of the present invention is to provide an image coding method for determining a scale factor, wherein encoded image data has a constant bit rate being adaptive to a complexity detected for each sub-block which is composed of a predetermined number of unit blocks. Another aim is to provide an image coding method for controlling the quantization step size being adaptive to the complexity detected in the space domain and frequency domain per macro block. Still another aim is to provide an image coding apparatus for obtaining a scale factor being adaptive to the complexity detected per sub-block. In accordance with a first aspect of the invention there is provided an image coding method for dividing an input image into sub-blocks composed of a predetermined number of unit blocks, quantizing the divided image signal at a quantization step size which is determined in accordance with a scale factor, and then coding, the image coding method characterised by the steps of: producing a complexity normalizing value of respective sub-blocks, based on a complexity in the space domain with regard to the input image; producing a zero coefficient sum by performing a discrete cosine transform operation on the input image and counting the discrete cosine transform coefficients within a predetermined range; producing a zero coefficient normalizing value for respective sub-blocks in accordance with the zero coefficient sum; producing a transient weight for respective sub-blocks in accordance with the zero coefficient sum and a predetermined compression ratio; and summing the complexity normalizing value, the zero coefficient normalizing value and the transient weight, so as to produce the scale factor. Preferably, said step of producing a complexity normalizing value is performed for a luminance signal. Said predetermined range is preferably from -1 to +1. Preferably, in said step of producing a zero coefficient sum, the coefficient whose discrete cosine transform coefficient is equal to or greater than -1 and is equal to or lower than +1, is the coefficient for the luminance signal. Said sub-block may be a macro block. Said step of producing a complexity normalizing value preferably comprises the steps of: producing an average complexity for respective unit blocks in a macro block; producing an average complexity for the macro block based on the average complexities of respective unit blocks; producing a difference between the average complexity and a real pixel value of a unit block, so as to produce a square average value of a unit block; adding one to the minimum value among the square average values for respective unit blocks in a macro block, so as to produce a minimum square average value of the macro block; and normalizing the respective macro blocks in accordance with the minimum square average value and the average complexity of the macro block, so as to produce a complexity normalizing value of respective macro blocks. Said step of producing a zero coefficient normalizing value preferably comprises the steps of: summing up all the zero coefficient sums of macro blocks, so as to produce an overall zero coefficient sum; producing an average zero coefficient sum of macro blocks, in accordance with the overall zero coefficient sum; producing a zero coefficient square average value of macro block in accordance with the difference between the average zero coefficient sum of macro blocks and the zero coefficient sum of the macro block; and normalizing in accordance with the zero coefficient square average value and the zero coefficient sum of the macro block, so as to produce a zero coefficient normalizing value of each macro block. Preferably, the step of producing a transient weight further comprises the steps of: summing up all the zero coefficient sums, so as to produce an overall zero coefficient sum; producing an average zero coefficient sum of macro blocks in accordance with the overall zero coefficient sum; and producing a transient weight of respective macro block in accordance with the average zero coefficient sum of macro blocks and a predetermined scale factor. In accordance with a second aspect of the invention, there is provided an image coding apparatus comprising: a discrete cosine transform unit for performing a discrete cosine transform function with respect to an input image to be divided into sub-blocks composed of a predetermined number of unit blocks, to produce discrete cosine transform co-efficient; a quantizing unit for quantizing the discrete cosine transform coefficient at a predetermined quantization step size determined in accordance with a scale factor; and a variable-length coding unit for encoding the quantized coefficient into a variable-length code; characterised by: the discrete cosine transform unit performing the discrete cosine transform function on a sub-block as time-domain data so as to produce a discrete cosine transform coefficient as frequency-domain data; a complexity calculating unit for producing a complexity in accordance with a pixel value of an input image per sub-block; a complexity normalizing unit for normalizing the complexity for respective sub blocks; a zero coefficient counting unit for counting the zero coefficients within a predetermined range per sub-block among the discrete cosine transform coefficients from said discrete cosine transform unit; a zero coefficient normalizing unit for normalizing the zero coefficient for respective sub-blocks; a weight calculating unit for producing a transient weight in accordance with the zero coefficient and a predetermined compression ratio; and a scale factor generator for summing the complexity normalizing value, the zero coefficient normalizing value and the transient weight, to generate the scale factor and supply the scale factor to the quantizing unit. Said sub-block is preferably a macro block unit. Said predetermined range is preferably from -1 to +1. For a better understanding of the invention, and to show how embodiments of the same may be carried into effect, reference will now be made, by way of example, to the accompanying diagrammatic drawings, in which: Figure 1 is a block diagram of a conventional image coding apparatus; Figures 2A-2C are diagrams of an input image according to the CCIR 601 format; Figures 3A and 3B are composition maps with regard to the Y signal shown in Figure 2A; Figure 4 is a flow chart for determining a scale factor in accordance with an embodiment of an image coding method of the invention and Figure 5 is a block diagram of an image coding apparatus according to one embodiment of the present invention. Figures 2A-2C illustrate 4:2:2 format of images based on the recommendation of CCIR 601 and Figures 3A and 3B are views for illustrating the composition of macro blocks with regard to Y image. Each image is composed of Y (shown in Figure 2A), Cr (shown in Figure 2B), and Cb (shown in Figure 2C) signals and respective signal is divided into macro blocks. In respective macro blocks, the Y signal is composed of four 8×8 pixel block signals and the Cr and Cb signals are composed of two 8×8 pixel block signals. Figure 3A illustrates one frame of the Y signal, and Figure 3B illustrates a macro block of 16×16 pixels with regard to the Y signal. Figure 4 is a flow chart for determining a scale factor according to an embodiment of the image coding method invention. The method for determining a scale factor on an input image will be explained in more detail with reference to Figures 2A-C and 3A & 3B. In the following calculations of the method Pix(k,l) is a pixel value where k and l are whole numbers from 0 to 7, N refers to the number of blocks (in this embodiment, N=4), MB refers to the number of macro blocks (in this embodiment, MB=30×45), i refers to the number from 0 to MB-1, and j refers to the number from 0 to N-1. As the first step, with regard to the input 4:2:2 format image (step 410), in order to obtain a complexity normalizing value with regard to respective macro blocks in accordance with the complexity of a space domain, an average complexity of an image is produced per 8×8 block (hereinafter called a unit block) in a macro block (step 421). The complexity is calculated with regard to the luminance signal Y, using the pixel value of the image. The average complexity A yb [j] of a unit block can be expressed as the following. An average complexity A yt [i] is produced by summing up all the average complexities of unit blocks with regard to the macro block and then dividing the result by the number of unit blocks (step 422). Here, a square average value σ 2 BT [j] of unit block is produced with respect to the difference between the average complexity and real pixel value of respective unit blocks in a macro block (step 423). After producing a minimum square average value among the square average values of respective unit blocks with regard to four Y unit blocks (j varies from 0 to 3) of respective macro blocks, one is added to the obtained value, to thereby reach the minimum square average value σ 2 BTmin [i] of respective macro blocks (step 424). σ 2 BTmin [i] = MIN(σ 2 BT [j]) +1 Here, adding one is so that the minimum square average value is not zero. Each macro block is normalized in accordance with the minimum square average value of the macro block and the average complexity of the macro block, so as to produce a complexity normalizing value Nor ACT [i] of the macro block (step 425). Nor ACT [i] = ασ 2 BTmin [i] + A yt [i] σ 2 BTmin [i] + αA yt [i] Here, α is a constant for normalization. As a second step, in order to obtain a zero coefficient normalizing value and a transient weight value to respective macro block in a frequency domain of an image signal, a discrete cosine transform operation is performed on the input 4:2:2 format image, so as to produce a coefficient Pix Coeff(u,v) (step 431). Here, u and v are integers from 0 to 7 and when zero, C(u) and C(v) are equal to 1/√2, but are otherwise equal to one. Within the macro block, all Y blocks whose discrete cosine transform coefficient is greater than or equal to -1 and less than or equal +1, are counted, so as to produce a zero coefficient sum Z[i] of the macro block (step 432). The zero coefficient sums of respective macro blocks are summed, so as to produce an overall zero coefficient sum Zr for all macro blocks (step 433). The overall zero coefficient sum is divided by the number of macro blocks, so as to produce an average zero coefficient sum A ZERO of the macro blocks (step 434). A ZERO = Zr MB The difference between the average zero coefficient sum of the macro blocks and the zero coefficient sum of the macro blocks is squared, to produce a zero coefficient square average value σ 2 ZERO [i] of the macro blocks (step 435). σ 2 ZERO [i] = (A ZERO -Z[i]) 2 Normalization is performed in accordance with the zero coefficient square average value and the zero coefficient sum per macro block, so as to produce a zero coefficient normalizing value Nor ZERO [i] of respective macro blocks (step 436). Nor ZERO [i] = αZ[i] + σ 2 ZERO [i] Z[i] +ασ 2 ZERO [i] Here, α is a constant for normalization. The scale factor is varied in accordance with the complexity of an image and the quantization step size interval is determined by this scale factor. Since the quantization step size can be varied in accordance with the generation of zero coefficients and the scale factor is controlled in accordance with the compression ratio, the transient weight W of scale factor can be expressed as the following. W = A ZERO - βR γ Here, β and γ are weight constants and R represents a compression ratio which has been predetermined. Accordingly, a transient weight W of respective macro blocks is produced in accordance with an average zero coefficient sum and a compression ratio of macro block (step 441). Therefore, the scale factor SF[i] of macro block unit is determined by the sum of the complexity normalizing value, the zero coefficient normalizing value and the transient weight (step 450). SF[i] = Nor ACT [i] +Nor ZERO [i] +W The quantization step size is determined by the scale factor, where the quantization step size is for the DCT coefficient in accordance with the quantizing matrix in the quantizier. In other words, the greater the average zero coefficient sum of macro block is and the smaller the compression ratio is, the greater the transient weight W is. If the transient weight is increased, the scale factor is increased and the quantizing interval is decreased. Figure 5 is a block diagram according to one embodiment of an image coding apparatus of the present invention. In addition to a discrete cosine transform (DCT) unit 51, a quantizer 58, and a variable-length coding (VLC) unit 59 which are similar to the prior art composition, the apparatus further comprises elements for producing a scale factor on an input image. Here, the DCT unit 51 performs a discrete cosine transform function on macro block data as time-domain data into DCT coefficients as frequency-domain data, with respect to an input image divided into macro blocks of Y, Cr and Cb signals. Quantizer 58 quantizes the DCT coefficients output from DCT unit 51 at a predetermined quantization step size. VLC unit 59 produces coding data having variable length in accordance with the information quantity, which results in minimizing the overall number of bits for coding. Hereinafter, the additive elements will be explained, referring to Figure 5. A complexity calculator 52 produces a complexity in accordance with the pixel values of an input image. A complexity normalizing unit 53 normalizes the complexity for respective macro blocks. A zero coefficient counter 54 counts the zero coefficients which are greater than or equal to -1 and less than or equal to +1, among the DCT coefficients of DCT unit 51. A zero coefficient normalizing unit 55 normalizes the zero coefficient, for respective macro blocks. A weight value calculator 56 calculates a transient weight for each macro block, based on the zero coefficient counted in zero coefficient counting unit 54 and the compression ratio. An adder 57 sums the complexity normalizing value, the zero coefficient normalizing value and the transient weight, so as to output a scale factor to quantizer 58. The quantization step size for the DCT coefficient is determined based on the scale factor and the quantizing matrix. The quantizing matrices for all input images are different in accordance with the degree of activity, the characteristics of color components, the resolution, and the object of application, so that a suitable quantizing matrix is produced. This quantizing matrix is determined in consideration of various psychological and visual experiments which are coupled the human visual sense characteristics and the characteristics of DCT coefficients. Quantizer 58 quantizes the image signal in accordance with the determined quantization step size. The quantized results are applied to VLC unit 59, so as to produce a compressed bit stream having the desired bit ratio. Though the coding is made such that the macro blocks should have a constant bit rate in the above embodiment of the present invention, it is possible for a larger block than the macro block to have a constant bit rate. As described above, a scale factor for coding with a constant bit rate is produced, in accordance with the complexity in the space domain and the complexity in the frequency domain (which is the generating of a zero coefficient) for an input image, so as to control the quantization step size of the quantizer, which leads to the effect that the coding can be accomplished with a constant bit rate and no deterioration of image quality, even for an image frame composed of images having different complexities.

Claims: An image coding method for dividing an input image into sub-blocks composed of a predetermined number of unit blocks, quantizing the divided image signal at a quantization step size determined in accordance with a scale factor, and then coding, the image coding method characterised by the steps of: producing (425) a complexity normalizing value of respective sub-blocks, based on a complexity in the space domain with regard to the input image; producing (432) a zero coefficient sum by performing a discrete cosine transform operation on the input image and counting the discrete cosine transform coefficients within a predetermined range; producing (434) a zero coefficient normalizing value for respective sub-blocks in accordance with the zero coefficient sum; producing (440) a transient weight for respective sub-blocks in accordance with the zero coefficient sum and a predetermined compression ratio; and summing (450) the complexity normalizing value, the zero coefficient normalizing value and the transient weight, so as to produce the scale factor. An image coding method according to claim 1, wherein said step of producing a complexity normalizing value is performed for a luminance signal. An image coding method according to claim 1 or 2, wherein said predetermined range is from -1 to +1. An image coding method according to claim 3, wherein, in said step of producing a zero coefficient sum, the coefficient whose discrete cosine transform coefficient is equal to or greater than -1 and is equal to or lower than +1, is the coefficient for the luminance signal. An image coding method according to any of the preceding claims, wherein said sub-block is a macro block. An image coding method according to claim 5, wherein said step of producing a complexity normalizing value comprises the steps of: producing (421) an average complexity for respective unit blocks in a macro block; producing (422) an average complexity for the macro block based on the average complexities of respective unit blocks; producing (423) a difference between the average complexity and a real pixel value of a unit block, so as to produce a square average value of a unit block; adding (424) one to the minimum value among the square average values for respective unit blocks in a macro block, so as to produce a minimum square average value of the macro block; and normalizing (425) the respective macro blocks in accordance with the minimum square average value and the average complexity of the macro block, so as to produce a complexity normalizing value of respective macro blocks. An image coding method according to claim 5, wherein said step of producing a zero coefficient normalizing value comprises the steps of: summing (430) up all the zero coefficient sums of macro blocks, so as to produce an overall zero coefficient sum; producing (434) an average zero coefficient sum of macro blocks, in accordance with the overall zero coefficient sum; producing (435) a zero coefficient square average value of macro block in accordance with the difference between the average zero coefficient sum of macro blocks and the zero coefficient sum of the macro block; and normalizing (436) in accordance with the zero coefficient square average value and the zero coefficient sum of the macro block, so as to produce a zero coefficient normalizing value of each macro block. An image coding method according to claim 5, wherein the step of producing a transient weight further comprises the steps of: summing (430) up all the zero coefficient sums, so as to produce an overall zero coefficient sum; producing (433) an average zero coefficient sum of macro blocks in accordance with the overall zero coefficient sum; and producing (440) a transient weight of respective macro block in accordance with the average zero coefficient sum of macro blocks and a predetermined scale factor. An image coding apparatus comprising: a discrete cosine transform unit (51) for performing a discrete cosine transform function with respect to an input image to be divided into sub-blocks composed of a predetermined number of unit blocks, to produce discrete cosine transform co-efficient; a quantizing unit (58) for quantizing the discrete cosine transform coefficient at a predetermined quantization step size determined in accordance with a scale factor; and a variable-length coding unit (59) for encoding the quantized coefficient into a variable-length code; characterised by : the discrete cosine transform unit (51) performing the discrete cosine transform function on a sub-block as time-domain data so as to produce a discrete cosine transform coefficient as frequency-domain data; a complexity calculating unit (52) for producing a complexity in accordance with a pixel value of an input image per sub-block; a complexity normalizing unit (53) for normalizing the complexity for respective sub-blocks; a zero coefficient counting unit (54) for counting the zero coefficients within a predetermined range per subblock among the discrete cosine transform coefficients from said discrete cosine transform unit; a zero coefficient normalizing unit (55) for normalizing the zero coefficient for respective sub-blocks; a weight calculating unit (56) for producing a transient weight in accordance with the zero coefficient and a predetermined compression ratio; and a scale factor generator (57) for summing the complexity normalizing value, the zero coefficient normalizing value and the transient weight, to generate the scale factor and supply the scale factor to the quantizing unit. An image coding apparatus according to claim 9 , wherein said sub-block is a macro block unit. An image coding apparatus according to claim 9, wherein said predetermined range is from -1 to +1.

Inventors: JEON JONG-GU, JEON, JONG-GU
Applicants: SAMSUNG ELECTRONICS CO LTD, SAMSUNG ELECTRONICS CO., LTD.
Application year: 1994
Main classification: H04N7
IPC codes: G06T9, H04N9, H04N1, H04N7, H04B1, H03M7