Background of the Invention
The present invention relates to an image compression encoding and decoding method and apparatus therefor, and more particularly to an image compression coding and decoding method and apparatus therefor which, using a multilevel compression method, reproduces pictures without degradation of picture quality during a special playback such as a high speed search.
Recently, video information compressing technology has been used in processing a video signal as digital data in digital video apparatus such as digital VCR, HDTV, digital video camera and video phone.
Since known image compression technology has a variable number of compressed coding bits according to picture complexity, a problem has been raised about how to keep constant a compression result in digital VCRs, HDTVs and others which require a constant compression result. Especially, for image compression for a DVCR, since its recording medium is magnetic tape which enables only sequential recording and playback, it has more limitations than that of an ordinary transmission line or disk (CD or hard disk). The most serious problem to be solved is a special playback function (also known as trick play) such as a high speed search.
For a solution, when an image compression method and its tape format are selected, movement of the VCR head (head's scan trace) during recording and playback should be considered. In other words, for special functions such as a high speed search, during compression, each image should be exactly the same size, and a portion of data on a tape should correspond to the image's original screen position and be reproduced regardless of other images.
Generally however, during coding, a complicated portion of an image requires a relatively large amount of bits and a simple portion relatively few bits. Accordingly, when video signals corresponding to one picture or its one segment are to be encoded and recorded in a track having a limited length of magnetic tape, and if the number of encoded bits exceed one track, a conventional digital VCR method records the excess of the encoded bits in a next track or, if the encoded bits reach the number of set bits, stops coding the remaining part which is discarded.
However, the recording method of the excess of the encoded bits in a next track has difficulty in a special playback or high speed search, and the coding stop method deteriorates the quality of a reproduced picture because of partial loss of its picture information.
Summary of the Invention
Therefore, it is an object of the present invention to provide an image compression coding method and apparatus therefor which, using a multilevel compression method, more compactly compresses lower levels of an image to output a result having a constant number of bits and outputs an encoded result having components leading to more elaborate picture quality in higher levels, so that one picture has a constant bit rate.
It is another object of the present invention to provide an image compression decoding method and apparatus therefor which records, on magnetic tape, codes produced by a multilevel compression method which more compactly compresses lower levels of image to output a result having a constant number of bits and outputs an encoded result having components leading to more elaborate picture quality in higher levels, and decodes only the lowest level codes in a special playback mode such as a high speed search differently from a normal playback mode where the entire codes are decoded, thereby enabling a special playback function.
To accomplish the objects, in the image compression encoding and decoding method and apparatus therefor of the present invention, DC coefficients of a DCT block are scalar-quantized and AC coefficients are classified-vector-quantized (CVQ). Respective DCT blocks are classified by the least value of the square of the value that part or all of the AC coefficient among horizontal AC coefficients including a first AC coefficient according to the zigzag scanning sequence of a DCT block, and vertical AC coefficients including a second AC coefficient are subtracted from a representative value of a preset reference class. Using the multilevel compression method, lowest level codes are vector-partitioned by P-units at equal intervals with respect to each classified DCT block, and code books of representative vectors corresponding to the partitioned vectors are provided. Indices of corresponding representative vectors in respective code books and the classified codes are provided as encoding data corresponding to AC coefficients to keep a constant number of bits. Then, errors created in a preceding level are obtained. Code books of S-units of representative vectors corresponding to the errors are provided again. The multilevel CVQ of the method providing corresponding indices and parity data in the respective code books is performed to be encoded. Here, codes are output in which an image is more compactly compressed in lower levels, and higher levels have more elaborate picture quality.
Decoding is performed in the reverse sequence of encoding. During a high speed search, only the lowest level codes having a constant number of bits are restored regardless of the complexity of the picture so that a high speed search does not lead to deterioration of picture quality.
Brief Description of the Drawings
The above objects and other advantages of the present invention will become more apparent by describing in detail a preferred embodiment of the present invention with reference to the attached drawings in which:
FIG. 1 is a block diagram of a video compression coder according to the present invention;
FIG. 2 illustrates DC and AC coefficients of an 8 by 8 DCT block;
FIG. 3 illustrates a classification in the classifier for the video compression coder of FIG. 1;
FIGS. 4A and 4B illustrate a tape format for the video compression coder of FIG. 1; and
FIG. 5 is a block diagram of a video compression decoder according to the present invention.
Detailed Description of the Invention
In FIG. 1, Y, R-Y, and B-Y video signals (4:2:2) input from a signal input source are subsampled with respect to a chrominance difference signal by a buffer 10 to be changed into the form of 4:2:0. That is, the form of 4:2:2 represents Y (width: 720 pixels, length: 480 pixels), R-Y and B-Y (width: 360 pixels, length: 480 pixels), while the form of 4:2:0 represents Y (width: 720 pixels, length: 480 pixels), R-Y and B-Y (width: 360 pixels, length: 240 pixels).
A DCT block 20 divides the two-dimensional video signal output from buffer 10 into N by N blocks (e.g., 8 by 8) and DCT-transforms each block to generate DCT coefficients. A DC encoder 30 scalar-quantizes (SQ) the DC values of DCT block 20 by eight bits and, for decoding, records them on tape.
A classifier 41 selects part or all the AC coefficient k among a horizontal AC coefficient including a first AC coefficient according to the zigzag scanning sequence of a DCT block and vertical AC coefficient including a second AC coefficient (here, x01 and y10). As shown in FIG. 3, edge direction is detected according to the minimum value of the square of the value from which representative values Yj of eight reference classes preset in the horizontal, vertical, diagonal and its opposing diagonal directions, are subtracted. According to the detected results, each DCT block is classified into eight classes. In other words, ##EQU1##
In other words, each DCT block is classified into a most approximate class by the V and H values on the coordinates of FIG. 3. Here, value j is more favorable as it becomes larger but may be selected according to the complexity of classifier 41. For decoding, these class codes are recorded on tape by three bits.
A first code book 42 contains 21 components and 128 vectors according to each class. A clustering algorithm (LBG algorithm) is used with respect to a transform coefficient relating to edge characteristic, among DCT coefficients. The LBG algorithm is disclosed in "An Algorithm for Vector Quantizer Design," by Y. Linde, A. Buzo and R. M. Gray, IEEE Trans.on Comm., vol. COM-28, pp. 84-95, Jan. 1980.
A first level vector quantization block 43 selects a code vector having the smallest error by comparing DCT input vectors with vectors of the code book, and outputs addresses that are indices of the vector as 7-bit compressed codes.
In other words, the input DCT blocks are vector-partitioned by equal interval sampling to form three vectors. That is, as shown in FIG. 2, an 8 by 8 DCT block is zigzag-scanned and one-dimensionally arranged as follows.
VECTOR 0=(0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60)
VECTOR 1=(1, 4, 7, 10, 13, 16, 19, 22, 25, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61)
VECTOR 2=(2, 5, 8, 11, 14, 17, 20, 23, 26, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62)
This is based upon "Asymptotic Performance of Block Quantizer with Difference Distortion Measure," by Y. Yamada, S. Tazaki and R. M. Gray, IEEE Trans. inform. Theory, Vol. IT-26, pp. 6-14, Jan. 1980. Here, the reason the vectors are partitioned is to reduce the distortion of vector quantization. The whole distortion is as follows.
Here, K(k) is a constant, [det P] is a correlation determinant, and N is a uniform probability in case of DC or a Laplacian probability in case of AC.
In the above equations, as value .sigma..sup.2 becomes smaller, value D1 (distortion) becomes smaller. Therefore, in order to reduce the value of geometric dispersion .sigma.g.sup.2, the vector is partitioned because, when the values of the vector consist of both low-frequency components and high-frequency components of the DCT block, the value .sigma.g.sup.2 becomes smaller. The present invention is composed of three vectors to improve picture quality by about 2dB.
When a code vector having little error is selected, all 128 vectors are usually compared, which requires a considerable amount of operation. Thus, here, in order to reduce the amount of operation, all the vectors of code books 42, 44, and 47 are sorted according to a mathematic statistical value such as an activity or dispersion value. In other words, the search area of the code books is reduced to one quarter of their original search area by the mathematic statistical value such as the activity of vector or dispersion value so as to also reduce the amount of operation to one quarter.
A first level code, which is the output of a first level vector quantization block 43, is compressed to 1/16. During special playback such as a high speed search, only the first level code is reproduced. During normal playback, the first level code is reproduced along with a higher level code. Even only with the first level code, image can be obtained. When recorded on tape, as shown in FIGS. 4A and 4B, the first level code is recorded on an independent decodable code (IDC) region. The code has a total of 21 bits where each vector has seven bits, and decoding requires at least 32 bits (8 DC bits+3 class bits+21 vector bits).
Second and third code books 44 and 47 each have seven components and 128 vectors. A first subtracter 45 subtracts an encoding result in first level vector quantization block 43, that is, the vectors of first code book 42 corresponding to selected indices, from the whole AC coefficients of DCT block 20 except its DC, to determine the errors produced during the lowest level encoding of each DCT block 20.
A second level vector quantization block 46 vector partitions the errors produced during the lowest level encoding of each DCT block 20 into nine vectors, by equal-interval sampling. A second subtracter 48 subtracts an encoding result in the second level vector quantization block 46 from the AC coefficients of the errors produced during the lowest level encoding of each DCT block 20, as supplied from the subtracter 45, to determine remnant errors after the second level encoding, for encoding in third level vector quantization block 49. In other words, image cannot be reproduced only with the second and third level vector codes but should be necessarily reproduced along with the lowest level code.
Meanwhile, a parameter determiner 50 determines an encoding parameter of the image of a current picture, based upon an encoding result of the video signal of a preceding picture. As the encoding result of a preceding image, if the number of required bits are smaller than that of reference bits set for one frame, the value of the parameter is controlled to require a larger number of bits in encoding a current image, and if the number of required bits is larger than that of the reference bits set for one frame, the value of the parameter is controlled to require a smaller number of bits in encoding a current image. Here, data transmission speed M of DVCR is 20 megabits per second (Mbps). As one second needs 30 frames, the number b of reference bits for one frame is b=M/30. In other words, if the difference between the required bits and reference bits is larger than a preset value, the parameter is determined considering the number of the reference bits by the vector distribution according to its activity.
An intraframe vector allocator 60 adaptively allocates vectors by the parameter determined by parameter determiner 50.
Even if the number of vectors to be encoded in second and third level vector quantization blocks 46 and 49 is 18, since only about nine vectors are allowed to be encoded considering the number of reference bits, only vectors having an activity above a proper size (threshold value) are actually encoded. The activity of each vector is defined as follows. ##EQU2##
Here, the threshold value (parameter:THR) is determined by the encoding state of a preceding image, that is to say, transfer vectors from second and third level vector quantization blocks 46 and 49.
Transfer Vector=Vj, (j.epsilon.Actj>THR), (0.ltoreq.j.ltoreq.8)
Though the bits of the second and third level encoding codes are fixed in one frame, they can be varied in units of a sync block. In other words, as shown in FIG. 4A, one frame has four tracks and one sync bloc has six DCT blocks. The sync block comprises a sync signal for indicating the beginning and end of the block, an index signal for indicating a position in a frame, a first level quantization encoding code contained in an IDC area, an error correction code (ECC) for error-correcting the code loaded on the IDC area, the plurality of vector quantization encoding codes contained in a dependent decodable code (DDC), and an ECC for error-correcting the code loaded on the DDC area.
If the required number of bits exceeds the reference number of bits, the amount of bits in the periphery of the image is forced to be cut. The image on the periphery is reproduced only with the lowest level code. This means that the center and the periphery of the image are encoded using different weights. This is possible because normal human vision will concentrate mainly on the center of an image.
Higher level codes are sequentially recorded on the DDC area shown in FIGS. 4A and 4B when recorded in tape. The second level needs parity data of 9-bit parity data and the third level needs parity data of the number of bits of actual transfer vectors of the second level. The parity data indicates to a decoder which vector is actually recorded on a tape.
Here, without intraframe vector allocator 60, the reference bits are satisfied by only using differential encoding according to weights and by image sections. Good picture quality can be obtained even if the image is divided into a plurality of levels from the center to the periphery, so that the lowest level is uniformly encoded and higher levels are encoded by varying their parameters for each level.
From now on, the image compression decoding method of the present invention will be briefly described below. The decoding method is performed by the reverse order of the image compression coding method.
In FIG. 5, a DC decoder 110 inverse-scalar-quantizes an 8-bit DC code reproduced from a tape, and decodes it with DC coefficients. A first code book 121, which is the same as code book 42 of FIG. 1, has 21 components and 128 vectors. Second and third code books 123 and 125, which are the same as code books 44 and 47 of FIG. 1, each have 7 components and 128 vectors. Each code book 121, 123 and 125 outputs its vector according to an input class code.
A first level vector inverse-quantization block 122 outputs a corresponding vector component by comparing a first level code and the code of code book 121. The decoding result of the first level code and the DC coefficients are supplied to a first adder 127. Second and third level vector inverse-quantization blocks 124 and 126 output a corresponding vector component by the comparison of second and third level codes loaded on the DDC area and the codes of code books 123 and 125. The decoding results of the second and third level codes are supplied to a second adder 128.
Meanwhile, according to a normal/trick playback control signal for indicating whether a VCR is in a normal playback or special playback mode, a mode selector 130 supplies the outputs of second and third level vector inverse-quantization blocks 124 and 126 to a third adder 129, during normal playback. During a trick playback such as high speed search, since only the lowest level code is reproduced according to the VCR characteristic and the higher level codes are not reproduced, mode selector 130 supplies a null signal to third adder 129.
Third adder 129 adds the DC and the decoding results of the respective levels, and an inverse-DCT block 140 inverse-DCT transforms the added outputs to be converted into an original two-dimensional video signal. A buffer 150 changes the inverse-DCT result into an output form, that is, changes the result of 4:2:0 form into 4:2:2 form.
As described above in detail, the image compression encoding and decoding method and apparatus therefor of the present invention compresses DCT blocks by steps, using classified vector quantization via a multilevel compression method so that, during a special playback mode such as high speed search, only the lowest level image having a fixed number of bits is reproduced to cause no degradation of picture quality during the special playback mode.
While the invention has been particularly shown and described with reference to preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.