BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to a variable-length coding/decoding device which is applied to transmission or recording of digital signals.
2. Description of the Related Art
In accordance with providing higher density of recording, there have been developed various kinds of recording codes used in recording and reproducing digital signals on optical disks, magnetic disks or the like. For a recording code, which is a bit string of information data to be recorded converted into a form suitable for recording, the following properties are required.
(1) Minimum magnetization reversal interval: T.sub.min
It is desirable that T.sub.min be large in order to be influenced as little as possible by a bandwidth limitation of a recording and reproducing system.
(2) Maximum magnetization reversal interval: T.sub.max
It is desirable that T.sub.max be small for ease of extraction of clock information, in order to obtain a self-clock function.
(3) Detecting window width: T.sub.w
This term represents an allowance for time-base variation, such as peak shift of reproduced signals due to jitter or waveform interference, or the like. It is desirable that T.sub.w be large.
For example, as the recording code, the run-length-limited (abbreviated hereafter as RLL) code has hitherto been used. The RLL code is called the (d, k, n, m, r.sub.max) code, where d and k are the minimum value and maximum value, respectively, of the run number of "0"'s between successive "1"'s (or vice versa) within a bit string of codes after conversion, n is the basic data word length, m is the basic code word length, and r.sub.max is the number of code word lengths. Using these parameters, the following representations hold:
(T: the length of one bit of a data word). Among the RLL codes, a variable-length code is suitable for high densification in that performance of a similar degree can be realized with smaller code word length and code word number than by a fixed-length code, or the like.
In order to use a recording code, it is necessary to provide a coding device for converting a data word into a code word. Among methods for providing a coding device, there is a method of constituting the device by combining gate circuits, and a method in which a bit string of information data is used as address signals, and access is made to a ROM (Read Only Memory) in which a bit string of code words has been written. When a ROM is used in a coding device using the (d, k, m, n, r.sub.max) code, its required capacity V.sub.1 is represented by V.sub.1 =2r.sub.max .multidot.m.multidot.r.sub.max .multidot.n bits. In a variable-length code, it is necessary to provide information representing how many bits the data word has been coded into in order to provide word synchronization. This information is usually written also in the same ROM. In the above-described capacity V.sub.1, however, the memory capacity corresponding to this information was excluded. For example, a conventional variable-length coding circuit using the (4, 19, 2, 5, 6) code, the correspondence table between data words and code words of which is shown in Table 1 to be described later, is configured as shown in FIG. 1.
In FIG. 1, a 12-bit shift register 100 sequentially inputs data words, a latch circuit 101 latches input data words taken in the shift register 100, and a ROM 102 uses as addresses data words latched by the latch circuit 101 and outputs code words corresponding to the data words. The required capacity V.sub.1 of the ROM is V.sub.1 =2.sup.12 .multidot.30=122,880 bits. A 30-bit shift register 103 sequentially outputs code words output from the ROM 102, and a latch-signal generating circuit 104 receives the information which is stored in the ROM 102 and is simultaneously output from the ROM 102 when a code word is output in order to provide word synchronization and which represents how many bits the data word has been coded into, and generates a latch signal so that the latch circuit 101 performs a latch operation. Since the configuration of the coding circuit shown in FIG. 1 is a common one, further detailed explanation about its operation or the like will be omitted.
Further, in order to use a recording code, it is necessary to provide a decoding device for inverting a code word into a data word. Among methods for providing a decoding device, there is a method of constituting the device by combining gate circuits, and a method in which a bit string of input code words is made to form address signals, and access is made to a ROM in which a bit string of data words has been written. When a ROM is used in a decoding device using the (d, k, m, n, r.sub.max) code, its required capacity V.sub.2 is represented by V.sub.2 =2r.sub.max .multidot.n.multidot.r.sub.max .multidot.m bits. In a varible-length code, it is necessary to provide information representing how many bits are in the code word to be decoded in order to provide word synchronization. This information is usually written also in the same ROM. In the above-described capacity V.sub.2, however, the memory capacity corresponding to this information is excluded. For example, a conventional variable-length decoding circuit using the (4, 19, 2, 5, 6) code (the correspondence table between data words and code words of which is shown in Table 1 to be described later) is configured as shown in FIG. 2.
In FIG. 2, a 30-bit shift register 105 sequentially inputs code words, a latch circuit 106 latches the input code words taken in the shift register 105, and a ROM 107 addresses code words latched by the latch circuit 106 and outputs data words corresponding to the code words. The capacity V.sub.2 of the ROM is represented by V.sub.2 =2.sup.30 .multidot.12 bits. A 12-bit shift register 108 sequentially outputs code words output from the ROM 107, and a latch-signal generating circuit 109 inputs the information, which is stored in the ROM 107 and is simultaneously output when a data word is output in order to provide word synchronization and which represents how many bits are in the data word which has been decoded, and generates a latch signal so that the latch circuit 106 performs its latch operation. Since the configuration of the decoding circuit shown in FIG. 2 is a common one, detailed explanation about its operation will be omitted.
Now, in genral, it is possible to improve either of T.sub.min, T.sub.max and T.sub.w by increasing the code word length n. Then, when it is tried to provide a code having better performance in order to realize higher density in the varible-length code as described above, both its code word length and code word number become large. Hence, when it is tried to configure a coding circuit or decoding circuit using a ROM, the required capacity of the ROM increases, and there occurs the inconvenience that the circuits are not practical.
SUMMARY OF THE INVENTION
It is an object of the present invention to provide a variable-length coding/decoding device in which the above-described problems can be solved.
It is another object of the present invention to provide a variable-length coding device which can convert data words into variable-length code words by a memory circuit having a small capacity.
Under such objective, in accordance with one aspect of the present invention, a variable-length coding device in accordance with the present invention is a device for converting an r.multidot.m-bit data word into an r.multidot.n-bit code word, where r is an integer having the relationship 1.ltoreq.r.ltoreq. r.sub.max, a basic data word length consists of m bits (m is a positive integer), and a basic code word length consists of n bits (n is a positive integer), and coding each of the data words of a variable-length run-length-limited code limiting the run number of bits of a first value between successive bits of a second value in a binary-coded bit string generated by concatenation of code words after the conversion to a value no smaller than d and no larger than k (d and k being positive integers), into a code word corresponding thereto, and the variable-length coding device comprises:
first coding means for coding an input data word into r.sub.max .multidot.q (q is a positive integer) bits, and outputting a first code word; and
second coding means for dividing the first code word output from the first coding means into r.sub.max blocks each consisting of q bits, coding a code word in each of the blocks, and outputting a second code word.
It is still another object of the present invention to provide a variable-length decoding device which can invert a variable-length code word into a data word by a memory circuit having a small capacity.
Under such objective, in another aspect of the present invention, a variable-length decoding device in accordance with the present invention is a device for converting an r.multidot.m-bit data word into an r.multidot.n-bit code word, where r is an integer having the relationship 1.ltoreq.r.ltoreq.r.sub.max, where a basic data word length consists of m bits (m is a positive integer), and a basic code word length consists of n bits (n is a positive integer), and inverting each of the code words of a variable-length run-length-limited code limiting the run number of bits of a first value between successive bits of a second value in a binary-coded bit string generated by concatenation of code words after the conversion to a value no smaller than d and no larger than k (d and k being positive integers), into a data word corresponding thereto, and the variable-length decoding device comprises:
first decoding means for dividing an input code word into r.sub.max blocks each consisting of n bits, decoding a code word in each of the blocks into a q-bit (q is a positive integer) code word, and outputting an r.sub.max .multidot.q-bit first code word; and
second coding means for decoding an r.sub.max .multidot.q-bit first code word output from the first decoding means, and outputting a second code word.
The foregoing and other objects and features of the present invention will become more apparent from the following detailed description of the aspects of the present invention taken in connection with the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram showing a configuration of a conventional variable-length coding device using a ROM;
FIG. 2 is a block diagram showing a configuration of a conventional variable-length decoding device using a ROM;
FIG. 3 is a block diagram showing a configuration of a variable-length coding device in accordance with the present invention; and
FIG. 4 is a block diagram of a configuration of a variable-length decoding device in accordance with the present invention.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
Now, the present invention will be hereinafter explained with reference to preferred embodiments. In the present embodiment, as an example, a case in which the (4, 19, 2, 5, 6) code is used will be explained by reference to the drawings.
The (4, 19, 2, 5, 6) code is a variable-length code having the basic data word length m=2, basic code word length n=5, number of code word lengths r.sub.max =6, T.sub.min =2.0, T.sub.max =8.0, and T.sub.w =0.4. FIG. 3 shows a block diagram of a variable-length coding circuit, in which a bit string of input data is taken in a 12-bit shift register 10, and sent to a latch circuit 11. Then, the 12-bit data are sent to a virtual coding circuit 12. The virtual coding circuit 12 comprises a ROM. Now, the content of the ROM will be explained using Tables 1 through 4 found at the end of the present specification.
First, 3-bit virtual code words are assigned to 6 kinds of basic code words. Although it is arbitrary how to assign 8 kinds of 3-bit virtual code words for 6 kinds of basic code words, the assignment is made here as shown in Table 2. Next, by delimiting code words in Table 1 by 5 bits, and replacing code words by virtual code words according to Table 2, code words are converted into virtual code words, and it is possible to make data words correspond to virtual code words. A part of the correspondence between data words and virtual code words is shown in Table 3. For example, the first data word 00 corresponds to code word 1000 (Table 1). Therefore data word 00 corresponds to virtual code word 001 (Table 3). As another example, the second data word 0100 corresponds to code word [10000][00000], as delimited by 5 bits, and so corresponds to virtual code word 001 000. For a maximum length data word of 12 bits, the corresponding data word has 30 bits and the corresponding virtual code word has 18 (=30.times.3/5) bits. Now, an explanation will be given as to which addresses in the ROM within the virtual coding circuit 12 these bit strings of 18-bit virtual code words are to be assigned.
When the first 2 bits of an input data word are "00", "001" may be output as a virtual code word. Accordingly, "001 000 000 000 000 000" is written in 1024 words from the address "000000000000" to the address "001111111111". Similarly, when an input data word is "110010", "101 000 000" may be output as a virtual code word. Hence, "101 000 000 000 000 000" is assigned in 64 words from the address "110010000000" to the address "110010111111". In general, when r.multidot.m bits from the start in an input data string within the input shift register 10 are objects of coding, a virtual code word corresponding to its data word is assigned in 2(r.sub.max -r) words in the entire address for r.sub.max .multidot.m bits which is the data word for r.multidot.m bits from the start. In this case, (r.sub.max -r).multidot.n " 0" bits are added so that each of data consists of r.sub.max .multidot.n (6.times.5=30) bits in total. A part of the memory map in the ROM within the virtual coding circuit 12 corresponding to the (4, 19, 2, 5, 6) code thus obtained, is shown in Table 4. Further, the information representing how many bits the data word has been virtually coded into is stored also within the ROM. The capacity of the ROM which is necessary in this case can be reduced by 3/5 compared with the conventional case.
Virtually-coded data are output from the ROM within the virtual coding circuit 12, making an output from the latch circuit 11 an address. A data word output from the latch circuit 11 is virtually coded, and supplied to a final coding circuit 13. The final coding circuit 13 comprises six identical coding circuits, each of them corresponding to a 5-bit basic code word. Each of coding circuits in the final coding circuit 13 may be constituted by a ROM, or by gate circuits or the like. In each of coding circuits, each of 3-bit virtual code words is converted into a 5-bit basic code word, and code words having 30 bits in total are supplied to a shift register 14 for output. Simultaneously, the information representing how many bits the data word has been virtually coded into by the virtual coding circuit 12, which is stored in the ROM within the virtual coding circuit 12, is sent to a latch-signal generating circuit 15. When it is confirmed by the latch-signal generating circuit 15 according to this information that, for example, a 4-bit data word has been virtually coded, and the new 4-bit data word is further input in the shift register 10, a latch signal is generated from the latch-signal generating circuit 15, and the data word is latched in the virtual coding circuit 12 by the latch circuit 11. The code word sent to the shift register 14 for output is then converted into serial form and output bit by bit. Though not illustrated in FIG. 3, a clock having a frequency 2.5 times that of a clock frequency supplied to the shift register 11 and latch-signal generating circuit 15 is supplied to the shift register 14 for output. The coding circuit is configured so that the shift register 14 for output shifts code words by 5 bits while the shift register 10 for input shifts data words by 2 bits.
FIG. 4 shows a block diagram of a variable-length decoding circuit corresponding to the variable-length coding circuit shown in FIG. 3. In FIG. 4, a bit string of input code words is taken in a 30-bit input shift register 16, and sent to a latch circuit 17. This 30-bit bit string of input code words is further sent to a virtual decoding circuit 18. The virtual decoding circuit 18 comprises six identical decoding circuits, each of them virtually decoding a 5-bit basic code word. Each of the decoding circuits in the virtual decoding circuit 18 may be constituted by a ROM, or by gate circuits or the like. Now, the method of virtual decoding and the content of a ROM within a final decoding circuit 19 which is used for final decoding will be explained with reference to Tables 1 through 3, 5 and 6. Table 1 is the correspondence table between data words and code words of the (4, 19, 2, 5, 6) code.
First, 3-bit virtual decode words are assigned to 6 kinds of basic code words. Although it is arbitrary how to assign 8 kinds of 3-bit virtual decode words for 6 kinds of basic code words, assignment is made here as shown in FIG. 2. The virtual decoding circuit 18 converts each of basic code words into a 3-bit virtual decode word according to the correspondence shown in FIG. 2, and outputs the decode word. Further, by delimiting code words shown in Table 1 by 5 bits, and replacing code words by virtual decode words according to Table 2, code words are converted into virtual decode words, and it is possible to make data words correspond to virtual decode words. A part of the correspondence between data words and virtual decode words is shown in Table 3. Next, these bit strings of 18-bit virtual decode words are made address signals in the ROM within the final decoding circuit 19, and data stored in the ROM are accessed. Now, an explanation will be given as to which addresses data shown in Table 3 are assigned.
As is apparent from Table 1, when it is assumed r.sub.2 >r.sub.1 (r.sub.1 and r.sub.2 are the numbers of code word lengths), there are cases in which a 5r.sub.1 -bit code word and 5r.sub.1 bits from the head of a 5r.sub.2 -bit code word are equal. For example, code words in which the leading 5 bits are "10000" are shown in Table 5. When the leading 5 bits within the input shift register 16 are "10000" (the virtual decode word corresponding to the code word "10000" is "001", which actually becomes the input to the ROM within the final decoding circuit 19) as shown in Table 5, the "10000" cannot instantaneously be decoded, because it is necessary to give priority to a code word having long word length. In order realize this process by arrangement of data within the ROM of the final decoding circuit 19, the following procedure is taken.
For example, relative to data for a 9-bit virtual decode word, for all 18-bit address 2.sup.9 =512 words in which the leading 9 bits are the same as the 9-bit virtual decode word, six 0's are added after the corresponding data words so as to be 12 bits in total. However, if there is an overlapping address when addresses have similarly been assigned for 3r-bit (r>3) virtual decode words, data of a virtual decode word having a longer word length are preferred. Further, in the case of general varible-length codes, relative to data for an r.multidot.q-bit virtual decode word, for all r.sub.max .multidot.q-bit address 2(r.sub.max -r).multidot.q words in which the leading r.multidot.q bits are the same as the r.multidot.q-bit virtual decode word, m.multidot.(r.sub.max -r) 0's are added after the corresponding data words so as to be r.sub.max .multidot.m bits in total. In the case of an overlapping address, data for a code word having a longer word length is preferred.
A part of the memory map in the ROM within the final decoding circuit 19 which has been prepared as described above is shown in Table 6. The memory map, a part of which is shown in Table 6, is for a case in which the leading three bits of virtual decode words are "001". Similar tables can also be obtained for other cases. Further, the information representing how many bit-code words have been decoded is also stored within the ROM. Thus, the required capacity of the ROM can be reduced down to 2.sup.-12 compared with the conventional case.
Next, a 12-bit data word output from the ROM of the final decoding circuit 19 is supplied to a 12-bit shift register 20 for output. Simultaneously, the information representing how many bits are in the code word to be decoded by the final decoding circuit 19, which is stored in the ROM of the final decoding circuit 19, is sent to a latch-signal generating circuit 21. When it is confirmed by the latch-signal generating circuit 21 according to this information that, for example, a 10-bit code word has been decoded, and the new 10-bit code word is further input in the shift register 16 for input, a latch signal is generated from the latch-signal generating circuit 21, and the code word is latched in the virtual decoding circuit 18 by the latch circuit 17. The data word sent to the shift register 20 for output is then converted into serial form and output bit by bit. Though not illustrated in FIG. 4, a clock having a frequency 2/5 times that of a clock frequency supplied to the shift register 16 for input and the latch-signal generating circuit 21 is supplied to the shift register 20 for output. The decoding circuit is configured so that the shift register 20 for output shifts data words by 4 bits while the shift register 16 for input shifts code words by 10 bits.
Next, as a second embodiment of the present invention, a case in which the (5, 16, 2, 6, 4) code is applied will be explained. This code is a variable-length code having the basic data word length m=2, basic code word length n=6, number of code word lengths r.sub.max =4, T.sub.min =2.0, T.sub.max =5.7, T.sub.w =0.33. In Table 7, the correspondence table between data words and code words is shown. In the second embodiment, the configuration of a varible-length coding device is such that, in FIG. 3, the shift register 10 for input consists of 8 bits, and the shift register 14 for output consists of 24 bits. Further, the final coding circuit 13 in FIG. 3 comprises four coding circuits. The number of basic code words is seven. Hence, the representation by 3-bit virtual code words is possible. The correspondence between the basic code words and virtual code words is as shown in Table 8. Accordingly, a part of the correspondence between input data words and virtual code words, and a part of the memory map of the ROM in the virtual coding circuit 12 are as shown in Table 9 and Table 10, respectively. Consequently, the capacity of the ROM in the second embodiment can be reduced to 3/6 =1/2 compared with that in the conventional case. The circuit operation is the same as that in the case in which the (4, 19, 2, 5, 6) code is applied, that is, in the first embodiment. Hence, detailed explanation thereof will be omitted.
Further, in the case of the second embodiment, the configuration of a variable-length decoding circuit is such that, in FIG. 4, the shift register 16 for input consists of 24 bits, and the shift register 20 for output consists of 8 bits. The virtual decoding circuit 18 in FIG. 4 comprises four decoding circuits. The number of basic code words is seven. Hence, the representation by 3-bit virtual decode words is possible. The correspondence between the basic code words and virtual decode words is as shown in Table 8. Accordingly, a part of the correspondence between virtual decode words and output data words is as shown in Table 9. Table 11 shows the memory map for a case in which the preceding 3 bits of virtual decode words are, for example, "100" (the basic code word corresponding to the virtual decode word "100" is "000100"). In this case, there is no overlapping of addresses. Memory maps for other cases can similarly be obtained. Consequently, the required capacity of the ROM in the second embodiment can be reduced down to 2.sup.-12 compared with that in the conventional case. The circuit operation is the same as that in the case in which the (4, 19, 2, 5, 6) code is applied. Hence, explanation thereof will be omitted.