JPH04330829A - Coding and decoding device - Google Patents

Coding and decoding device

Info

Publication number
JPH04330829A
JPH04330829A JP3100864A JP10086491A JPH04330829A JP H04330829 A JPH04330829 A JP H04330829A JP 3100864 A JP3100864 A JP 3100864A JP 10086491 A JP10086491 A JP 10086491A JP H04330829 A JPH04330829 A JP H04330829A
Authority
JP
Japan
Prior art keywords
code
bits
codes
code length
length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP3100864A
Other languages
Japanese (ja)
Inventor
Masaaki Hyodo
正晃 兵頭
Yoji Noguchi
要治 野口
Hiroyuki Katada
裕之 堅田
Hiroyuki Akagi
宏之 赤木
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sharp Corp
Original Assignee
Sharp Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sharp Corp filed Critical Sharp Corp
Priority to JP3100864A priority Critical patent/JPH04330829A/en
Publication of JPH04330829A publication Critical patent/JPH04330829A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide an coding and decoding device by which a code can be decoded with a small error, even when an erroneous transmission is reduced, and the information of a code length can not be obtained. CONSTITUTION:An A/D converter 1 converts a television signal into an 8 bit digital signal, and a blocking circuit 2 divides the output into blocks formed of the prescribed number of picture elements. A DCT circuit 3 operates a discrete cosine transformation, an adaptive quantizer 4 encodes a conversion factor obtained as the result after adaptively changing the number of quantizing bits so that a coding amount can be constant, and outputs both a code length (b) and additional information (c) which decides the code length. A rearranging circuit 5 operates the rearrangement of the codes of each conversion factor at every above mentioned block, and outputs a code string (e) in which the complete code which is not divided appears at each 8 bit. A multiplexer 6 receives this code string (e) and the additional information (c) from the adaptive quantizer 4, and outputs them to an error correcting encoder 7. The error correcting encoder 7 operates an error correcting encoding by using 8 bits as one word.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明は、デジタル信号の符号化
装置および復号装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a digital signal encoding device and decoding device.

【0002】0002

【従来の技術】デジタル映像信号を高能率に符号化する
技術として、映像信号の分散、ダイナミックレンジ、発
生確率といった統計的性質にもとづいて適応的に符号長
を変化させる符号化技術が知られている。その一つに、
デジタル信号をもとのビット数より少ないビット数で再
量子化するという方法がある。それによれば、例えば8
ビットで量子化された信号の、一定間隔毎の分散が計算
され、その分散に従って該間隔の信号が適応的に0〜8
ビットで再量子化され、符号化の結果として再量子化さ
れた量子化値と、付加情報としての量子化ビット長を決
定する分散とが与えられる。
[Prior Art] As a technology for highly efficient encoding of digital video signals, there is a known encoding technology that adaptively changes the code length based on statistical properties such as dispersion, dynamic range, and probability of occurrence of the video signal. There is. One of them is
There is a method of requantizing a digital signal with a smaller number of bits than the original number of bits. According to it, for example, 8
The variance of the bit-quantized signal for each fixed interval is calculated, and the signal of the interval is adaptively divided into 0 to 8 according to the variance.
It is requantized in bits, and as a result of encoding the requantized quantization value and the variance determining the quantization bit length are given as additional information.

【0003】このような方法で符号化された符号は、さ
らに誤り訂正のための符号化が行われ、その後、伝送さ
れたり、あるいはデジタルVTRなどに記録される。高
能率の誤り訂正符号の例としては、1ワード毎の誤りを
検出し、訂正するリードソロモン積符号がある。そして
、伝送あるいは記録された符号は誤り訂正の後、復号さ
れるが、その場合には上記付加情報により決る符号長に
もとづいて量子化値より復号されることになる。
[0003] The code encoded by this method is further encoded for error correction, and then transmitted or recorded on a digital VTR or the like. An example of a highly efficient error correcting code is a Reed-Solomon product code that detects and corrects errors on a word-by-word basis. Then, the transmitted or recorded code is decoded after error correction, but in that case, it is decoded from a quantized value based on the code length determined by the above-mentioned additional information.

【0004】0004

【発明が解決しようとする課題】上述した符号化方法で
符号化され、記録された符号を復号するとき、付加情報
が得られない場合がある。例えばデジタルVTRでは、
高速再生を行うとき、ヘッドは複数のヘリカルトラック
にまたがって走査するため、記録されているすべての情
報を読み取ることができず、付加情報が読み出せなくな
ることがある。あるいは画像伝送装置では、ノイズなど
が混入した場合には、その影響で付加情報に誤りが発生
する。このような場合、符号化の際のビット長に関する
情報が得られないため、復号すべき符号列のうち、どこ
からどこまでが1つの符号であるかを判別できなくなり
、結局すべての符号の復号が不可能となる。
[Problems to be Solved by the Invention] When decoding a code encoded and recorded using the above-described encoding method, additional information may not be obtained. For example, in a digital VTR,
When performing high-speed reproduction, the head scans across multiple helical tracks, so it may not be possible to read all the recorded information, and additional information may not be read out. Alternatively, in an image transmission device, if noise or the like is mixed in, errors will occur in the additional information due to the influence. In such a case, since information regarding the bit length during encoding cannot be obtained, it becomes impossible to determine from which part of the code string to be decoded a single code ends, and in the end all codes cannot be decoded. It becomes possible.

【0005】また、デジタルVTRで再生時にエラーが
発生した場合、エラー訂正符号によってある程度符号を
復元することができるが、復元できる単位は例えばリー
ドソロモン積符号の場合には1ワードである。そして、
符号長が異なる符号で構成される符号列の場合、通常、
1ワードは複数の符号で構成されるので、あるワードが
訂正されても、符号を再生できない場合がある。例えば
、図15に示すように異なる符号長で符号化された合計
32ビットの符号列w1〜w6を8ビットを1ワードと
して誤り訂正を行うとすると、図16に示すような第1
〜第4の各ワード毎に処理することになる。そして、例
えば第1〜第3のワードに誤りが生じ、第2のワードだ
けが誤り訂正が可能であったとすると、符号w2、w3
は第2のワードに属しているにもかかわらず第1および
第3のワードの誤りのため、復号することは不可能とな
ってしまう。
Furthermore, if an error occurs during reproduction in a digital VTR, it is possible to restore the code to some extent using an error correction code, but the unit of restoration is one word in the case of a Reed-Solomon product code, for example. and,
In the case of a code string consisting of codes with different code lengths, usually
Since one word is composed of a plurality of codes, even if a certain word is corrected, the code may not be able to be reproduced. For example, if error correction is performed on a total of 32 bits of code strings w1 to w6 encoded with different code lengths as shown in FIG. 15, using 8 bits as one word, the first
. . . each fourth word will be processed. For example, if an error occurs in the first to third words and error correction is possible only in the second word, then the codes w2 and w3
Although it belongs to the second word, it becomes impossible to decode it due to errors in the first and third words.

【0006】本発明の目的は、このような問題を解決し
、符号長を決定する付加情報がなくても小さい誤差で符
号を復号することが可能であり、かつ符号列のある部分
で生じた誤りが他の部分の復号に影響しないように構成
された符号化装置および復号装置を提供することにある
An object of the present invention is to solve such problems, to make it possible to decode codes with small errors even without additional information for determining the code length, and to make it possible to decode codes with small errors that occur in a certain part of the code string. An object of the present invention is to provide an encoding device and a decoding device configured so that errors do not affect decoding of other parts.

【0007】[0007]

【課題を解決するための手段】本発明の符号化装置は、
上記目的を達成すべく入力信号をその統計的性質に応じ
て適応的にビット長を変化させて量子化し符号を生成す
る手段と、該手段から順次出力される符号を一定数のビ
ット毎に分割されない完全な符号が現れるような符号列
に並び替える手段とを備えたことを特徴とする。
[Means for Solving the Problems] The encoding device of the present invention includes:
In order to achieve the above purpose, means for quantizing and generating codes by adaptively changing the bit length of an input signal according to its statistical properties, and dividing the codes sequentially output from the means into a fixed number of bits. The present invention is characterized in that it includes means for rearranging the code string such that a complete code that is not included in the code appears.

【0008】本発明の復号装置は、上記目的を達成すべ
く一定数のビット毎に分割されない完全な符号が現れる
ように並び替えられた符号列が入力されたときに、各符
号の長さを示す符号長情報が存在する場合には該情報に
基づき、また前記符号長情報が存在しない場合には予め
記憶された符号長パターンに従って前記入力された符号
列を分割されない完全な符号の連続する符号列に並び替
える手段と、前記並び替えられた符号列を構成する符号
を順次復号する手段とを備えたことを特徴とする。
In order to achieve the above object, the decoding device of the present invention calculates the length of each code when a code string rearranged so that a complete code that is not divided into every certain number of bits appears is input. If code length information exists, the input code string is divided into continuous codes of complete codes that are not divided, based on the code length information, or according to a pre-stored code length pattern if the code length information does not exist. The present invention is characterized by comprising means for rearranging the code strings, and means for sequentially decoding the codes constituting the rearranged code strings.

【0009】[0009]

【作用】本発明の符号化装置は、入力信号をその分散、
ダイナミックレンジ、発生確立といった統計的性質に応
じてビット長を変化させて量子化する。そして、各符号
を、必要に応じて分割して並び替え、これにより、一定
のビット長毎に少なくとも1つの完全な符号が出現する
ような符号列を形成し、誤り訂正等の処理を施して出力
する。
[Operation] The encoding device of the present invention distributes the input signal,
Quantization is performed by changing the bit length according to statistical properties such as dynamic range and probability of occurrence. Then, each code is divided and rearranged as necessary, thereby forming a code string in which at least one complete code appears for each fixed bit length, and processing such as error correction is performed. Output.

【0010】本発明の復号装置は、上記符号化装置から
送られてくる符号列を、該符号列とともに送られてくる
符号長情報に従って元の符号列に並び変え、各符号を順
次復号する。ノイズ等の影響により、符号長情報が得ら
れなかった場合は、予め記憶された典型的な符号長パタ
ーンに従って、符号の長さを決定し、これにより、送ら
れてきた符号列を分割されない完全な符号の連続する符
号列に変換する。符号化装置から送られてくる符号列に
含まれる分割されない完全な符号は、所定の周期で現れ
るのでこれが符号列のどこから始まるかを知ることがで
き、従って符号長情報が得られない場合でも上記符号長
パターンを用いることにより、少ない誤差で符号を復号
することができる。
The decoding device of the present invention rearranges the code string sent from the encoding device into the original code string according to the code length information sent with the code string, and sequentially decodes each code. If code length information cannot be obtained due to the influence of noise, etc., the code length is determined according to a typical code length pattern stored in advance. Convert to a continuous code string. Since the undivided complete code contained in the code string sent from the encoding device appears at a predetermined period, it is possible to know where in the code string it starts, and therefore even if code length information is not obtained, the above By using the code length pattern, the code can be decoded with less error.

【0011】[0011]

【実施例】次に本発明の実施例について詳細に説明する
。図1に本発明による符号化装置の一例を示す。この装
置はアナログのテレビジョン信号に対して離散コサイン
変換を行い、変換係数を適応的に異なったビット数で量
子化して得られる符号列に本発明の特徴である符号の並
び替えを行うものである。
EXAMPLES Next, examples of the present invention will be described in detail. FIG. 1 shows an example of an encoding device according to the present invention. This device performs discrete cosine transform on an analog television signal, adaptively quantizes the transform coefficients with different numbers of bits, and rearranges the codes in the resulting code string, which is a feature of the present invention. be.

【0012】アナログのテレビジョン信号が入力される
と、A/D変換器1はそれを8ビットのデジタル信号に
変換し、ブロック化回路2に出力する。ブロック化回路
2はそのデジタル信号を例えば8画素×8画素のブロッ
ク毎のデジタル信号に並べ替え、順次、DCT(ディス
クリートコサイン変換)回路3に出力する。DCT回路
3はこのブロック化されたデジタル信号に対して離散コ
サイン変換を行い、これにより8×8の変換係数を得る
。そして例えばジグザグスキャンによって低い空間周波
数の変換係数から順次、適応量子化器4に出力する。
When an analog television signal is input, the A/D converter 1 converts it into an 8-bit digital signal and outputs it to the blocking circuit 2. The blocking circuit 2 rearranges the digital signals into digital signals for each block of 8 pixels x 8 pixels, for example, and sequentially outputs the digital signals to a DCT (discrete cosine transform) circuit 3. The DCT circuit 3 performs discrete cosine transform on this blocked digital signal, thereby obtaining 8×8 transform coefficients. Then, the transform coefficients are sequentially outputted to the adaptive quantizer 4 starting from the lowest spatial frequency by, for example, zigzag scanning.

【0013】適応量子化器4は、符号量が一定となるよ
うに量子化ビット数を適応的に変化させる量子化器で、
DCT回路3からの変換係数の統計をとり、その統計量
に従って量子化ビット数を決定し、各係数を8ビット以
下で量子化する。その結果、適応量子化器4からは異な
る符号長の符号で構成された符号列が出力される。符号
量を一定とする具体的な制御方法としては、例えば特願
平102643に記載されているような方法を1フィー
ルド単位で用いることができる。この場合、符号長を決
定する付加情報は、例えばフィールド毎に8×8の変換
係数それぞれの分散及び平均値、ブロック毎に量子化ビ
ット数の平均とすることができる。
The adaptive quantizer 4 is a quantizer that adaptively changes the number of quantization bits so that the code amount is constant.
The statistics of the transform coefficients from the DCT circuit 3 are taken, the number of quantization bits is determined according to the statistics, and each coefficient is quantized to 8 bits or less. As a result, the adaptive quantizer 4 outputs a code string composed of codes of different code lengths. As a specific control method for keeping the code amount constant, for example, the method described in Japanese Patent Application No. 102643 can be used in units of one field. In this case, the additional information that determines the code length can be, for example, the variance and average value of 8×8 transform coefficients for each field, and the average number of quantization bits for each block.

【0014】適応量子化器4からはこのような符号長を
決定する付加情報cがマルチプレクサ6に、そして各変
換係数の量子化結果、すなわち符号aと各変換係数の量
子化ビット数、すなわち符号長bとが並べ替え回路5に
それぞれ出力される。この符号化装置の特徴である並べ
替え回路5は、上記ブロック毎に各変換係数の符号の並
べ替えを行い、8ビット毎に完全な符号が最上位ビット
から現れる符号列eを出力する。
From the adaptive quantizer 4, the additional information c for determining the code length is sent to the multiplexer 6, and the quantization result of each transform coefficient, that is, the code a, and the number of quantized bits of each transform coefficient, that is, the code The length b is output to the rearrangement circuit 5, respectively. A rearrangement circuit 5, which is a feature of this encoding device, rearranges the codes of each transform coefficient for each block, and outputs a code string e in which a complete code appears from the most significant bit every 8 bits.

【0015】マルチプレクサ6は、この符号列eと適応
量子化器4からの付加情報cとを受け取り、1チャネル
のデータとして誤り訂正符号化器7に出力する。誤り訂
正符号化器7は8ビットを1ワードとして、例えばリー
ドソロモン積符号を用いて誤り訂正符号化を行う。
The multiplexer 6 receives this code string e and the additional information c from the adaptive quantizer 4, and outputs it to the error correction encoder 7 as one channel data. The error correction encoder 7 performs error correction encoding using 8 bits as one word, for example, using a Reed-Solomon product code.

【0016】並べ替え回路5は図2に示すような構成を
有している。カウンタ16は、量子化ビット数bを受け
取り、ブロック毎の合計の符号長をカウントし、その結
果を8で割った商dを出力する。すなわち、図3のフロ
ーチャートに示すように、カウンタ16はまず符号長の
加算結果iを0とし、符号の番号に対応するjを1とす
る(ステップ301)。そしてjが64以下か否かを判
定する(ステップ302)。jは1で、64以下である
ため、1番目の符号の符号長l1(すなわち符号長b)
をiに加算し、またjを1だけ増加させる(ステップ3
03)。その後、再びステップ302に戻り、以降、j
が64を越えるまで以上の手順を繰り返す。そして、j
が64を越えたときは、iを8で割り、その商dを出力
する(ステップ304)。
The rearrangement circuit 5 has a configuration as shown in FIG. The counter 16 receives the quantization bit number b, counts the total code length for each block, and outputs the quotient d obtained by dividing the result by 8. That is, as shown in the flowchart of FIG. 3, the counter 16 first sets the code length addition result i to 0, and sets j corresponding to the code number to 1 (step 301). Then, it is determined whether j is 64 or less (step 302). Since j is 1 and is less than or equal to 64, the code length l1 of the first code (i.e. code length b)
is added to i and j is increased by 1 (step 3
03). After that, the process returns to step 302, and from then on, j
Repeat the above steps until the number exceeds 64. And j
When exceeds 64, divide i by 8 and output the quotient d (step 304).

【0017】スイッチ18はカウンタが出力する商dに
もとづいて制御信号をFIFO(先入れ先出し)バッフ
ァ19、20に出力し、1ブロック毎の第1番目から第
d番目までの符号aをバッファ19に、第d+1番目以
降の符号はバッファ20にそれぞれ蓄える。ここで、バ
ッファ19に格納された符号は8ビット毎に完全な形で
現れる符号となり、バッファ20に格納された符号は分
割してバッファ19の符号に付加される符号となる。ス
イッチ18の動作を、図4のフローチャートを用いて具
体的に説明する。スイッチ18はまず符号の番号に対応
するjを1とし(ステップ401)、次にjが商d以下
か否かを判定する(ステップ402)。この場合、jは
dより小さいので、ステップ403に進み、各符号のビ
ットの番号に対応するiを1とする。そして、iが符号
長lj以下か否かを判定し(ステップ404)、iが符
号長lj以下の場合には符号ビットXj,iをバッファ
19に入力し、iを1だけ増加させる(ステップ405
)。なお、符号ビットXj,iは符号aの各ビットのこ
とであり、Xj,iはj番目の符号のMSBからi番目
のビットを表す。スイッチ18はiが符号長ljを越え
るまでステップ404及び405を繰り返し、iが符号
長ljを越えたとき第1番目の符号の格納が終了したこ
とになるので、jを1だけ増加させ(ステップ406)
、再びステップ402以降の手順を繰り返す。そして、
第d番目の符号までバッファ19に格納すると、次にス
テップ407に進む。そして以下同様の手順、すなわち
ステップ408〜411によって第d+1番目の符号以
降の符号を順次、バッファ20に格納する。
The switch 18 outputs a control signal to FIFO (first in, first out) buffers 19 and 20 based on the quotient d output by the counter, and sends the first to dth codes a of each block to the buffer 19. The d+1th and subsequent codes are stored in the buffer 20, respectively. Here, the code stored in the buffer 19 becomes a code that appears in a complete form every 8 bits, and the code stored in the buffer 20 becomes a code that is divided and added to the code in the buffer 19. The operation of the switch 18 will be specifically explained using the flowchart of FIG. The switch 18 first sets j corresponding to the code number to 1 (step 401), and then determines whether j is less than or equal to the quotient d (step 402). In this case, since j is smaller than d, the process proceeds to step 403, where i corresponding to the bit number of each code is set to 1. Then, it is determined whether or not i is less than or equal to the code length lj (step 404), and if i is less than or equal to the code length lj, the code bit Xj,i is input to the buffer 19 and i is incremented by 1 (step 405).
). Note that the code bits Xj,i are each bit of the code a, and Xj,i represents the i-th bit from the MSB of the j-th code. The switch 18 repeats steps 404 and 405 until i exceeds the code length lj, and when i exceeds the code length lj, it means that the storage of the first code is completed, so it increments j by 1 (step 406)
, repeat the steps from step 402 onwards. and,
After storing up to the d-th code in the buffer 19, the process proceeds to step 407. Thereafter, the codes after the (d+1)th code are sequentially stored in the buffer 20 through the same procedure, that is, steps 408 to 411.

【0018】符号長bおよびカウンタ16が出力する商
dはFIFOバッファ17にも入力され、格納される。 セレクタ21はバッファ17が出力するこれら符号長b
および商dにもとづいて動作する。すなわちセレクタ2
1は、符号長bの数だけバッファ19からビットを取り
出して出力し、それが8ビット未満の場合には、8ビッ
トに不足する数のビットをバッファ20から取り出して
出力する。セレクタ21はこのような動作をd回繰り返
す。図5に示すフローチャートを用いて説明すると、セ
レクタ21はまず、符号の番号に対応するjを1とし(
ステップ501)、次にjがd以下か否かを判定する(
ステップ502)。この場合にはjはd以下であるため
、次に各符号のビットの番号に対応するiを1とし(ス
テップ503)、iが符号長lj以下か否かを判定する
(ステップ504)。そして、iがlj以下のときは、
バッファ19から1ビット(Xj,i)を取り出して出
力し、また、iを1だけ増加させる(ステップ505)
。以降、ステップ504、505をiが符号長ljを越
えるまで繰り返し、iがljを越えると1つの完全な符
号の出力を終了したことになるので、ステップ506に
進む。そして、iが8以下か否かを判定し、8以下のと
きは、バッファ20から1ビットを取り出して出力し、
また、iを1だけ増加させる(ステップ507)。 その後、ステップ506に戻り、iが8を越えるまでス
テップ506、507を繰り返す。iが8を越えると1
ワード分のビットの出力を終了したことになるので、次
の1ワード分のビットを出力するため、jを1だけ増加
させ(ステップ508)、ステップ502に戻る。以降
、jがdを越え、1ブロック分の符号の送出を完了する
まで上述の手順を繰り返す。
The code length b and the quotient d output by the counter 16 are also input to the FIFO buffer 17 and stored therein. The selector 21 selects these code lengths b output from the buffer 17.
and the quotient d. That is, selector 2
1 takes out bits from the buffer 19 by the number of code lengths b and outputs them, and if the bits are less than 8 bits, the number of bits short of 8 bits is taken out from the buffer 20 and output. The selector 21 repeats this operation d times. To explain using the flowchart shown in FIG. 5, the selector 21 first sets j corresponding to the code number to 1 (
Step 501), then it is determined whether j is less than or equal to d (
Step 502). In this case, since j is less than or equal to d, next, i corresponding to the bit number of each code is set to 1 (step 503), and it is determined whether or not i is less than or equal to the code length lj (step 504). And when i is less than lj,
Take out 1 bit (Xj, i) from the buffer 19 and output it, and also increment i by 1 (step 505)
. Thereafter, steps 504 and 505 are repeated until i exceeds the code length lj, and when i exceeds lj, it means that the output of one complete code has been completed, so the process proceeds to step 506. Then, it is determined whether or not i is 8 or less, and if it is 8 or less, 1 bit is taken out from the buffer 20 and output,
Also, i is increased by 1 (step 507). Thereafter, the process returns to step 506 and steps 506 and 507 are repeated until i exceeds 8. 1 if i exceeds 8
Since the output of bits for a word has been completed, j is incremented by 1 in order to output the bits for the next word (step 508), and the process returns to step 502. Thereafter, the above-described procedure is repeated until j exceeds d and transmission of one block's worth of codes is completed.

【0019】次に、並べ替え回路5に図6(B)に示す
符号w1〜w6が入力された場合について具体的に説明
する。実際の符号の数は1ブロック当り64個であるが
、ここでは簡単のため1ブロック当りの符号の数は6で
あるとする。並べ替え回路5には、符号w1〜w6と共
に、図6(A)に示すそれらの符号長bが与えられる。 そして、カウンタ16は、符号長bの合計を計算し、そ
の結果である32を8で割った商4を商dとして出力す
る。スイッチ18はバッファ19、20を制御し、dの
値に従って符号列aの先頭から4符号をバッファ19に
、残りの符号をバッファ20にそれぞれ格納させる。そ
の結果、バッファ19の内容は図6(C)のようになり
、バッファ20の内容は図6(D)のようになる。一方
、バッファ17には符号長b(図6(A))と商d(=
4)とが格納され、セレクタ21はそれらの値にもとづ
いて動作する。すなわち、セレクタ21はまずバッファ
19から7ビットを取り出し、8ビットに対する不足分
である1ビットをバッファ20から取り出して出力する
。次にセレクタ21はバッファ19からは6ビット、バ
ッファ20からは2ビットを取り出して出力する。この
操作を4回繰り返すことにより、セレクタ21は図6(
E)に示す符号列を出力する。
Next, a case in which the codes w1 to w6 shown in FIG. 6(B) are input to the rearrangement circuit 5 will be specifically explained. The actual number of codes per block is 64, but here, for simplicity, it is assumed that the number of codes per block is 6. The reordering circuit 5 is given the codes w1 to w6 as well as their code lengths b shown in FIG. 6(A). Then, the counter 16 calculates the total code length b, and outputs the quotient 4 obtained by dividing the result 32 by 8 as the quotient d. The switch 18 controls the buffers 19 and 20, and stores the first four codes of the code string a in the buffer 19 and the remaining codes in the buffer 20, respectively, according to the value of d. As a result, the contents of the buffer 19 become as shown in FIG. 6(C), and the contents of the buffer 20 become as shown in FIG. 6(D). On the other hand, the buffer 17 stores the code length b (FIG. 6(A)) and the quotient d (=
4) are stored, and the selector 21 operates based on these values. That is, the selector 21 first takes out 7 bits from the buffer 19, then takes out 1 bit, which is the shortfall of 8 bits, from the buffer 20 and outputs it. Next, the selector 21 takes out 6 bits from the buffer 19 and 2 bits from the buffer 20 and outputs them. By repeating this operation four times, the selector 21 becomes
Output the code string shown in E).

【0020】図7に本発明による復号装置の一例を示す
。この復号装置は上述した本発明の符号化装置によって
符号化された信号を復号するものである。誤り訂正復号
器8は、復号入力、すなわち復号すべき符号を1ワード
(8ビット)毎に復号し、その結果をデマルチプレクサ
9に出力する。デマルチプレクサ9は付加情報fとブロ
ック毎の符号列gとを分離し、付加情報fは符号長計算
器10に、符号列gは逆並べ替え回路11に出力する。 符号長計算器10は付加情報fから各変換係数の符号長
hを計算し、それを逆並べ替え回路11と逆量子化器1
2とに出力する。符号長計算器10は典型的なブロック
の符号長パターンを記憶しており、正確な符号長が計算
できなかった場合には、記憶している符号長を出力する
と共に、制御信号oを出力する。
FIG. 7 shows an example of a decoding device according to the present invention. This decoding device decodes the signal encoded by the aforementioned encoding device of the present invention. The error correction decoder 8 decodes the decoded input, that is, the code to be decoded, word by word (8 bits), and outputs the result to the demultiplexer 9. The demultiplexer 9 separates the additional information f and the code string g for each block, and outputs the additional information f to the code length calculator 10 and the code string g to the inverse rearrangement circuit 11. The code length calculator 10 calculates the code length h of each transform coefficient from the additional information f, and sends it to the inverse rearrangement circuit 11 and the inverse quantizer 1.
Output to 2. The code length calculator 10 stores code length patterns of typical blocks, and if an accurate code length cannot be calculated, it outputs the stored code length and also outputs a control signal o. .

【0021】逆並べ替え回路11は、符号長hに従って
符号列gに対して並べ替え回路5と逆の操作を行い、復
元した符号列rを出力する。ここで制御信号oが入力さ
れたときは、適当な符号長で復号した場合に小さい誤差
で復号できる符号についてだけ読み取った符号を出力し
、それ以外の符号については、例えば0を出力する。
The inverse reordering circuit 11 performs an operation opposite to that of the reordering circuit 5 on the code string g according to the code length h, and outputs a restored code string r. When the control signal o is input here, the read code is output only for codes that can be decoded with a small error when decoded with an appropriate code length, and for other codes, for example, 0 is output.

【0022】逆量子化器12は逆並べ替え回路11から
の符号列rと、符号長計算器10からの符号長hおよび
制御信号oにもとづいて逆量子化を行う。そして、制御
信号oが入力された場合には、逆並べ替え回路11内の
後述するカウンタの出力値pに対して第p番目以降の変
換係数の逆量子化値を0として出力する。
The inverse quantizer 12 performs inverse quantization based on the code string r from the inverse rearrangement circuit 11 and the code length h and control signal o from the code length calculator 10. When the control signal o is input, the inverse quantization value of the p-th and subsequent transform coefficients is output as 0 for the output value p of a counter described later in the inverse rearrangement circuit 11.

【0023】逆DCT回路13は逆量子化器12の出力
に対して逆離散コサイン変換を行い、ブロック毎に画素
値を復元する。ブロック分解回路14はこの復元された
ブロック毎の画素値を並べ替え、もとの走査信号を出力
する。D/A変換器15はこの走査信号をデジタル信号
からアナログ信号に変換し、アナログのテレビジョン信
号として出力する。
The inverse DCT circuit 13 performs inverse discrete cosine transform on the output of the inverse quantizer 12 to restore pixel values for each block. The block decomposition circuit 14 rearranges the restored pixel values for each block and outputs the original scanning signal. The D/A converter 15 converts this scanning signal from a digital signal to an analog signal and outputs it as an analog television signal.

【0024】逆並べ替え回路11は図8に示す構成を有
している。この回路には符号長計算器10からの符号長
hおよび制御信号oと、デマルチプレクサ9で分離され
た符号列gとが入力される。符号長hはFIFOバッフ
ァ22とスイッチ24とに入力され、符号列gはFIF
Oバッファ23及びカウンタ28に入力される。カウン
タ28はブロック毎の符号列の長さを計算し、合計を8
で割った商pを出力する。すなわち、図9のフローチャ
ートに示すように、符号列を構成するビットの数に対応
するiをまず0として(ステップ901)、データ入力
があるか否かを判定し(ステップ902)、この場合に
はデータ入力があるのでiを1だけ増加させる(ステッ
プ903)。そして、ステップ902、903をデータ
入力がなくなるまで繰り返し、その後、iを8で割って
商pを求め、それを出力する(ステップ904)。
The inverse rearrangement circuit 11 has the configuration shown in FIG. The code length h and control signal o from the code length calculator 10 and the code string g separated by the demultiplexer 9 are input to this circuit. The code length h is input to the FIFO buffer 22 and switch 24, and the code string g is input to the FIFO buffer 22 and switch 24.
The signal is input to the O buffer 23 and the counter 28. The counter 28 calculates the length of the code string for each block and adds up to 8
The quotient p divided by is output. That is, as shown in the flowchart of FIG. 9, i, which corresponds to the number of bits constituting a code string, is first set to 0 (step 901), and it is determined whether there is data input (step 902). Since there is data input, i is increased by 1 (step 903). Then, steps 902 and 903 are repeated until there is no more data input, and then i is divided by 8 to obtain the quotient p, which is output (step 904).

【0025】バッファ23に蓄えられた符号列はスイッ
チ24によってFIFOバッファ25とFIFOバッフ
ァ26とに振り分けられる。すなわち、スイッチ24は
バッファ25、26に制御信号を出力し、符号長hの数
のビットはバッファ25に格納され、その数から8ビッ
トまでの不足分のビットはバッファ26に格納されるよ
うにする。その結果、バッファ25には8ビット毎に現
れる完全な符号が格納され、一方、バッファ26には分
割されていた符号が格納されることになる。
The code string stored in the buffer 23 is distributed to a FIFO buffer 25 and a FIFO buffer 26 by a switch 24. That is, the switch 24 outputs a control signal to the buffers 25 and 26, so that the bits corresponding to the code length h are stored in the buffer 25, and the missing bits from that number to 8 bits are stored in the buffer 26. do. As a result, the buffer 25 stores the complete code appearing every 8 bits, while the buffer 26 stores the divided code.

【0026】図10に示すフローチャートを用いて説明
すると、スイッチ24はまず、符号の番号に対応するi
を1として(ステップ101)、iが商p以下か否かを
判定し(ステップ102)、この場合にはiは商pより
小さいので、ビットの番号に対応するkを1とする(ス
テップ103)。そして、kがi番目の符号の符号長l
i(すなわち符号長h)以下か否かを判定し(ステップ
104)、この場合にはkは符号長liより小さいので
、バッファ23から1ビットをバッファ25に入力させ
、kを1だけ増加させる(ステップ105)。以降、k
がliを越えるまでステップ104、105を繰り返し
、kがliを越えたところでステップ106に進む。 そしてkが8以下か否かを判定し(ステップ106)、
この場合にはkは8より小さいので、バッファ23から
1ビットをバッファ26に入力し、kを1だけ増加させ
る。以降、kが8を越えるまでステップ106、107
を繰り返し、kが8を越えるとステップ102に戻り、
iがpを越えるまで以上の操作を繰り返す。
To explain using the flowchart shown in FIG. 10, the switch 24 first selects the i corresponding to the code number.
is set to 1 (step 101), and it is determined whether or not i is less than or equal to the quotient p (step 102). In this case, since i is smaller than the quotient p, k corresponding to the bit number is set to 1 (step 103). ). and k is the code length l of the i-th code
It is determined whether it is less than or equal to i (that is, code length h) (step 104), and in this case, since k is smaller than code length li, 1 bit is input from buffer 23 to buffer 25, and k is increased by 1. (Step 105). From then on, k
Steps 104 and 105 are repeated until k exceeds li, and when k exceeds li, the process proceeds to step 106. Then, it is determined whether k is 8 or less (step 106),
In this case, k is smaller than 8, so 1 bit is input from buffer 23 to buffer 26, and k is increased by 1. From then on, steps 106 and 107 until k exceeds 8.
is repeated, and when k exceeds 8, the process returns to step 102.
Repeat the above operations until i exceeds p.

【0027】セレクタ27はバッファ22に蓄積されて
いる符号長hに従って、まずバッファ25からp個の符
号を取り出し、次にバッファ26から符号を取り出すよ
うに切り替える。ただし、制御信号oが入力されている
場合には、すなわち正確な符号長が得られなかった場合
には、バッファ22の符号長を用いてバッファ26のデ
ータから符号を復元することはできないので、バッファ
26からのデータは用いず、すべて0として出力する。 図11に示すフローチャートを用いて説明すると、セレ
クタ27はまず符号の番号に対応するkを1として(ス
テップ1101)、kが商p以下か否かを判定し(ステ
ップ1012)、この場合にはkは商pより小さいので
、ビットの番号に対応するmを1とする(ステップ10
13)。そして、mが、k番目の符号の符号長lk以下
か否かを判定し(ステップ1104)、この場合にはm
はlkより小さいので、バッファ25から1ビット(X
k、m)を取り出して出力し、また、mを1だけ増加さ
せる。以降、mがlkを越えるまでステップ1104、
1105を繰り返し、mがlkを越えると、kを1増加
させてステップ1102に戻る。そして、以上の操作を
繰り返し、kがpを越えたところでステップ1106に
進む。
The selector 27 switches to take out p codes first from the buffer 25 and then take out codes from the buffer 26 according to the code length h stored in the buffer 22. However, if the control signal o is input, that is, if the correct code length cannot be obtained, the code cannot be restored from the data in the buffer 26 using the code length in the buffer 22. The data from the buffer 26 is not used and is output as all 0s. To explain using the flowchart shown in FIG. 11, the selector 27 first sets k corresponding to the code number to 1 (step 1101), determines whether k is less than or equal to the quotient p (step 1012), and in this case, Since k is smaller than the quotient p, m corresponding to the bit number is set to 1 (step 10
13). Then, it is determined whether m is less than or equal to the code length lk of the k-th code (step 1104), and in this case, m
is smaller than lk, so 1 bit (X
k, m) and outputs it, and also increments m by 1. Thereafter, step 1104 until m exceeds lk;
Step 1105 is repeated, and when m exceeds lk, k is incremented by 1 and the process returns to step 1102. Then, the above operations are repeated, and when k exceeds p, the process proceeds to step 1106.

【0028】ここでセレクタ27は制御信号oが送られ
てきているか否かを判定し(ステップ1106)、制御
信号oが送られてきていない場合にはkが64以下か否
かを判定し(ステップ1107)、kが64以下のとき
はビット番号に対応するnを1として(ステップ110
8)、nが符号長lk以下か否かを判定する(ステップ
1109)。そして、nがlk以下のときはバッファ2
6から1ビット(Xk、n)を取り出して出力し、また
nを1だけ増加させる(ステップ1110)。以降、n
がlkを越えるまでステップ1109、1110を繰り
返し、nがlkを越えると、kを1増加させてステップ
1107に戻ってkが64を越えるまで同様の処理を行
う。
Here, the selector 27 determines whether or not the control signal o is being sent (step 1106), and if the control signal o is not being sent, it is determined whether k is less than or equal to 64 (step 1106). Step 1107), when k is 64 or less, n corresponding to the bit number is set to 1 (Step 110
8), it is determined whether n is less than or equal to the code length lk (step 1109). Then, when n is less than lk, buffer 2
1 bit (Xk, n) is extracted from 6 and outputted, and n is incremented by 1 (step 1110). From then on, n
Steps 1109 and 1110 are repeated until n exceeds lk, and when n exceeds lk, k is incremented by 1 and the process returns to step 1107, where the same processing is performed until k exceeds 64.

【0029】ステップ1106で制御信号oが送られて
きていた場合には、バッファ26をクリアし(ステップ
1111)、次にkが64以下か否かを判定して(ステ
ップ1112)、kが64以下の場合にはnを1とする
(ステップ1113)。そして、nが符号長lk以下か
否かを判定し、nがlk以下の場合には値が0の1ビッ
ト分の情報を出力し、また、nを1だけ増加させる(ス
テップ1115)。そして、nがlkを越えるまでステ
ップ1114、1115を繰り返し、nがlkを越える
と、kを1増加させてステップ1112に戻り、kが6
4を越えるまで上述の処理を行う。
If the control signal o has been sent in step 1106, the buffer 26 is cleared (step 1111), and then it is determined whether or not k is 64 or less (step 1112). In the following cases, n is set to 1 (step 1113). Then, it is determined whether n is less than or equal to the code length lk, and if n is less than or equal to lk, one bit of information with a value of 0 is output, and n is increased by 1 (step 1115). Then, steps 1114 and 1115 are repeated until n exceeds lk, and when n exceeds lk, k is increased by 1 and the process returns to step 1112, and k becomes 6.
The above process is performed until the number exceeds 4.

【0030】次に、逆並べ替え回路11に図6(E)に
示す符号w1〜w6が入力された場合について具体的に
説明する。実際の符号の数は1ブロック当り64個であ
るが、ここでも簡単のため1ブロック当りの符号の数は
6であるとする。まず、符号長が正確に得られた場合に
は、符号長hとして図6(A)に示す符号長を表すデー
タが入力される。カウンタ28はブロック毎に符号列の
長さを計算し、合計を8で割った商4を出力する。スイ
ッチ24はバッファ25、26を制御し、符号長hの値
7により入力符号列の先頭から7ビットをバッファ25
に格納させ、8ビットに対する不足分1ビットをバッフ
ァ26に格納させる。次にスイッチ24は、符号長hの
値6により6ビットをバッファ25に格納させ、不足分
の2ビットをバッファ26に格納させる。スイッチ24
はこの操作を4回繰り返し、その結果、バッファ25の
内容は図6(C)に示すようになり、バッファ26の内
容は図6(D)に示すようになる。そして、セレクタ2
7は、バッファ22に蓄えられている図6(A)の符号
長のデータに従って、まずバッファ25から7ビット、
6ビット、5ビット、5ビットの順で4符号分のデータ
を読み出して出力し、次にバッファ26から5ビット、
4ビットの順で2符号分のデータを読み出して出力する
。その結果、図6(B)に示すもとの符号列が復元され
る。
Next, a case in which the codes w1 to w6 shown in FIG. 6(E) are input to the inverse rearrangement circuit 11 will be specifically explained. The actual number of codes per block is 64, but here again for the sake of simplicity it is assumed that the number of codes per block is 6. First, when the code length is accurately obtained, data representing the code length shown in FIG. 6(A) is input as the code length h. The counter 28 calculates the length of the code string for each block, and outputs the quotient 4 obtained by dividing the total by 8. The switch 24 controls the buffers 25 and 26, and transfers 7 bits from the beginning of the input code string to the buffer 25 according to the value 7 of the code length h.
1 bit is stored in the buffer 26, and the 1 bit missing from the 8 bits is stored in the buffer 26. Next, the switch 24 causes the buffer 25 to store 6 bits based on the value 6 of the code length h, and causes the buffer 26 to store the missing 2 bits. switch 24
repeats this operation four times, and as a result, the contents of the buffer 25 become as shown in FIG. 6(C), and the contents of the buffer 26 become as shown in FIG. 6(D). And selector 2
7 is stored in the buffer 22 according to the data of the code length shown in FIG.
Read and output data for 4 codes in the order of 6 bits, 5 bits, 5 bits, then 5 bits from the buffer 26,
Data for 2 codes is read out in 4-bit order and output. As a result, the original code string shown in FIG. 6(B) is restored.

【0031】次に、各符号の符号長が正確に求められな
かった場合について説明する。このとき制御信号oが入
力されるので、符号長hとして、予め典型的なパターン
として記憶されている図12(A)に示すような実際の
符号長とは異なる符号長が与えられる。スイッチ24は
、図6(E)の符号列に対して、図12(A)の符号長
に従ってバッファ25、26を制御し、その結果、バッ
ファ25の内容は図12(C)、バッファ26の内容は
図12(D)のようになる。そして、セレクタ27は、
バッファ22に蓄積された図12(A)のデータに従っ
て、まずバッファ25からデータを読み出す。次に、制
御信号oが入力されているので、セレクタ27はバッフ
ァ26の内容は用いず、バッファ26の内容は0として
値が0のビットデータを出力する。その結果、セレクタ
27からは図12(C)の符号列に値が0のビットを1
0個付加した図12(B)の符号列が出力されることに
なる。この符号列は正確には復元されていないが、符号
w1〜w4は各ワードに個別に保存されているので、こ
のまま復号しても符号w1〜w4については小さい誤差
で復号することができる。
Next, a case where the code length of each code cannot be accurately determined will be explained. Since the control signal o is input at this time, a code length different from the actual code length as shown in FIG. 12A, which is stored in advance as a typical pattern, is given as the code length h. The switch 24 controls the buffers 25 and 26 according to the code length of FIG. 12(A) for the code string of FIG. The contents are as shown in FIG. 12(D). Then, the selector 27 is
According to the data shown in FIG. 12A accumulated in the buffer 22, data is first read from the buffer 25. Next, since the control signal o is input, the selector 27 does not use the contents of the buffer 26, but sets the contents of the buffer 26 to 0 and outputs bit data with a value of 0. As a result, the selector 27 converts the bits with a value of 0 to 1 in the code string of FIG. 12(C).
The code string shown in FIG. 12(B) with 0 added will be output. Although this code string has not been accurately restored, since the codes w1 to w4 are individually stored in each word, the codes w1 to w4 can be decoded with small errors even if they are decoded as is.

【0032】ここで、符号w1〜w4が小さい誤差で復
号されることについて詳しく説明する。まず、量子化を
行うダイナミックレンジが量子化を行うビット数によら
ず一定の場合には、符号の上位ビットが保存されていれ
ば実際の符号長とは異なるビット数で復号しても、正し
いビット数で復号した場合に比べ復号値の誤差は小さい
ことを説明する。
[0032] Here, the fact that the codes w1 to w4 are decoded with small errors will be explained in detail. First, if the dynamic range for quantization is constant regardless of the number of bits for quantization, then if the high-order bits of the code are preserved, even if decoding is done with a number of bits different from the actual code length, it will still be correct. It will be explained that the error in the decoded value is smaller than when decoding is performed using the number of bits.

【0033】図13(A)〜(C)に一様量子化器で出
力される符号の例を示す。図13(A)はレベルが−1
27から+127の範囲の信号を2ビットで量子化する
場合に出力される符号を示し、図13(B)は3ビット
で量子化する場合、図13(C)は4ビットで量子化さ
れる場合に出力される符号をそれぞれ示している。例え
ば+40という値を3ビットで量子化した場合には10
1が出力される。
FIGS. 13A to 13C show examples of codes output by the uniform quantizer. In Figure 13(A), the level is -1
The codes output when a signal in the range from 27 to +127 is quantized with 2 bits are shown. FIG. 13(B) shows the code output when quantizing with 3 bits, and FIG. 13(C) shows the code output when quantizing with 4 bits. The codes output in each case are shown. For example, if the value +40 is quantized with 3 bits, it becomes 10
1 is output.

【0034】図13(D)〜(F)に量子化された符号
の復号結果の例を示す。図13(F)は、図13(A)
に示した2ビットで量子化された符号の復号結果を示し
、図13(E)、(D)はそれぞれ図13(B)、(C
)に示した3ビットおよび4ビットでそれぞれ量子化さ
れた符号の復号結果を示す。例えば図13(B)の3ビ
ットで量子化された符号101を復号した場合、その結
果は+47となる。
FIGS. 13(D) to 13(F) show examples of decoding results of quantized codes. Figure 13(F) is Figure 13(A)
13(E) and (D) show the decoding results of the 2-bit quantized code shown in FIG. 13(B) and (C), respectively.
) shows the decoding results of codes quantized with 3 bits and 4 bits, respectively. For example, when the code 101 quantized with 3 bits in FIG. 13(B) is decoded, the result is +47.

【0035】ところで、3ビットで量子化された符号1
01に対して上位2ビットを保存し、下位のビットを切
り捨てて2ビットの符号10として復号すると、図13
(F)より結果は+31となる。また、符号101をそ
のままにし、下位に1ビットを付加した4ビットの符号
1010、1011を復号すると、図13(D)より結
果は、それぞれ+39、+55となる。すなわち、2ビ
ットで復号した場合も、4ビットで復号した場合も、3
ビットで復号した場合の値+47に近い値が得られる。
By the way, code 1 quantized with 3 bits
If the upper 2 bits are saved for 01 and the lower bits are discarded and decoded as a 2-bit code 10, Figure 13
From (F), the result is +31. Furthermore, when code 101 is left as is and 4-bit codes 1010 and 1011 are decoded by adding 1 bit to the lower order, the results are +39 and +55, respectively, as shown in FIG. 13(D). In other words, whether it is decoded with 2 bits or 4 bits, 3
A value close to +47 is obtained when decoding with bits.

【0036】このことを一般的に表すと、量子化をおこ
なう範囲の下限をDL、上限をDHとするとき、ダイナ
ミックレンジDはD=DH−DLと表せる。入力された
値をnビットで量子化して得られる符号を、上位ビット
からa1、a2、・・・ 、anとし、mビットで復号
して得られる復号値をRmとすると、 Rn+1=DL+D/2・a1+・・・ +D/2^n
・an+D/2^n+1・an+1+D/2^n+2、
Rn=DL+D/2・a1+・・・ +D/2^n・a
n+D/2^n+1、 Rn−1=DL+D/2・a1+・・・ +D/2^n
となり、下位ビットは復号値に大きな影響を与えないこ
とが分かる。
Expressing this generally, when the lower limit of the range for quantization is DL and the upper limit is DH, the dynamic range D can be expressed as D=DH-DL. If the code obtained by quantizing the input value with n bits is a1, a2, ..., an from the upper bit, and the decoded value obtained by decoding with m bits is Rm, then Rn+1=DL+D/2・a1+... +D/2^n
・an+D/2^n+1・an+1+D/2^n+2,
Rn=DL+D/2・a1+... +D/2^n・a
n+D/2^n+1, Rn-1=DL+D/2・a1+... +D/2^n
It can be seen that the lower bits do not have a large effect on the decoded value.

【0037】このように、符号の上位ビットを保存して
おけば、実際の符号長と異なるビット数で復号した場合
でも小さい誤差で復号することができる。なお、以上の
説明ではダイナミックレンジは一定としたが、量子化を
行うビット数が変化し、ダイナミックレンジが変動する
場合でも、その変動の程度があまり大きくない場合には
同様の結果が得られる。
[0037] By preserving the high-order bits of the code in this way, even if the code is decoded with a number of bits different from the actual code length, the code can be decoded with a small error. Note that in the above description, the dynamic range is constant, but even if the number of bits for quantization changes and the dynamic range fluctuates, the same result can be obtained if the degree of the fluctuation is not very large.

【0038】本実施例の符号化装置では上述したように
、0〜8ビットで適応的に符号化された符号列に対して
、符号列の長さがnビットの場合には、先頭からn/8
個の符号について、8ビット毎に各符号の最上位ビット
が現れるように符号列の並び替えが行われる。従って、
例えば図15の符号列は、図14に示すように並び替え
られる。この例では、符号列の長さが32ビットである
ため、先頭からの4符号w1〜w4が8ビット毎に現れ
るようにそのまま残され、符号w5、w6が分割されて
符号w1〜w4に付加されている。そして、本実施例の
復号装置では、符号長を決定する付加情報が得られてい
る場合には、符号化装置での並び替えと逆の操作により
符号w1〜w6が復元できる。一方、付加情報が得られ
ない場合には、与えられる符号列の8ビット毎に符号の
開始点があり、8ビット毎に1つの完全な符号が含まれ
ているので、これらの符号については適当な符号長で復
号すれば、上述した効果により、少ない誤差で復号され
ることになる。
As described above, in the encoding device of this embodiment, when the length of the code string is n bits for a code string adaptively encoded with 0 to 8 bits, n bits from the beginning are /8
For these codes, the code strings are rearranged so that the most significant bit of each code appears every 8 bits. Therefore,
For example, the code string in FIG. 15 is rearranged as shown in FIG. 14. In this example, since the length of the code string is 32 bits, the first four codes w1 to w4 are left as they are so that they appear every 8 bits, and codes w5 and w6 are divided and added to the codes w1 to w4. has been done. In the decoding device of this embodiment, when additional information for determining the code length is obtained, the codes w1 to w6 can be restored by an operation opposite to the rearrangement in the encoding device. On the other hand, if additional information cannot be obtained, there is a code starting point for every 8 bits of the given code string, and each 8 bits contains one complete code, so these codes can be interpreted as appropriate. If decoding is performed with a code length of 1, the above-mentioned effect will result in decoding with less error.

【0039】次に、本実施例の符号化装置で得られる符
号化列が、誤り訂正に適していることについて説明する
。リードソロモン積符号では1ワードの固定長を最小単
位として誤り訂正符号化が行われる。例えば8ビット固
定長で符号化された符号に対しては、8ビットを1ワー
ドとして誤り訂正符号化が行われる。例えば、最大8ビ
ットで適応的に符号化された例えば図15の符号列は、
本実施例の符号化装置では図14のように並べ替えられ
、その符号列の8ビットを1ワードとして誤り訂正符号
化が行われる。ところで図14の各ワードには分割され
ていない符号が必ず1つ(または1つ以上)含まれてい
る。すなわち、1つの誤り訂正ワードに少なくとも1つ
は他のワードから影響を受けない符号が含まれているこ
とになる。そのため、あるワードに起こった誤りが訂正
できた場合には、少なくとも1つの符号は復号できるこ
とになる。すなわち、従来のようにあるワードで発生し
た訂正不可能の誤りのために、正常、あるいは訂正可能
なワードにふくまれる符号の復号が完全に不可能になる
ことがなく、少なくとも1つの符号の復号は可能となる
Next, it will be explained that the encoded sequence obtained by the encoding apparatus of this embodiment is suitable for error correction. In the Reed-Solomon product code, error correction encoding is performed using a fixed length of one word as the minimum unit. For example, for a code encoded with a fixed length of 8 bits, error correction encoding is performed using 8 bits as one word. For example, the code string shown in FIG. 15, which is adaptively encoded with a maximum of 8 bits, is
In the encoding apparatus of this embodiment, the data is rearranged as shown in FIG. 14, and error correction encoding is performed using 8 bits of the code string as one word. By the way, each word in FIG. 14 always includes one (or more than one) undivided code. That is, one error correction word includes at least one code that is not affected by other words. Therefore, if an error occurring in a certain word can be corrected, at least one code can be decoded. In other words, the decoding of at least one code is not completely impossible due to an uncorrectable error occurring in a certain word, as is the case in the past. becomes possible.

【0040】なお、本実施例では、DCT回路3から出
力される変換係数は、ジグザグスキャンによって空間周
波数の低い、すなわち視覚的に大きな影響を与える変換
係数から出力される。そして並べ替え回路5では空間周
波数の低い変換係数に対応する符号から順に8ビット毎
に現れるように並べ替えが行われる。そして、このよう
に並べ替えられた符号列を復号するとき、符号長が得ら
れなかった場合には8ビット毎に現れる符号が上述のよ
うに小さい誤差で復号されるが、空間周波数の低い変換
係数に対応する符号から順に並べられているので、その
符号が小さい誤差で復号されることになり、符号長が得
られなかった場合の影響は一層、小さいものとなる。
In this embodiment, the transform coefficients output from the DCT circuit 3 are outputted by zigzag scanning, starting with the transform coefficients having a low spatial frequency, that is, those having a large visual impact. Then, the rearrangement circuit 5 rearranges the codes so that they appear every 8 bits in order from the code corresponding to the transform coefficient with the lowest spatial frequency. When decoding a code string rearranged in this way, if the code length cannot be obtained, the code that appears every 8 bits is decoded with a small error as described above, but the conversion with a low spatial frequency Since the codes are arranged in order starting from the code corresponding to the coefficient, the code will be decoded with a small error, and the effect when the code length cannot be obtained will be even smaller.

【0041】また、本実施例では離散コサイン変換を行
って得られる変換係数を符号化したものに対して符号の
並べ替えを行うようにしたが、本発明はこの例に限定さ
れるものではなく、適応的に量子化して得られる符号列
に対して広く適応できるものである。
Furthermore, in this embodiment, the codes of the encoded transform coefficients obtained by performing the discrete cosine transform are rearranged, but the present invention is not limited to this example. , it is widely applicable to code strings obtained by adaptive quantization.

【0042】[0042]

【発明の効果】以上説明したように本発明の符号化装置
では、ビット長の異なる複数の符号からなる符号列に対
して、一定数のビット毎に分割されない完全な符号が現
れるように並べ替えが行われる。従って、符号長を示す
情報が失われても分割されない完全な符号が符号列のど
こから始まるかを知ることができる。本発明の復号装置
では、上記符号化装置により得られた符号列の復号を行
うとき、符号長が不明の場合には、予め記憶されている
典型的なパターンの符号長を用いて復号を行う。従って
、符号の長さに関する情報が失われた場合でも小さい誤
差で復号することが可能である。また、上述のように一
定数のビット毎に分割されない完全な符号が現れるよう
に符号の並べ替えが行われるので、1ワードの中には他
のワードの誤りの影響を受けない符号が少なくとも1つ
含まれることになり、誤り伝搬が少ない。従って、デジ
タルVTRで高速再生する場合などに符号長を決めるた
めの情報を読み出せない場合や誤りが生じた場合でも画
質の劣化が少ない。
As explained above, in the encoding device of the present invention, a code string consisting of a plurality of codes with different bit lengths is rearranged so that a complete code that is not divided into every certain number of bits appears. will be held. Therefore, even if information indicating the code length is lost, it is possible to know where in the code string a complete code that is not divided begins. In the decoding device of the present invention, when decoding the code string obtained by the encoding device, if the code length is unknown, decoding is performed using the code length of a typical pattern stored in advance. . Therefore, even if information regarding the code length is lost, it is possible to decode with small error. Additionally, as mentioned above, the codes are rearranged so that a complete code that is not divided into bits appears, so there is at least one code in one word that is not affected by errors in other words. This reduces error propagation. Therefore, even if the information for determining the code length cannot be read out or an error occurs during high-speed reproduction on a digital VTR, there is little deterioration in image quality.

【図面の簡単な説明】[Brief explanation of drawings]

【図1】本発明の符号化装置の一例を示すブロックであ
る。
FIG. 1 is a block diagram showing an example of an encoding device of the present invention.

【図2】図1の符号化装置の並べ替え回路を詳しく示す
ブロックである。
FIG. 2 is a block diagram showing in detail a rearrangement circuit of the encoding device of FIG. 1;

【図3】図2の並べ替え回路を構成するカウンタの動作
を示すフローチャートである。
FIG. 3 is a flowchart showing the operation of a counter forming the rearrangement circuit of FIG. 2;

【図4】図2の並べ替え回路を構成するスイッチの動作
を示すフローチャートである。
FIG. 4 is a flowchart showing the operation of switches forming the rearrangement circuit of FIG. 2;

【図5】図2の並べ替え回路を構成するセレクタの動作
を示すフローチャートである。
FIG. 5 is a flowchart showing the operation of a selector forming the rearrangement circuit of FIG. 2;

【図6】図2の並べ替え回路による符号の並べ替えの説
明図である。
FIG. 6 is an explanatory diagram of code rearrangement by the rearrangement circuit of FIG. 2;

【図7】本発明の復号装置の一例を示すブロックである
FIG. 7 is a block diagram showing an example of a decoding device of the present invention.

【図8】図7の復号装置の逆並べ替え回路を詳しく示す
ブロックである。
FIG. 8 is a block diagram showing in detail the inverse reordering circuit of the decoding device of FIG. 7;

【図9】図8の逆並べ替え回路のカウンタの動作を示す
フローチャートである。
FIG. 9 is a flowchart showing the operation of a counter in the inverse reordering circuit of FIG. 8;

【図10】図8の逆並べ替え回路のスイッチの動作を示
すフローチャートである。
FIG. 10 is a flowchart showing the operation of the switches in the inverse reordering circuit of FIG. 8;

【図11】図8の逆並べ替え回路を構成するセレクタの
動作を示すフローチャートである。
FIG. 11 is a flowchart showing the operation of a selector forming the inverse reordering circuit of FIG. 8;

【図12】図8の逆並べ替え回路による符号の並べ替え
の説明図である。
FIG. 12 is an explanatory diagram of code rearrangement by the inverse rearrangement circuit of FIG. 8;

【図13】種々のビット数での量子化および逆量子化の
説明図である。
FIG. 13 is an explanatory diagram of quantization and inverse quantization with various numbers of bits.

【図14】図2の並べ替え回路によって並び替えられ、
各ワードに分割された符号を示す図である。
FIG. 14 is sorted by the sorting circuit of FIG. 2;
FIG. 3 is a diagram showing a code divided into words.

【図15】異なるビット数で符号化された符号を示す図
である。
FIG. 15 is a diagram showing codes encoded with different numbers of bits.

【図16】従来の符号化装置において、誤り訂正の際の
符号列のワード分割の一例を示す図である。
FIG. 16 is a diagram illustrating an example of word division of a code string during error correction in a conventional encoding device.

【符号の説明】[Explanation of symbols]

1  A/D変換器 2  ブロック化回路 3  DCT回路 4  適応量子化器 5  並べ替え回路 6  マルチプレクサ 7  誤り訂正符号化器 8  誤り訂正復号器 9  デマルチプレクサ 10  符号長計算器 11  逆並べ替え回路 12  逆量子化器 13  逆DCT回路 14  ブロック分解回路 15  D/A変換器 16、28  カウンタ 17、19、20、22、23、25、26  FIF
Oバッファ 18、24  スイッチ 21、27  セレクタ
1 A/D converter 2 Blocking circuit 3 DCT circuit 4 Adaptive quantizer 5 Reordering circuit 6 Multiplexer 7 Error correction encoder 8 Error correction decoder 9 Demultiplexer 10 Code length calculator 11 Inverse reordering circuit 12 Inverse Quantizer 13 Inverse DCT circuit 14 Block decomposition circuit 15 D/A converter 16, 28 Counter 17, 19, 20, 22, 23, 25, 26 FIF
O buffer 18, 24 switch 21, 27 selector

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】  入力信号をその統計的性質に応じて適
応的にビット長を変化させて量子化し符号を生成する手
段と、該手段から順次出力される符号を一定数のビット
毎に分割されない完全な符号が現れるような符号列に並
び替える手段とを備えたことを特徴とする符号化装置。
Claim 1: A means for quantizing an input signal by adaptively changing the bit length according to its statistical properties to generate a code, and a code sequentially output from the means that is not divided into a fixed number of bits. 1. An encoding device comprising means for rearranging a code string such that a complete code appears.
【請求項2】  一定数のビット毎に分割されない完全
な符号が現れるように並び替えられた符号列が入力され
たときに、各符号の長さを示す符号長情報が存在する場
合には該情報に基づき、また前記符号長情報が存在しな
い場合には予め記憶された符号長パターンに従って前記
入力された符号列を分割されない完全な符号の連続する
符号列に並び替える手段と、前記並び替えられた符号列
を構成する符号を順次復号する手段とを備えたことを特
徴とする復号装置。
Claim 2: When a code string rearranged so that a complete code that is not divided into every certain number of bits appears is input, if code length information indicating the length of each code exists, means for rearranging the input code string into a continuous code string of undivided complete codes based on the code length information or according to a pre-stored code length pattern if the code length information does not exist; A decoding device comprising means for sequentially decoding codes constituting a code string.
JP3100864A 1991-05-02 1991-05-02 Coding and decoding device Pending JPH04330829A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3100864A JPH04330829A (en) 1991-05-02 1991-05-02 Coding and decoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3100864A JPH04330829A (en) 1991-05-02 1991-05-02 Coding and decoding device

Publications (1)

Publication Number Publication Date
JPH04330829A true JPH04330829A (en) 1992-11-18

Family

ID=14285181

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3100864A Pending JPH04330829A (en) 1991-05-02 1991-05-02 Coding and decoding device

Country Status (1)

Country Link
JP (1) JPH04330829A (en)

Similar Documents

Publication Publication Date Title
US4454546A (en) Band compression device for shaded image
KR0129558B1 (en) Adaptive variable length coding method and apparatus
US5528628A (en) Apparatus for variable-length coding and variable-length-decoding using a plurality of Huffman coding tables
US5781561A (en) Encoding apparatus for hierarchically encoding image signal and decoding apparatus for decoding the image signal hierarchically encoded by the encoding apparatus
WO1991003128A1 (en) Control system for encoding image
JPH09261078A (en) Data decoding method and its device
JPH0793724B2 (en) High efficiency coding apparatus and coding method for television signal
EP0683568A1 (en) Variable length code look-up table having separate code length determination
JPH07184057A (en) Adct compression of minimum compression ratio
JPH04221465A (en) Recording device
EP0945021B1 (en) Data efficient quantization table for a digital video signal processor
US11475600B2 (en) Method and device for digital data compression
US5995171A (en) Coding and/or decoding apparatus for decoding variable-length coded image information
JPH04330829A (en) Coding and decoding device
JPH08204971A (en) Image compression method using predictive coding and error diffusion
EP0699001A2 (en) Image data signal compression/transmission method and image data signal compression/transmission system
JPH0621830A (en) Two-dimension huffman coding method
JPS62284535A (en) Method and apparatus for encoding data by employing block list conversion
JPH0133993B2 (en)
EP0703675B1 (en) Variable length decoding method and apparatus
KR0134324B1 (en) Variable length method of data compression
JP2785209B2 (en) Data transmission equipment
EP0419141A2 (en) Bit-rate reduction
JP3919038B2 (en) Variable length coding method and apparatus
JP3304989B2 (en) High efficiency coding method