JP2885235B1 - Data compression method and machine readable recording medium recording compression program - Google Patents
Data compression method and machine readable recording medium recording compression programInfo
- Publication number
- JP2885235B1 JP2885235B1 JP10017935A JP1793598A JP2885235B1 JP 2885235 B1 JP2885235 B1 JP 2885235B1 JP 10017935 A JP10017935 A JP 10017935A JP 1793598 A JP1793598 A JP 1793598A JP 2885235 B1 JP2885235 B1 JP 2885235B1
- Authority
- JP
- Japan
- Prior art keywords
- code
- data
- pixel value
- difference
- storage means
- 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.)
- Expired - Fee Related
Links
Landscapes
- Image Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
【要約】
【課題】 画像の種類を問わずに高い圧縮率を達成す
る。
【解決手段】 圧縮対象画像から1つの画素値を入力す
る毎に、比較手段14により記憶手段17に記憶された直前
の画素値と比較し、一致した場合はカウンタ14aをイン
クリメントし、次の画素値を処理する。一致しない場
合、カウンタ14aの値が1以上であれば連続数を設定し
た一致符号を出力した後、比較手段15により記憶手段18
に記憶された過去の何れかの画素値と一致するかを調
べ、一致した場合にその画素値のインデックス番号を設
定したインデックス符号を出力し、記憶手段17を書き換
え、次の画素値を処理する。過去データに一致するもの
がない場合、差分取得手段16により直前の画素値との差
分を求め、その差分値が所定値以下であればその差分値
を設定した差分符号を出力し、それ以外は画素値そのも
のを設定した即値符号を出力し、記憶手段17及び記憶手
段18を書き換え、次の画素値を処理する。A high compression ratio is achieved regardless of the type of image. Each time one pixel value is input from an image to be compressed, a comparison unit compares the pixel value with the immediately preceding pixel value stored in a storage unit. Process values. If they do not match, if the value of the counter 14a is equal to or greater than 1, after outputting a coincidence code in which the number of continuations is set, the comparing means 15 outputs
Is checked to see if it matches any of the past pixel values, and if matched, outputs an index code that sets the index number of that pixel value, rewrites the storage means 17, and processes the next pixel value . If there is no match with the past data, the difference with the immediately preceding pixel value is obtained by the difference acquisition means 16, and if the difference value is equal to or less than a predetermined value, a difference code in which the difference value is set is output. An immediate code in which the pixel value itself is set is output, the storage unit 17 and the storage unit 18 are rewritten, and the next pixel value is processed.
Description
【0001】[0001]
【発明の属する技術分野】本発明はデータ圧縮方法に関
し、特に可逆圧縮方法に関するものである。The present invention relates to a data compression method, and more particularly to a lossless compression method.
【0002】[0002]
【従来の技術】画像を対象とした圧縮方法には、非可逆
圧縮方法と可逆圧縮方法との2種類がある。非可逆圧縮
方法は、一般に高い圧縮率を実現できるが、圧縮,伸張
の過程でなんらかの歪みが付加されるため、完全には元
の画像を再現することはできない。これに対し、可逆圧
縮方法は圧縮率では一般に非可逆圧縮方法に劣るもの
の、圧縮,伸張の過程を経ても元の画像を忠実に再現す
ることができるため、画質劣化が許されない分野で賞用
されている。本発明は、この後者の可逆圧縮に関する。2. Description of the Related Art There are two types of compression methods for images, an irreversible compression method and a lossless compression method. The irreversible compression method can generally realize a high compression ratio, but cannot completely reproduce the original image because some distortion is added in the process of compression and expansion. On the other hand, the lossless compression method is generally inferior to the irreversible compression method in the compression ratio, but since it can faithfully reproduce the original image through the process of compression and decompression, it is awarded in fields where image quality degradation is not allowed. Have been. The present invention relates to this latter lossless compression.
【0003】画像を対象とした可逆圧縮方法としては、
以下のような方法が従来より提案ないし実用化されてい
る。As a reversible compression method for an image,
The following methods have been conventionally proposed or put into practical use.
【0004】(1)差分法 JPEGの可逆モード(ロスレスモード)に代表される
ように、画素間の差分を取るなどにより情報のエントロ
ピーを減じた後、ハフマン符号化や算術符号化により圧
縮する方法。 (2)ランレングス法 packbits(TIFFフォーマットの圧縮方式の
一つ)に代表されるように、同じ値の画素が連続してい
る個数(ランレングス)をその画素値と共に記録するこ
とで圧縮する方法。 (3)辞書法 LZW法に代表されるように、入力の画素列に最長一致
する既登録の符号化済の画素列を辞書から検索して辞書
の参照番号により符号化することで圧縮する方法。(1) Difference method A method of reducing the entropy of information by taking a difference between pixels, as represented by the lossless mode (lossless mode) of JPEG, and then compressing the information by Huffman coding or arithmetic coding. . (2) Run-length method A method of compressing by recording the number of consecutive pixels having the same value (run-length) together with the pixel value, as represented by packbits (one of the compression methods of the TIFF format). . (3) Dictionary method As typified by the LZW method, a registered encoded pixel sequence that matches the input pixel sequence at the longest is retrieved from the dictionary, and is compressed by encoding using a dictionary reference number. .
【0005】[0005]
【発明が解決しようとする課題】上述したように画像を
対象とした可逆圧縮方法として従来より各種の方法が知
られているが、それぞれに一長一短がある。例えば、ラ
ンレングス法は処理が簡単であり、また単純で大きな領
域からなる2値画像など特定の画像に対しては圧縮率が
良いが、写真のような自然画はほとんど圧縮することが
できず、圧縮不能となる。また、辞書法はアルゴルズム
が簡単でファイル圧縮等に良く使われているが、原理的
に同じパターンが繰り返し現れないと圧縮できず、圧縮
不能になる場合がある。これに対して差分法は、これら
3種類の従来方法の中では画像の種類を問わず満遍なく
圧縮することができるが、その分、ランレングス法や辞
書法が得意とする画像に対する圧縮率はそれらより劣
る。また、ハフマン符号/算術符号は符号長がビット単
位で可変なため、ビット単位でのデータ処理が必要で処
理が複雑になるという問題点もある。As described above, various methods have conventionally been known as lossless compression methods for images, but each has advantages and disadvantages. For example, the run-length method is simple in processing and has a good compression ratio for a specific image such as a binary image consisting of a simple and large area, but a natural image such as a photograph can hardly be compressed. Becomes incompressible. The dictionary method has a simple algorithm and is often used for file compression and the like. However, in principle, if the same pattern does not appear repeatedly, it cannot be compressed and may not be compressed. On the other hand, the difference method can uniformly compress the image among the three types of conventional methods regardless of the type of image. Inferior. Further, since the code length of the Huffman code / arithmetic code is variable in bit units, there is also a problem that data processing in bit units is required and processing becomes complicated.
【0006】本発明はこのような事情に鑑みて提案され
たものであり、その第1の目的は、様々な種類の画像に
対して上記3種類の従来方法のうち最も高い圧縮率とな
る圧縮方法と遜色ない圧縮率を得ることができるデータ
圧縮方法を提供することにある。The present invention has been proposed in view of such circumstances, and a first object of the present invention is to provide a compression method which provides the highest compression ratio among the above three conventional methods for various types of images. An object of the present invention is to provide a data compression method capable of obtaining a compression ratio comparable to that of the data compression method.
【0007】また本発明の目的は、ビット単位でのデー
タ処理が不要なデータ圧縮方法を提供することにある。Another object of the present invention is to provide a data compression method that does not require data processing in bit units.
【0008】[0008]
【課題を解決するための手段】本発明は上記第1の目的
を達成するために、画像の情報エントロピーを減少させ
る方式を複数種類用意し、画素毎にこれらの方式から最
も圧縮率の高い方式を適用する。つまり、直前のデータ
値と同じデータ値が連続する回数を設定した一致符号
と、直前のデータ値との差分を設定した差分符号と、過
去データ記憶手段に記憶された処理済のデータ値のイン
デックス番号を設定したインデックス符号と、データ値
そのものを設定した即値符号との合計4種類の符号を使
用し、圧縮対象となるデータ群の先頭から順に1データ
毎に、圧縮後のデータ量がより少なくなる符号を選択し
てデータの圧縮を行うようにしている。より具体的に
は、画像を対象とする場合、以下のステップによりデー
タを圧縮する。In order to achieve the first object, the present invention provides a plurality of types of methods for reducing the information entropy of an image, and for each pixel, a method with the highest compression rate is used. Apply That is, a matching code that sets the number of times the same data value as the immediately preceding data value continues, a difference code that sets the difference between the immediately preceding data value, and the index of the processed data value stored in the past data storage unit. Using a total of four types of codes, an index code that sets a number and an immediate code that sets the data value itself, the data amount after compression is smaller for each data in order from the beginning of the data group to be compressed. The data compression is performed by selecting a certain code. More specifically, when an image is targeted, data is compressed by the following steps.
【0009】(a)直前データ記憶手段,過去データ記
憶手段および連続数カウンタを初期化するステップ (b)圧縮対象画像から1つの画素値を入力するステッ
プ (c)ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値とを比較するステップ (d)ステップcで比較一致のとき連続数カウンタをイ
ンクリメントすると共に、連続数カウンタが最大値に達
していれば連続回数を設定した一致符号を出力して連続
数カウンタを初期化した後、ステップbに戻るステップ (e)ステップcで比較不一致のとき、連続数カウンタ
が初期値以外であれば連続回数を設定した一致符号を出
力して連続数カウンタを初期化した後、過去に出現した
画素値をインデックス番号を付けて保持する過去データ
記憶手段を検索してステップbで入力された画素値と一
致する画素値のインデックス番号を求めるステップ (f)ステップeでインデックス番号が求められたと
き、インデックス番号を設定したインデックス符号を出
力すると共に、ステップbで入力された画素値を直前デ
ータ記憶手段に格納して、ステップbに戻るステップ (g)ステップeでインデックス番号が求まらなかった
とき、ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値との差分を求めるステップ (h)ステップbで入力された画素値を設定した即値符
号のサイズより小さなサイズの差分符号にステップgで
求められた差分を設定できるとき、ステップgで求めら
れた差分を設定した差分符号を出力し、そうでないとき
はステップbで入力された画素値を設定した即値符号を
出力し、ステップbで入力された画素値を直前データ記
憶手段に格納すると共に所定の格納方法で過去データ記
憶手段にも格納し、ステップbに戻るステップ(A) a step of initializing the immediately preceding data storage means, the past data storage means and the continuous number counter (b) a step of inputting one pixel value from the image to be compressed (c) a pixel value input in step b And (d) when the number of consecutive times has reached the maximum value, the number of consecutive times is set when the number of consecutive times has reached the maximum value. Returning the coincidence code to initialize the continuous number counter, and then returning to step b. (E) When the comparison does not match in step c, if the consecutive number counter is other than the initial value, output the coincidence code that sets the number of consecutive times. And initializes the continuous number counter, searches the past data storage means for holding the pixel values which appeared in the past with an index number, and performs step searching. (F) When the index number is obtained in step e, an index code in which the index number is set is output, and the index code input in step b is obtained. (G) When the index number is not obtained in step e, the pixel value input in step b and the pixel value stored in the immediately preceding data storage unit are stored. (H) When the difference obtained in step g can be set to a difference code having a size smaller than the size of the immediate code set in the pixel value input in step b, the difference is obtained in step g. The difference code that sets the obtained difference is output. Otherwise, the immediate code that sets the pixel value input in step b is used. And force, also stored in the historical data storage means by a predetermined storage method stores the pixel values input in step b immediately before the data storage means, the flow returns to step b step
【0010】また本発明は上記第2の目的をも達成する
ために、全ての種類の符号をバイト単位の符号としてい
る。Further, in the present invention, in order to achieve the above-mentioned second object, all kinds of codes are byte-based codes.
【0011】さらに本発明は、差分符号として、設定で
きる最大の差分値が異なる複数種類の差分符号を使用し
ている。Further, in the present invention, a plurality of types of difference codes having different maximum difference values that can be set are used as difference codes.
【0012】また本発明は、上記第1の目的を達成する
と共に、圧縮データの途中からの伸張処理を高速に行え
るようにするために、更に以下のステップを有する。 (i)予め定められた画素数の処理を終える毎に、連続
数カウンタが初期値以外であれば連続回数を設定した一
致符号を出力すると共に直前データ記憶手段,過去デー
タ記憶手段および連続数カウンタを初期化して、ステッ
プbに戻るステップThe present invention further has the following steps in order to achieve the first object and to enable high-speed decompression of compressed data. (I) Every time the processing of a predetermined number of pixels is completed, if the continuous number counter is other than the initial value, a coincidence code in which the number of continuous times is set is output, and the immediately preceding data storage means, past data storage means, and continuous number counter are output. To initialize and return to step b
【0013】[0013]
【発明の実施の形態】次に本発明の実施の形態の例につ
いて図面を参照して詳細に説明する。DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, embodiments of the present invention will be described in detail with reference to the drawings.
【0014】図1は本発明を適用したデータ圧縮装置の
一例を示すブロック図である。この例のデータ圧縮装置
1は、制御手段11と、データ入力手段12と、データ
出力手段13と、直前データ比較手段14と、過去デー
タ比較手段15と、差分取得手段16といった機能手段
を有すると共に、直前データ記憶手段17と過去データ
記憶手段18といった記憶手段を有している。また、画
像ファイル2,圧縮ファイル3および利用者入出力装置
4に接続されている。FIG. 1 is a block diagram showing an example of a data compression apparatus to which the present invention is applied. The data compression device 1 of this example includes functional units such as a control unit 11, a data input unit 12, a data output unit 13, a previous data comparison unit 14, a past data comparison unit 15, and a difference acquisition unit 16, , Storage means such as the immediately preceding data storage means 17 and the past data storage means 18. Further, it is connected to the image file 2, the compressed file 3, and the user input / output device 4.
【0015】データ入力手段12は、圧縮対象とする画
像データを画像ファイル2から入力する手段である。本
実施例では、画像データの画素値は各々8ビットの3つ
の色値R,G,Bで表されている。また、画像の走査順
序、つまりデータの入力順序は、画像の左端の画素から
右方向に行い、右端の画素に達したら次のラインの左端
から再び右方向に行う所謂ラスタ方式である。なお、圧
縮対象とする画像データの入力元はファイルに限られな
い。The data input means 12 is means for inputting image data to be compressed from the image file 2. In this embodiment, the pixel values of the image data are represented by three 8-bit color values R, G, and B, respectively. The scanning order of the image, that is, the data input order is a so-called raster method in which the scanning is performed rightward from the leftmost pixel of the image, and when the rightmost pixel is reached, the scanning is performed rightward again from the left end of the next line. The input source of image data to be compressed is not limited to a file.
【0016】直前データ記憶手段17は、現在処理対象
としている画素値の直前の画素値を保持する手段であ
る。The immediately preceding data storage means 17 is a means for holding a pixel value immediately before the pixel value currently being processed.
【0017】過去データ記憶手段18は、過去に出現し
た画素値を複数種類記憶する手段である。本実施例で
は、図2に示すように最大8個の画素値を記録する。図
2において、E0〜E7はエントリであり、それぞれイ
ンデックス番号0〜7が付されている。初期化時、各エ
ントリE0〜E7の画素値の欄はオール0にされ、記憶
すべき画素値が出現する毎に、エントリE0→E1→…
と、インデックス番号の若いエントリから順に使用され
て画素値が記憶される。インデックス番号7のエントリ
E7まで画素値を記憶した状態で新たな画素値を記憶す
る場合、インデックス番号0のエントリE0に戻り、再
びインデックス番号の若いエントリから順に再利用す
る。つまり、上書きしていく。The past data storage means 18 is a means for storing a plurality of types of pixel values which appeared in the past. In this embodiment, a maximum of eight pixel values are recorded as shown in FIG. In FIG. 2, E0 to E7 are entries, which are assigned index numbers 0 to 7, respectively. At the time of initialization, the columns of the pixel values of the entries E0 to E7 are all set to 0, and each time a pixel value to be stored appears, the entry E0 → E1 →.
And the pixel values are stored in order from the entry having the smallest index number. When a new pixel value is stored in a state where the pixel value is stored up to the entry E7 of the index number 7, the process returns to the entry E0 of the index number 0, and is reused again from the entry with the smallest index number. In other words, it overwrites.
【0018】直前データ比較手段14は、データ入力手
段12で今回入力された画素値と直前データ記憶手段1
7に記憶されている直前の画素値とを比較する手段であ
る。両者が一致した場合には内部の連続数カウンタ14
aが1だけインクリメントされる。連続数カウンタ14
aは、本実施例の場合、初期値の0から最大32までカ
ウントできる。The immediately preceding data comparing means 14 stores the pixel value inputted this time by the data input means 12 and the immediately preceding data storing means 1.
7 is a means for comparing with the immediately preceding pixel value stored in the memory 7. If they match, the internal continuous number counter 14
a is incremented by one. Continuous number counter 14
In this embodiment, a can be counted from an initial value of 0 to a maximum of 32.
【0019】過去データ比較手段15は、データ入力手
段12で今回入力された画素値と過去データ記憶手段1
8に記憶されている過去に出現した画素値とを比較する
手段である。一致する画素値が過去データ記憶手段18
に存在する場合、そのインデックス番号が取り出され
る。The past data comparison means 15 stores the pixel value inputted this time by the data input means 12 and the past data storage means 1.
This is a means for comparing with the pixel values that have appeared in the past and stored in 8. The matching pixel value is stored in the past data storage unit 18.
, Its index number is retrieved.
【0020】差分取得手段16は、データ入力手段12
で今回入力された画素値と直前データ記憶手段17に記
憶されている直前の画素値との、各色値ごとの差分を求
める手段である。The difference acquisition means 16 is provided with the data input means 12
Is a means for calculating a difference for each color value between the currently input pixel value and the immediately preceding pixel value stored in the immediately preceding data storage means 17.
【0021】データ出力手段13は、圧縮ファイル3に
圧縮データを出力する手段である。なお、圧縮データの
出力先はファイルに限られない。The data output means 13 is means for outputting compressed data to the compressed file 3. The output destination of the compressed data is not limited to a file.
【0022】制御手段11は、データ圧縮装置1全体を
制御する手段であり、直前データ比較手段14,過去デ
ータ比較手段15および差分取得手段16の処理結果に
基づき、圧縮対象となる画像の先頭の画素から順に1画
素毎に、圧縮後のデータ量がより少なくなる符号を選択
してデータの圧縮を行い、圧縮データをデータ出力手段
13を通じて圧縮ファイル3に出力する。The control means 11 is a means for controlling the whole of the data compression apparatus 1. Based on the processing results of the immediately preceding data comparison means 14, the past data comparison means 15 and the difference acquisition means 16, the control means 11 controls the head of the image to be compressed. Data is compressed by selecting a code with a smaller data amount after compression for each pixel in order from the pixel, and the compressed data is output to the compressed file 3 through the data output unit 13.
【0023】図3は本実施例で使用される圧縮符号のフ
ォーマット例である。同図に示すように、本実施例で
は、1バイトの一致符号(同図(a))、1バイトのイ
ンデックス符号(同図(b))、1バイト,2バイト及
び3バイトの差分符号(同図(c)〜(e))、4バイ
トの即値符号(同図(f))の合計6種類の圧縮符号を
用いる。何れも、ビット単位でのデータ処理が不要にな
るようにバイト単位のデータとなっている。FIG. 3 shows an example of the format of a compression code used in this embodiment. As shown in the figure, in the present embodiment, a 1-byte matching code (FIG. 7A), a 1-byte index code (FIG. 6B), a difference code of 1 byte, 2 bytes and 3 bytes ( (C) to (e) in FIG. 6, a total of six types of compression codes, that is, a 4-byte immediate code (f) in FIG. Each of them is data in units of bytes so that data processing in units of bits becomes unnecessary.
【0024】図3(f)の即値符号は、画像の先頭画素
など、非圧縮の画素値そのものを出力するときに使用さ
れる。1バイト目は当該符号が即値符号であることを示
す固定のビット列(11111000)が入り、続く3
バイトにR,G,Bの各色値が入る。The immediate code shown in FIG. 3F is used when outputting an uncompressed pixel value itself, such as the first pixel of an image. The first byte contains a fixed bit string (11111000) indicating that the code is an immediate code, and
Each color value of R, G, B is put in the byte.
【0025】図3(a)の一致符号は、同じ画素値が連
続する部分を圧縮する場合に使用される。5ビット目〜
7ビット目は当該符号が一致符号であることを示す固定
のビット列(110)が入り、0ビット目〜4ビット目
の合計5ビットにレングス項が入る。レングス項は直前
の画素値と同じ画素値が後何個連続するかを示し、0の
とき直前画素と同じ画素が1個続くことを、1のとき直
前画素と同じ画素が2個続くことを、…、最大値31の
とき直前画素と同じ画素が32個続くことを、それぞれ
示す。The matching code shown in FIG. 3A is used when compressing a portion where the same pixel value continues. 5th bit ~
The seventh bit contains a fixed bit string (110) indicating that the code is a coincidence code, and the length term is contained in a total of 5 bits from the 0th bit to the 4th bit. The length term indicates how many subsequent pixel values are the same as the immediately preceding pixel value. When 0, 0 indicates that one identical pixel continues, and 1 indicates that two identical pixels continue. ,..., The maximum value of 31 indicates that 32 same pixels as the immediately preceding pixel continue.
【0026】図3(b)のインデックス符号は、過去デ
ータ記憶手段18に記憶された画素値と同じ画素値を圧
縮する場合に使用される。3ビット目〜7ビット目は当
該符号がインデックス符号であることを示す固定のビッ
ト列(11110)が入り、0ビット目〜2ビット目の
合計3ビットにインデックス項が入る。インデックス項
には、過去データ記憶手段18中の同じ値であった画素
値のインデックス番号が設定される。The index code shown in FIG. 3B is used when compressing the same pixel value as the pixel value stored in the past data storage means 18. The third to seventh bits contain a fixed bit sequence (11110) indicating that the code is an index code, and the index term is contained in a total of three bits from the 0th bit to the second bit. In the index item, the index number of the pixel value having the same value in the past data storage unit 18 is set.
【0027】図3(c)〜(e)の差分符号は、直前の
画素値との差分によって画素値を圧縮する場合に使用さ
れ、(c)は1バイト形式の1バイト差分符号、(d)
は2バイト形式の2バイト差分符号、(e)は3バイト
形式の3バイト差分符号である。The difference codes shown in FIGS. 3C to 3E are used for compressing a pixel value by a difference from the immediately preceding pixel value, and FIG. 3C shows a 1-byte 1-byte difference code. )
Is a 2-byte differential code in a 2-byte format, and (e) is a 3-byte differential code in a 3-byte format.
【0028】1バイト差分符号では、7ビット目に当該
符号が1バイト差分符号であることを示す固定のビット
(0)が入り、5ビット目と6ビット目の合計2ビット
に色値Rの差分ΔRが、3ビット目と4ビット目の合計
2ビットに色値Gの差分ΔGが、0ビット目〜2ビット
目の3ビットに色値Bの差分ΔBが、それぞれ入る。In the 1-byte differential code, a fixed bit (0) indicating that the code is a 1-byte differential code is inserted in the 7th bit, and the 5th and 6th bits have a total of 2 bits of the color value R. In the difference ΔR, the difference ΔG of the color value G is entered in a total of two bits of the third and fourth bits, and the difference ΔB of the color value B is entered in the three bits of the 0th bit to the second bit.
【0029】2バイト差分符号では、1バイト目の6ビ
ット目と7ビット目の合計2ビットに当該符号が2バイ
ト差分符号であることを示す固定のビット列(10)が
入り、1バイト目の1ビット目〜5ビット目の合計5ビ
ットに差分ΔRが、1バイト目の0ビット目と続くバイ
トの5ビット目〜7ビット目の合計4ビットに差分ΔG
が、2バイト目の0ビット目〜4ビット目の合計5ビッ
トに差分ΔBが、それぞれ入る。In the two-byte differential code, a fixed bit string (10) indicating that the code is a two-byte differential code is inserted into a total of two bits of the sixth and seventh bits of the first byte. The difference ΔR is a total of 5 bits of the first to fifth bits, and the difference ΔG is a total of 4 bits of the 0th bit of the first byte and the fifth to seventh bits of the subsequent byte.
However, the difference ΔB is entered in a total of 5 bits from the 0th bit to the 4th bit of the second byte.
【0030】3バイト差分符号では、1バイト目の4ビ
ット目〜7ビット目の合計4ビットに当該符号が3バイ
ト差分符号であることを示す固定のビット列(111
0)が入り、1バイト目の0ビット目〜3ビット目と続
くバイトの5ビット目〜7ビット目の合計7ビットに差
分ΔRが、2バイト目の0ビット目〜4ビット目と続く
バイトの7ビット目の合計6ビットに差分ΔGが、3バ
イト目の0ビット目〜6ビット目の合計7ビットに差分
ΔBが、それぞれ入る。In the 3-byte differential code, a fixed bit string (111) indicating that the code is a 3-byte differential code is added to a total of 4 bits from the fourth bit to the seventh bit of the first byte.
0) is inserted, and a difference ΔR is added to a total of 7 bits from the 0th bit to the 3rd bit of the 1st byte and the 5th to 7th bits of the following byte, and the byte following the 0th to 4th bits of the 2nd byte The difference ΔG is entered in a total of 6 bits of the seventh bit, and the difference ΔB is entered in a total of 7 bits of the 0th to 6th bits of the third byte.
【0031】直前の画素値とのR,G,Bそれぞれの差
分ΔR,ΔG,ΔBがそれぞれ2,2,3ビット以下で
表現できる場合には1バイト差分符号が使用され、5,
4,5ビット以下で表現できるならば2バイト差分符号
が使用され、7,6,7ビット以下で表現できるならば
3バイト差分符号が使用される。When the differences ΔR, ΔG, and ΔB of R, G, and B from the immediately preceding pixel value can be expressed by 2, 2, and 3 bits or less, respectively, a 1-byte difference code is used.
If it can be represented by 4 or 5 bits or less, a 2-byte differential code is used, and if it can be represented by 7, 6, 7 bits or less, a 3-byte differential code is used.
【0032】図4は図1のデータ圧縮装置1の処理例を
示すフローチャートである。以下、図1ないし図4を参
照して本実施例の動作を説明する。なお、データ圧縮装
置1をCPUおよびメモリを有するコンピュータで実現
する場合、図4に示される処理を記述した圧縮プログラ
ムがCD−ROM,半導体メモリ,磁気ディスク等の機
械読み取り可能な記録媒体(図1のM1)に記録されて
おり、その記録媒体M1の圧縮プログラムがコンピュー
タに読み取られ、コンピュータの動作を制御することに
より、そのコンピュータを図1のデータ圧縮装置1とし
て機能させる。FIG. 4 is a flowchart showing a processing example of the data compression apparatus 1 of FIG. Hereinafter, the operation of this embodiment will be described with reference to FIGS. When the data compression apparatus 1 is realized by a computer having a CPU and a memory, a compression program describing the processing shown in FIG. 4 is stored in a machine-readable recording medium such as a CD-ROM, a semiconductor memory, and a magnetic disk (FIG. 1). M1), the compressed program of the recording medium M1 is read by the computer, and the computer is controlled to operate so that the computer functions as the data compression device 1 of FIG.
【0033】圧縮対象となる画像データを格納する画像
ファイル2,圧縮画像を格納する圧縮ファイル3を指定
した圧縮要求が利用者入出力装置4からデータ圧縮装置
1に入力されると、データ圧縮装置1の制御手段11の
制御の下で、図4に示す処理が開始される。When a compression request designating an image file 2 for storing image data to be compressed and a compression file 3 for storing a compressed image is input from the user input / output device 4 to the data compression device 1, the data compression device Under the control of the first control means 11, the processing shown in FIG. 4 is started.
【0034】まず制御手段11は、装置各部を初期化す
る(S1)。この処理で、直前データ記憶手段17及び
過去データ記憶手段18中の画素値がすべて0に初期化
され、直前データ比較手段14内の連続数カウンタ14
aも0に初期化される。First, the control means 11 initializes each part of the apparatus (S1). In this process, the pixel values in the immediately preceding data storage unit 17 and the past data storage unit 18 are all initialized to 0, and the continuous number counter 14 in the immediately preceding data comparison unit 14 is initialized.
a is also initialized to 0.
【0035】次に制御手段11は、データ入力手段12
を用いて画像ファイル2から最初の画素値を入力する
(S2)。入力された画素値は、制御手段11,直前デ
ータ比較手段14,過去データ比較手段15,差分取得
手段16に伝達される。Next, the control means 11 includes a data input means 12
Is used to input the first pixel value from the image file 2 (S2). The input pixel value is transmitted to the control unit 11, the immediately preceding data comparison unit 14, the past data comparison unit 15, and the difference acquisition unit 16.
【0036】制御手段11は、初期化後の最初の画素値
なので(S4でYES)、伝達された画素値を設定した
即値符号をデータ出力手段13に出力すると共に(S
5)、直前データ記憶手段17に格納し(S6)、更に
過去データ記憶手段18のインデックス番号0のエント
リE0に格納する(S7)。そして、ステップS2に戻
って次の画素値を入力する。なお、データ出力手段13
は制御手段11から出力された符号をその都度、あるい
は一定量蓄積された時点で一括して圧縮ファイル3に出
力する。Since the control means 11 is the first pixel value after initialization (YES in S4), the control means 11 outputs an immediate code in which the transmitted pixel value is set to the data output means 13 (S4).
5) It is stored in the immediately preceding data storage unit 17 (S6), and further stored in the entry E0 of the index number 0 of the past data storage unit 18 (S7). Then, returning to step S2, the next pixel value is input. The data output means 13
Outputs the codes output from the control means 11 to the compressed file 3 collectively each time or when a predetermined amount is accumulated.
【0037】2番目以降の画素値については直前の画素
値あるいは過去の画素値を利用して圧縮できる可能性が
ある。The second and subsequent pixel values may be compressed using the immediately preceding pixel value or the past pixel value.
【0038】先ず制御手段11は、今回入力された画素
値と直前データ記憶手段17に記憶されている直前の画
素値との比較結果を直前データ比較手段14から読み取
り、両者が一致しているか否かを判定する(S8)。両
者が一致していた場合、連続数カウンタ14aを1だけ
インクリメントする(S9)。そして、インクリメント
後の連続数カウンタ14aのカウント値が最大値(本例
では32)に達したか否かを調べ(S10)、達してい
なければステップS2に戻って次の画素値を処理する。
また、最大値に達していれば、つまり、直前データ記憶
手段17に記憶された直前の画素値と同じ画素値が32
個連続して出現した場合には、図3(a)のレングス項
にカウント値−1の値(31)を設定した一致符号をデ
ータ出力手段13に出力し、連続数カウンタ14aの値
を0に初期化して(S11)、ステップS2に戻り、次
の画素値を処理する。First, the control means 11 reads from the immediately preceding data comparison means 14 the result of comparison between the currently input pixel value and the immediately preceding pixel value stored in the immediately preceding data storage means 17, and determines whether or not both match. Is determined (S8). If they match, the continuation number counter 14a is incremented by 1 (S9). Then, it is determined whether or not the count value of the consecutive number counter 14a after the increment has reached the maximum value (32 in this example) (S10). If not, the process returns to step S2 to process the next pixel value.
If the pixel value has reached the maximum value, that is, the same pixel value as the immediately preceding pixel value stored in the immediately preceding data storage unit 17 is equal to 32.
If the number of consecutive occurrences is found, a coincidence code in which the value (31) of the count value -1 is set in the length term of FIG. 3A is output to the data output means 13, and the value of the continuous number counter 14a is set to 0. (S11), and returns to step S2 to process the next pixel value.
【0039】他方、今回入力された画素値と直前データ
記憶手段17に記憶されている直前の画素値とが一致し
なかった場合(S8でNO)、制御手段11は他の圧縮
形式による圧縮が可能か否かを調べるが(S14,S1
5)、その前に、連続数カウンタ14aの値が0より大
きいか否かを調べ(S12)、0より大きい場合には、
図3(a)のレングス項にカウント値−1の値を設定し
た一致符号をデータ出力手段13に出力し、連続数カウ
ンタ14aの値を0に初期化する(S13)。On the other hand, if the currently input pixel value does not match the immediately preceding pixel value stored in the immediately preceding data storage means 17 (NO in S8), the control means 11 performs compression by another compression format. It is checked whether it is possible or not (S14, S1
5) Before that, it is checked whether or not the value of the continuous counter 14a is larger than 0 (S12).
The coincidence code in which the value of the count value -1 is set to the length term in FIG. 3A is output to the data output means 13, and the value of the continuous number counter 14a is initialized to 0 (S13).
【0040】さて、ステップS14では、今回入力され
た画素値と過去データ記憶手段18に記憶されている過
去の画素値との比較結果を過去データ比較手段15から
読み取り、今回入力された画素値と一致する過去データ
の有無を判定する。一致する過去データが存在していた
場合、過去データ比較手段15はその一致した画素値を
格納しているエントリのインデックス番号を出力するの
で、制御手段11は、このインデックス番号を図3
(b)のIndex項に設定したインデックス符号をデ
ータ出力手段13に出力する。そして、今回の画素値を
直前データ記憶手段17に格納し(S17)、ステップ
S2に戻って次の画素値を処理する。In step S14, the result of comparison between the currently input pixel value and the past pixel value stored in the past data storage unit 18 is read from the past data comparison unit 15, and the currently input pixel value is compared with the currently input pixel value. It is determined whether there is matching past data. If there is a matching past data, the past data comparing unit 15 outputs the index number of the entry storing the matching pixel value.
The index code set in the Index item of (b) is output to the data output means 13. Then, the current pixel value is stored in the immediately preceding data storage unit 17 (S17), and the process returns to step S2 to process the next pixel value.
【0041】また、過去に出現した画素値の中にも同一
の画素値が存在しない場合(S14でNO)、差分符号
による圧縮が可能か否かを調べる(S15)。制御手段
11は、差分取得手段16において求められた、今回の
画素値と直前データ記憶手段17に記憶されている直前
の画素値との各色値ごとの差分ΔR,ΔG,ΔBが、そ
れぞれ2,2,3ビット以下で表現できる場合には1バ
イト差分符号による圧縮が可能と判断し、差分ΔR,Δ
G,ΔBを設定した図3(c)の1バイト差分符号をデ
ータ出力手段13に出力する(S18)。また、差分Δ
R,ΔG,ΔBが、それぞれ5,4,5ビット以下で表
現できる場合は2バイト差分符号による圧縮が可能と判
断し、差分ΔR,ΔG,ΔBを設定した図3(d)の2
バイト差分符号をデータ出力手段13に出力する(S1
8)。さらに、差分ΔR,ΔG,ΔBが、それぞれ7,
6,7ビット以下で表現できる場合は3バイト差分符号
による圧縮が可能と判断し、差分ΔR,ΔG,ΔBを設
定した図3(e)の3バイト差分符号をデータ出力手段
13に出力する(S18)。それ以外の場合、つまり差
分ΔR,ΔG,ΔBのそれぞれが7,6,7ビット以下
で表現できない場合は差分符号による圧縮は不可能と判
断し、今回の画素値そのものを設定した図3(f)の即
値符号をデータ出力手段13に出力する(S19)。If the same pixel value does not exist among the pixel values that appeared in the past (NO in S14), it is checked whether or not the compression by the difference code is possible (S15). The control means 11 calculates the differences ΔR, ΔG, and ΔB for each color value between the current pixel value and the immediately preceding pixel value stored in the immediately preceding data storage means 17, which are obtained by the difference acquisition means 16, respectively, by 2, If it can be expressed in a few bits or less, it is determined that compression using a 1-byte difference code is possible, and the differences ΔR, Δ
The 1-byte differential code of FIG. 3C in which G and ΔB are set is output to the data output unit 13 (S18). Also, the difference Δ
If R, ΔG, and ΔB can be represented by 5 bits, 4 bits, and 5 bits or less, respectively, it is determined that compression using a 2-byte difference code is possible, and the differences ΔR, ΔG, and ΔB are set in FIG.
The byte difference code is output to the data output means 13 (S1
8). Further, the differences ΔR, ΔG, and ΔB are 7,
If the data can be expressed by 6 or 7 bits or less, it is determined that compression by the 3-byte differential code is possible, and the 3-byte differential code of FIG. 3E in which the differences ΔR, ΔG, and ΔB are set is output to the data output means 13 ( S18). In other cases, that is, when each of the differences ΔR, ΔG, and ΔB cannot be represented by 7, 6, or 7 bits or less, it is determined that the compression by the difference code is impossible, and FIG. ) Is output to the data output means 13 (S19).
【0042】そして、差分符号,即値符号を上述のよう
に出力した場合には、今回の画素値を直前データ記憶手
段17に格納すると共に(S6)、過去データ記憶手段
18の次のインデックス番号のエントリに格納する(S
7)。そして、ステップS2に戻って次の画素値を入力
する。When the difference code and the immediate code are output as described above, the current pixel value is stored in the immediately preceding data storage means 17 (S6) and the next index number of the past data storage means 18 is stored. Store in the entry (S
7). Then, returning to step S2, the next pixel value is input.
【0043】以上のような処理が繰り返され、画像ファ
イル2中の最後の画素まで処理を終えると(S3でYE
S)、連続数カウンタ14aの値が0より大きければ図
3(a)のレングス項にカウンタ値−1の値を設定した
一致符号を出力し(S20,S21)、圧縮処理を終了
する。When the above processing is repeated and the processing is completed up to the last pixel in the image file 2 (YE in S3)
S), if the value of the continuous number counter 14a is larger than 0, a coincidence code in which the value of the counter value -1 is set to the length term in FIG. 3A is output (S20, S21), and the compression process ends.
【0044】図5に、幾つかの画像について本実施例に
よるデータ圧縮方法および従来方法を使って実際に圧縮
した場合の圧縮率の測定例を示す。従来方法としてはp
ackbits,LZW法,JPEG(ロスレスモー
ド)を用いた。図中の数値は、「圧縮後のデータ量/元
のデータ量」を示し、数値が小さいほど圧縮率が高いこ
とを示す。また、1.00 は圧縮不能を示す。ここで、画
像1は文字列が表示された2つのウィンドウと電卓など
のイメージ図が表示されているコンピュータ画面上の画
像であり、画像2はコンピュータ画面上に表示された或
るホームページ画面の画像であり、画像3は開かれた本
の上に懐中時計が蓋を開いた状態で置かれた或るPho
toDisc中の画像であり、画像4は手前に湖、奥に
森林のある風景を撮影した自然画であり、画像5は筋状
の紋様が多数描かれたパターン画像である。この図5に
示されるように本実施例のデータ圧縮方法によれば、様
々な種類の画像に対して1番目か或いは2番目に高い圧
縮率で圧縮することができる。FIG. 5 shows a measurement example of the compression ratio when some images are actually compressed using the data compression method according to the present embodiment and the conventional method. The conventional method is p
ackbits, LZW method, and JPEG (lossless mode) were used. Numerical values in the figure indicate “data amount after compression / original data amount”, and a smaller numerical value indicates a higher compression rate. Also, 1.00 indicates that compression is impossible. Here, image 1 is an image on a computer screen displaying two windows displaying character strings and an image diagram of a calculator and the like, and image 2 is an image of a certain homepage screen displayed on the computer screen. Yes, image 3 shows a Pho with a pocket watch on the open book with the lid open
The image 4 is a natural image obtained by photographing a landscape with a lake in the front and a forest in the back, and the image 5 is a pattern image in which a large number of stripe patterns are drawn. As shown in FIG. 5, according to the data compression method of this embodiment, various types of images can be compressed at the first or second highest compression ratio.
【0045】以上の実施例においては、圧縮符号の適用
優先順序として、一致符号を最優先し、次にインデック
ス符号を優先し、差分符号は最後に適用した。これは、
本実施例の場合、一致符号が1バイト、インデックス符
号が1バイト、差分符号が最大3バイトであるため、こ
の適用優先順序がより情報量を少なくし得る順序である
からである。しかし、各符号のバイト数は上述の例に限
定されず、各種のものを採用することができ、その場
合、圧縮符号の適用優先順序も変わり得る。例えば、レ
ングス項を13ビットにした2バイトの一致符号を用い
る場合、同じ画素値が2個だけ連続する箇所では、若
し、インデックス符号或いは1バイト差分符号による表
現が可能であればその方が情報量が少ないので、一致符
号よりインデックス符号或いは1バイト差分符号が優先
的に適用される。In the embodiment described above, as the application priority order of the compression codes, the matching code has the highest priority, the index code has the highest priority, and the difference code has been applied last. this is,
This is because, in the case of the present embodiment, the matching code is 1 byte, the index code is 1 byte, and the difference code is 3 bytes at the maximum. Therefore, this application priority order is an order that can further reduce the information amount. However, the number of bytes of each code is not limited to the above example, and various types can be adopted, and in that case, the application priority order of the compression codes can be changed. For example, when a 2-byte coincidence code with a 13-bit length term is used, where two identical pixel values are continuous, if it can be represented by an index code or a 1-byte difference code, that method is better. Since the amount of information is small, an index code or a one-byte difference code is applied with priority over a matching code.
【0046】次に上述の実施例のデータ圧縮方法によっ
て圧縮された画像を伸張し、元の画像を復元するデータ
伸張方法の実施例について説明する。Next, an embodiment of a data decompression method for decompressing an image compressed by the data compression method of the above embodiment and restoring the original image will be described.
【0047】図6は本発明を適用したデータ伸張装置の
一例を示すブロック図である。この例のデータ伸張装置
5は、制御手段51と、データ入力手段52と、データ
出力手段53と、連続画素出力手段54と、過去データ
出力手段55と、差分データ出力手段56と、セレクタ
59−1,59−2いった機能手段を有すると共に、直
前データ記憶手段57と過去データ記憶手段58といっ
た記憶手段を有している。また、圧縮ファイル3,復元
ファイル6および利用者入出力装置7に接続されてい
る。FIG. 6 is a block diagram showing an example of a data decompression device to which the present invention is applied. The data decompression device 5 of this example includes a control unit 51, a data input unit 52, a data output unit 53, a continuous pixel output unit 54, a past data output unit 55, a difference data output unit 56, a selector 59- 1, 59-2 as well as storage means such as the immediately preceding data storage means 57 and the past data storage means 58. Further, it is connected to the compressed file 3, the decompressed file 6, and the user input / output device 7.
【0048】データ入力手段52は、復元対象とする圧
縮データを圧縮ファイル3から入力する手段である。前
述したように圧縮データは、1バイトの一致符号(図3
(a))、1バイトのインデックス符号(図3
(b))、1バイト,2バイト及び3バイトの差分符号
(図3(c)〜(e))、4バイトの即値符号(図3
(f))の合計6種類の圧縮符号から構成されている。
データ入力手段52は圧縮データの先頭から順にこれら
の圧縮符号を入力する。符号の区切りはバイト単位であ
り、何バイト符号であるかは符号の識別子ビットで判別
可能である。つまり、読み込んだ1バイトの7ビット目
が0であれば1バイト差分符号であり、7,6ビット目
が1,0であれば2バイト差分符号であり、7,6,5
ビット目が1,1,0であれば1バイトの一致符号であ
り、7,6,5,4ビット目が1,1,1,0であれば
3バイト差分符号であり、7,6,5,4,3ビット目
が1,1,1,1,0であればインデックス符号であ
り、7,6,5,4,3,2,1,0が1,1,1,
1,1,0,0,0であれば即値符号である。なお、復
元対象とする圧縮データの入力元はファイルに限られな
い。The data input means 52 is means for inputting compressed data to be restored from the compressed file 3. As described above, the compressed data is a one-byte matching code (FIG. 3).
(A)) 1-byte index code (FIG. 3
(B)) 1-byte, 2-byte, and 3-byte differential codes (FIGS. 3C to 3E) and 4-byte immediate codes (FIG.
(F)) is composed of a total of six types of compression codes.
The data input means 52 inputs these compression codes sequentially from the head of the compressed data. Code delimiters are in byte units, and the number of byte codes can be determined by the code identifier bits. That is, if the 7th bit of the read 1 byte is 0, it is a 1-byte differential code, and if the 7th and 6th bits are 1, 0, it is a 2-byte differential code.
If the first bit is 1,1,0, it is a 1-byte matching code, and if the seventh, sixth, fifth, and fourth bits are 1,1,1,0, then it is a three-byte differential code; If the fifth, fourth, and third bits are 1,1,1,1,0, it is an index code, and 7,6,5,4,3,2,1,0 is 1,1,1,
If it is 1,1,0,0,0, it is an immediate code. The input source of the compressed data to be restored is not limited to a file.
【0049】直前データ記憶手段57は、直前に復元し
た画素値を保持する手段である。The immediately preceding data storage means 57 is a means for holding the pixel value restored immediately before.
【0050】過去データ記憶手段58は、過去に復元し
た画素値を複数種類記憶する手段であり、その構造およ
びそれへの画素値の格納方法はデータ圧縮装置側の過去
データ記憶手段18と同一である。つまり、本実施例の
場合、図2に示すように最大8個の画素値をデータ圧縮
装置と同様の順序で記憶していく。The past data storage means 58 is a means for storing a plurality of types of pixel values restored in the past. The structure and the method of storing the pixel values therein are the same as those of the past data storage means 18 on the data compression apparatus side. is there. That is, in the case of the present embodiment, as shown in FIG. 2, up to eight pixel values are stored in the same order as in the data compression device.
【0051】連続画素出力手段54は、一致符号の伸張
手段であり、直前データ記憶手段57に記憶されている
画素値を、データ入力手段52で入力された一致符号の
レングス項の値+1だけ連続して出力する。The continuous pixel output means 54 is a decompression means of the coincidence code, and continuously converts the pixel value stored in the immediately preceding data storage means 57 by the value of the length term of the coincidence code input by the data input means 52 plus +1. And output.
【0052】過去データ出力手段55は、インデックス
符号の伸張手段であり、データ入力手段52で入力され
たインデックス符号が示すインデックス番号に対応して
過去データ記憶手段58に記憶されている画素値を読み
出して出力する。The past data output means 55 is a means for expanding the index code, and reads out the pixel value stored in the past data storage means 58 corresponding to the index number indicated by the index code input by the data input means 52. Output.
【0053】差分データ出力手段56は、差分符号の伸
張手段であり、データ入力手段52で入力された差分符
号中のΔR,ΔG,ΔBを直前データ記憶手段57に記
憶されている画素値の各色値R,G,Bに加算して画素
値を復元し、出力する。The difference data output means 56 is a means for expanding the difference code. The difference data output means 56 converts ΔR, ΔG, and ΔB in the difference code inputted by the data input means 52 into the respective colors of the pixel values stored in the immediately preceding data storage means 57. The pixel values are restored by adding to the values R, G, and B and output.
【0054】セレクタ59─1は、連続画素出力手段5
4,差分データ出力手段56および制御手段51から出
力された画素値の何れかを、制御手段51からの制御信
号に基づいて選択してセレクタ59−2に出力すると共
に、過去データとして格納するために過去データ記憶手
段58に出力する。The selector 59 # 1 is connected to the continuous pixel output means 5
4. To select any one of the pixel values output from the difference data output means 56 and the control means 51 based on the control signal from the control means 51, output the same to the selector 59-2, and store it as past data. To the past data storage means 58.
【0055】セレクタ59−2は、セレクタ59−1お
よび過去データ出力手段55から出力された画素値の何
れかを、制御手段51からの制御信号に基づいて選択し
てデータ出力手段53に出力すると共に、直前の画素値
として格納するために直前データ記憶手段57に出力す
る。The selector 59-2 selects one of the pixel values output from the selector 59-1 and the past data output means 55 based on a control signal from the control means 51, and outputs the selected pixel value to the data output means 53. At the same time, the image data is output to the immediately preceding data storage unit 57 to be stored as the immediately preceding pixel value.
【0056】データ出力手段53は、復元した画素値を
復元ファイル6に出力する手段である。なお、復元デー
タの出力先はファイルに限られない。The data output means 53 is means for outputting the restored pixel values to the restored file 6. The output destination of the restored data is not limited to a file.
【0057】制御手段51は、データ伸張装置5全体を
制御する手段である。The control means 51 is a means for controlling the entire data decompression device 5.
【0058】図7は図6のデータ伸張装置5の処理例を
示すフローチャートである。以下、図6及び図7を参照
して本実施例の動作を説明する。なお、データ伸張装置
5をCPUおよびメモリを有するコンピュータで実現す
る場合、図7に示される処理を記述した伸張プログラム
がCD−ROM,半導体メモリ,磁気ディスク等の機械
読み取り可能な記録媒体(図6のM2)に記録されてお
り、その記録媒体M2の伸張プログラムがコンピュータ
に読み取られ、コンピュータの動作を制御することによ
り、そのコンピュータを図6のデータ伸張装置5として
機能させる。FIG. 7 is a flowchart showing a processing example of the data decompression device 5 of FIG. Hereinafter, the operation of this embodiment will be described with reference to FIGS. When the data decompression device 5 is realized by a computer having a CPU and a memory, a decompression program describing the processing shown in FIG. 7 is stored in a machine-readable recording medium such as a CD-ROM, a semiconductor memory, or a magnetic disk (FIG. 6). M2), the decompression program of the recording medium M2 is read by the computer, and the computer is controlled to operate so that the computer functions as the data decompression device 5 in FIG.
【0059】復元対象となる圧縮データを格納する圧縮
ファイル3,復元画像を格納する復元ファイル6を指定
した伸張要求が利用者入出力装置7からデータ伸張装置
5に入力されると、データ伸張装置5の制御手段51の
制御の下で、図7に示す処理が開始される。When a decompression request designating a compressed file 3 for storing compressed data to be decompressed and a decompression file 6 for storing decompressed images is input from the user input / output device 7 to the data decompression device 5, the data decompression device 5 Under the control of the control means 51, the processing shown in FIG. 7 is started.
【0060】まず制御手段51は、装置各部を初期化す
る(S31)。この処理で、直前データ記憶手段57及
び過去データ記憶手段58中の画素値がすべて0に初期
化される。First, the control means 51 initializes each part of the apparatus (S31). In this process, all the pixel values in the immediately preceding data storage unit 57 and the past data storage unit 58 are initialized to 0.
【0061】次に制御手段51は、データ入力手段52
を用いて圧縮ファイル3から最初の圧縮符号を入力し
(S32)、その符号の種類を判定する(S34〜S3
6)。Next, the control means 51 includes a data input means 52
Is used to input the first compression code from the compression file 3 (S32), and the type of the code is determined (S34 to S3).
6).
【0062】圧縮符号が即値符号の場合(S36でN
O)、即値符号に設定された画素値そのものを制御手段
51からセレクタ59−1,59−2を通じてデータ出
力手段53に送り、復元ファイル6に出力する(S3
7)。そして、その画素値を直前画素値として直前デー
タ記憶手段57に記憶すると共に(S38)、過去デー
タ記憶手段58に過去データの1つとして記憶し(S3
9)、ステップS32に戻って次の圧縮符号を入力す
る。When the compression code is an immediate code (N in S36)
O), the pixel value itself set to the immediate code is sent from the control means 51 to the data output means 53 through the selectors 59-1 and 59-2, and output to the restoration file 6 (S3).
7). Then, the pixel value is stored as the immediately preceding pixel value in the immediately preceding data storage unit 57 (S38), and is stored in the past data storage unit 58 as one of the past data (S3).
9) Return to step S32 and input the next compression code.
【0063】圧縮符号が一致符号の場合(S34でYE
S)、制御手段51はその一致符号を連続画素出力手段
54に伝達し、連続画素出力手段54は直前データ記憶
手段57に記憶されている画素値を、その一致符号のレ
ングス項の値+1の個数だけ連続してセレクタ59−1
に出力し、制御手段51はその出力をセレクタ59−
1,59−2で選択せしめてデータ出力手段53を通じ
て復元ファイル6に出力する(S40)。そして、その
画素値を直前画素値として直前データ記憶手段57に記
憶すると共に(S38)、過去データ記憶手段58に過
去データの1つとして記憶し(S39)、ステップS3
2に戻って次の圧縮符号を入力する。When the compression code is a coincidence code (YE in S34)
S), the control means 51 transmits the coincidence code to the continuous pixel output means 54, and the continuous pixel output means 54 compares the pixel value stored in the immediately preceding data storage means 57 with the value of the length term of the coincidence code + 1. The selector 59-1 is continuously provided by the number.
And the control means 51 outputs the output to the selector 59-
The selected data is output to the restored file 6 through the data output means 53 (S40). Then, the pixel value is stored as the immediately preceding pixel value in the immediately preceding data storage unit 57 (S38), and is stored as one of the past data in the past data storage unit 58 (S39), and step S3 is performed.
Returning to step 2, the next compression code is input.
【0064】圧縮符号がインデックス符号の場合(S3
5でYES)、制御手段51はそのインデックス符号を
過去データ出力手段55に伝達し、過去データ出力手段
55はそのインデックス符号に設定されたインデックス
番号に対応して過去データ記憶手段58に記憶されてい
る画素値を読み取ってセレクタ59−2に出力し、制御
手段51はその出力をセレクタ59−2で選択せしめて
データ出力手段53を通じて復元ファイル6に出力する
(S41)。そして、その画素値を直前画素値として直
前データ記憶手段57に記憶し(S42)、ステップS
32に戻って次の圧縮符号を入力する。When the compression code is an index code (S3
5), the control means 51 transmits the index code to the past data output means 55, and the past data output means 55 is stored in the past data storage means 58 corresponding to the index number set for the index code. The read pixel value is read and output to the selector 59-2, and the control means 51 selects the output with the selector 59-2 and outputs it to the restored file 6 through the data output means 53 (S41). Then, the pixel value is stored as the immediately preceding pixel value in the immediately preceding data storage means 57 (S42), and the process proceeds to step S
Returning to step 32, the next compression code is input.
【0065】圧縮符号が差分符号の場合(S36でYE
S)、制御手段51はその差分符号を差分データ出力手
段56に伝達し、差分データ出力手段56は直前データ
記憶手段57に記憶されている画素値のR,G,B値
に、その差分符号のΔR,ΔG,ΔBを加算した画素値
をセレクタ59−1に出力し、制御手段51はその出力
をセレクタ59−1,59−2で選択せしめてデータ出
力手段53を通じて復元ファイル6に出力する(S4
3)。そして、その画素値を直前画素値として直前デー
タ記憶手段57に記憶すると共に(S38)、過去デー
タ記憶手段58に過去データの1つとして記憶し(S3
9)、ステップS32に戻って次の圧縮符号を入力す
る。When the compression code is a difference code (YE in S36)
S), the control means 51 transmits the difference code to the difference data output means 56, and the difference data output means 56 adds the difference code to the R, G, B values of the pixel values stored in the immediately preceding data storage means 57. And outputs the pixel value obtained by adding ΔR, ΔG, and ΔB to the selector 59-1. The control means 51 selects the output with the selectors 59-1 and 59-2, and outputs the output to the restoration file 6 through the data output means 53. (S4
3). Then, the pixel value is stored as the immediately preceding pixel value in the immediately preceding data storage unit 57 (S38), and is stored in the past data storage unit 58 as one of the past data (S3).
9) Return to step S32 and input the next compression code.
【0066】以上のような処理が繰り返され、圧縮ファ
イル3中の最後の圧縮符号まで処理を終えると(S33
でYES)、伸張処理を終了する。When the above processing is repeated and the processing is completed up to the last compression code in the compressed file 3 (S33)
YES), and terminates the decompression processing.
【0067】図8は本発明を適用したデータ圧縮装置の
別の例を示すブロック図、図9はその処理例を示すフロ
ーチャートである。本実施例のデータ圧縮装置1が図1
のデータ圧縮装置と相違するところは、圧縮対象画像の
1ライン分の画素値を処理し終わるごとに、直前の画素
値や過去データなどを初期化することにより、圧縮ファ
イル3の伸張時に後述するように圧縮データの途中から
の伸張処理を高速に行えるようにした点にある。このた
め制御手段11内には現在まで処理した画素数をカウン
トする画素数カウンタ11aが設けられており、また、
ステップS1とステップS2との間にステップS22〜
S26が挿入されている等の変更が加えられている。な
お、データ圧縮装置1をCPUおよびメモリを有するコ
ンピュータで実現する場合、図9に示される処理を記述
した圧縮プログラムがCD−ROM,半導体メモリ,磁
気ディスク等の機械読み取り可能な記録媒体(図8のM
1)に記録されており、その記録媒体M1の圧縮プログ
ラムがコンピュータに読み取られ、コンピュータの動作
を制御することにより、そのコンピュータを図8のデー
タ圧縮装置1として機能させる。FIG. 8 is a block diagram showing another example of the data compression apparatus to which the present invention is applied, and FIG. 9 is a flowchart showing an example of the processing. FIG. 1 shows a data compression apparatus 1 according to the present embodiment.
The difference from this data compression device is that each time pixel values for one line of the image to be compressed are processed, the immediately preceding pixel values and past data are initialized, which will be described later when the compressed file 3 is decompressed. In this way, the decompression process from the middle of the compressed data can be performed at high speed. For this purpose, the control means 11 is provided with a pixel number counter 11a for counting the number of pixels processed up to the present time.
Between steps S1 and S2, steps S22-
Changes such as insertion of S26 have been made. When the data compression apparatus 1 is realized by a computer having a CPU and a memory, a compression program describing the processing shown in FIG. 9 is stored in a machine-readable recording medium such as a CD-ROM, a semiconductor memory, or a magnetic disk (FIG. 8). M
1), the compression program of the recording medium M1 is read by the computer, and the computer is controlled to operate so that the computer functions as the data compression device 1 in FIG.
【0068】以下、図1の実施例のデータ圧縮装置との
差異を中心に本実施例の動作を説明する。Hereinafter, the operation of this embodiment will be described focusing on differences from the data compression apparatus of the embodiment of FIG.
【0069】圧縮対象となる画像データを格納する画像
ファイル2,圧縮画像を格納する圧縮ファイル3および
画像の1ライン当たりの画素数Lを指定した圧縮要求が
利用者入出力装置4からデータ圧縮装置1に入力される
と、データ圧縮装置1の制御手段11の制御の下で、図
9に示す処理が開始される。なお、画素数Lは画像ファ
イル3中の画像を走査して自動的に取得するようにして
も良い。An image file 2 for storing image data to be compressed, a compressed file 3 for storing a compressed image, and a compression request designating the number of pixels L per line of the image are transmitted from the user input / output device 4 to the data compression device. 9 is started under the control of the control means 11 of the data compression device 1. The number of pixels L may be automatically obtained by scanning an image in the image file 3.
【0070】まず制御手段11は、装置各部を初期化す
る(S1)。この処理では、直前データ記憶手段17及
び過去データ記憶手段18中の画素値がすべて0に初期
化され、直前データ比較手段14内の連続数カウンタ1
4aも0に初期化されると共に、画素数カウンタ11a
が0に初期化される。First, the control means 11 initializes each part of the apparatus (S1). In this process, the pixel values in the immediately preceding data storage unit 17 and the past data storage unit 18 are all initialized to 0, and the continuous number counter 1 in the immediately preceding data comparison unit 14 is reset.
4a is also initialized to 0, and the pixel number counter 11a
Is initialized to 0.
【0071】次に制御手段11は、データ入力手段12
を用いて画像ファイル2から順次に画素値を入力して図
1のデータ圧縮装置と同様の処理を繰り返すが(S2〜
S21)、本実施例では、1つの画素値を処理する前
に、画素数カウンタ11aを1だけインクリメントする
ことで(S22)、初期化後から現在までに処理し終え
た画素の数をカウントする。そして、画素数カウンタ1
1aの値がL+1に達していた場合(S23でYE
S)、1ライン分の処理を終えているので、連続数カウ
ンタ14aの値が0より大きければ図3(a)のレング
ス項にカウント値−1の値を設定した一致符号をデータ
出力手段13に出力する処理を行った後(S24,S2
5)、また連続数カウンタ14aの値が0であれば処理
S25をスキップして、それぞれステップS26に進
み、直前データ記憶手段17及び過去データ記憶手段1
8中の画素値をすべて0に初期化し、直前データ比較手
段14内の連続数カウンタ14aを0に初期化し、また
画素数カウンタ11aを1に設定する。そして、ステッ
プS2に進んで次の画素値を処理する。Next, the control means 11
Are used to sequentially input pixel values from the image file 2, and the same processing as in the data compression apparatus of FIG.
S21) In this embodiment, before processing one pixel value, the pixel number counter 11a is incremented by 1 (S22) to count the number of pixels that have been processed from initialization to the present. . And the pixel number counter 1
If the value of 1a has reached L + 1 (YE in S23)
S) Since the processing for one line has been completed, if the value of the continuous number counter 14a is greater than 0, a coincidence code in which the value of the count value -1 is set in the length term of FIG. (S24, S2)
5) If the value of the continuous number counter 14a is 0, the process S25 is skipped, and the process proceeds to step S26, where the immediately preceding data storage unit 17 and the past data storage unit 1 are respectively executed.
All the pixel values in 8 are initialized to 0, the continuous number counter 14a in the immediately preceding data comparison means 14 is initialized to 0, and the pixel number counter 11a is set to 1. Then, the process proceeds to step S2 to process the next pixel value.
【0072】このように画像の1ライン分の画素値を処
理し終える毎に再度初期化することにより、圧縮率は多
少劣化することになるが、圧縮データの途中からの伸張
処理が高速に行える。以下、伸張時の処理について説明
する。As described above, when the pixel values for one line of the image are re-initialized each time the processing is completed, the compression ratio slightly deteriorates, but the decompression process from the middle of the compressed data can be performed at high speed. . Hereinafter, the processing at the time of decompression will be described.
【0073】図10は図8のデータ圧縮装置で生成され
た画像ファイル3中の圧縮画像を伸張するデータ伸張装
置の一例を示すブロック図である。本実施例のデータ伸
張装置5が図6のデータ伸張装置と相違するところは、
利用者入出力装置7からの伸張要求時、復元を開始した
いラインが指定された場合に、そのラインの頭出しを行
い、そのライン以降の画素値から実際に復元を行う機能
を有する点にある。このため制御手段11内には、画素
カウンタ51a,ラインカウンタ51bおよび頭出し手
段51が設けられており、またデータ伸張装置の処理も
図11および図12に示すように変更されている。な
お、データ伸張装置5をCPUおよびメモリを有するコ
ンピュータで実現する場合、図11および図12に示さ
れる処理を記述した伸張プログラムがCD−ROM,半
導体メモリ,磁気ディスク等の機械読み取り可能な記録
媒体(図10のM2)に記録されており、その記録媒体
M2の伸張プログラムがコンピュータに読み取られ、コ
ンピュータの動作を制御することにより、そのコンピュ
ータを図10のデータ伸張装置5として機能させる。FIG. 10 is a block diagram showing an example of a data decompression device for decompressing a compressed image in the image file 3 generated by the data compression device of FIG. The difference between the data decompression device 5 of this embodiment and the data decompression device of FIG.
When a decompression request is made from the user input / output device 7, when a line to be restored is specified, the line is caught and the function for actually restoring from the pixel values after that line is provided. . Therefore, a pixel counter 51a, a line counter 51b, and a cueing unit 51 are provided in the control unit 11, and the processing of the data decompression device is changed as shown in FIGS. When the data decompression device 5 is realized by a computer having a CPU and a memory, a decompression program describing the processing shown in FIGS. 11 and 12 is stored in a machine-readable recording medium such as a CD-ROM, a semiconductor memory, or a magnetic disk. (M2 in FIG. 10), the decompression program of the recording medium M2 is read by the computer, and the computer is controlled so as to function as the data decompression device 5 in FIG.
【0074】以下、図6の実施例のデータ伸張装置との
差異を中心に本実施例の動作を説明する。Hereinafter, the operation of this embodiment will be described focusing on differences from the data decompression device of the embodiment of FIG.
【0075】復元対象となる圧縮データを格納する圧縮
ファイル3,復元画像を格納する復元ファイル6および
1ライン当たりの画素数L並びに必要に応じて復元開始
ライン番号mを指定した伸張要求が利用者入出力装置7
からデータ伸張装置5に入力されると、データ伸張装置
5の制御手段51の制御の下で、図11に示す処理が開
始される。なお、1ライン当たりの画素数は圧縮時に圧
縮ファイル3中に記録しておき、これを読み込むように
しても良い。また、復元開始ライン番号mは先頭ライン
を1番として指定する。例えば3番目のラインの場合、
m=3とする。The user receives a decompression request specifying the compressed file 3 for storing the compressed data to be decompressed, the decompressed file 6 for storing the decompressed image, the number of pixels L per line, and if necessary, the decompression start line number m. I / O device 7
11 is input to the data decompression device 5, the process shown in FIG. 11 is started under the control of the control unit 51 of the data decompression device 5. The number of pixels per line may be recorded in the compressed file 3 at the time of compression, and may be read. The restoration start line number m designates the first line as the first line. For example, for the third line,
Let m = 3.
【0076】まず制御手段51は、装置各部を初期化す
る(S51)。この処理で、直前データ記憶手段57及
び過去データ記憶手段58中の画素値がすべて0に初期
化されると共に、画素数カウンタ51aおよびラインカ
ウンタ51bも0に初期化される。First, the control means 51 initializes each section of the apparatus (S51). In this process, the pixel values in the immediately preceding data storage unit 57 and the past data storage unit 58 are all initialized to 0, and the pixel number counter 51a and the line counter 51b are also initialized to 0.
【0077】次に制御手段51は、復元開始ライン番号
の指定があったか否かを判定し(S52)、そのような
指定が有れば、頭出し手段51cによってステップS5
3〜S61の処理を実行した後に図12の処理へ進み、
そのような指定が無ければ直ちに図12の処理へ進む。Next, the control means 51 determines whether or not the restoration start line number has been designated (S52). If such designation has been made, the cueing means 51c causes the step S5 to proceed.
After executing the processing of 3 to S61, the process proceeds to the processing of FIG.
If there is no such designation, the process immediately proceeds to the process of FIG.
【0078】頭出し手段51cによる頭出し処理は、デ
ータ入力手段52により圧縮ファイル3の先頭の圧縮符
号から順に1符号ずつ読み出し(S53)、その圧縮符
号が一致符号であれば(S55でYES)、その一致符
号のレングス項の値+1の回数だけ画素数カウンタ51
aをインクリメントし(S56)、それ以外の圧縮符号
であれば画素数カウンタ51aを1だけインクリメント
していく(S57)。そして、インクリメント後の画素
数カウンタ51aのカウント値が1ライン分の画素数L
−1に達したら、ラインカウンタ51bを1だけインク
リメントしていき(S58,S59)、ラインカウンタ
51bのカウント値が復元開始ライン番号m−1に達し
たら(S60でYES)、頭出し完了となる。符号の種
類を判別し復元される画素数を計算するだけで、実際の
画素値の復元は行わないので、頭出しは高速に行える。
なお、ステップS60でYESと判断される前に、最後
の圧縮符号まで処理されたときは(S54でYES)、
復元開始ライン番号の指定に誤りがあったことになり、
利用者入出力装置7にエラーメッセージを出力する(S
61)。In the cueing process by the cueing means 51c, the data input means 52 reads out one code at a time from the first compression code of the compressed file 3 (S53), and if the compression code is a coincidence code (YES in S55). , The number-of-pixels counter 51 for the number of times of the value of the length term of the matching code + 1
a is incremented (S56), and for other compression codes, the pixel number counter 51a is incremented by 1 (S57). Then, the count value of the pixel number counter 51a after the increment is equal to the pixel number L for one line.
When the count reaches -1, the line counter 51b is incremented by 1 (S58, S59). When the count value of the line counter 51b reaches the restoration start line number m-1 (YES in S60), the cueing is completed. . Only the type of code is determined and the number of pixels to be restored is calculated, but the actual pixel value is not restored.
Note that if the processing up to the last compression code has been performed before YES is determined in step S60 (YES in S54),
The restoration start line number was specified incorrectly.
An error message is output to the user input / output device 7 (S
61).
【0079】図12の処理は、図7の処理とほぼ同じで
ある。但し、圧縮時、1ライン毎に直前の画素値および
過去データが初期化されているため、伸張時も、画素カ
ウンタ51aを用いて復元画素数をカウントし(S7
1,S73)、1ラインの最後の画素まで復元し終えた
ら(S72,S74でYES)、ステップS31に戻っ
て、直前データ記憶手段57及び過去データ記憶手段5
8中の画素値をすべて0に初期化すると共に、画素数カ
ウンタ51aを0に初期化する。The processing in FIG. 12 is almost the same as the processing in FIG. However, at the time of compression, since the immediately preceding pixel value and past data are initialized for each line, the number of restored pixels is counted using the pixel counter 51a also at the time of decompression (S7).
(1, S73) When the restoration to the last pixel of one line is completed (YES in S72, S74), the process returns to step S31, and the immediately preceding data storage unit 57 and the past data storage unit 5
All the pixel values in 8 are initialized to 0, and the pixel counter 51a is initialized to 0.
【0080】図8および図10の実施例では、任意のラ
インの先頭からの復元を可能としたが、任意のラインの
任意の行からの復元を可能にすることもできる。その場
合、復元開始ライン番号以外に復元開始行番号を指定
し、指定された復元開始ラインに頭出しした後、復元開
始行の直前までの画素値は出力せずに直前画素値および
過去データとして記憶するのに止め、復元開始行の画素
から実際に復元ファイル6に出力する通常処理を行う。In the embodiment shown in FIGS. 8 and 10, the restoration from the head of an arbitrary line is enabled. However, the restoration from an arbitrary line of an arbitrary line is also possible. In this case, a restoration start line number is specified in addition to the restoration start line number, and after cueing to the specified restoration start line, the pixel values immediately before the restoration start line are not output, but as the immediately preceding pixel value and the past data. Normal processing for actually outputting the restored file 6 from the pixel on the restoration start line is performed instead of storing.
【0081】[0081]
【発明の効果】以上説明したように本発明によれば以下
のような効果を得ることができる。As described above, according to the present invention, the following effects can be obtained.
【0082】一致符号,差分符号,インデックス符号お
よび即値符号の合計4種類の符号を使い分け、圧縮対象
となるデータ群の先頭から順に1データ毎に、圧縮後の
データ量がより少なくなる符号を選択してデータの圧縮
を行うため、様々な種類の画像に対して従来方法のうち
最も高い圧縮率となる圧縮方法と遜色ない圧縮率を得る
ことができる。A total of four kinds of codes, a match code, a difference code, an index code, and an immediate code, are selectively used, and a code that reduces the amount of data after compression is selected for each data in order from the beginning of the data group to be compressed. Since the data is compressed in such a manner, it is possible to obtain a compression rate comparable to that of the conventional method which provides the highest compression rate for various types of images.
【0083】全ての種類の符号をバイト単位の符号とす
る構成にあっては、ビット単位でのデータ処理が不要に
なり、その分、処理量が低減する。In a configuration in which all kinds of codes are codes in byte units, data processing in bit units becomes unnecessary, and the processing amount is reduced accordingly.
【0084】予め定められた画素数の処理を終える毎に
直前の画素値や過去データなどを初期化する構成にあっ
ては、伸張時、圧縮データの途中からの伸張処理を高速
に行うことができる。In a configuration in which the immediately preceding pixel value or past data is initialized each time the processing of a predetermined number of pixels is completed, at the time of decompression, decompression processing from the middle of compressed data can be performed at high speed. it can.
【図1】本発明を適用したデータ圧縮装置の一例を示す
ブロック図である。FIG. 1 is a block diagram illustrating an example of a data compression device to which the present invention has been applied.
【図2】過去データ記憶手段の構成例を示す図である。FIG. 2 is a diagram illustrating a configuration example of a past data storage unit.
【図3】本発明の実施例で使用される圧縮符号のフォー
マット例である。FIG. 3 is a format example of a compression code used in an embodiment of the present invention.
【図4】図1のデータ圧縮装置の処理例を示すフローチ
ャートである。FIG. 4 is a flowchart illustrating a processing example of the data compression device in FIG. 1;
【図5】幾つかの画像について本発明の実施例によるデ
ータ圧縮方法および従来方法を使って実際に圧縮した場
合の圧縮率の測定例を示す図である。FIG. 5 is a diagram illustrating a measurement example of a compression ratio when some images are actually compressed using the data compression method according to the embodiment of the present invention and the conventional method.
【図6】本発明を適用したデータ伸張装置の一例を示す
ブロック図である。FIG. 6 is a block diagram illustrating an example of a data decompression device to which the present invention has been applied.
【図7】図6のデータ伸張装置の処理例を示すフローチ
ャートである。FIG. 7 is a flowchart illustrating a processing example of the data decompression device of FIG. 6;
【図8】本発明を適用したデータ圧縮装置の別の例を示
すブロック図である。FIG. 8 is a block diagram showing another example of the data compression device to which the present invention is applied.
【図9】図8のデータ処理装置の処理例を示すフローチ
ャートである。FIG. 9 is a flowchart illustrating a processing example of the data processing device of FIG. 8;
【図10】本発明を適用したデータ伸張装置の別の例を
示すブロック図である。FIG. 10 is a block diagram showing another example of a data decompression device to which the present invention is applied.
【図11】図10のデータ伸張装置の処理例を示すフロ
ーチャートである。FIG. 11 is a flowchart illustrating a processing example of the data decompression device of FIG. 10;
【図12】図10のデータ伸張装置の処理例を示すフロ
ーチャートである。FIG. 12 is a flowchart illustrating a processing example of the data decompression device of FIG. 10;
1…データ圧縮装置 11…制御手段 12…データ入力手段 13…データ出力手段 14…直前データ比較手段 14a…連続数カウンタ 15…過去データ比較手段 16…差分取得手段 17…直前データ記憶手段 18…過去データ記憶手段 2…画像ファイル 3…圧縮ファイル 4,7…利用者入出力装置 5…データ伸張装置 6…復元ファイル DESCRIPTION OF SYMBOLS 1 ... Data compression device 11 ... Control means 12 ... Data input means 13 ... Data output means 14 ... Previous data comparison means 14a ... Continuous number counter 15 ... Past data comparison means 16 ... Difference acquisition means 17 ... Previous data storage means 18 ... Past Data storage means 2 ... Image file 3 ... Compressed file 4,7 ... User input / output device 5 ... Data decompression device 6 ... Decompression file
フロントページの続き (58)調査した分野(Int.Cl.6,DB名) G06T 1/00 H03M 7/30 - 7/50 H04N 1/41 - 1/419 Continuation of the front page (58) Field surveyed (Int.Cl. 6 , DB name) G06T 1/00 H03M 7/30-7/50 H04N 1/41-1/419
Claims (9)
る回数を設定した一致符号と、直前のデータ値との差分
を設定した差分符号と、過去データ記憶手段に記憶され
た処理済のデータ値のインデックス番号を設定したイン
デックス符号と、データ値そのものを設定した即値符号
との合計4種類の符号を使用し、圧縮対象となるデータ
群の先頭から順に1データ毎に、圧縮後のデータ量がよ
り少なくなる符号を選択してデータの圧縮を行うように
したことを特徴とするデータ圧縮方法。1. A matching code that sets the number of times the same data value as the immediately preceding data value continues, a difference code that sets a difference between the immediately preceding data value, and processed data stored in the past data storage unit. Using a total of four types of codes, an index code that sets the index number of the value and an immediate code that sets the data value itself, the data amount after compression for each data in order from the top of the data group to be compressed A data compression method characterized by selecting a code having a smaller number of bits and compressing the data.
したことを特徴とする請求項1記載のデータ圧縮方法。2. The data compression method according to claim 1, wherein all kinds of codes are byte-based codes.
値が異なる複数種類の差分符号を使用することを特徴と
する請求項1または2記載のデータ圧縮方法。3. The data compression method according to claim 1, wherein a plurality of types of difference codes having different maximum difference values that can be set are used as the difference codes.
データ圧縮方法。 (a)直前データ記憶手段,過去データ記憶手段および
連続数カウンタを初期化するステップ (b)圧縮対象画像から1つの画素値を入力するステッ
プ (c)ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値とを比較するステップ (d)ステップcで比較一致のとき連続数カウンタをイ
ンクリメントすると共に、連続数カウンタが最大値に達
していれば連続回数を設定した一致符号を出力して連続
数カウンタを初期化した後、ステップbに戻るステップ (e)ステップcで比較不一致のとき、連続数カウンタ
が初期値以外であれば連続回数を設定した一致符号を出
力して連続数カウンタを初期化した後、過去に出現した
画素値をインデックス番号を付けて保持する過去データ
記憶手段を検索してステップbで入力された画素値と一
致する画素値のインデックス番号を求めるステップ (f)ステップeでインデックス番号が求められたと
き、インデックス番号を設定したインデックス符号を出
力すると共に、ステップbで入力された画素値を直前デ
ータ記憶手段に格納して、ステップbに戻るステップ (g)ステップeでインデックス番号が求まらなかった
とき、ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値との差分を求めるステップ (h)ステップbで入力された画素値を設定した即値符
号のサイズより小さなサイズの差分符号にステップgで
求められた差分を設定できるとき、ステップgで求めら
れた差分を設定した差分符号を出力し、そうでないとき
はステップbで入力された画素値を設定した即値符号を
出力し、ステップbで入力された画素値を直前データ記
憶手段に格納すると共に所定の格納方法で過去データ記
憶手段にも格納し、ステップbに戻るステップ4. A data compression method for compressing data by the following steps. (A) a step of initializing the immediately preceding data storage means, the past data storage means, and the continuous number counter (b) a step of inputting one pixel value from the image to be compressed (c) a pixel value input in step b and the immediately preceding data A step of comparing the pixel value stored in the storage means with the pixel value stored in the storage means. (D) In the case of a comparison match in step c, the continuous number counter is incremented. Return to step b after outputting and initializing the continuous number counter. (E) If the comparison does not match in step c, and if the continuous number counter is other than the initial value, then output a coincidence code that sets the number of consecutive times. After initializing the number counter, the past data storage means for holding the pixel values which appeared in the past with an index number is stored and inputted in step b. (F) When an index number is obtained in step e, an index code in which an index number is set is output, and the pixel value input in step b is obtained. (G) when the index number is not determined in step e, the pixel value input in step b and the pixel value stored in the immediately preceding data storage means are stored. (H) When the difference obtained in step g can be set to a difference code having a size smaller than the size of the immediate code in which the pixel value input in step b is set, the difference obtained in step g is The set difference code is output, and if not, an immediate code that sets the pixel value input in step b is output. The pixel values input in flop b also stored in the historical data storage means by a predetermined storage method stores just before the data storage means, the flow returns to step b step
える毎に、連続数カウンタが初期値以外であれば連続回
数を設定した一致符号を出力すると共に直前データ記憶
手段,過去データ記憶手段および連続数カウンタを初期
化して、ステップbに戻るステップを更に有することを
特徴とする請求項4記載のデータ圧縮方法。5. (i) Each time the processing of a predetermined number of pixels is completed, if the number-of-continuations counter is other than the initial value, a coincidence code in which the number of continuations is set is output. 5. The data compression method according to claim 4, further comprising the step of initializing the means and the continuous number counter and returning to step b.
とを特徴とする請求項4または5記載のデータ圧縮方
法。6. The data compression method according to claim 4, wherein each of the codes is a code in a byte unit.
値が異なる複数種類の差分符号を使用することを特徴と
する請求項4,5または6記載のデータ圧縮方法。7. The data compression method according to claim 4, wherein a plurality of types of difference codes having different maximum difference values that can be set are used as the difference codes.
せる圧縮プログラムを記録した機械読み取り可能な記録
媒体。 (a)直前データ記憶手段,過去データ記憶手段および
連続数カウンタを初期化するステップ (b)圧縮対象画像から1つの画素値を入力するステッ
プ (c)ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値とを比較するステップ (d)ステップcで比較一致のとき連続数カウンタをイ
ンクリメントすると共に、連続数カウンタが最大値に達
していれば連続回数を設定した一致符号を出力して連続
数カウンタを初期化した後、ステップbに戻るステップ (e)ステップcで比較不一致のとき、連続数カウンタ
が初期値以外であれば連続回数を設定した一致符号を出
力して連続数カウンタを初期化した後、過去に出現した
画素値をインデックス番号を付けて保持する過去データ
記憶手段を検索してステップbで入力された画素値と一
致する画素値のインデックス番号を求めるステップ (f)ステップeでインデックス番号が求められたと
き、インデックス番号を設定したインデックス符号を出
力すると共に、ステップbで入力された画素値を直前デ
ータ記憶手段に格納して、ステップbに戻るステップ (g)ステップeでインデックス番号が求まらなかった
とき、ステップbで入力された画素値と直前データ記憶
手段に記憶された画素値との差分を求めるステップ (h)ステップbで入力された画素値を設定した即値符
号のサイズより小さなサイズの差分符号にステップgで
求められた差分を設定できるとき、ステップgで求めら
れた差分を設定した差分符号を出力し、そうでないとき
はステップbで入力された画素値を設定した即値符号を
出力し、ステップbで入力された画素値を直前データ記
憶手段に格納すると共に所定の格納方法で過去データ記
憶手段にも格納し、ステップbに戻るステップ8. A machine-readable recording medium on which a compression program for causing a computer to execute the following steps is recorded. (A) a step of initializing the immediately preceding data storage means, the past data storage means, and the continuous number counter (b) a step of inputting one pixel value from the image to be compressed (c) a pixel value input in step b and the immediately preceding data A step of comparing the pixel value stored in the storage means with the pixel value stored in the storage means. (D) In the case of a comparison match in step c, the continuous number counter is incremented. Return to step b after outputting and initializing the continuous number counter. (E) If the comparison does not match in step c, and if the continuous number counter is other than the initial value, then output a coincidence code that sets the number of consecutive times. After initializing the number counter, the past data storage means for holding the pixel values which appeared in the past with an index number is stored and inputted in step b. (F) When an index number is obtained in step e, an index code in which an index number is set is output, and the pixel value input in step b is obtained. (G) when the index number is not determined in step e, the pixel value input in step b and the pixel value stored in the immediately preceding data storage means are stored. (H) When the difference obtained in step g can be set to a difference code having a size smaller than the size of the immediate code in which the pixel value input in step b is set, the difference obtained in step g is The set difference code is output, and if not, an immediate code that sets the pixel value input in step b is output. The pixel values input in flop b also stored in the historical data storage means by a predetermined storage method stores just before the data storage means, the flow returns to step b step
行させることを特徴とする請求項8記載の圧縮プログラ
ムを記録した機械読み取り可能な記録媒体。 (i)予め定められた画素数の処理を終える毎に、連続
数カウンタが初期値以外であれば連続回数を設定した一
致符号を出力すると共に直前データ記憶手段,過去デー
タ記憶手段および連続数カウンタを初期化して、ステッ
プbに戻るステップ9. A machine-readable recording medium recording a compression program according to claim 8, further causing the computer to execute the following steps. (I) Every time the processing of a predetermined number of pixels is completed, if the continuous number counter is other than the initial value, a coincidence code in which the number of continuous times is set is output, and the immediately preceding data storage means, past data storage means, and continuous number counter are output. To initialize and return to step b
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP10017935A JP2885235B1 (en) | 1998-01-14 | 1998-01-14 | Data compression method and machine readable recording medium recording compression program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP10017935A JP2885235B1 (en) | 1998-01-14 | 1998-01-14 | Data compression method and machine readable recording medium recording compression program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2885235B1 true JP2885235B1 (en) | 1999-04-19 |
JPH11203457A JPH11203457A (en) | 1999-07-30 |
Family
ID=11957646
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP10017935A Expired - Fee Related JP2885235B1 (en) | 1998-01-14 | 1998-01-14 | Data compression method and machine readable recording medium recording compression program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2885235B1 (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7321623B2 (en) | 2002-10-01 | 2008-01-22 | Avocent Corporation | Video compression system |
US9560371B2 (en) | 2003-07-30 | 2017-01-31 | Avocent Corporation | Video compression system |
KR100728918B1 (en) | 2005-04-21 | 2007-06-15 | 삼성전자주식회사 | Method and apparatus for high speed compression of binary image, Method and apparatus for high speed restoration of binary image, System and method for high speed compression and restoration of binary image |
US8718147B2 (en) * | 2006-02-17 | 2014-05-06 | Avocent Huntsville Corporation | Video compression algorithm |
US7555570B2 (en) | 2006-02-17 | 2009-06-30 | Avocent Huntsville Corporation | Device and method for configuring a target device |
MY149291A (en) * | 2006-04-28 | 2013-08-30 | Avocent Corp | Dvc delta commands |
JP2010154156A (en) * | 2008-12-25 | 2010-07-08 | Casio Electronics Co Ltd | Data compressing apparatus |
JP5499894B2 (en) * | 2010-05-14 | 2014-05-21 | 株式会社リコー | Image processing apparatus and image processing method |
US8427301B2 (en) | 2010-06-24 | 2013-04-23 | Avocent Corporation | System and method for identifying electrical equipment using wireless receivers |
-
1998
- 1998-01-14 JP JP10017935A patent/JP2885235B1/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH11203457A (en) | 1999-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5710719A (en) | Apparatus and method for 2-dimensional data compression | |
JP2002507354A (en) | Visually lossless image compression scheme based on efficient lookup table | |
JP2802694B2 (en) | Image reproducing apparatus and method | |
JP2885235B1 (en) | Data compression method and machine readable recording medium recording compression program | |
EP0678986B1 (en) | Data compression method and system | |
JPH10500273A (en) | Video image color encoding | |
US6956511B2 (en) | Multi-symbol/coefficient decode operation for Huffman codes | |
JP4189443B2 (en) | Graphics image compression and decompression method | |
US6404927B1 (en) | Control point generation and data packing for variable length image compression | |
JPH11308465A (en) | Color image encoding method and encoding device thereof, color image decoding method and decoding device thereof | |
USRE45300E1 (en) | Context-adaptive variable length coder with simultaneous storage of incoming data and generation of syntax elements | |
JP3434088B2 (en) | Image data conversion device and its inverse conversion device | |
US6650259B1 (en) | Character table implemented data decompression method and apparatus | |
JP5070086B2 (en) | Data compression apparatus and image reading apparatus | |
US6501395B1 (en) | System, method and computer readable medium for compressing a data sequence | |
JP2965084B2 (en) | Image data compression method | |
KR100530654B1 (en) | Method for compressing image data | |
JP2564749B2 (en) | Data compression method | |
JP2001217722A (en) | Device and method for encoding information, and computer readable storage medium | |
JP3143029B2 (en) | Data compression method and device, and data decompression method and device | |
JPH0621827A (en) | Data compressor and its method | |
JP3143030B2 (en) | Data compression method and device, and data decompression method and device | |
JP2806169B2 (en) | Compressed data decompression device | |
JPH0730764A (en) | Method and device for compression | |
Razavi et al. | Low-cost still-picture compression chip set |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080212 Year of fee payment: 9 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090212 Year of fee payment: 10 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100212 Year of fee payment: 11 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100212 Year of fee payment: 11 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110212 Year of fee payment: 12 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110212 Year of fee payment: 12 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120212 Year of fee payment: 13 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120212 Year of fee payment: 13 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130212 Year of fee payment: 14 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130212 Year of fee payment: 14 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140212 Year of fee payment: 15 |
|
LAPS | Cancellation because of no payment of annual fees |