JPH08139610A - Device and method for compressing program - Google Patents
Device and method for compressing programInfo
- Publication number
- JPH08139610A JPH08139610A JP27476394A JP27476394A JPH08139610A JP H08139610 A JPH08139610 A JP H08139610A JP 27476394 A JP27476394 A JP 27476394A JP 27476394 A JP27476394 A JP 27476394A JP H08139610 A JPH08139610 A JP H08139610A
- Authority
- JP
- Japan
- Prior art keywords
- data
- vector
- program
- code
- compressed
- 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
Links
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
【0001】[0001]
【産業上の利用分野】本発明は、プログラムデータ等の
圧縮において圧縮率を向上し得るプログラム圧縮装置お
よびプログラム圧縮方法に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program compressing apparatus and a program compressing method capable of improving the compression rate in compressing program data and the like.
【0002】[0002]
【従来の技術】一般に、ハフマンテーブル204は予め
プログラムデータ200を用いて作成されるものであ
り、図28はハフマンテーブル204の作成方法を示す
フローチャートである。従来では、図28の如く、ま
ず、与えられたプログラムデータ200について順次8
ビットを取り出し、データカウンター201に入力す
る。データカウンター201は入力されたデータの出現
数をカウントし、その結果をカウント結果202として
出力する。ハフマンテーブル生成器203はカウント結
果202のカウント数の多い値ほどより短いコードを割
り当てた状態でハフマンテーブル204を生成し出力す
る。2. Description of the Related Art Generally, a Huffman table 204 is created in advance using the program data 200, and FIG. 28 is a flowchart showing a method for creating the Huffman table 204. In the prior art, as shown in FIG.
The bit is taken out and input to the data counter 201. The data counter 201 counts the number of appearances of the input data, and outputs the result as a count result 202. The Huffman table generator 203 generates and outputs the Huffman table 204 in a state in which a shorter code is assigned to a value having a larger count number in the count result 202.
【0003】次に、圧縮方法について記述する。図29
は従来の圧縮方法を示すフローチャートであって、図2
9中のハフマンテーブル204は図28に示した方法で
作成されたものである。従来における圧縮時には、図2
9の如く、まずプログラムデータ200から順次8ビッ
トを取り出しハフマン符号化器205に入力する。ハフ
マン符号化器205はハフマンテーブル204内のデー
タを参照して、入力された値に割り当てられているハフ
マンコードを圧縮データ206として出力する。Next, a compression method will be described. FIG. 29
2 is a flowchart showing a conventional compression method.
The Huffman table 204 in FIG. 9 is created by the method shown in FIG. At the time of conventional compression, FIG.
As shown in FIG. 9, first, 8 bits are sequentially extracted from the program data 200 and input to the Huffman encoder 205. The Huffman encoder 205 refers to the data in the Huffman table 204 and outputs the Huffman code assigned to the input value as compressed data 206.
【0004】[0004]
【発明が解決しようとする課題】ところで、例えばC言
語等の一般的なプログラムにおいては、通常、一定の規
則(文法)に従って設定されたオブジェクトコードが使
用される。ここで、図28乃至図29で示した従来例の
圧縮方法では、プログラムのオブジェクトコードを固定
長のデータに分割し、分割されたデータを1シンボルと
してエントロピー圧縮していた。すなわち、分割された
データ間の相関を利用しないで圧縮していたため、これ
を一律に処理してマルコフモデルを設定すると、データ
分布が平均化されてしまい、特徴のあるマルコフモデル
を形成することができなくなる。このため、データ出現
頻度(出現確率)が低レベルになり、復号時に効率的な
復号ができなくなってしまうおそれがある。By the way, in a general program such as C language, an object code set according to a certain rule (grammar) is usually used. Here, in the conventional compression method shown in FIGS. 28 to 29, the object code of the program is divided into fixed-length data, and the divided data is entropy-compressed as one symbol. That is, since the compression was performed without using the correlation between the divided data, if this was uniformly processed and the Markov model was set, the data distribution would be averaged and a characteristic Markov model could be formed. become unable. For this reason, the data appearance frequency (appearance probability) becomes a low level, and efficient decoding may not be possible during decoding.
【0005】本発明は、上記課題に鑑み、圧縮率を向上
し得るプログラム圧縮装置およびプログラム圧縮方法を
提供することを目的とする。In view of the above problems, it is an object of the present invention to provide a program compression device and a program compression method that can improve the compression rate.
【0006】[0006]
【課題を解決するための手段】本発明の請求項1に係る
課題解決手段は、命令コードおよびアドレスコードを含
むプログラムのオブジェクトコードを圧縮するものであ
って、圧縮すべきデータを所定の構成単位に分割し、複
数の前記所定の構成単位を1個のシンボルに変換する変
換手段と、前記シンボルをエントロピー圧縮する圧縮手
段とを備える。The problem solving means according to claim 1 of the present invention compresses an object code of a program including an instruction code and an address code, and compresses data to be compressed into a predetermined constituent unit. And conversion means for converting the plurality of predetermined constituent units into one symbol, and compression means for entropy-compressing the symbols.
【0007】本発明の請求項2に係る課題解決手段は、
命令コードおよびアドレスコードを含むプログラムのオ
ブジェクトコードを圧縮するものであって、圧縮すべき
データを1語長の第1のブロックデータに分割する第1
の分割手段と、前記第1のブロックデータを所定の構成
単位の第2のブロックデータに分割し、前記第2のブロ
ックデータの複数個をベクトルとして出力する第2の分
割手段と、前記ベクトルを所定のコードブックから適切
に選ばれた代表ベクトルに量子化し該代表ベクトルを出
力するとともに、前記代表ベクトルに対応するインデク
スを圧縮データの1構成要素として出力するベクトル量
子化手段と、前記第2の分割手段の出力と前記代表ベク
トルとの差分を計算して圧縮データの他の構成要素とし
て出力するベクトル差分手段とを備える。The problem solving means according to claim 2 of the present invention is
A first object compression method for compressing an object code of a program including an instruction code and an address code, wherein the data to be compressed is divided into first block data of one word length
Dividing means for dividing the first block data into second block data of a predetermined constituent unit, and outputting a plurality of the second block data as a vector, and the vector Vector quantizing means for quantizing a representative vector appropriately selected from a predetermined codebook and outputting the representative vector, and outputting an index corresponding to the representative vector as one component of compressed data; Vector difference means for calculating the difference between the output of the dividing means and the representative vector and outputting it as another component of the compressed data.
【0008】本発明の請求項3に係る課題解決手段は、
命令コードおよびアドレスコードを含むプログラムのオ
ブジェクトコードを圧縮するものであって、圧縮すべき
データを所定の構成単位のブロックデータに分割する分
割手段と、前記ブロックデータ間の相関を分析すること
によって事前に作成された予測テーブルに基づいてデー
タ予測値を出力する予測手段と、前記ブロックデータ
と、当該ブロックデータに対応した前記データ予測値と
の差分を計算するとともに、前記データ予測値に対応す
るインデックスと前記差分を圧縮データの構成要素とし
て併せて出力する差分手段とを備える。The problem solving means according to claim 3 of the present invention is
A method for compressing an object code of a program including an instruction code and an address code, wherein a dividing means for dividing data to be compressed into block data of a predetermined structural unit and a correlation between the block data are analyzed beforehand. Prediction means for outputting a data prediction value based on the prediction table created in, the block data, and calculates the difference between the data prediction value corresponding to the block data, the index corresponding to the data prediction value And a difference unit that outputs the difference as a component of the compressed data.
【0009】本発明の請求項4に係る課題解決手段は、
命令コードおよびアドレスコードを含むプログラムのオ
ブジェクトコードを所定の構成単位に分割し、複数の前
記所定の構成単位を1個のシンボルに変換する変換工程
と、前記シンボルをエントロピー圧縮する圧縮工程とを
備える。The problem solving means according to claim 4 of the present invention is
The method includes a conversion step of dividing an object code of a program including an instruction code and an address code into predetermined constituent units, converting the plurality of predetermined constituent units into one symbol, and a compression step of entropy-compressing the symbols. .
【0010】本発明の請求項5に係る課題解決手段は、
命令コードおよびアドレスコードを含むプログラムのオ
ブジェクトコードを1語長の第1のブロックデータに分
割する第1の分割工程と、前記第1のブロックデータを
所定の構成単位の第2のブロックデータに分割し、前記
第2のブロックデータの複数個をベクトルとして出力す
る第2の分割工程と、前記ベクトルを所定のコードブッ
クから適切に選ばれた代表ベクトルに量子化し該代表ベ
クトルを出力するとともに、前記代表ベクトルに対応す
るインデクスを圧縮データの1構成要素として出力する
ベクトル量子化工程と、前記第2の分割工程の出力と前
記代表ベクトルとの差分を計算して圧縮データの他の構
成要素として出力するベクトル差分工程とを備える。The problem solving means according to claim 5 of the present invention is
A first dividing step of dividing an object code of a program including an instruction code and an address code into first block data of one word length, and dividing the first block data into second block data of a predetermined structural unit A second dividing step of outputting a plurality of the second block data as a vector, quantizing the vector into a representative vector appropriately selected from a predetermined codebook, and outputting the representative vector, and A vector quantization step of outputting an index corresponding to a representative vector as one component of compressed data, and a difference between the output of the second division step and the representative vector is calculated and output as another component of compressed data. And a vector subtraction step.
【0011】本発明の請求項6に係る課題解決手段は、
命令コードおよびアドレスコードを含むプログラムのオ
ブジェクトコードを所定の構成単位のブロックデータに
分割する分割工程と、前記ブロックデータ間の相関を分
析することによって事前に作成された予測テーブルに基
づいてデータ予測値を出力する予測工程と、前記ブロッ
クデータと、当該ブロックデータに対応した前記データ
予測値との差分を計算するとともに、前記データ予測値
に対応するインデックスと前記差分を圧縮データの構成
要素として併せて出力する差分工程とを備える。The problem solving means according to claim 6 of the present invention is
A data prediction value based on a dividing step of dividing an object code of a program including an instruction code and an address code into block data of a predetermined structural unit, and a prediction table created in advance by analyzing correlation between the block data. And a difference between the block data and the data prediction value corresponding to the block data is calculated, and the index and the difference corresponding to the data prediction value are combined as a constituent element of compressed data. And a difference step of outputting.
【0012】[0012]
【作用】本発明請求項1に係るプログラム圧縮装置およ
び請求項4に係るプログラム圧縮方法では、プログラム
のオブジェクトコードの1語長には命令コードとアドレ
スコードが含まれているため、オブジェクトコードの1
語長をバイト単位等の所定の構成単位に分割すると、分
割されたデータ間には一定の相関があることになる。こ
のことから、分割されたデータの複数個を1個のシンボ
ルとしてエントロピー圧縮すれば、データ間の相関を一
定のパターンに類型化することで、圧縮率を飛躍的に向
上することができる。In the program compression apparatus and the program compression method according to claim 4 of the present invention, since one word length of the object code of the program includes the instruction code and the address code, the object code 1
When the word length is divided into predetermined constituent units such as byte units, there is a certain correlation between the divided data. Therefore, if a plurality of pieces of divided data are entropy-compressed as one symbol, the correlation between the data is classified into a certain pattern, so that the compression rate can be dramatically improved.
【0013】本発明請求項2に係るプログラム圧縮装置
および請求項5に係るプログラム圧縮方法では、プログ
ラムのオブジェクトコードの1語長には命令コードとア
ドレスコードが含まれているため、オブジェクトコード
の1語長をバイト単位等の所定の構成単位に分割し、分
割されたデータをベクトルに量子化すると、そのベクト
ルはベクトル空間で一様に分布せず、偏った分布とな
る。従って、ベクトルをその偏りの重心ベクトルに量子
化し、重心ベクトルを示すデータと量子化誤差を圧縮デ
ータとすることで、圧縮率を飛躍的に向上できる。In the program compressing apparatus and the program compressing method according to claim 5 of the present invention, since one word length of the object code of the program includes the instruction code and the address code, the object code 1 When the word length is divided into predetermined constituent units such as byte units and the divided data is quantized into a vector, the vector is not uniformly distributed in the vector space, but has a biased distribution. Therefore, the compression ratio can be dramatically improved by quantizing the vector into the biased center of gravity vector and using the data indicating the center of gravity vector and the quantization error as the compressed data.
【0014】本発明請求項3に係るプログラム圧縮装置
および請求項6に係るプログラム圧縮方法では、プログ
ラムのオブジェクトコードの1語長は命令コードとアド
レスコードで構成されているため、オブジェクトコード
の1語長をバイト単位等の所定の構成単位に分割する
と、分割されたデータ間には相関がある。従って、ある
分割データから別の分割データを、極めて高い確率で予
測することができ、その予測誤差をエントロピー圧縮す
ることにより、圧縮率を飛躍的に向上することができ
る。In the program compressing apparatus and the program compressing method according to claim 6 of the present invention, since one word length of the object code of the program is composed of an instruction code and an address code, one word of the object code When the length is divided into predetermined constituent units such as byte units, there is a correlation between the divided data. Therefore, another divided data can be predicted from one divided data with a very high probability, and the compression error can be dramatically improved by entropy compressing the prediction error.
【0015】[0015]
{第1の実施例} <構成>図1は本発明の第1の実施例のプログラム圧縮
装置を示す機能ブロック図である。本実施例のプログラ
ム圧縮装置は、プログラムデータ10の最後のデータの
ビット数を調整するファイルエンド調整器11と、該フ
ァイルエンド調整器11からのデータを前後に2分割し
て出力する変換器12(変換手段)と、該変換器12か
らの出力データをハフマンテーブル14を参照してエン
トロピー圧縮するハフマン符号化器13(圧縮手段)と
を備える。{First Embodiment} <Structure> FIG. 1 is a functional block diagram showing a program compression apparatus according to a first embodiment of the present invention. The program compression apparatus according to the present embodiment adjusts the number of bits of the last data of the program data 10, and a converter 12 that outputs the data from the file end adjuster 11 by dividing the data into two parts. (Conversion means) and a Huffman encoder 13 (compression means) for entropy-compressing the output data from the converter 12 with reference to the Huffman table 14.
【0016】前記ファイルエンド調整器11は、プログ
ラムデータ10がファイルエンドに達するまでは入力さ
れた16ビットデータをそのまま出力する。The file end adjuster 11 outputs the input 16-bit data as it is until the program data 10 reaches the file end.
【0017】前記変換器12はファイルエンド調整器1
1から出力された16ビットデータを前8ビットデータ
と後ろ8ビットデータに分割し、前8ビットデータが示
す値aと後ろ8ビットデータが示す値bからなるパター
ン(a,b)(シンボル)に変換し出力する。なお、前
記a,bは夫々0〜255の範囲の整数であり、以降に
記述するa,bも同様である。The converter 12 is a file end adjuster 1.
16-bit data output from 1 is divided into front 8-bit data and rear 8-bit data, and a pattern (a, b) (symbol) composed of a value a indicated by the front 8-bit data and a value b indicated by the rear 8-bit data And output it. Note that a and b are integers in the range of 0 to 255, respectively, and the same applies to a and b described below.
【0018】なお、図1中のハフマンテーブル14はプ
ログラムデータ10を用いて図2のように予め作成され
たものである。図2中のプログラムデータ30は図1中
のプログラムデータ10と同じものである。また、31
はプログラムデータ30の最後のデータのビット数を調
整するファイルエンド調整器であって前記ファイルエン
ド調整器11と類似のものであるが、付加ビット数35
を出力する点で前記ファイルエンド調整器11と異な
る。また、32は該ファイルエンド調整器31からのデ
ータを前後に2分割して出力する変換器であって前記変
換器12と同様のものである。そして、33は変換器3
2から出力されたパターンの出現数をカウントするパタ
ーンカウンター、36は前記パターンカウンター33か
らのカウント結果34に基づいてパターンとそのハフマ
ンコードの対応の一覧をハフマンテーブル37として出
力するハフマンテーブル生成器である。The Huffman table 14 in FIG. 1 is created in advance as shown in FIG. 2 using the program data 10. The program data 30 in FIG. 2 is the same as the program data 10 in FIG. Also, 31
Is a file end adjuster for adjusting the number of bits of the last data of the program data 30 and is similar to the file end adjuster 11, but has an additional bit number 35.
Is different from the file end adjuster 11 described above. Reference numeral 32 denotes a converter that outputs the data from the file end adjuster 31 by dividing the data into two parts before and after, and is the same as the converter 12. And 33 is the converter 3
2 is a pattern counter for counting the number of appearances of the patterns output from 2, and 36 is a Huffman table generator that outputs a list of correspondences between patterns and their Huffman codes as a Huffman table 37 based on the count result 34 from the pattern counter 33. is there.
【0019】次に、圧縮されたデータを復号する復号部
について図3にしたがって説明する。図3中のハフマン
テーブル24および圧縮データ26は、夫々図1中のハ
フマンテーブル14、圧縮データ15と同じものであ
る。また図3中の付加ビット数25は図2中の付加ビッ
ト数35と同じものである。図3中の23は圧縮データ
26からのデータがハフマンテーブル24のハフマンコ
ードに一致した場合にハフマンコードが割り当てられる
パターン(a,b)を出力するハフマン復号器、22は
ハフマン復号器23から出力されたパターン(a,b)
の要素aおよびbを合わせて一個のデータを出力する逆
変換器、21は最後のデータのビット数の調整を行なう
ファイルエンド調整器である。Next, a decoding unit for decoding the compressed data will be described with reference to FIG. The Huffman table 24 and the compressed data 26 in FIG. 3 are the same as the Huffman table 14 and the compressed data 15 in FIG. 1, respectively. The additional bit number 25 in FIG. 3 is the same as the additional bit number 35 in FIG. Reference numeral 23 in FIG. 3 denotes a Huffman decoder that outputs a pattern (a, b) to which the Huffman code is assigned when the data from the compressed data 26 matches the Huffman code of the Huffman table 24, and 22 outputs from the Huffman decoder 23. Pattern (a, b)
An inverse converter for outputting a single data by combining the elements a and b of the above, and a file end adjuster 21 for adjusting the number of bits of the last data.
【0020】<ハフマンテーブル作成方法>図2の如
く、ハフマンテーブル37の作成時には、まず、プログ
ラムデータ30のうち先頭から16ビットを取り出しフ
ァイルエンド調整器31に入力する。この際、プログラ
ムデータ30がファイルエンドに達するまでは入力され
た16ビットデータをそのまま出力する。<Huffman Table Creating Method> As shown in FIG. 2, when creating the Huffman table 37, first, 16 bits from the beginning of the program data 30 are extracted and input to the file end adjuster 31. At this time, the input 16-bit data is output as it is until the program data 30 reaches the file end.
【0021】変換器32はファイルエンド調整器31か
ら入力された16ビットデータを前8ビット後ろ8ビッ
トに分割し、前8ビットデータが示す値aと後ろ8ビッ
トデータが示す値bから成るパターン(a,b)に変換
し出力する。図4に16ビットのデータとパターン
(a,b)の関係を示す。The converter 32 divides the 16-bit data input from the file end adjuster 31 into front 8 bits and rear 8 bits, and a pattern composed of a value a indicated by the front 8 bit data and a value b indicated by the rear 8 bit data. It is converted into (a, b) and output. FIG. 4 shows the relationship between 16-bit data and pattern (a, b).
【0022】変換器32から出力されたパターン(a,
b)はパターンカウンター33でその出現数がカウント
される。プログラムデータ30にデータがなくなるまで
上記のプログラムデータ30からパターンカウンター3
3までの過程を繰り返す。The pattern (a,
In b), the number of appearances is counted by the pattern counter 33. From the above program data 30 to the pattern counter 3 until no data remains in the program data 30.
Repeat the process up to 3.
【0023】ただし、プログラムデータ30の最終デー
タはファイルエンド調整器31でビット数の調整が行な
われる。すなわちプログラムデータ30からファイルエ
ンド調整器31に入力された最終データが16ビットに
満たないとき、ファイルエンド調整器31は出力が16
ビットとなるように入力されたデータの後に足りない数
だけ“0”値のビットデータを追加して出力する。そし
て追加した“0”値のビットデータの数を付加ビット数
35として出力する。図5はプログラムデータ30の最
終データD1が11ビットのときファイルエンド調整器
31から出力されるデータを示している。図5中のD2
は追加されるデータを示しており、最終データD1が1
1ビットであることから、16ビットにするため“0”
値のビットデータが5個追加されている。この場合は、
ファイルエンド調整器31が付加ビット数35として出
力する値は“5”である。もしプログラムデータ30の
最終データが16のときはファイルエンド調整器31は
入力された最終データ16ビットをそのまま変換器32
へ送り、付加ビット数35として値“0”を出力する。However, the final data of the program data 30 is adjusted in the number of bits by the file end adjuster 31. That is, when the final data input from the program data 30 to the file end adjuster 31 is less than 16 bits, the file end adjuster 31 outputs 16 bits.
Bit data having a value of "0" is added and output after the data that has been input so as to be bits is insufficient. Then, the number of added bit data of “0” value is output as the additional bit number 35. FIG. 5 shows data output from the file end adjuster 31 when the final data D1 of the program data 30 is 11 bits. D2 in FIG.
Indicates the data to be added, and the final data D1 is 1
Since it is 1 bit, "0" is set to 16 bits
Five bit data of value are added. in this case,
The value output by the file end adjuster 31 as the additional bit number 35 is "5". If the final data of the program data 30 is 16, the file end adjuster 31 converts the input 16 bits of the final data as it is to the converter 32.
And outputs the value “0” as the additional bit number 35.
【0024】このようにしてプログラムデータ30の全
てのデータがファイルエンド調整器31および変換器3
2を経てパターンカウンター33でカウントされた後、
パターンカウンター33はカウントした結果をカウント
結果34として出力する。In this way, all the data of the program data 30 is converted into the file end adjuster 31 and the converter 3.
After being counted by the pattern counter 33 through 2,
The pattern counter 33 outputs the counted result as the count result 34.
【0025】カウント結果34をハフマンテーブル生成
器36に入力すると、ハフマンテーブル生成器36はパ
ターン(a,b)とそのハフマンコードの対応の一覧を
ハフマンテーブル37として出力する。このときパター
ンカウンター33で1回もカウントされなかったパター
ンにはハフマンコードは生成されない。When the count result 34 is input to the Huffman table generator 36, the Huffman table generator 36 outputs a list of correspondences between the patterns (a, b) and the Huffman codes as a Huffman table 37. At this time, the Huffman code is not generated for the pattern that has not been counted even once by the pattern counter 33.
【0026】<圧縮方法>次に本実施例における圧縮方
法を図1にしたがって説明する。図1中のハフマンテー
ブル14は上記のハフマンテーブル作成動作にて作成さ
れたハフマンテーブルである。まず、プログラムデータ
10から16ビットを取り出し、ファイルエンド調整器
11に入力する。ファイルエンド調整器11は、プログ
ラムデータ10がファイルエンドに達するまでは入力さ
れた16ビットデータをそのまま出力する。<Compression Method> Next, the compression method in this embodiment will be described with reference to FIG. The Huffman table 14 in FIG. 1 is a Huffman table created by the above Huffman table creating operation. First, 16 bits are extracted from the program data 10 and input to the file end adjuster 11. The file end adjuster 11 outputs the input 16-bit data as it is until the program data 10 reaches the file end.
【0027】次に、変換器12はファイルエンド調整器
11から出力された16ビットデータを前8ビットデー
タと後ろ8ビットデータに分割し、前8ビットデータが
示す値aと後ろ8ビットデータが示す値bからなるパタ
ーン(a,b)に変換し出力する。Next, the converter 12 divides the 16-bit data output from the file end adjuster 11 into front 8-bit data and rear 8-bit data, and the value a indicated by the front 8-bit data and the rear 8-bit data are divided. The pattern (a, b) having the indicated value b is converted and output.
【0028】変換器12から出力されたパターン(a,
b)はハフマン符号化器13に入力される。ハフマン符
号化器13はハフマンテーブル14を参照して入力され
たパターン(a,b)に割り当てられているハフマンコ
ードを圧縮データとして出力する。ハフマン符号化器1
3から出力されたハフマンコードは順次圧縮データ15
となる。The pattern (a,
b) is input to the Huffman encoder 13. The Huffman encoder 13 refers to the Huffman table 14 and outputs the Huffman code assigned to the input pattern (a, b) as compressed data. Huffman encoder 1
The Huffman code output from 3 is compressed data 15 in sequence.
Becomes
【0029】以上の過程をプログラムデータ10がファ
イルエンドに達するまで繰り返す。ただしプログラムデ
ータ10の最終データはファイルエンド調整器11でビ
ット数の調整が行なわれる。すなわちプログラムデータ
10の最終データが16ビットに満たない場合、ファイ
ルエンド調整器11は入力された最終データの後に足り
ない数だけ“0”値のビットデータを追加してデータ長
を16ビットに調整し出力する。ファイルエンド調整器
11から出力された最後のデータは、前記と同様に変換
器12とハフマン符号化器13を経て圧縮データ15と
なる。以上で圧縮過程が終了する。The above process is repeated until the program data 10 reaches the file end. However, the final data of the program data 10 is adjusted in the number of bits by the file end adjuster 11. That is, when the final data of the program data 10 is less than 16 bits, the file end adjuster 11 adjusts the data length to 16 bits by adding bit data of "0" value after the input final data. And output. The final data output from the file end adjuster 11 becomes the compressed data 15 via the converter 12 and the Huffman encoder 13 as described above. This is the end of the compression process.
【0030】<復号方法>次に前記の圧縮方法で圧縮さ
れたデータの復号方法を図3にしたがって説明する。ま
ず、ハフマン復号器23は順次圧縮データ26を取り出
してハフマンテーブル24に一致するハフマンコードが
あるかどうかを調べる。もし一致するハフマンコードが
見つかれば、そのハフマンコードが割り当てられている
パターン(a,b)を出力する。復号器23から出力さ
れたパターン(a,b)は逆変換器22でaとbを夫々
8ビットのデータとし、合わせて16ビットのデータを
出力する。このときのパターン(a,b)と16ビット
のデータの関係は図4のようになる。逆変換器22から
出力された16ビットのデータは、図3の如く、ファイ
ルエンド調整器21に入力される。<Decoding Method> Next, the decoding method of the data compressed by the above compression method will be described with reference to FIG. First, the Huffman decoder 23 sequentially extracts the compressed data 26 and checks whether or not there is a matching Huffman code in the Huffman table 24. If a matching Huffman code is found, the pattern (a, b) to which the Huffman code is assigned is output. The pattern (a, b) output from the decoder 23 is converted into 8-bit data by a and b by the inverse converter 22, and 16-bit data is output in total. The relationship between the pattern (a, b) and 16-bit data at this time is as shown in FIG. The 16-bit data output from the inverse converter 22 is input to the file end adjuster 21 as shown in FIG.
【0031】ファイルエンド調整器21は入力されたデ
ータが最後のデータでなければ何もせずに入力された1
6ビットデータをそのまま出力する。ファイルエンド調
整器21から出力された16ビットデータは順次復号デ
ータ20となる。以上の過程を圧縮データ26にデータ
がなくなるまで繰り返す。The file end adjuster 21 does not do anything if the input data is not the last data.
6-bit data is output as it is. The 16-bit data output from the file end adjuster 21 becomes the decoded data 20 sequentially. The above process is repeated until there is no data in the compressed data 26.
【0032】一方、ファイルエンド調整器21に最後の
データが入力されると、ファイルエンド調整器21は入
力された16ビットデータの後ろから付加ビット数25
で与えられるビット数を削除して出力する。付加ビット
数25の値が“0”のときは入力された16ビットデー
タをそのまま出力する。このようにしてファイルエンド
調整器21から出力された最後のデータが復号データ2
0となって、復号過程が終了する。On the other hand, when the last data is input to the file end adjuster 21, the file end adjuster 21 adds 25 additional bits from the end of the input 16-bit data.
The number of bits given by is deleted and output. When the value of the additional bit number 25 is "0", the input 16-bit data is output as it is. In this way, the final data output from the file end adjuster 21 is the decoded data 2
It becomes 0, and the decoding process ends.
【0033】{第2の実施例} <構成>図6は本発明の第2の実施例のプログラム圧縮
装置を示す機能ブロック図である。図6中の41はプロ
グラムデータ40から所定ビット数のデータを繰り返し
取り出しかつ最後のデータのビット数を調整するファイ
ルエンド調整器(第1の分割手段)、42はファイルエ
ンド調整器41から出力されたデータ4分割して4次元
ベクトルを生成し出力するベクトル生成器(第2の分割
手段)、44は入力されたベクトルをコードブック45
中の量子化代表ベクトルに量子化するベクトル量子化器
(ベクトル量子化手段)、43はベクトル生成器42か
らの入力である4次元ベクトルの成分とベクトル量子化
器44からの入力である量子化代表ベクトルの成分とか
ら2個のベクトルの四種類の成分(第1成分、第2成
分、第3成分、および第4成分)の誤差を計算して圧縮
データを生成する残差計算器(ベクトル差分手段)であ
る。{Second Embodiment} <Structure> FIG. 6 is a functional block diagram showing a program compression apparatus according to a second embodiment of the present invention. Reference numeral 41 in FIG. 6 is a file end adjuster (first dividing means) for repeatedly taking out a predetermined number of bits of data from the program data 40 and adjusting the bit number of the last data, and 42 is output from the file end adjuster 41. A vector generator (second dividing means) that divides the data into four to generate and outputs a four-dimensional vector, 44 is a codebook for the input vector
, A vector quantizer (vector quantizing means) for quantizing into a quantized representative vector, 43 is a four-dimensional vector component which is an input from the vector generator 42, and a quantizer which is an input from the vector quantizer 44. A residual calculator (vector that calculates the error of four types of components (first component, second component, third component, and fourth component) of two vectors from the components of the representative vector to generate compressed data. Difference means).
【0034】前記ファイルエンド調整器41は、プログ
ラムデータ10がファイルエンドに達するまでは入力さ
れた16ビットデータをそのまま出力する。The file end adjuster 41 outputs the input 16-bit data as it is until the program data 10 reaches the file end.
【0035】前記ベクトル生成器42は、ファイルエン
ド調整器41から出力された32ビットデータを図7に
示すように8ビットデータに分割し、分割された4個の
8ビットデータからそれらを成分とする4次元ベクトル
を生成し出力する。The vector generator 42 divides the 32-bit data output from the file end adjuster 41 into 8-bit data as shown in FIG. 7, and divides the 4-bit divided 8-bit data into components. Generates and outputs a four-dimensional vector.
【0036】前記残差計算器43は、プログラムデータ
32ビットから生成した4次元ベクトルをベクトル量子
化器44で量子化代表ベクトルに量子化したときに生じ
る量子化誤差を圧縮データとして出力するよう構成され
る。The residual calculator 43 is configured to output, as compressed data, a quantization error generated when a four-dimensional vector generated from 32 bits of program data is quantized by the vector quantizer 44 into a quantized representative vector. To be done.
【0037】ここで、図6中のコードブック45はベク
トル量子化の際に使用するものであり、図8に示すよう
に256個の4次元ベクトルとこれらの夫々に対応する
インデックスで構成されている。図8中のD3は4次元
ベクトルの成分を示している。コードブック45は圧縮
べきプログラムデータを用いて予め作成されるもので、
図9中のプログラムデータ60は図6のプログラムデー
タ40と同じものである。また、図9中の61はプログ
ラムデータの最後のデータ数を調整するとともに付加ビ
ット数65を出力するファイルエンド調整器、62はフ
ァイルエンド調整器61から出力されたデータを4分割
して4次元ベクトルの学習系列63を生成するベクトル
生成器、64は学習系列63を入力し学習系列63に適
したコードブック66を生成するコードブック生成器で
ある。The codebook 45 shown in FIG. 6 is used for vector quantization, and is composed of 256 four-dimensional vectors and indexes corresponding to each of them, as shown in FIG. There is. D3 in FIG. 8 indicates a component of a four-dimensional vector. The code book 45 is created in advance using program data to be compressed,
The program data 60 in FIG. 9 is the same as the program data 40 in FIG. Further, 61 in FIG. 9 is a file end adjuster which adjusts the last data number of the program data and outputs an additional bit number 65, and 62 is a four-dimensional division of the data output from the file end adjuster 61 into four. A vector generator that generates a learning sequence 63 of vectors, and a codebook generator 64 that inputs the learning sequence 63 and generates a codebook 66 suitable for the learning sequence 63.
【0038】また、図10は本実施例の復号過程を示す
図である。図10中のコードブック56、圧縮データ5
7は夫々図6中のコードブック45、圧縮データ46と
同じものであり、また付加ビット数55は図9中の付加
ビット数65と同じものである。さらに、図10中の5
4はコードブック56の中から入力されたデータと一致
するインデックスを探して当該インデックスの量子化代
表ベクトルを後述の残差加算器53へ送るベクトル逆量
子化器、53は入力されたデータを4分割し4次元ベク
トル(残差)を生成しこれにベクトル逆量子化器54か
らの値を加算する残差加算器、52は残差加算器53か
ら出力された4次元ベクトルを一個のデータに変換する
変換器、51は圧縮データ57のファイルエンドにおい
てデータのビット数を調整するファイルエンド調整器で
ある。FIG. 10 is a diagram showing the decoding process of this embodiment. Codebook 56 and compressed data 5 in FIG.
7 is the same as the codebook 45 and the compressed data 46 in FIG. 6, and the number of additional bits 55 is the same as the number of additional bits 65 in FIG. Furthermore, 5 in FIG.
4 is a vector dequantizer that searches the codebook 56 for an index that matches the input data, and sends the quantized representative vector of the index to a residual adder 53, which will be described later. A residual adder that divides and generates a four-dimensional vector (residual) and adds the value from the vector dequantizer 54 to it, 52 represents the four-dimensional vector output from the residual adder 53 into one data A converter 51 for converting is a file end adjuster for adjusting the number of bits of data at the file end of the compressed data 57.
【0039】<コードブック生成方法>コードブック生
成時には、図9の如く、まず、プログラムデータ60か
ら32ビットデータを取り出し、ファイルエンド調整器
61に入力する。ファイルエンド調整器61は、プログ
ラムデータがファイルエンドに達するまでは入力された
32ビットデータをそのまま出力する。ベクトル生成器
62はファイルエンド調整器61から出力された32ビ
ットデータを図7に示すように4個の8ビットデータに
分割し、該4個の8ビットデータを4成分とする4次元
ベクトルを生成する。図11はベクトル生成器62に入
力される32ビットのデータと、それから生成されるベ
クトルの成分との対応を示している。<Codebook Generation Method> At the time of codebook generation, as shown in FIG. 9, first, 32-bit data is extracted from the program data 60 and input to the file end adjuster 61. The file end adjuster 61 outputs the input 32-bit data as it is until the program data reaches the file end. The vector generator 62 divides the 32-bit data output from the file end adjuster 61 into four 8-bit data as shown in FIG. 7, and generates a four-dimensional vector having the four 8-bit data as four components. To generate. FIG. 11 shows the correspondence between the 32-bit data input to the vector generator 62 and the vector components generated from the 32-bit data.
【0040】ベクトル生成器62から出力された4次元
ベクトルは順次学習系列63となり、プログラムデータ
60にデータがなくなるまでプログラムデータ60から
学習系列63までの過程を繰り返す。ただし、プログラ
ムデータ60のファイルエンドにおいてファイルエンド
調整器61は出力するデータ数の調整を行なう。すなわ
ち、ファイルエンド調整器61に入力されたプログラム
データ60の最終データが32ビットに満たないとき、
ファイルエンド調整器61は出力が32ビットデータに
なるように不足するビット数だけ“0”値のビットデー
タを入力データの後に追加して出力する。またその時追
加した“0”値のビットの数を付加ビット数65として
出力する。プログラムデータ60の最終データが32ビ
ットである場合は、ファイルエンド調整器61は入力さ
れた32ビットデータをそのまま出力し、付加ビット数
65として値“0”を出力する。図12はプログラムデ
ータ60から取り出された最終データD4が24ビット
のときファイルエンド調整器61から出力されるデータ
を示している。図12中のD5は追加されるデータを示
しており、最終データD4が24ビットなので合わせて
32ビットにするために“0”値のビットデータが8個
追加される。The four-dimensional vector output from the vector generator 62 sequentially becomes the learning series 63, and the process from the program data 60 to the learning series 63 is repeated until the program data 60 has no data. However, at the file end of the program data 60, the file end adjuster 61 adjusts the number of output data. That is, when the final data of the program data 60 input to the file end adjuster 61 is less than 32 bits,
The file end adjuster 61 adds bit data having a value of "0" after the input data and outputs the bit data so that the output becomes 32-bit data. Further, the number of "0" value bits added at that time is output as the additional bit number 65. When the final data of the program data 60 is 32 bits, the file end adjuster 61 outputs the input 32-bit data as it is, and outputs the value “0” as the additional bit number 65. FIG. 12 shows the data output from the file end adjuster 61 when the final data D4 extracted from the program data 60 is 24 bits. D5 in FIG. 12 indicates the data to be added. Since the final data D4 is 24 bits, 8 bit data of "0" value are added to make the total 32 bits.
【0041】ファイルエンド調整器61から出力された
最終データ32ビットは、上記と同様にベクトル生成器
62を経て学習系列63となる。このようにして生成さ
れた学習系列63は4次元ベクトルの集合である。コー
ドブック生成器64は、学習系列63の4次元ベクトル
空間での分布を分析することにより、学習系列63に適
したコードブック66を生成する。The final data of 32 bits output from the file end adjuster 61 becomes a learning sequence 63 via the vector generator 62 as described above. The learning sequence 63 thus generated is a set of four-dimensional vectors. The codebook generator 64 generates a codebook 66 suitable for the learning series 63 by analyzing the distribution of the learning series 63 in the four-dimensional vector space.
【0042】<圧縮方法>次に本実施例の圧縮方法につ
いて記述する。図6の如く、まず、プログラムデータ4
0から32ビットデータを取り出しファイルエンド調整
器41に入力する。ファイルエンド調整器41は図9の
ファイルエンド調整器61と同様のものであるが付加ビ
ット数は出力しない。ファイルエンド調整器41はプロ
グラムデータ40がファイルエンドに達するまでは入力
された32ビットデータをそのまま出力する。図6のベ
クトル生成器42はファイルエンド調整器41から出力
された32ビットデータを図7に示すように8ビットデ
ータに分割し、分割された4個の8ビットデータからそ
れらを成分とする4次元ベクトルを生成し出力する。ベ
クトル生成器から出力された4次元ベクトルはベクトル
量子化器44および残差計算器43に入力される。ベク
トル量子化器44は入力ベクトルをコードブック45の
中から後述する方法で選択された量子化代表ベクトルに
量子化する。<Compression Method> Next, the compression method of this embodiment will be described. As shown in FIG. 6, first, the program data 4
The 32-bit data from 0 is taken out and input to the file end adjuster 41. The file end adjuster 41 is similar to the file end adjuster 61 of FIG. 9, but does not output the number of additional bits. The file end adjuster 41 outputs the input 32-bit data as it is until the program data 40 reaches the file end. The vector generator 42 of FIG. 6 divides the 32-bit data output from the file end adjuster 41 into 8-bit data as shown in FIG. 7, and divides the 4-bit divided 8-bit data into four components. Generates and outputs a dimension vector. The four-dimensional vector output from the vector generator is input to the vector quantizer 44 and the residual calculator 43. The vector quantizer 44 quantizes the input vector into a quantized representative vector selected from the codebook 45 by a method described later.
【0043】次に、量子化代表ベクトルの選択方法につ
いて説明する。まず、図8に示したコードブックのイン
デックス“0”にある量子化代表ベクトルと入力ベクト
ルから次の数式(数1)で与えられるひずみ量を計算
し、そのひずみ量の値とインデックスの値“0”を保存
する。Next, a method of selecting the quantized representative vector will be described. First, the distortion amount given by the following mathematical expression (Equation 1) is calculated from the quantized representative vector and the input vector at the index “0” of the codebook shown in FIG. 8, and the value of the distortion amount and the index value “ Save 0 ".
【0044】[0044]
【数1】 [Equation 1]
【0045】次にインデックス“1”にある量子化代表
ベクトルと入力ベクトルから上記数式(数1)で与えら
れるひずみ量を計算し、保存されているひずみ量の値と
比較する。そしてもし計算したひずみ量の値が保存され
ているひずみ量の値よりも小さい値であれば、保存され
ているひずみ量の値とインデックスの値を消去し、入力
ベクトルとインデックス“1”にある量子化代表ベクト
ルとのひずみ量の値と、インデックスの値“1”を新た
に保存する。もし計算したひずみ量の値が保存されてい
るひずみ量の値と等しいかそれより大きい場合は何もし
ない。次も同様にインデックス“2”にある量子化代表
ベクトルと第1のベクトルから上記数式(数1)で与え
られるひずみ量を計算し、計算したひずみ量の値が保存
されているひずみ量の値よりも小さい場合は、保存され
ているひずみ量の値とインデックスの値を消去し、計算
したひずみ量の値とインデックスの値“2”を新たに保
存する。もし計算したひずみ量の値が保存されているひ
ずみ量の値と等しいかそれよりも小さい場合はなにもせ
ず次のインデックスにある量子化代表ベクトルとのひず
み量の値の計算に移る。以下インデックス“255”ま
で同様にする。Next, the distortion amount given by the above mathematical expression (Equation 1) is calculated from the quantized representative vector at the index "1" and the input vector, and is compared with the stored distortion amount value. If the calculated strain amount value is smaller than the stored strain amount value, the stored strain amount value and index value are deleted, and the input vector and the index “1” are stored. The distortion amount value with the quantized representative vector and the index value “1” are newly stored. If the calculated strain value is equal to or greater than the stored strain value, do nothing. Similarly, the strain amount given by the above equation (Equation 1) is calculated from the quantized representative vector and the first vector at the index “2” in the same manner, and the calculated strain amount value is the stored strain amount value. If it is smaller than the above, the stored strain amount value and index value are deleted, and the calculated strain amount value and index value “2” are newly stored. If the calculated strain amount value is equal to or smaller than the stored strain amount value, nothing is done and the calculation of the strain amount value with the quantized representative vector at the next index is performed. The same applies to index "255" and so on.
【0046】このようにして図6のコードブック45の
全ての量子化代表ベクトルと入力ベクトルとのひずみ量
の計算が終了したとき、保存されているひずみ量は計算
した全てのひずみ量の中で最小のものであり、保存され
ているインデックスはその最小のひずみ量を与える量子
化代表ベクトルのインデックスである。このようにして
ベクトル量子化器44は入力ベクトルを前記の方法で選
択した量子化代表ベクトルに量子化し、その量子化代表
ベクトルとそのインデックスを出力する。インデックス
は“0”〜“255”の範囲の整数であるので8ビット
データとして出力される。ベクトル量子化器44から出
力された量子化代表ベクトルは残差計算器43に入力さ
れる。残差計算器43はベクトル生成器42からの入力
である4次元ベクトルの成分と、ベクトル量子化器44
からの入力である量子化代表ベクトルの成分から2個の
ベクトルの第1成分の誤差、第2成分の誤差、第3成分
の誤差、第4成分の誤差を計算し、夫々5ビットのデー
タとし、合わせて20ビットを圧縮データとして出力す
る。即ち残差計算器43はプログラムデータ32ビット
から生成した4次元ベクトルをベクトル量子化器44で
量子化代表ベクトルに量子化したときに生じる量子化誤
差を圧縮データとして出力するものである。プログラム
データ40の32ビットは、ベクトル量子化器44の出
力と残差計算器43の出力とを合わせた28ビットのデ
ータに圧縮される。この圧縮データ28ビットは図14
に示すように先頭から8ビット(D8)がベクトル量子
化器44の出力(量子化代表ベクトルのインデックス)
であり、続く20ビット(4×5ビット:D9〜D1
2)が残差計算器43の出力(量子化誤差)である。圧
縮データ28ビットは順次圧縮データ46となる。When the calculation of the distortion amount of all the quantized representative vectors and the input vector of the codebook 45 of FIG. 6 is completed in this way, the stored distortion amount is among all the calculated distortion amounts. The smallest and stored index is the index of the quantized representative vector that gives the smallest amount of distortion. In this way, the vector quantizer 44 quantizes the input vector into the quantized representative vector selected by the above method, and outputs the quantized representative vector and its index. Since the index is an integer in the range of "0" to "255", it is output as 8-bit data. The quantized representative vector output from the vector quantizer 44 is input to the residual calculator 43. The residual calculator 43 receives the components of the four-dimensional vector, which is the input from the vector generator 42, and the vector quantizer 44.
The error of the first component, the error of the second component, the error of the third component, and the error of the fourth component of the two vectors are calculated from the components of the quantized representative vector which is the input from , A total of 20 bits are output as compressed data. That is, the residual calculator 43 outputs, as compressed data, a quantization error that occurs when the vector quantizer 44 quantizes a four-dimensional vector generated from 32 bits of program data into a quantized representative vector. The 32 bits of the program data 40 are compressed into 28 bits of data, which is the sum of the output of the vector quantizer 44 and the output of the residual calculator 43. 28 bits of this compressed data are shown in FIG.
8 bits (D8) from the beginning are output of the vector quantizer 44 (index of the quantized representative vector) as shown in FIG.
And the following 20 bits (4 × 5 bits: D9 to D1
2) is the output (quantization error) of the residual calculator 43. The 28 bits of compressed data become the compressed data 46 in sequence.
【0047】<復号方法>次に上記の圧縮方法で圧縮し
たデータの復号方法について記述する。図10の如く、
まず圧縮データ57から28ビットデータを取り出し、
先頭から8ビットデータをベクトル逆量子化器54に入
力し、残りの20ビットデータを残差加算器53に入力
する。残差加算器53は入力された20ビットデータを
5ビットデータに分割し、4個の5ビットデータを4成
分とする4次元ベクトルを生成する。<Decoding Method> Next, a method of decoding the data compressed by the above compression method will be described. As shown in Figure 10,
First, extract 28-bit data from compressed data 57,
The 8-bit data from the beginning is input to the vector dequantizer 54, and the remaining 20-bit data is input to the residual adder 53. The residual adder 53 divides the input 20-bit data into 5-bit data and generates a 4-dimensional vector having four 5-bit data as four components.
【0048】ベクトル逆量子化器54はコードブック5
6の中から、入力された8ビットデータと一致するイン
デックスを探し、そのインデックスの量子化代表ベクト
ルを残差加算器53へ送る。残差加算器53は圧縮デー
タから生成した4次元ベクトルと、ベクトル逆量子化器
54からの入力である4次元ベクトルとを加算して出力
する。残差加算器53から出力された4次元ベクトルは
変換器52で図11のように32ビットのデータに変換
される。The vector dequantizer 54 uses the codebook 5
An index that matches the input 8-bit data is searched from 6 and the quantized representative vector of the index is sent to the residual adder 53. The residual adder 53 adds the four-dimensional vector generated from the compressed data and the four-dimensional vector which is the input from the vector dequantizer 54, and outputs the result. The four-dimensional vector output from the residual adder 53 is converted into 32-bit data by the converter 52 as shown in FIG.
【0049】ファイルエンド調整器51は圧縮データ5
7のファイルエンドにおいてはデータのビット数を調整
し、ファイルエンド以外では変換器からの入力である3
2ビットのデータをそのまま出力する。ファイルエンド
調整器51からの出力32ビットは順次復号データ50
となる。圧縮データ57の最後の28ビットの復号過程
において、ファイルエンド調整器51は入力された32
ビットデータの後ろから付加ビット数55で与えられる
ビット数を削除して出力する。以上で復号過程を終了す
る。The file end adjuster 51 uses the compressed data 5
The number of bits of data is adjusted at the file end of 7 and the input from the converter is made at other than the file end.
2-bit data is output as it is. 32 bits output from the file end adjuster 51 are sequentially decoded data 50
Becomes In the decoding process of the last 28 bits of the compressed data 57, the file end adjuster 51 inputs 32
The bit number given by the additional bit number 55 is deleted from the end of the bit data and output. This completes the decoding process.
【0050】{第3の実施例} <構成>図15は本発明の第3の実施例のプログラム圧
縮装置を示す機能ブロック図である。本実施例では、後
述するカウンター91(図17参照)に先に入力された
データをカレントデータと呼び、カレントデータの次に
入力されたデータをネクストデータと呼ぶことにする。
図15中の71は予測テーブル75内のデータと等しい
カレントデータを探してこれに対応する予測値を出力す
る予測器(予測手段)、72はプログラムデータ70の
値と予測器71の予測値との差を出力する減算器(差分
手段)、73は減算器72から出力されたデータを所定
のランレングスパターン(図16参照)に変換するラン
レングス変換器、74は、入力されたランレングスパタ
ーンの一部をハフマンコードに、他の一部を所定ビット
のデータに符号化するハフマン符号化器である。なお、
前記予測器71および前記減算器72の夫々は、前記プ
ログラムデータ70のデータを8ビットのブロックデー
タとして取り出す(データ分割する)分割手段として機
能する。すなわち、本実施例の予測器71は、予測手段
と分割手段の両機能を兼ね備えており、減算器72は差
分手段と分割手段の両機能を兼ね備えている。{Third Embodiment} <Structure> FIG. 15 is a functional block diagram showing a program compression apparatus according to a third embodiment of the present invention. In this embodiment, the data previously input to the counter 91 (see FIG. 17) described later is referred to as current data, and the data input next to the current data is referred to as next data.
Reference numeral 71 in FIG. 15 is a predictor (prediction means) that searches for current data that is equal to the data in the prediction table 75 and outputs a predicted value corresponding to the current data, and 72 is the value of the program data 70 and the predicted value of the predictor 71. , A run length converter for converting the data output from the subtractor 72 into a predetermined run length pattern (see FIG. 16), and 74 an input run length pattern. Is a Huffman encoder, and the other part is encoded into data of a predetermined bit. In addition,
Each of the predictor 71 and the subtractor 72 functions as a dividing unit that takes out (data divides) the data of the program data 70 as 8-bit block data. That is, the predictor 71 of this embodiment has both the functions of the predicting means and the dividing means, and the subtractor 72 has both the functions of the difference means and the dividing means.
【0051】ここで、図15に示した予測テーブル75
およびハフマンテーブル76は、図17および図18の
如く、夫々プログラムデータ70を用いて予め作成され
たものである。図17のプログラムデータ90は図15
のプログラムデータ70と同じものである。図17中の
91は、先に入力されたカレントデータに対する次に入
力されたネクストデータの値をカウントするカウンタ
ー、93は前記カウンター91でのカウント結果92に
基づいて各カレントデータに対して最も出現頻度の高い
一のネクストデータを選択し夫々の予測値を設定する予
測テーブル生成器である。Here, the prediction table 75 shown in FIG.
The Huffman table 76 is created in advance using the program data 70 as shown in FIGS. 17 and 18. The program data 90 of FIG. 17 is shown in FIG.
Is the same as the program data 70. Reference numeral 91 in FIG. 17 is a counter for counting the value of the next input next data with respect to the previously input current data, and 93 is the most appearance for each current data based on the count result 92 of the counter 91. It is a prediction table generator that selects one frequently-used next data and sets respective prediction values.
【0052】さらに、図18はハフマンテーブルを作成
する過程を示す図である。図18のプログラムデータ1
00は図15のプログラムデータ70と同じものであ
り、図18の予測テーブル106は上記の方法で作成さ
れたものである。図18中の101は予測テーブル10
6のカレントデータのうちプログラムデータ100のデ
ータと等しいものを探しこれに対応する予測値を出力す
る予測器であって、図15中の予測器71と同じ機能を
持つ。102はプログラムデータ100からの値と予測
器101からの予測値との差を出力する減算器であっ
て、図15中の減算器72と同じ機能を持つ。103は
減算器102から出力されるデータを所定のランレング
スパターン(図19参照)に変換するランレングス変換
器、104はランレングス変換器103から出力された
ランレングスパターンの出現回数をカウントするカウン
ター、105は入力されたカウント結果のカウント数の
多いランレングスパターンほどより短いハフマンコード
を生成しランレングスパターンとハフマンコードの対応
の一覧をハフマンテーブル107として出力するハフマ
ンテーブル生成器である。Further, FIG. 18 is a diagram showing a process of creating a Huffman table. Program data 1 of FIG.
00 is the same as the program data 70 of FIG. 15, and the prediction table 106 of FIG. 18 is created by the above method. Reference numeral 101 in FIG. 18 is the prediction table 10.
It is a predictor that searches for the same as the data of the program data 100 out of the current data of 6 and outputs the predicted value corresponding to it, and has the same function as the predictor 71 in FIG. Reference numeral 102 denotes a subtracter that outputs the difference between the value from the program data 100 and the predicted value from the predictor 101, and has the same function as the subtractor 72 in FIG. 103 is a run length converter that converts the data output from the subtractor 102 into a predetermined run length pattern (see FIG. 19), and 104 is a counter that counts the number of appearances of the run length pattern output from the run length converter 103. , 105 are Huffman table generators that generate shorter Huffman codes for run-length patterns having a larger number of counts of the input count results and output a list of correspondences between run-length patterns and Huffman codes as a Huffman table 107.
【0053】さらにまた、図20は本実施例の復号過程
を示す図である。図20中の予測テーブル85、ハフマ
ンテーブル86、圧縮データ87は夫々図15の予測テ
ーブル75、ハフマンテーブル76、圧縮データ77と
同じものである。また、84は圧縮データ87がハフマ
ンテーブル86のハフマンコードに一致したときにこれ
を所定のランレングスパターンに復号するハフマン復号
器、83はハフマン復号器84から出力された所定のラ
ンレングスパターンを後述する所定のデータ列に変換し
1データずつ出力する逆変換器、81は予測テーブル8
5の中から入力されたデータと等しいカレントデータを
探しそのカレントデータに対応する予測値を出力する予
測器、82は逆変換器83からの入力と予測器81から
の入力を加算して出力する加算器である。Furthermore, FIG. 20 is a diagram showing the decoding process of this embodiment. The prediction table 85, the Huffman table 86, and the compressed data 87 in FIG. 20 are the same as the prediction table 75, the Huffman table 76, and the compressed data 77 in FIG. 15, respectively. Reference numeral 84 is a Huffman decoder that decodes the compressed data 87 into a predetermined run length pattern when the Huffman table 86 matches the Huffman code. Reference numeral 83 is a predetermined run length pattern output from the Huffman decoder 84. An inverse converter for converting into a predetermined data sequence and outputting one data at a time, 81 is a prediction table 8
A predictor that searches for a current data equal to the input data from 5 and outputs a prediction value corresponding to the current data. Reference numeral 82 adds and outputs the input from the inverse converter 83 and the input from the predictor 81. It is an adder.
【0054】<予測テーブルの作成方法>次に、予測テ
ーブル75の作成方法について図17に基づいて説明す
る。まず、カウンター91にプログラムデータ90のう
ちの8ビット分を入力する。続いて、再度カウンター9
1にプログラムデータ90の8ビット分を入力する。カ
ウンター91は先に入力されたカレントデータに対する
次に入力されたネクストデータの値を図21に示すカウ
ント表にカウントする。図21のカウント表の縦方向の
値はカレントデータの値を表し、横方向の値はネクスト
データの値を表している。<Method of Creating Prediction Table> Next, a method of creating the prediction table 75 will be described with reference to FIG. First, 8 bits of the program data 90 are input to the counter 91. Then counter 9 again
Input 8 bits of the program data 90 to 1. The counter 91 counts the value of the next input next data with respect to the previously input current data in the count table shown in FIG. The values in the vertical direction of the count table in FIG. 21 represent the values of the current data, and the values in the horizontal direction represent the values of the next data.
【0055】続いてカウンター91にプログラムデータ
90としての8ビットデータを入力すると、カウンター
91は前のカレントデータの値を消去し、代わりにネク
ストデータの値をカレントデータとし、あらたに入力さ
れた値をネクストデータとする。そしてそのカレントデ
ータに対するネクストデータの値を図21のカウント表
にカウントする。さらにプログラムデータ90としての
8ビットデータをカウンター91に入力すると、カウン
ター91は前記と同様にカレントデータを消去し、代わ
りにネクストデータの値をカレントデータとし、新たに
入力されたデータをネクストデータとし、そのカレント
データに対するネクストデータの値を図21のカウント
表にカウントする。プログラムデータ90にデータがな
くなるまで上記の過程を繰り返す。Subsequently, when 8-bit data as program data 90 is input to the counter 91, the counter 91 erases the previous value of the current data, and instead uses the value of the next data as the current data, and the newly input value. Is the next data. Then, the value of the next data for the current data is counted in the count table of FIG. Further, when 8-bit data as the program data 90 is input to the counter 91, the counter 91 erases the current data in the same manner as described above, instead, the value of the next data is used as the current data, and the newly input data is used as the next data. , The value of the next data for the current data is counted in the count table of FIG. The above process is repeated until the program data 90 is empty.
【0056】プログラムデータ90にデータがなくなる
と、カウンター91は図21のカウント表にカウントし
た結果をカウント結果92として出力する。予測テーブ
ル生成器93はカウント結果92を読み込み、まずカレ
ントデータ“0”に対する“0”〜“255”のネクス
トデータの中から最もカウント数の多いネクストデータ
を選択し、図22に示す予測表のカレントデータ0に対
応する予測値に設定する。次にカレントデータ“1”に
対する“0”〜“255”のネクストデータの中から最
もカウント数の多いネクストデータを選択し、図22の
予測表のカレントデータ“1”に対応する予測値として
設定する。以下カレントデータ“255”まで同様にし
て図22の予測表を完成し、予測テーブル94を得る。When the program data 90 has no data, the counter 91 outputs the count result in the count table of FIG. 21 as the count result 92. The prediction table generator 93 reads the count result 92, first selects the next data with the largest count number from the next data of “0” to “255” for the current data “0”, and then the prediction table shown in FIG. Set to the predicted value corresponding to the current data 0. Next, the next data having the largest number of counts is selected from the next data of “0” to “255” for the current data “1” and set as the prediction value corresponding to the current data “1” of the prediction table of FIG. To do. Similarly, the prediction table of FIG. 22 is completed up to the current data “255”, and the prediction table 94 is obtained.
【0057】<ハフマンテーブルの作成方法>次に、ハ
フマンテーブル76の作成方法について記述する。図1
8の如く、まず、プログラムデータ100のうちの8ビ
ットのデータを取り出し予測器101および減算器10
2に入力する。<Method of Creating Huffman Table> Next, a method of creating the Huffman table 76 will be described. FIG.
As shown in FIG. 8, first, 8-bit data of the program data 100 is taken out, and the predictor 101 and the subtractor 10
Enter 2.
【0058】減算器102は1番最初に入力されたデー
タはそのまま出力する。一方、予測器101は予測テー
ブル106の中から、入力されたデータと等しいカレン
トデータを探し、そのカレントデータに対応する予測値
を出力する。このとき同時にプログラムデータ100か
ら次の8ビットデータを予測器101と減算器102に
入力する。減算器102はプログラムデータ100から
入力された値と、予測器101から入力された予測値と
の差を出力する。The subtractor 102 outputs the first input data as it is. On the other hand, the predictor 101 searches the prediction table 106 for the current data equal to the input data, and outputs the prediction value corresponding to the current data. At this time, the next 8-bit data from the program data 100 is simultaneously input to the predictor 101 and the subtractor 102. The subtractor 102 outputs the difference between the value input from the program data 100 and the predicted value input from the predictor 101.
【0059】次も同様に予測器101は予測テーブル1
06の中から入力されたデータと等しいカレントデータ
を探し、そのカレントデータに対応する予測値を出力す
る。同時にプログラムデータ100から次の8ビットデ
ータを予測器101と減算器102に入力する。減算器
102はプログラムデータ100から入力された値と予
測器101から入力された値の差を計算し出力する。以
下プログラムデータ100にデータがなくなるまで同様
にする。Similarly, the predictor 101 uses the prediction table 1
The current data that is equal to the input data is searched from 06, and the predicted value corresponding to the current data is output. At the same time, the next 8-bit data from the program data 100 is input to the predictor 101 and the subtractor 102. The subtractor 102 calculates and outputs the difference between the value input from the program data 100 and the value input from the predictor 101. The same applies until the program data 100 is empty.
【0060】減算器102から出力されるデータはラン
レングス変換器103で後述するランレングスパターン
に変換される。ランレングスパターンは連続する“0”
とその後に続く“0”でない値をまとめて(n,g)と
表したものである。ここで変数nは連続する“0”の数
を表し、変数gは連続する“0”に続く“0”でない値
のグループナンバーを表している。グループナンバーは
図23のグループナンバー表で与えられる数値である。
以下にデータ列を前記のランレングスパターンに変換す
る方法について記述する。図19に一例としてデータ列
と、それがランレングスパターンに変換されたものを示
す。図19のデータ列の先頭データ「12」は、直前に
連続する“0”が1個もなく、12のグループナンバー
が4なので、ランレングスパターン(0,4)となる。
その次に続くデータ列「0、0、55」は“0”でない
値「55」の直前に連続する“0”の数が2であり、5
5のグループナンバーが6なので、ランレングスパター
ン(2,6)となる。その次のデータ「−254」は、
直前に連続する“0”が1個もなく、−254のグルー
プナンバーが8なので、ランレングスパターン(0,
8)となる。同様に、次のデータ列「0、3」は、
“0”でない値「3」の直前に“0”が1個あり、3の
グループナンバーが2なので、ランレングスパターン
(1,2)となる。このようにして、減算器102から
出力されたデータ列はランレングス変換器103で順次
ランレングスパターンに変換される。ただし減算器10
2から出力されるデータ列が連続する“0”で終わる場
合は、その連続する“0”をまとめてランレングスパタ
ーン(0,0)とする。The data output from the subtractor 102 is converted into a run length pattern described later by the run length converter 103. Run length pattern is continuous "0"
And the values that are not “0” that follow it are collectively represented as (n, g). Here, the variable n represents the number of consecutive "0" s, and the variable g represents the group number of a value which is not "0" following the consecutive "0" s. The group number is a numerical value given in the group number table of FIG.
The method of converting a data string into the above run length pattern will be described below. FIG. 19 shows, as an example, a data string and a data string converted into a run length pattern. The head data “12” of the data string in FIG. 19 has a run length pattern (0, 4) because there is no single “0” immediately before and the group number of 12 is 4.
In the subsequent data string “0, 0, 55”, the number of consecutive “0s” immediately before the value “55” which is not “0” is 2 and 5
Since the group number of 5 is 6, the run length pattern is (2, 6). The next data "-254" is
Since there is no 1 "0" consecutive immediately before, and the group number of -254 is 8, the run length pattern (0,
8). Similarly, the next data string “0, 3” is
Since there is one “0” immediately before the value “3” that is not “0” and the group number of 3 is 2, the run length pattern (1, 2) is obtained. In this way, the data string output from the subtractor 102 is sequentially converted into a run length pattern by the run length converter 103. However, subtracter 10
When the data string output from 2 ends with continuous "0" s, the continuous "0s" are collectively set as a run length pattern (0,0).
【0061】ランレングス変換器103から出力された
上記のランレングスパターンはカウンター104に入力
され、その出現回数がカウントされる。カウンター10
4はランレングス変換器103から出力された全てのラ
ンレングスパターンのカウントが終わるとそのカウント
結果をハフマンテーブル生成器105に送る。The run length pattern output from the run length converter 103 is input to the counter 104, and the number of appearances thereof is counted. Counter 10
When the count of all the run length patterns output from the run length converter 103 is completed, 4 sends the count result to the Huffman table generator 105.
【0062】ハフマンテーブル生成器105は入力され
たカウント結果のカウント数の多いランレングスパター
ンほどより短いハフマンコードを生成して、ランレング
スパターンとハフマンコードの対応の一覧をハフマンテ
ーブル107として出力する。The Huffman table generator 105 generates a shorter Huffman code for a run length pattern having a larger number of counts of the input count result, and outputs a list of correspondences between run length patterns and Huffman codes as a Huffman table 107.
【0063】<圧縮方法>次に圧縮方法について記述す
る。図15は圧縮方法を示す図である。図15の予測テ
ーブル75とハフマンテーブル76は夫々上述した方法
で作成されたものである。まず、プログラムデータ70
から8ビットデータを取り出し予測器71および減算器
72に入力する。減算器72は最初に入力されたデータ
はそのまま出力する。一方、予測器71は予測テーブル
75の中から入力されたデータと等しいカレントデータ
を探し、そのカレントデータに対応する予測値を出力す
る。このとき同時にプログラムデータ70から次の8ビ
ットデータを予測器71と減算器72に入力する。減算
器72はプログラムデータ70から入力された値と、予
測器71から入力された予測値との差を出力する。次も
同様に予測器71は予測テーブル75の中から入力され
たデータと等しいカレントデータを探し、そのカレント
データに対応する予測値を出力する。同時にプログラム
データ70から次の8ビットデータを予測器71と減算
器72に入力する。減算器72はプログラムデータ70
から入力された値と予測器71から入力された値の差を
計算し出力する。以下プログラムデータ70にデータが
なくなるまで同様にする。<Compression Method> Next, the compression method will be described. FIG. 15 is a diagram showing a compression method. The prediction table 75 and the Huffman table 76 in FIG. 15 are created by the above-described method. First, the program data 70
The 8-bit data is taken out and input to the predictor 71 and the subtractor 72. The subtractor 72 outputs the first input data as it is. On the other hand, the predictor 71 searches the prediction table 75 for current data equal to the input data, and outputs a prediction value corresponding to the current data. At the same time, the next 8-bit data from the program data 70 is input to the predictor 71 and the subtractor 72. The subtractor 72 outputs the difference between the value input from the program data 70 and the predicted value input from the predictor 71. Next, similarly, the predictor 71 searches the prediction table 75 for current data equal to the input data, and outputs the prediction value corresponding to the current data. At the same time, the next 8-bit data from the program data 70 is input to the predictor 71 and the subtractor 72. The subtractor 72 uses the program data 70
The difference between the value input from and the value input from the predictor 71 is calculated and output. The same applies until the program data 70 is empty.
【0064】減算器72から出力されたデータはランレ
ングス変換器73で後述するランレングスパターンに変
換される。ランレングスパターンは連続する“0”とそ
の後に続く“0”でない値をまとめて(n,g)「x」
と表したものである。ここで変数nは連続する“0”の
数を表し、変数xは連続する“0”の後に続く“0”で
ない値を表し、変数gは前記の変数xのグループナンバ
ーを表しており、以下に記述する変数n,g,xも同様
である。グループナンバーは図23のグループナンバー
表で与えられる数値である。The data output from the subtractor 72 is converted into a run length pattern described later by the run length converter 73. The run length pattern is a combination of consecutive "0" and the following non- "0" values (n, g) "x".
It is expressed as. Here, the variable n represents the number of consecutive "0" s, the variable x represents a value that is not "0" following the consecutive "0" s, and the variable g represents the group number of the variable x described below. The same applies to the variables n, g, and x described in. The group number is a numerical value given in the group number table of FIG.
【0065】次に、データ列を前記のランレングスパタ
ーンに変換する方法について記述する。図16に一例と
してデータ列と、それがランレングスパターンに変換さ
れたものを示す。図16のデータ列の先頭データ「1
2」は、直前に連続する“0”が1個もなく、12のグ
ループナンバーが4なので、ランレングスパターン
(0,4)「12」となる。その次に続くデータ列
「0、0、55」は“0”でない値「55」の直前に連
続する“0”の数が2であり、55のグループナンバー
が6なので、ランレングスパターン(2,6)「55」
となる。その次のデータ「−254」は、直前に連続す
る“0”が1個もなく、−254のグループナンバーが
8なので、ランレングスパターン(0,8)「−25
4」となる。同様に、次のデータ列「0、3」は、
“0”でない値「3」の直前に“0”が1個あり、3の
グループナンバーが2なので、ランレングスパターン
(1,2)「3」となる。Next, a method of converting a data string into the above run length pattern will be described. FIG. 16 shows, as an example, a data string and a data string converted into a run length pattern. The first data "1" of the data string in FIG.
2 ”is the run length pattern (0, 4)“ 12 ”because there is no single“ 0 ”immediately before and the group number 12 is 4. In the data string "0, 0, 55" that follows the number "0", which is immediately before the value "55" that is not "0", is 2, and the group number of 55 is 6, so the run length pattern (2 , 6) "55"
Becomes In the next data "-254", since there is no single "0" immediately before and the group number of -254 is 8, the run length pattern (0,8) "-25
4 ”. Similarly, the next data string “0, 3” is
Since there is one "0" immediately before the value "3" that is not "0" and the group number of 3 is 2, the run length pattern (1, 2) is "3".
【0066】ランレングス変換器73から出力されたラ
ンレングスパターンはハフマン符号化器74に入力され
る。ハフマン符号化器74は入力されたランレングスパ
ターン(n,g)「x」の(n,g)をハフマンコード
に、「x」をgビットのデータに符号化する。図13は
ランレングスパターンと、それに対する圧縮データを示
している。図13中のD6はハフマンコード、D7はg
ビットのデータを夫々示している。ハフマン符号化器7
4の出力は順次圧縮データ77となる。The run length pattern output from the run length converter 73 is input to the Huffman encoder 74. The Huffman encoder 74 encodes (n, g) of the input run length pattern (n, g) "x" into a Huffman code and "x" into g-bit data. FIG. 13 shows a run length pattern and compressed data corresponding thereto. In FIG. 13, D6 is a Huffman code and D7 is g.
Bit data is shown respectively. Huffman encoder 7
The output of 4 becomes compressed data 77 in sequence.
【0067】<復号方法>次に、上記の方法で圧縮され
たデータの復号方法について記述する。図20の如く、
ハフマン復号器84は圧縮データ87から順次データを
取り出しハフマンテーブル86に一致するハフマンコー
ドがあるかどうかを調べる。もし一致するハフマンコー
ドが見つかれば、取り出した圧縮データをそのハフマン
コードが割り当てられているパターン(n,g)に変換
し、圧縮データ87からさらにgビットデータを取り出
して、ランレングスパターン(n,g)「x」を出力す
る。<Decoding Method> Next, a decoding method of the data compressed by the above method will be described. As shown in Figure 20,
The Huffman decoder 84 sequentially takes out the data from the compressed data 87 and checks whether or not there is a matching Huffman code in the Huffman table 86. If a matching Huffman code is found, the extracted compressed data is converted into a pattern (n, g) to which the Huffman code is assigned, and further g-bit data is extracted from the compressed data 87 to obtain a run length pattern (n, g). g) Output "x".
【0068】逆変換器83はハフマン復号器84から出
力されたランレングスパターン(n,g)「x」をn個
の0データと値xのデータのデータ列に変換し1データ
ずつ出力する。図16はランレングスパターンとそれに
対応するデータ列を示している。逆変換器83から出力
されたデータは加算器82に入力される。加算器82は
最初に入力されたデータの場合はそのまま出力する。加
算器82の出力は順次復号データ80となるが、その同
じデータが一方で予測器81へ入力される。予測器81
は予測テーブル85の中から入力されたデータと等しい
カレントデータを探し、そのカレントデータに対応する
予測値を出力する。このとき同時に逆変換器83から次
にデータを加算器82に入力する。逆変換器83に出力
するデータがなければ、前記同様、圧縮データ87から
データを取り出し、ハフマン復号器84と逆変換器83
を経てデータ列を生成する。The inverse converter 83 converts the run length pattern (n, g) "x" output from the Huffman decoder 84 into a data string of n pieces of 0 data and data of value x, and outputs one data at a time. FIG. 16 shows a run length pattern and a data string corresponding to it. The data output from the inverse converter 83 is input to the adder 82. The adder 82 outputs the first input data as it is. The output of the adder 82 becomes the decoded data 80 sequentially, and the same data is input to the predictor 81 on the one hand. Predictor 81
Searches for the same current data as the input data in the prediction table 85, and outputs the predicted value corresponding to the current data. At this time, the data is next input from the inverse converter 83 to the adder 82 at the same time. If there is no data to be output to the inverse converter 83, the data is extracted from the compressed data 87, and the Huffman decoder 84 and the inverse converter 83 are used as described above.
To generate a data string.
【0069】加算器82は逆変換器83からの入力と予
測器81からの入力を加算して出力する。加算器82の
出力は一方で復号データ80となり、その同じ値が予測
器81に入力される。以下同様の過程を圧縮データ87
にデータがなくなるまで繰り返し、復号を終了する。The adder 82 adds the input from the inverse converter 83 and the input from the predictor 81 and outputs the result. On the other hand, the output of the adder 82 becomes the decoded data 80, and the same value is input to the predictor 81. The same procedure is followed for compressed data 87.
Iterate until there is no more data, and finish decoding.
【0070】{変形例} (1) 上述した第1の実施例、第2の実施例、第3の
実施例ではプログラムデータを圧縮していたが、画像デ
ータ等の他の種類のデータであってもよい。{Modification} (1) Although the program data is compressed in the first, second, and third embodiments described above, it may be other kinds of data such as image data. May be.
【0071】(2) 上述した第1の実施例、第2の実
施例、第3の実施例では元データを自然2進数として圧
縮していたが、元データを4ビット単位でグレーコード
に変換した後、各々の圧縮を行なう方法を用いてもよ
い。グレーコードについてはその一部を図24に示す。(2) Although the original data was compressed as a natural binary number in the above-described first, second and third embodiments, the original data is converted into a gray code in units of 4 bits. After that, a method of performing each compression may be used. A part of the gray code is shown in FIG.
【0072】(3) 第1の実施例ではプログラムデー
タを前から順に隣り合う8ビットのデータを1組にして
パターン(a,b)に変換していたが、図25に示すよ
うにプログラムデータを32ビット幅に並べ、各ライン
を4分割して第1の8ビットと第3の8ビットを1組と
し、第2の8ビットと第4の8ビットを1組としてパタ
ーン(a,b)に変換してもよい。また、図26に示す
ようにプログラムデータを32ビット幅に並べ、各ライ
ンを4分割して縦方向に隣合う8ビットのデータを組に
する方法、あるいは縦方向に1個又はそれ以上の間隔を
おいたデータを組にする方法を用いてもよい。(3) In the first embodiment, the program data was converted into the pattern (a, b) by grouping the 8-bit data adjacent to each other in order from the front, but as shown in FIG. Are arranged in a 32-bit width, each line is divided into four, and the first 8 bits and the third 8 bits are set as one set, and the second 8 bits and the fourth 8 bits are set as one set. ). Further, as shown in FIG. 26, a method of arranging program data in a 32-bit width and dividing each line into four to form 8-bit data adjacent to each other in the vertical direction, or one or more intervals in the vertical direction You may use the method of grouping the data which put the.
【0073】(4) 第2の実施例では、4次元ベクト
ルの量子化誤差を1成分について5ビットとしていた
が、予め4次元ベクトルの量子化誤差の第1成分の最大
値、第2成分の最大値、第3成分の最大値、第4成分の
最大値を計算しておき、各成分を夫々の最大値を表しう
るビット数に圧縮する方法を用いれば、より圧縮率を向
上することができる。また、コードブックは学習系列に
対して適したサイズにすることが望ましい。(4) In the second embodiment, the quantization error of the four-dimensional vector is set to 5 bits for one component. However, the maximum value of the first component of the quantization error of the four-dimensional vector and the second component If the maximum value, the maximum value of the third component, and the maximum value of the fourth component are calculated and each component is compressed to the number of bits that can represent the maximum value, the compression rate can be further improved. it can. Further, it is desirable that the codebook has a size suitable for the learning sequence.
【0074】(5) 第2の実施例では、4次元ベクト
ルの各成分の量子化誤差をそのまま圧縮データとしてい
たが、4次元ベクトルの各成分の量子化誤差をさらにハ
フマンテーブルを用いてハフマン符号化する方法でもよ
い。その場合の圧縮データは図27のようになる。図2
7中のD13は量子化代表ベクトルのインデックス、D
14〜D17はハフマンコードを示している。(5) In the second embodiment, the quantization error of each component of the four-dimensional vector is directly used as the compressed data, but the quantization error of each component of the four-dimensional vector is further processed by the Huffman code using the Huffman table. It may be a method of converting. The compressed data in that case is as shown in FIG. Figure 2
D13 in 7 is the index of the quantized representative vector, D
14 to D17 are Huffman codes.
【0075】(6) 第3の実施例では、8ビットのデ
ータからそのすぐ隣の8ビットのデータを予測していた
が、これに代えて、1個おきに8ビットのデータを予測
する方法、あるいは2個おきに8ビットのデータを予測
する方法を用いてもよい。(6) In the third embodiment, the 8-bit data immediately adjacent to the 8-bit data is predicted, but instead of this, every other 8-bit data is predicted. Alternatively, a method of predicting 8-bit data every two bits may be used.
【0076】[0076]
【発明の効果】本発明請求項1および請求項4による
と、プログラムのオブジェクトコードの1語長には命令
コードとアドレスコードが含まれているため、オブジェ
クトコードの1語長をバイト単位等の所定の構成単位に
分割すると、分割されたデータ間には一定の相関がある
ことになる。このことから、分割されたデータの複数個
を1個のシンボルとしてエントロピー圧縮すれば、デー
タ間の相関を一定のパターンに類型化することで、圧縮
率を飛躍的に向上することができるという効果がある。According to claim 1 and claim 4 of the present invention, since the one word length of the object code of the program includes the instruction code and the address code, the one word length of the object code is expressed in byte units. When the data is divided into predetermined constituent units, there is a certain correlation between the divided data. From this, it is possible to dramatically improve the compression rate by categorizing the correlation between data into a certain pattern by entropy-compressing a plurality of divided data as one symbol. There is.
【0077】本発明請求項2および請求項5によると、
プログラムのオブジェクトコードの1語長には命令コー
ドとアドレスコードが含まれているため、オブジェクト
コードの1語長をバイト単位等の所定の構成単位に分割
し、分割されたデータをベクトルに量子化すると、その
ベクトルはベクトル空間で一様に分布せず、偏った分布
となる。従って、ベクトルをその偏りの重心ベクトルに
量子化し、重心ベクトルを示すデータと量子化誤差を圧
縮データとすることで、圧縮率を飛躍的に向上できると
いう効果がある。According to claims 2 and 5 of the present invention,
Since the 1-word length of the program's object code includes the instruction code and the address code, the 1-word length of the object code is divided into predetermined constituent units such as byte units, and the divided data is quantized into vectors. Then, the vector is not uniformly distributed in the vector space, but has a biased distribution. Therefore, by quantizing the vector into the biased centroid vector and using the data indicating the centroid vector and the quantization error as the compressed data, the compression rate can be dramatically improved.
【0078】本発明請求項3および請求項6によると、
プログラムのオブジェクトコードの1語長は命令コード
とアドレスコードで構成されているため、オブジェクト
コードの1語長をバイト単位等の所定の構成単位に分割
すると、分割されたデータ間には相関がある。従って、
ある分割データから別の分割データを、極めて高い確率
で予測することができ、その予測誤差をエントロピー圧
縮することにより、圧縮率を飛躍的に向上することがで
きるという効果がある。According to claims 3 and 6 of the present invention,
Since one word length of the object code of the program is composed of an instruction code and an address code, if one word length of the object code is divided into predetermined constituent units such as byte units, there is a correlation between the divided data. . Therefore,
There is an effect that it is possible to predict one divided data from another divided data with a very high probability, and by entropy compressing the prediction error, the compression rate can be dramatically improved.
【図1】本発明の第1の実施例のプログラム圧縮装置を
示す機能ブロック図である。FIG. 1 is a functional block diagram showing a program compression device according to a first embodiment of the present invention.
【図2】本発明の第1の実施例のハフマンテーブルを作
成する装置を示すブロック図である。FIG. 2 is a block diagram showing an apparatus for creating a Huffman table according to the first embodiment of the present invention.
【図3】本発明の第1の実施例のプログラム復号装置を
示すブロック図である。FIG. 3 is a block diagram showing a program decoding device of a first exemplary embodiment of the present invention.
【図4】本発明の第1の実施例におけるプログラムデー
タの一部とその変換データの対応を示す図である。FIG. 4 is a diagram showing a correspondence between a part of program data and its conversion data in the first embodiment of the present invention.
【図5】本発明の第1の実施例におけるプログラムデー
タの最終データとそれに追加するデータを示す図であ
る。FIG. 5 is a diagram showing final data of program data and data added thereto in the first embodiment of the present invention.
【図6】本発明の第2の実施例のプログラム圧縮装置を
示す機能ブロック図である。FIG. 6 is a functional block diagram showing a program compression device according to a second embodiment of the present invention.
【図7】本発明の第2の実施例におけるプログラムデー
タの一部およびその分割方法を示す図である。FIG. 7 is a diagram showing a part of program data and a method of dividing the program data according to a second embodiment of the present invention.
【図8】本発明の第2の実施例におけるコードブックを
示す図である。FIG. 8 is a diagram showing a codebook according to a second embodiment of the present invention.
【図9】本発明の第2の実施例のコードブックを作成す
る装置を示すブロック図である。FIG. 9 is a block diagram showing an apparatus for creating a codebook according to a second embodiment of the present invention.
【図10】本発明の第2の実施例のプログラム復号装置
を示すブロック図である。FIG. 10 is a block diagram showing a program decoding device according to a second embodiment of the present invention.
【図11】本発明の第2の実施例におけるプログラムデ
ータの一部とそれから生成される4次元ベクトルの成分
との対応を示す図である。FIG. 11 is a diagram showing correspondence between a part of program data and components of a four-dimensional vector generated from the program data according to the second embodiment of the present invention.
【図12】本発明の第2の実施例におけるプログラムデ
ータ32ビットに対する圧縮データを示す図である。FIG. 12 is a diagram showing compressed data for 32 bits of program data in the second embodiment of the present invention.
【図13】本発明の第3の実施例における圧縮データを
示す図である。FIG. 13 is a diagram showing compressed data according to the third embodiment of the present invention.
【図14】本発明の第2の実施例における圧縮データを
示す図である。FIG. 14 is a diagram showing compressed data according to the second embodiment of the present invention.
【図15】本発明の第3の実施例のプログラム圧縮装置
を示す機能ブロック図である。FIG. 15 is a functional block diagram showing a program compression device according to a third embodiment of the present invention.
【図16】本発明の第3の実施例におけるデータ列とそ
のランレングスパターンを示す図である。FIG. 16 is a diagram showing a data string and its run length pattern in the third embodiment of the present invention.
【図17】本発明の第3の実施例の予測テーブルを作成
する装置を示すブロック図である。FIG. 17 is a block diagram showing an apparatus for creating a prediction table according to the third embodiment of the present invention.
【図18】本発明の第3の実施例のハフマンテーブルを
作成する装置を示すブロック図である。FIG. 18 is a block diagram showing an apparatus for creating a Huffman table according to a third embodiment of the present invention.
【図19】本発明の第3の実施例におけるデータ列とそ
のランレングスパターンを示す図である。FIG. 19 is a diagram showing a data string and its run length pattern in the third embodiment of the present invention.
【図20】本発明の第3の実施例のプログラム復号装置
を示すブロック図である。FIG. 20 is a block diagram showing a program decoding device according to a third embodiment of the present invention.
【図21】本発明の第3の実施例におけるカウント表を
示す図である。FIG. 21 is a diagram showing a count table in the third embodiment of the present invention.
【図22】本発明の第3の実施例における予測テーブル
を示す図である。FIG. 22 is a diagram showing a prediction table according to the third embodiment of the present invention.
【図23】本発明の第3の実施例におけるグループナン
バー表を示す図である。FIG. 23 is a diagram showing a group number table in the third embodiment of the present invention.
【図24】グレーコードと10進数および2進数の対応
を示す図である。FIG. 24 is a diagram showing correspondence between a gray code and a decimal number or a binary number.
【図25】本発明の第2の実施例におけるプログラムデ
ータの一部およびその分割方法を示す図である。FIG. 25 is a diagram showing a part of program data and a method of dividing the program data according to the second embodiment of the present invention.
【図26】本発明の第2の実施例におけるプログラムデ
ータの一部およびその分割方法を示す図である。FIG. 26 is a diagram showing a part of program data and a method of dividing the program data according to the second embodiment of the present invention.
【図27】本発明の第2の実施例における圧縮データを
示す図である。FIG. 27 is a diagram showing compressed data according to the second embodiment of the present invention.
【図28】従来例におけるハフマンテーブルを作成する
方法を示す図である。FIG. 28 is a diagram showing a method of creating a Huffman table in a conventional example.
【図29】従来例における圧縮方法を示す図である。FIG. 29 is a diagram showing a compression method in a conventional example.
10,30,40,60,70,90,100,200
プログラムデータ 11,21,31,41,51,61 ファイルエンド
調整器 12,32,52 変換器 13,74,205 ハフマン符号化器 14,24,37,76,86,107,204 ハフ
マンテーブル 15,26,46,57,77,87,206 圧縮デ
ータ 20,50,80 復号データ 21 ファイルエンド調整器 22,83 逆変換器 23,84 ハフマン復号器 24 ハフマンテーブル 25,35,55,65 付加ビット数 33 パターンカウンター 34,92,202 カウント結果 36,105,203 ハフマンテーブル生成器 42,62 ベクトル生成器 43 残差計算器 44 ベクトル量子化器 45,56,66 コードブック 53 残差加算器 54 ベクトル逆量子化器 63 学習系列 64 コードブック生成器 71,81,101 予測器 72,702 減算器 73,103 ランレングス変換器 75,85,94,106 予測テーブル 82 加算器 91,104 カウンター 93 予測テーブル生成器 201 データカウンター10, 30, 40, 60, 70, 90, 100, 200
Program data 11, 21, 31, 41, 51, 61 File end adjuster 12, 32, 52 Converter 13, 74, 205 Huffman encoder 14, 24, 37, 76, 86, 107, 204 Huffman table 15, 26,46,57,77,87,206 Compressed data 20,50,80 Decoded data 21 File end adjuster 22,83 Inverse converter 23,84 Huffman decoder 24 Huffman table 25,35,55,65 Number of additional bits 33 pattern counter 34,92,202 count result 36,105,203 Huffman table generator 42,62 vector generator 43 residual calculator 44 vector quantizer 45,56,66 codebook 53 residual adder 54 vector inverse Quantizer 63 Learning sequence 64 Codebook generator 7 , 81, 101 predictor 72,702 subtractor 73,103 run length converter 75,85,94,106 prediction table 82 adder 91,104 counter 93 prediction table generator 201 Data Counter
【手続補正書】[Procedure amendment]
【提出日】平成6年12月7日[Submission date] December 7, 1994
【手続補正1】[Procedure Amendment 1]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図3[Name of item to be corrected] Figure 3
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図3】 [Figure 3]
【手続補正2】[Procedure Amendment 2]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図5[Name of item to be corrected] Figure 5
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図5】 [Figure 5]
【手続補正3】[Procedure 3]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図6[Name of item to be corrected] Figure 6
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図6】 [Figure 6]
【手続補正4】[Procedure amendment 4]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図10[Name of item to be corrected] Fig. 10
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図10】 [Figure 10]
【手続補正5】[Procedure Amendment 5]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図20[Name of item to be corrected] Fig. 20
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図20】 FIG. 20
【手続補正6】[Procedure correction 6]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図22[Correction target item name] Fig. 22
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図22】 FIG. 22
【手続補正7】[Procedure Amendment 7]
【補正対象書類名】図面[Document name to be corrected] Drawing
【補正対象項目名】図23[Correction target item name] Fig. 23
【補正方法】変更[Correction method] Change
【補正内容】[Correction content]
【図23】 FIG. 23
Claims (6)
プログラムのオブジェクトコードを圧縮するものであっ
て、 圧縮すべきデータを所定の構成単位に分割し、複数の前
記所定の構成単位を1個のシンボルに変換する変換手段
と、 前記シンボルをエントロピー圧縮する圧縮手段とを備え
るプログラム圧縮装置。1. A method for compressing an object code of a program including an instruction code and an address code, wherein data to be compressed is divided into predetermined constituent units, and a plurality of the predetermined constituent units are made into one symbol. A program compression device comprising conversion means for converting and compression means for entropy compressing the symbols.
プログラムのオブジェクトコードを圧縮するものであっ
て、 圧縮すべきデータを1語長の第1のブロックデータに分
割する第1の分割手段と、 前記第1のブロックデータを所定の構成単位の第2のブ
ロックデータに分割し、前記第2のブロックデータの複
数個をベクトルとして出力する第2の分割手段と、 前記ベクトルを所定のコードブックから適切に選ばれた
代表ベクトルに量子化し該代表ベクトルを出力するとと
もに、前記代表ベクトルに対応するインデクスを圧縮デ
ータの1構成要素として出力するベクトル量子化手段
と、 前記第2の分割手段の出力と前記代表ベクトルとの差分
を計算して圧縮データの他の構成要素として出力するベ
クトル差分手段とを備えるプログラム圧縮装置。2. A first dividing means for compressing an object code of a program including an instruction code and an address code, wherein the data to be compressed is divided into first block data of one word length; A second dividing means for dividing one block data into second block data of a predetermined constitutional unit, and outputting a plurality of the second block data as a vector, and the vector appropriately from a predetermined codebook Vector quantizing means for quantizing the selected representative vector and outputting the representative vector, and outputting an index corresponding to the representative vector as one component of compressed data; output of the second dividing means and the representative Program compression provided with vector difference means for calculating a difference with a vector and outputting it as another component of compressed data Location.
プログラムのオブジェクトコードを圧縮するものであっ
て、 圧縮すべきデータを所定の構成単位のブロックデータに
分割する分割手段と、 前記ブロックデータ間の相関を分析することによって事
前に作成された予測テーブルに基づいてデータ予測値を
出力する予測手段と、 前記ブロックデータと、当該ブロックデータに対応した
前記データ予測値との差分を計算するとともに、前記デ
ータ予測値に対応するインデックスと前記差分を圧縮デ
ータの構成要素として併せて出力する差分手段とを備え
るプログラム圧縮装置。3. A program for compressing an object code of a program including an instruction code and an address code, wherein a dividing means for dividing data to be compressed into block data of a predetermined structural unit and a correlation between the block data are provided. A prediction unit that outputs a data prediction value based on a prediction table created in advance by analyzing, the block data, and a difference between the data prediction value corresponding to the block data is calculated, and the data prediction is performed. A program compression apparatus comprising: an index corresponding to a value; and a difference unit that outputs the difference as a component of compressed data.
プログラムのオブジェクトコードを所定の構成単位に分
割し、複数の前記所定の構成単位を1個のシンボルに変
換する変換工程と、 前記シンボルをエントロピー圧縮する圧縮工程とを備え
るプログラム圧縮方法。4. A conversion step of dividing an object code of a program including an instruction code and an address code into predetermined constituent units and converting a plurality of the predetermined constituent units into one symbol, and entropy compressing the symbols. A program compression method comprising a compression step.
プログラムのオブジェクトコードを1語長の第1のブロ
ックデータに分割する第1の分割工程と、 前記第1のブロックデータを所定の構成単位の第2のブ
ロックデータに分割し、前記第2のブロックデータの複
数個をベクトルとして出力する第2の分割工程と、 前記ベクトルを所定のコードブックから適切に選ばれた
代表ベクトルに量子化し該代表ベクトルを出力するとと
もに、前記代表ベクトルに対応するインデクスを圧縮デ
ータの1構成要素として出力するベクトル量子化工程
と、 前記第2の分割工程の出力と前記代表ベクトルとの差分
を計算して圧縮データの他の構成要素として出力するベ
クトル差分工程とを備えるプログラム圧縮方法。5. A first dividing step of dividing an object code of a program including an instruction code and an address code into first block data of one word length, and the first block data of a second block of a predetermined constitutional unit. A second dividing step of dividing the block data into a plurality of the second block data as a vector, and quantizing the vector into a representative vector appropriately selected from a predetermined codebook, A vector quantization step of outputting the index corresponding to the representative vector as one component of compressed data, and a difference between the output of the second division step and the representative vector to calculate the compressed data. And a vector difference step of outputting as a component of the program compression method.
プログラムのオブジェクトコードを所定の構成単位のブ
ロックデータに分割する分割工程と、 前記ブロックデータ間の相関を分析することによって事
前に作成された予測テーブルに基づいてデータ予測値を
出力する予測工程と、 前記ブロックデータと、当該ブロックデータに対応した
前記データ予測値との差分を計算するとともに、前記デ
ータ予測値に対応するインデックスと前記差分を圧縮デ
ータの構成要素として併せて出力する差分工程とを備え
るプログラム圧縮方法。6. A division step of dividing an object code of a program including an instruction code and an address code into block data of a predetermined structural unit, and a prediction table created in advance by analyzing a correlation between the block data. A prediction step of outputting a data prediction value based on the block data, while calculating the difference between the block prediction data and the data prediction value corresponding to the block data, the index corresponding to the data prediction value and the difference of the compressed data A program compression method comprising a difference step of outputting together as a component.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP27476394A JPH08139610A (en) | 1994-11-09 | 1994-11-09 | Device and method for compressing program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP27476394A JPH08139610A (en) | 1994-11-09 | 1994-11-09 | Device and method for compressing program |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH08139610A true JPH08139610A (en) | 1996-05-31 |
Family
ID=17546242
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP27476394A Pending JPH08139610A (en) | 1994-11-09 | 1994-11-09 | Device and method for compressing program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH08139610A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009095956A1 (en) * | 2008-01-31 | 2009-08-06 | Fujitsu Limited | Data compression/decompression method, and compression/ decompression program |
-
1994
- 1994-11-09 JP JP27476394A patent/JPH08139610A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009095956A1 (en) * | 2008-01-31 | 2009-08-06 | Fujitsu Limited | Data compression/decompression method, and compression/ decompression program |
GB2469955A (en) * | 2008-01-31 | 2010-11-03 | Fujitsu Ltd | Data compression/decompression method,and compression/decompression program |
US8164490B2 (en) | 2008-01-31 | 2012-04-24 | Fujitsu Limited | Data compression/decompression method and computer readable storage medium storing compression/decompression program |
GB2469955B (en) * | 2008-01-31 | 2012-09-12 | Fujitsu Ltd | Data compression/decompression method,and compression/decompression program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5045852A (en) | Dynamic model selection during data compression | |
JP3323175B2 (en) | Encoding device | |
CN108768403B (en) | Lossless data compression and decompression method based on LZW and LZW encoder and decoder | |
JP4328358B2 (en) | Information compression encoding apparatus, decoding apparatus thereof, method thereof, program thereof and recording medium thereof | |
JP4049793B2 (en) | Floating point signal lossless encoding method, decoding method, apparatus thereof, program, and recording medium thereof | |
KR100894002B1 (en) | Device and data method for selective compression and decompression and data format for compressed data | |
US5594435A (en) | Permutation-based data compression | |
JPH08205140A (en) | Image compressing device | |
US7548175B2 (en) | Encoding apparatus, decoding apparatus, encoding method, computer readable medium storing program thereof, and computer data signal | |
US8810439B1 (en) | Encoder, decoder and method | |
JP2009105838A (en) | Encoding method, device, and program | |
CN113630125B (en) | Data compression, encoding and decompression method, device, electronic equipment and storage medium | |
KR0167092B1 (en) | Method and apparatus for statistically encoding digital data | |
JPH10173541A (en) | Compressed encoding and decoding system | |
JP2003524983A (en) | Method and apparatus for optimized lossless compression using multiple coders | |
Nikara et al. | Multiple-symbol parallel decoding for variable length codes | |
KR20110043684A (en) | Methods, systems, and apparatus for compressing or decompressing digital signals | |
RU2611249C1 (en) | Entropy modifier and method to use it | |
US8947274B2 (en) | Encoding apparatus, decoding apparatus, encoding method, encoding program, decoding method, and decoding program | |
CN106537914A (en) | Method and apparatus for performing arithmetic coding by limited carry operation | |
JPH08139610A (en) | Device and method for compressing program | |
WO1997006641A1 (en) | Image encoder, image decoder, image decoding method, and image transmitting system | |
JP4093193B2 (en) | Data compression method and program, and data restoration method and apparatus | |
JP2004120623A (en) | Encoding apparatus, encoding method, decoding apparatus and decoding method | |
JP3709381B2 (en) | Color image compression method |