Variable length coding apparatus and method for motion vector

Abstract: A ROM constituting a variable length coding table of 2 picture element range is provided. A motion vector within the range of 2 picture elements is given to the ROM to provide a VLC code corresponding to the motion vector within the range of 2 picture elements. In a calculation circuit, assuming that the value of a motion vector within the range of 4 picture elements is X, a quotient Y and a remainder Z are obtained by the division of X by 2. The quotient Y is supplied to the ROM whose output is added the remainder Z at an additional circuit to obtain a VLC code corresponding to the motion vector lying within the range of 4 picture elements. This is equivalent to the coding at the variable length coding for four-picture element range. By sending a flag indicating whether a motion vector range is 2 picture elements or 4 picture elements, the motion vector is correctly reproduced from the VLC code. By the use of the single table ROM, a motion vector within the range of 2 picture elements and 4 picture elements can be coded to reduce the load imposed on the hardware.

Description: The invention relates to a variable length coding apparatus for motion vector used in highly efficient coding of a moving picture signal, for example, based on interframe correlation. When coding which utilizes interframe correlation is done in highly efficient coding of a moving picture signal, a difference between frames is coded. At this time, a motion vector is used to consider a movement between two frames. More specifically, a picture is divided into blocks of a predetermined size (for example, 16 x 16 picture elements shown in Fig. 1A). In this case, a motion vector indicates that a certain block (objective block) has moved to what position on another picture from which a difference is taken (shown in Fig. 1B). When a difference with a position which has moved by a motion vector is taken in the case of providing a difference of two frames, the difference is a minimum to enable highly efficient coding. Conversely speaking, if the motion vector is obtained so that the difference between frames becomes a minimum, such highly efficient coding can be made. Now, for improving transmission efficiency of the motion vector, the variable length coding of the motion vector has been known. Namely, as shown in Fig. 2, picture data is supplied to a motion vector detecting circuit 10 to detect a motion vector. The motion vector is given to a variable length coding circuit 20 and coded to provide a variable length coding code (VLC code). As to the motion vector, its size and accuracy are theoretically arbitrary, and there is restriction on hardware size, etc, actually. For example, the range of the size of the motion vector may be ± 7 picture elements or ± 15 picture elements from the origin which is the center. Further, its accuracy may be 1 picture element unit or 0.5 picture element unit. A case where such a motion vector is variable-length -coded will be considered. For instance, in the case where a motion vector lying within the range of ± 7 picture elements and a motion vector lying within the range of ± 15 picture elements are coded two kinds of variable length coding tables are needed. At this time, the table for the range of ±7 picture elements with 1 picture element accuracy becomes a table which has 15 kinds of elements 7, 6, ..., 0, ..., -6, -7, while the table of the range of ± 15 picture elements becomes a table which has 31 kinds of elements 15, 14, ..., 0, ..., -14, -15. In addition, the table for the range of ± 7 picture elements with 0.5 picture element becomes a table which has 29 kinds of elements 7.0, 6.5, ..., 0, ..., -6.5, -7.0. In this way, when there are plural kinds of motion vector ranges and when there are plural kinds of accuracies, the number of necessary tables increase to elevate the burden of hardware. An object of this invention is, therefore, to provide a variable length coding apparatus for motion vector which can reduce the load imposed on the hardware when there are plural kinds of motion vector ranges and accuracies. According to one aspect of the invention, there is provided a variable length coding apparatus for producing variable length codes representing motion vectors indicative of motion within images, comprising means responsive to image data for producing motion vectors and means for variable length coding the motion vectors; wherein the variable length coding means includes a memory circuit for storing a table of VLC data representing a predetermined set of motion vector values, control means responsive to the motion vectors for reading the VLC data out of the memory circuit and for producing data additional to VLC data read-out of the memory circuit and which changes the values represented by the said VLC data or part of the VLC data, and means for combining the said VLC data with the additional data. The above, and other, objects, features and advantages of the present invention will become readily apparent from the following detailed description thereof which is to be read in connection with the accompanying drawings, in which: Figures 1A and 1B are diagrams showing the concept of a motion vector; Figure 2 is a block diagram showing a circuit for motion vector detection and coding; Figure 3 is a diagram showing one example of a variable length coding table; Fig. 4 is a diagram showing one example of a variable length coding table; Fig. 5 is a diagram showing one example of a motion vector coding circuit; Fig. 6 is a diagram showing one example of a motion vector decoding circuit; Fig. 7 is a diagram showing one example of a variable length coding table; Fig. 8 is a diagram showing one example of a variable length coding table; and Fig. 9 is a diagram showing one example of a variable length coding table. Hereunder, one embodiment of the invention will be described referring to the drawings. In this embodiment, the variable length coding is done for a motion vector within the range of ±2 picture elements with the 1 picture element accuracy and a motion vector within the range of ±4 picture elements with the 1 picture element accuracy. Fig. 3 indicates a variable length coding table for the range of ±2 picture elements with the 1 picture element accuracy (the relationship between a value of a motion vector and a VLC code). The table has 5 kinds of elements 2, 1, 0, -1, and -2. The variable length coding of a motion vector lying within the range of ± 4 picture elements is performed based on a variable length coding table for ± two-picture element range. First, assuming that the value of a motion vector is X, a quotient Y and a remainder Z are obtained by the division of X by two. X = 2*Y + Z Next, a VLC code is provided by adding a remainder Z as an additional bit to a VLC code (coded at the table of Fig. 3) corresponding to the quotient Y. As a result, this is equivalent to the coding with the 1 picture element accuracy at the variable length coding table for ± four-picture element range as shown in Fig. 4 and the variable length table shown in Fig. 3 is expanded consequently. The variable length coding table of Fig. 4 has nine kinds of elements 4, 3, ..., 0, ..., -3, -4. On the other hand, for the coding of a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy, a VLC code corresponding to the motion vector X is directly obtained using the variable length coding table shown in Fig. 3. With this, on the basis of the variable length coding table of the range of ± 2 picture elements with the 1 picture element accuracy, the coding of a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy as well as the coding of a motion vector within the range of ± 4 picture elements with the 1 picture element accuracy can be made. As mentioned above, a coded motion vector can be reproduced correctly on the decoder side with the operation reverse with the above-mentioned one by transmitting a flag indicative of whether the motion vector is within the range of ± 2 picture elements or within the range of ± 4 picture elements. Fig. 5 is an example of a circuit for coding a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy as well as for coding of a motion vector within the range of ± 4 picture elements with the 1 picture element accuracy on the basis of a variable length coding table for ± 2 picture elements with the 1 picture element accuracy. In Fig. 5, reference numeral 1 denotes a calculation circuit to which a motion vector within the range ± 4 picture elements is supplied. At the calculation circuit 1, the above-mentioned calculation of equation (1) is done so that a quotient Y and a remainder Z are produced. Reference numeral 2 indicates a ROM, which constructs a variable length coding table shown in Fig. 3. The ROM 2 is directly supplied with a motion vector as an address when the motion vector lies within the range of ± 2 picture elements, while the quotient Y which is produced from the calculation circuit 1 when the motion vector lies with the range of ± 4 picture elements. When the motion vector is within the range of ± 2 picture elements, the output of the ROM 2 is produced as a VLC code. Meanwhile, in the case where the motion vector lies in the range of ± 4 picture elements, the remainder Z given from the calculation circuit 1 is added to the output of the ROM 2 as an additional bit by the additional circuit 3 to provide a VLC code as an output. In this way, in the example, the coding of the motion vector within the range of ± 2 picture elements with the 1 picture element accuracy as well as that of the motion vector within the range of ± 4 picture elements with the 1 picture element accuracy can be made using the single variable length coding table (ROM 2) to reduce the burden of the hardware. Fig. 6 shows a decoding circuit corresponding to a coding circuit shown in Fig. 5. It is judged based on a flag sent with a VLC code whether the VLC code relates to a motion vector within the range of ± 2 picture elements or a motion vector within the range of ± 4 picture elements. In Fig. 6, reference numeral 4 denotes a separating circuit, which is supplied with a VLC code relating to a motion vector within the range of ± 4 picture elements. The separation into an additional bit (remainder Z) and the other bits is carried out at the separating circuit 4. Also, reference numeral 5 indicates a ROM, which constitutes a conversion table reverse with the variable length coding table of Fig. 3. To the ROM 5, a VLC code is directly supplied as an address when the VLC code relates to a motion vector lying within the range of ± 2 picture elements. On the other hand, when the VLC code relates to a motion vector lying within the range of ± 4 picture elements, bits other than the additional bit separated at the separating circuit 4 are supplied as an address. In the case where the VLC code relates to a motion vector lying within the range of ± 2 picture elements, the output of the ROM 5 is produced as a motion vector. Meanwhile, when the VLC code relates to a motion vector lying within the range of ± 4 picture element, the output of the calculation circuit 6 is produced as a motion vector. As a result, X is obtained in the calculation circuit 6 from the output Y of the ROM 5 and an additional bit Z separated at the separating circuit 4 by the use of equation (1). Next, an example where coding of a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy as well as coding of a motion vector within the range of ± 2 picture elements with the 0.5 picture element accuracy will be explained. The coding of a motion vector within the range of ± 2 picture elements with the 0.5 picture element accuracy is done based on the variable length coding table shown in Fig. 3. First, assuming that the value of a motion vector is X, a quotient Y and a remainder Z are provided by the division of 2X by 2. 2*X = 2*Y + Z Now, assuming that Y, Z are integers, Y becomes an integer part of X. Meanwhile, Z becomes the value equal to twice the decimal part to be "0" or "1". Next, a VLC code is provided by adding a remainder Z as an additional bit to a VLC code (coded at the table of Fig. 3) corresponding to the quotient Y. Consequently, this is equivalent to the coding with the 0.5 picture element accuracy at the variable length coding for ± two-picture element range as shown in Fig. 7 and the variable length coding table shown in Fig. 3 is expanded resultantly. The variable length coding table of Fig. 7 has nine kinds of elements 2.0, 1.5, ..., 0, ..., -1.5, -2.0. Meanwhile, for the coding of a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy, a VLC code corresponding to a motion vector X is directly obtained using the variable length coding table shown in Fig. 3. As a result, on the basis of the variable length coding table for the range of ± 2 picture elements with the 1 picture element accuracy, not only the coding of a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy but also the coding of a motion vector within the range of ± 2 picture elements with the 0.5 picture element accuracy can be performed. As stated above, a coded motion vector can be reproduced accurately on the decoder side with the operation reverse with the above-mentioned one by transmitting a flag indicating whether the motion vector is within the 1 picture element accuracy or within the 0.5 picture element accuracy. Based on the variable length coding table for the range of ± 2 picture elements with the 1 picture element accuracy, circuits for coding and decoding a motion vector within the range of ± 2 picture elements with the 1 picture element accuracy and a motion vector within the range of ± 2 picture elements with the 0.5 picture element accuracy can be composed of similarly to those of Figs. 5 and 6. The coding can be made using one variable length coding table (ROM 2) to reduce the burden of hardware. Next, the case where a motion vector is subjected to DPCM (Differential PCM) and where only a difference with a motion vector of an adjacent block is transmitted is considered. For instance, when the value of a motion vector of a certain block is 4, 4 - 3 = 1 is provided if the value of next motion vector is 3. In this case, only the value 1 of the difference is transmitted. With this, since transmission is done with VLC code shorter than a VLC code corresponding to 4, advantageous transmission can be made. Now, in the DPCM of a motion vector, there is a method which is called the reflected DPCM method. This is a method used in DPCM of a value whose range is determined like a motion vector. For example, two values are allotted to one VLC code as shown in Figs. 8 and 9. Figs. 8 and 9 are variable length coding tables for DPCM transmission of motion vectors lying within the range of ± 7 picture elements with the 1 picture element accuracy and ±3 picture elements with the 1 picture element accuracy. In Fig. 9, since the range of a motion vector is ± 3 picture elements, the result of DPCM becomes ± 6. For example, assuming that the value of a previous motion vector is 3 and that the value of a present motion vector is 1, 3 - 1 = 2 is established. Consequently, the VLC code is "0010". In the case where the reproduction into a motion vector is made after the transmission of this code, the VLC code is "0010". Therefore, the value is 2 or -6. At this time, since the decoder side knows that the value of a previous motion vector is 3, the value of the motion vector is 3 - 2 = 1 or 3 - (-6) = 9. Now, because the motion vector lies in the range of ± 3 picture elements, it cannot take 9 to become 1. In the above-described reflected DPCM method, a table proportional to the range of a motion vector is necessary. For this reason, in the case where the variable length coding through DPCM is done for a motion vector whose range covers ± 7 picture elements and ± 3 picture elements, for example, there is a method in which the variable length coding tables shown in Figs. 8 and 9 are prepared. Also, for example, there is a method in which only the variable length coding table shown in Fig. 8 is prepared so that values ± 6 of DPCM of a motion vector within the range of ± 3 picture elements are variable length coded depending on the table shown in Fig. 8. In the former method, since two tables are needed, the load imposed on the hardware becomes great. On the other hand, in the latter method, the probability that a longer code is generated becomes high in the table of Fig. 8 as compared with that of Fig. 9 and efficiency is degraded consequently. To eliminate these disadvantages, a flag indicative of the range of a motion vector is provided as in the above-mentioned embodiment. For variable length coding the motion vector, only the table shown in Fig. 8 is prepared. In this case, if the range of the motion vector is ± 7 picture elements, the coding is done using the entire table. Meanwhile, if the range is ± 3 picture elements, the broken portion is replaced by the table shown in Fig. 9 for coding. By transmitting a flag indicating the range of a motion vector together with a thus coded VLC code, the motion vector is correctly reproduced by preparing a reference table shown in Fig. 8 on the decoder side and decoding by the replacement of the table of Fig. 8 with the table of Fig. 9 only when the flag indicating the range of the motion vector shows the range of ± 3 picture elements. In this manner, by the use and replacement of a reference table, the hardware burden can be decreased as compared with the case of provision of plural tables. In an embodiment of the invention, a reference variable length coding table suffices for plural kinds of motion vector ranges and accuracies to decrease the burden of the hardware. Also, since an embodiment of invention can be adapted to a motion vector of a broad range by expanding the reference table and be further adapted to a motion vector of a narrow range, there is an advantage that flexibility increases. Further, as to the accuracy, the accuracy can be elevated by expanding the reference table. Having described a specific preferred embodiment of the present invention with reference to the accompanying drawings, it is to be understood that the invention is not limited to that precise embodiment, and that various changes and modifications may be effected therein by one skilled in the art without departing from the scope of the invention as defined in the appended claims.

Claims: A variable length coding apparatus for producing variable length codes (VLC) representing motion vectors indicative of motion within images, comprising means (10) responsive to image data for producing motion vectors and means (20) for variable length coding the motion vectors; wherein the variable length coding means (20) includes a memory circuit (2) for storing a table of VLC data representing a predetermined set of motion vector values, control means (1) responsive to the motion vectors for reading the VLC data out of the memory circuit and for producing data additional to VLC data read-out of the memory circuit (2) and which changes the values represented by the said VLC data or part of the VLC data, and means (3) for combining the said VLC data with the additional data. Apparatus according to Claim 1, wherein the said additional data changes the range and/or accuracy of the said VLC data. Apparatus according to Claim 1 or 2, wherein the control means (1) reads out the VLC data stored in the memory circuit without production of the additional data when the said motion vector values are represented by the stored VLC data; and, the control means (1) reads out the VLC data stored in the memory circuit and produces the additional data when the motion vectors have the said changed values. Apparatus according to Claim 3, wherein motion vector values are applied directly to the memory circuit (2) as addresses to read out the VLC data without additional data, and the control means (1) responds to the motion vector values having the changed values to produce addresses for the memory circuit (2) and to produce the additional data. Apparatus according to Claim 4, wherein the control means (1) comprises a calculation circuit (1) which outputs a quotient (Y) as the said address and a remainder (Z) as the additional data the quotient and remainder being obtained by the division of the value of the motion vector by two. Apparatus according to any one of claims 3 to 5 wherein the memory circuit (2) stores a variable length coding table representing a range of plus or minus two picture elements with a one picture element accuracy and the additional data changes the VLC data to represent motion vector values within the range plus or minus four picture elements with one picture element accuracy. Apparatus according to Claim 1, 2 or 3 wherein the VLC data is data representing differences between motion vector values. Apparatus according to Claim 7 wherein the said additional data changes the values represented by a portion of the VLC data. Apparatus according to any preceding claims wherein the memory circuit (2) comprises a ROM.

Inventors: IGARASHI KATSUJI, MARK VELTMAN, YAGASAKI YOICHI, YONEMITSU JUN, IGARASHI, KATSUJI, MARK, VELTMAN, YAGASAKI, YOICHI, YONEMITSU, JUN
Applicants: SONY CORP, SONY CORPORATION
Application year: 1992
Main classification: H04N7
IPC codes: H04N7, H03M7