JP4493551B2 - Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program - Google Patents

Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program Download PDF

Info

Publication number
JP4493551B2
JP4493551B2 JP2005170122A JP2005170122A JP4493551B2 JP 4493551 B2 JP4493551 B2 JP 4493551B2 JP 2005170122 A JP2005170122 A JP 2005170122A JP 2005170122 A JP2005170122 A JP 2005170122A JP 4493551 B2 JP4493551 B2 JP 4493551B2
Authority
JP
Japan
Prior art keywords
data
encoding
predetermined
counter
detected
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
Application number
JP2005170122A
Other languages
Japanese (ja)
Other versions
JP2006345320A (en
Inventor
隆志 石川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Olympus Imaging Corp
Original Assignee
Olympus Imaging Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Olympus Imaging Corp filed Critical Olympus Imaging Corp
Priority to JP2005170122A priority Critical patent/JP4493551B2/en
Publication of JP2006345320A publication Critical patent/JP2006345320A/en
Application granted granted Critical
Publication of JP4493551B2 publication Critical patent/JP4493551B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Description

本発明は、符号化テーブルに基づいてデータを符号化または復号化するデータ符号化装置、データ復号化装置、データ符号化方法、データ復号化方法、プログラムに関する。   The present invention relates to a data encoding device, a data decoding device, a data encoding method, a data decoding method, and a program for encoding or decoding data based on an encoding table.

デジタルカメラ等の撮像装置では、例えば一眼レフレックスタイプの機種などにおいて、RAWデータと呼ばれる撮像データを記録媒体に記録することが行われている。このRAWデータは、撮像素子から得られる画像信号に簡単なアナログ処理を施した後にデジタルデータに変換しただけのものである。ところで、近年、デジタルカメラの撮像素子の高画素化が進んでいるために、こうしたRAWデータのデータサイズが大きくなってきている。従って、RAWデータに圧縮処理を行って、データサイズの縮小を図っているデジタルカメラも存在している。ただし、RAWデータは、ユーザによりレタッチされることが想定されるものであり、圧縮処理を行う場合にはロスレス(Lossless)圧縮であることが望ましい。   In an imaging apparatus such as a digital camera, for example, in a single-lens reflex type model, imaging data called RAW data is recorded on a recording medium. This RAW data is simply converted into digital data after performing simple analog processing on the image signal obtained from the image sensor. By the way, in recent years, as the number of pixels of an image sensor of a digital camera is increasing, the data size of such RAW data is increasing. Accordingly, there are digital cameras that perform compression processing on RAW data to reduce the data size. However, it is assumed that the RAW data is retouched by the user, and it is desirable to perform lossless compression when performing compression processing.

圧縮方式は、一般に、圧縮率が高いことが望まれるが、デジタルカメラ等の撮像装置に適用される圧縮方式の場合には、単体のパーソナルコンピュータ等に適用される圧縮方式の場合と異なって、仕様上の制限等から、さらに幾つかの望ましい条件があり、例えば以下のようになっている。
(1)処理時間が短いこと
(2)処理に要するバッファ量が小さいこと
The compression method is generally desired to have a high compression rate, but in the case of a compression method applied to an imaging device such as a digital camera, unlike the compression method applied to a single personal computer or the like, There are some more desirable conditions due to the restrictions on the specifications and the like, for example, as follows.
(1) Processing time is short (2) Buffer amount required for processing is small

これらの内の条件(1)は、例えば、連写性能や、バッテリの消耗などに関連する条件である。また、条件(2)は、デジタルカメラのコストやサイズ、重量などに関連する条件となっている。   The condition (1) among these is a condition related to, for example, continuous shooting performance and battery consumption. Condition (2) is a condition related to the cost, size, weight, etc. of the digital camera.

しかし、条件(1)と条件(2)とをともに満足させようとすると、今度は、圧縮性能が低下してしまう可能性が高くなる。   However, if both the condition (1) and the condition (2) are satisfied, the compression performance is likely to deteriorate.

ところで、符号化には様々な方式があるが、JPEG等における画像圧縮などに用いられているハフマン符号化は、よく知られた可変長符号化方式の1つである。このハフマン符号化を行う際には、適切な符号化テーブルを用いることにより、より効率的な圧縮を行うことが可能であるために、符号化テーブルをどのように選択するかについて、従来より種々の提案がなされている。   By the way, although there are various encoding methods, Huffman encoding used for image compression in JPEG or the like is one of well-known variable length encoding methods. When performing this Huffman coding, since it is possible to perform more efficient compression by using an appropriate coding table, there are various methods for selecting a coding table. Proposals have been made.

例えば、特開平9−65334号公報には、符号化テーブルを、零係数信号の割合に基づいて選択する技術が記載されている。従って、該公報に記載の技術は、零係数信号の割合が大きい場合、例えば、量子化を伴うロッシー(Lossy)な圧縮方式の場合などに、高い圧縮率を達成することができると考えられる。
特開平9−65334号公報
For example, Japanese Patent Laid-Open No. 9-65334 describes a technique for selecting an encoding table based on the ratio of zero coefficient signals. Therefore, it is considered that the technique described in the publication can achieve a high compression rate when the ratio of the zero coefficient signal is large, for example, in the case of a lossy compression method with quantization.
JP-A-9-65334

しかしながら、ロスレス圧縮においては、零係数信号の割合が比較的小さい場合が多いために、特開平9−65334号公報に記載されたような零係数のみに基づく技術では、選択すべき符号化テーブルを高精度に判定することは困難である。さらに、該公報に記載されたような零係数信号の割合に基づいて評価する技術では、画像ブロック内における零係数以外の値に対する符号化効率(圧縮効率)が考慮されていないために、特にエッジを含む画像ブロックに対する処理を行う場合には、符号化効率が極端に低下する可能性がある。   However, in lossless compression, the ratio of the zero coefficient signal is often relatively small. Therefore, in the technique based only on the zero coefficient as described in JP-A-9-65334, the encoding table to be selected is not selected. It is difficult to determine with high accuracy. Further, in the technique for evaluating based on the ratio of the zero coefficient signal as described in the publication, since the coding efficiency (compression efficiency) with respect to a value other than the zero coefficient in the image block is not taken into consideration, the edge particularly When processing is performed on an image block including “”, the encoding efficiency may be extremely reduced.

従って、ロッシーな圧縮だけでなく、ロスレスな圧縮においても、上述した条件(1)および条件(2)を満たしながら、高い圧縮性能を発揮し得る圧縮方式が望まれている。   Therefore, not only lossy compression but also lossless compression, a compression method that can exhibit high compression performance while satisfying the above conditions (1) and (2) is desired.

本発明は上記事情に鑑みてなされたものであり、処理時間が短く、必要なメモリ量が小さく、高い圧縮性能を発揮し得るデータ符号化装置、データ符号化方法、プログラムを提供することを目的としている。   The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a data encoding device, a data encoding method, and a program that have a short processing time, require a small amount of memory, and can exhibit high compression performance. It is said.

また、本発明は、上記圧縮されたデータを、短い処理時間、かつ、小さな必要なメモリ量で復号化し得るデータ復号化装置、データ復号化方法、プログラムを提供することを目的としている。   It is another object of the present invention to provide a data decoding apparatus, a data decoding method, and a program that can decode the compressed data with a short processing time and a small required memory amount.

上記の目的を達成するために、第1の発明によるデータ符号化装置は、予め設定された複数の符号化テーブルを記憶する符号化テーブル記憶手段と、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、上記ランセットカウンタにより検出したランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段と、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段と、を具備し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して、検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものである。 In order to achieve the above object, a data encoding apparatus according to a first invention comprises encoding table storage means for storing a plurality of preset encoding tables, and data values continuously within a predetermined range. detects the consecutive number of the data to be the run counter for successive number of said data repeating said detection for each reaches a predetermined number, the number of successive said data by the run counter reaches the predetermined number A lancet counter for detecting the number of lancets, which is the number of times the detection has been detected, and a plurality of encoding tables stored in the encoding table storage means according to the number of lancets detected by the lancet counter. A coding table selecting means for selecting any one of the coding tables, and a coding table selected by the coding table selecting means Based anda coding means for generating coded coded data the data, the above coding table, and a category representing the number significant bits of the data, the code word corresponding to this category, the corresponding The encoding means generates the encoded data by associating the code word with the significant bit part of the data, and the predetermined range can be set in a plurality of types. The run counter detects, for each of a plurality of set predetermined ranges, the number of consecutive data whose data values are continuously within the predetermined range, and The detection is repeatedly performed every time the continuous number reaches a predetermined number, and the lancet counter indicates that the continuous number of the data detected by the ran counter has reached the predetermined number. The number of detected lancets is detected corresponding to each of the plurality of types of predetermined ranges, and the encoding table selection means uses the lancet counter to detect the plurality of types of predetermined ranges. One of the plurality of encoding tables stored in the encoding table storage means is selected according to the number of lancets detected corresponding to each of the above .

また、第2の発明によるデータ符号化装置は、上記第1の発明によるデータ符号化装置において、過去に読み出された符号化対象データに基づき注目する符号化対象データを予測し予測データを算出する予測手段と、注目する符号化対象データと上記予測手段により算出された予測データとの差分をとることにより予測誤差データを生成する予測誤差演算手段と、をさらに具備し、上記データは、上記予測誤差演算手段により生成された予測誤差データである。   The data encoding apparatus according to the second invention is the data encoding apparatus according to the first invention, wherein the encoding target data to be noticed is predicted based on the encoding target data read in the past, and the prediction data is calculated. A prediction error calculating means for generating prediction error data by taking a difference between the target encoding target data and the prediction data calculated by the prediction means. This is prediction error data generated by the prediction error calculation means.

の発明によるデータ符号化装置は、上記第の発明によるデータ符号化装置において、上記所定の範囲が、上記データの絶対値が所定の閾値以下となる範囲であり、上記ランカウンタは、設定された複数種類の閾値のそれぞれに対して、データの絶対値が連続して該所定の閾値以下となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものである。 In the data encoding device according to a third invention, in the data encoding device according to the first invention, the predetermined range is a range in which an absolute value of the data is a predetermined threshold value or less, and the run counter is For each of a plurality of set thresholds, the continuous number of data in which the absolute value of the data is continuously less than or equal to the predetermined threshold is detected , and each time the continuous number of data reaches the predetermined number This detection is repeated .

の発明によるデータ符号化装置は、上記第の発明によるデータ符号化装置において、上記符号化テーブル記憶手段が、最も符号長の短い符号語が割り当てられるカテゴリが異なる複数の符号化テーブルを記憶するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の閾値のそれぞれに対応して検出された上記ランセットの数が所定数以上であるか否かを各々判定し、所定数以上となった最も低い閾値が、低いときには平坦度が高く、高いときには平坦度が低いと判定し、平坦度が高いときには平坦度が低いときに比して、最も符号長の短い符号語が割り当てられるカテゴリがより小さい有意ビット数を表すカテゴリとなる符号化テーブルを選択するものである。 A data encoding device according to a fourth invention is the data encoding device according to the third invention, wherein the encoding table storage means includes a plurality of encoding tables having different categories to which a codeword having the shortest code length is assigned. is intended to store, the coding table selection means, the number of the lancet that has been detected in correspondence with each of the plurality of types of threshold determined each to or greater than the predetermined number by the lancet counter, A codeword with the shortest code length is judged to have a high flatness when the lowest threshold value which is equal to or greater than a predetermined number is low, and a low flatness when the threshold is high, and when the flatness is high, the flatness is low. An encoding table is selected in which the category to which is assigned is a category representing a smaller number of significant bits.

の発明によるデータ符号化装置は、上記第1の発明によるデータ符号化装置において、上記符号化テーブル選択手段により選択された符号化テーブルの種類を示す情報と、上記符号化手段により生成された符号化データと、は一のファイルとして出力されるものである。 A data encoding device according to a fifth invention is the data encoding device according to the first invention, wherein the data encoding device is generated by the encoding means and information indicating the type of the encoding table selected by the encoding table selection means. The encoded data is output as one file.

の発明によるデータ符号化方法は、ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップと、ランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと、符号化テーブル選択手段により、上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する第3ステップと、符号化手段により、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する第4ステップと、を有し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記第4ステップは、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記第1ステップは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記第2ステップは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記第3ステップは、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択して符号化データを生成する方法である。 In the data encoding method according to the sixth aspect of the invention, the run counter detects the continuous number of the data whose data values are continuously within a predetermined range, and each time the continuous number of the data reaches the predetermined number. A first step of repeatedly performing the detection; a second step of detecting by the lancet counter the number of lancets that is the number of times that the continuation number of the data has been detected by the lance counter ; A third step of selecting any one of a plurality of preset encoding tables stored in accordance with the number of lancets detected by the lancet counter by the encoding table selecting means; by means, to generate encoded data by encoding the data based on the selected coding table by the coding table selection means A fourth step, the, above coding table is obtained by a category representing the number significant bits of the data, the code word corresponding to this category, the correspondence to the table, the fourth step Is to generate encoded data by associating the codeword with a significant bit part of the data, and the predetermined range can be set in plural types, and the first step is set For each of a plurality of types of predetermined ranges, the continuous number of the data in which the data value is continuously within the predetermined range is detected, and the detection is performed every time the continuous number of the data reaches the predetermined number. In the second step, the number of lancets, which is the number of times that the continuous number of the data detected by the run counter has been detected to reach the predetermined number, is determined by the plurality of types. The third step is performed in advance according to the number of lancets detected by the lancet counter corresponding to each of the predetermined ranges. This is a method for generating encoded data by selecting any one of a plurality of encoding tables that are set and stored .

の発明によるプログラムは、コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段、として機能させるためのプログラムであって、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするプログラムである。 A program according to a seventh invention causes a computer to detect the number of continuous data whose data values are continuously within a predetermined range and repeat the detection every time the number of continuous data reaches a predetermined number. A lancet counter for detecting the number of lancets, which is the number of times the continuation of the data has been detected to have reached the predetermined number, and the number of lancets detected by the lancet counter. In response, the encoding table selection means for selecting any one of the plurality of encoding tables that are set and stored in advance, and the encoding table selected based on the encoding table selected by the encoding table selection means a program for causing a data encoding means for generating encoded coded data as, the code The table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category, and the encoding means includes the significant bit portion of the code word and the data. , And a plurality of types of the predetermined ranges can be set, and the run counter is configured to generate data for each of the set types of predetermined ranges. The continuation value is continuously within a predetermined range, and the detection is repeated every time the continuous number of data reaches the predetermined number. The number of lancets, which is the number of times that it has been detected that the number of consecutive data detected by the counter has reached the predetermined number, corresponds to each of the plurality of predetermined ranges. The encoding table selection means includes a plurality of codes set and stored in advance according to the number of lancets detected by the lancet counter corresponding to each of the plurality of types of predetermined ranges. A program characterized by selecting any one of the encoding tables .

の発明によるデータ復号化装置は、予め設定された複数の符号化テーブルを記憶する符号化テーブル記憶手段と、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、上記ランセットカウンタにより検出したランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段と、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段と、を具備し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して、検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするデータ符号化装置によって生成された符号化データ、を復号化するためのデータ復号化装置であって、上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現する符号化テーブル再現手段と、上記符号化テーブル再現手段により再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する復号化手段と、を具備したものである。 According to an eighth aspect of the present invention, there is provided a data decoding device for detecting a coding table storage means for storing a plurality of preset coding tables and a continuous number of the data whose data values are continuously within a predetermined range. And a run counter for repeatedly performing the detection every time the continuous number of the data reaches a predetermined number, and the number of times that the continuous number of the data has been detected by the run counter. A lancet counter for detecting the number of lancets, and any one of the plurality of coding tables stored in the coding table storage means according to the number of lancets detected by the lancet counter and encoding table select means for selecting, coding the data based on the coding table selected by the coding table selection means Comprising encoding means for generating encoded data, and is the encoding table, a category that represents a significant number bits of the data, the code word corresponding to this category, the correspondence obtained by the table And the encoding means generates encoded data by associating the code word with a significant bit portion of the data, and the predetermined range can be set in plural types, and the run counter Detects, for each of a plurality of set predetermined ranges, the continuous number of the data in which the data value is continuously within the predetermined range, and the continuous number of the data reaches the predetermined number The lancet counter repeats the detection every time, and the lancet counter is a lancet that is the number of times that the continuous number of the data detected by the rancounter has reached the predetermined number. The encoding table selection means uses the lancet counter to correspond to each of the plurality of types of predetermined ranges. A data encoding device that selects one of the plurality of encoding tables stored in the encoding table storage unit according to the number of detected lancets. a data decoding apparatus for decoding encoded data, generated by, on the basis of information indicating the type of the selected code table, to reproduce the coding table used for coding Decoding for reproducing the data by decoding the encoded data based on the encoding table reproducing means and the encoding table reproduced by the encoding table reproducing means Means.

の発明によるデータ復号化方法は、ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップと、ランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと符号化テーブル選択手段により、上記ランセットカウンタにより検出したランセットの数に応じて予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する第3ステップと、符号化手段により、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する第4ステップと、を有し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記第4ステップは、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記第1ステップは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記第2ステップは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記第3ステップは、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするデータ符号化方法により生成された符号化データを復号化するためのデータ復号化方法であって、上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現し、再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する方法である。 In the data decoding method according to the ninth aspect of the invention, the run counter detects the continuous number of the data whose data values are continuously within a predetermined range, and each time the continuous number of the data reaches the predetermined number. a first step of repeating said detection, the lancet counter, a second step of the number of successive said data by the run counter to detect the number of the lancet which is the number of times that has been detected to have reached the predetermined number, the code A third step of selecting any one of a plurality of encoding tables preset and stored in accordance with the number of lancets detected by the lancet counter by an encoding table selecting means; Accordingly, to generate encoded data by encoding the data based on the coding table selected by the coding table selection means The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category. The fourth step includes The encoded data is generated by associating the code word with the significant bit portion of the data, and the predetermined range can be set in a plurality of types. For each of the predetermined ranges of types, the number of continuous data whose data values are continuously within the predetermined range is detected, and the detection is repeated each time the number of continuous data reaches the predetermined number. In the second step, the number of lancets, which is the number of times the continuous number of the data detected by the run counter has been detected to reach the predetermined number, is determined in the plurality of kinds of places. In the third step, the presetting is performed in accordance with the number of lancets detected by the lancet counter corresponding to each of the plurality of predetermined ranges. Data decoding for decoding encoded data generated by a data encoding method, wherein one of the plurality of stored encoding tables is selected . A method of reproducing the encoding table used for encoding based on the information indicating the type of the selected encoding table, and decoding the encoded data based on the reproduced encoding table; It is a method to reproduce data.

10の発明によるプログラムは、コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段として機能させるためのプログラムであって、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするプログラムによって生成された符号化データ、を復号化する処理をコンピュータに実行させるためのプログラムであって、上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現し、再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する処理をコンピュータに実行させるためのプログラムである。 A program according to a tenth aspect of the invention causes a computer to detect the continuous number of the data whose data values are continuously within a predetermined range, and repeat the detection every time the continuous number of the data reaches a predetermined number. A lancet counter for performing, a lancet counter for detecting the number of lancets that is the number of times the continuation of the data has been detected by the lance counter, and the number of lancets detected by the lancet counter According to the encoding table selection means for selecting any one of the plurality of encoding tables set and stored in advance, based on the encoding table selected by the encoding table selection means a program for causing the data encoded by encoding means for generating encoded data as, the The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category, and the encoding means is configured to determine whether the code word and the data are significant. The encoded data is generated by associating with the bit part, and the plurality of predetermined ranges can be set, and the run counter is set for each of the set predetermined ranges. , Detecting the continuous number of the data whose value continuously falls within a predetermined range, and repeatedly detecting the data every time the continuous number of the data reaches a predetermined number. The number of lancets, which is the number of times the number of consecutive data detected by the run counter is detected to reach the predetermined number, corresponds to each of the predetermined ranges of the plurality of types. The encoding table selection means is configured to detect a plurality of pre-set and stored in accordance with the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. A program for causing a computer to execute a process of decoding encoded data generated by a program characterized by selecting any one of the encoding tables . The encoding table used for encoding is reproduced based on the information indicating the type of the selected encoding table, and the encoded data is decoded and the data is reproduced based on the reproduced encoding table. A program for causing a computer to execute processing.

本発明のデータ符号化装置、データ符号化方法、プログラムによれば、短い処理時間、かつ、小さな必要なメモリ量で、高い圧縮性能を発揮することが可能となる。   According to the data encoding device, the data encoding method, and the program of the present invention, it is possible to exhibit high compression performance with a short processing time and a small required memory amount.

また、本発明のデータ復号化装置、データ復号化方法、プログラムによれば、上記圧縮されたデータを、短い処理時間、かつ、小さな必要なメモリ量で復号化することが可能となる。   In addition, according to the data decoding apparatus, data decoding method, and program of the present invention, the compressed data can be decoded with a short processing time and a small required memory amount.

以下、図面を参照して本発明の実施の形態を説明する。   Embodiments of the present invention will be described below with reference to the drawings.

[実施形態1]
図1から図21は本発明の実施形態1を示したものであり、図1はデータ符号化装置の構成を示すブロック図、図2はデータ復号化装置の構成を示すブロック図である。
[Embodiment 1]
FIG. 1 to FIG. 21 show Embodiment 1 of the present invention. FIG. 1 is a block diagram showing the configuration of the data encoding device, and FIG. 2 is a block diagram showing the configuration of the data decoding device.

図1に示すように、データ符号化装置1は、ブロック化部11と、予測部12と、減算器13と、絶対値化部14と、平坦度検出部15と、ハフマンテーブル選択部16と、ハフマン符号化部17と、を含んで構成されている。これらの内の、ブロック化部11には画像データが入力され、ハフマンテーブル選択部16からは選択された符号化テーブルの種類を示す情報として符号化テーブルデータが出力され、符号化手段たるハフマン符号化部17からは符号化データが出力されるようになっている。さらに、ハフマンテーブル選択部16は、後述するような予め設定された複数種類のハフマン符号化テーブルを記憶する符号化テーブル記憶手段となっており、また、符号化テーブル選択手段として機能することにより、これら複数種類のハフマン符号化テーブルから一のハフマン符号化テーブルを選択するようになっている。このデータ符号化装置1の詳細については、後で図4、図6〜図8等を参照しながら作用に沿って説明する。   As shown in FIG. 1, the data encoding device 1 includes a blocking unit 11, a prediction unit 12, a subtractor 13, an absolute value conversion unit 14, a flatness detection unit 15, and a Huffman table selection unit 16. And a Huffman encoder 17. Of these, image data is input to the block forming unit 11, and encoding table data is output from the Huffman table selection unit 16 as information indicating the type of the selected encoding table. The encoding unit 17 outputs encoded data. Further, the Huffman table selection unit 16 is a coding table storage unit that stores a plurality of types of preset Huffman coding tables as described later, and also functions as a coding table selection unit. One Huffman encoding table is selected from the plurality of types of Huffman encoding tables. Details of the data encoding device 1 will be described later along the operation with reference to FIGS. 4 and 6 to 8 and the like.

また、このデータ符号化装置1により圧縮されたデータは、図2に示すようなデータ復号化装置2により復号化されるようになっている。すなわち、データ復号化装置2は、符号化テーブル再現手段たる復号テーブル作成部21と、復号化手段たるハフマン復号化部22と、加算器23と、メモリ24と、予測部25と、を含んで構成されている。これらの内の、復号テーブル作成部21には符号化テーブルデータが入力され、ハフマン復号化部22には符号化データが入力され、加算器23からは画像データが出力されるようになっている。このデータ復号化装置2の詳細については、後で図5等を参照しながら作用に沿って説明する。   Further, the data compressed by the data encoding device 1 is decoded by a data decoding device 2 as shown in FIG. That is, the data decoding apparatus 2 includes a decoding table creation unit 21 as a coding table reproduction unit, a Huffman decoding unit 22 as a decoding unit, an adder 23, a memory 24, and a prediction unit 25. It is configured. Among these, the encoding table data is input to the decoding table creation unit 21, the encoding data is input to the Huffman decoding unit 22, and the image data is output from the adder 23. . The details of the data decoding device 2 will be described later along the operation with reference to FIG.

なお、図1、図2において、各ブロック間の相互の動作タイミングの調整は、図示しないタイミング調整回路により行うようになっている。   In FIG. 1 and FIG. 2, the adjustment of the mutual operation timing between the blocks is performed by a timing adjustment circuit (not shown).

さらに、データ符号化装置1の平坦度検出部15は、図3に示すように構成されている。図3は平坦度検出部の構成を示すブロック図である。   Furthermore, the flatness detection unit 15 of the data encoding device 1 is configured as shown in FIG. FIG. 3 is a block diagram illustrating a configuration of the flatness detection unit.

平坦度検出部15は、比較部31と、ランカウンタ32と、比較部33と、ランセットカウンタ34と、比較部35と、を含んで構成されている。これらの内の、比較部31には予測誤差データと閾値thとが入力され、ランカウンタ32には外部カウントリセット信号が入力され、比較部33には閾値th_runが入力され、ランセットカウンタ34には外部カウントリセット信号が入力され、比較部35には閾値th_run_setが入力されるようになっている。   The flatness detection unit 15 includes a comparison unit 31, a run counter 32, a comparison unit 33, a lancet counter 34, and a comparison unit 35. Among these, the prediction error data and the threshold th are input to the comparison unit 31, the external count reset signal is input to the run counter 32, the threshold th_run is input to the comparison unit 33, and the lancet counter 34 is input to the lancet counter 34. An external count reset signal is input, and the threshold value th_run_set is input to the comparison unit 35.

この平坦度検出部15の詳細についても、後で作用に沿って説明する。   The details of the flatness detection unit 15 will also be described later along the operation.

次に、図4はデータ符号化装置1による圧縮処理を示すフローチャート、図6は平坦度検出の処理の画素単位分の処理を示すフローチャート、図7は平坦度検出の処理のライン単位分の処理を示すフローチャート、図8は平坦度検出の処理のブロック単位分の処理を示すフローチャート、図9は画像データをブロックに分割する様子を示す図、図10はブロックの画素データの例を示す図、図11は注目画素と注目画素以前に読み出される近傍画素との配置を示す図、図12は図10の画素データから得られるブロックの予測誤差データを示す図、図13は図12の予測誤差データを絶対値化して得られる絶対値化された予測誤差データを示す図、図14は平坦度検出において用いられる各閾値や設定値を示す図表、図15は図13の絶対値化された予測誤差データに対して図14の各閾値や設定値を適用して得られる平坦度検出の結果を示す図表、図16は平坦度の高中低に応じて予め設定された符号化テーブルの例を示す図表、図17はハフマン符号の構造を示す図、図18は予測誤差データの一例を示す図、図19は図18の予測誤差データを符号化して得られるハフマン符号を示す図である。   Next, FIG. 4 is a flowchart showing compression processing by the data encoding device 1, FIG. 6 is a flowchart showing processing for pixel units of flatness detection processing, and FIG. 7 is processing for line units of flatness detection processing. FIG. 8 is a flowchart showing processing for each block unit of flatness detection processing, FIG. 9 is a diagram showing how image data is divided into blocks, and FIG. 10 is a diagram showing an example of pixel data of a block. 11 is a diagram showing the arrangement of the target pixel and neighboring pixels read before the target pixel, FIG. 12 is a diagram showing the prediction error data of the block obtained from the pixel data of FIG. 10, and FIG. 13 is the prediction error data of FIG. Fig. 14 is a diagram showing prediction error data converted into absolute values obtained by converting into absolute values, Fig. 14 is a chart showing threshold values and set values used in flatness detection, and Fig. 15 is an absolute value of Fig. 13. FIG. 16 is a chart showing the result of flatness detection obtained by applying the threshold values and setting values shown in FIG. 14 to the prediction error data, and FIG. 16 is a table of encoding tables set in advance according to the high, medium and low flatness. FIG. 17 is a diagram illustrating an example of prediction error data, FIG. 18 is a diagram illustrating an example of prediction error data, and FIG. 19 is a diagram illustrating a Huffman code obtained by encoding the prediction error data in FIG. .

この処理を開始すると、まず、ブロック化部11が、入力される画像データを図9に示すようにブロックに分割する(ステップS1)。この図9には、縦32×横56画素でなる画像データを、8×8画素でなるブロックに分割する例を示し、分割した結果、B1〜B28までの横7×縦4個のブロックが生成される。なお、ここでは1つの画像データを28個のブロックに分割し、かつ1ブロックを64画素で構成しているが、これに限るものではないために、ブロックの個数をより一般的にn個、ブロック内の画素数をより一般的にm個、であるとする。また、1つの画像データを複数に分割するに限るものではなく、画像データ全体を1つのブロックとして処理しても構わない。   When this process is started, first, the blocking unit 11 divides input image data into blocks as shown in FIG. 9 (step S1). FIG. 9 shows an example in which image data of 32 × 56 pixels is divided into blocks of 8 × 8 pixels. As a result of the division, 7 × 4 blocks from B1 to B28 are obtained. Generated. Here, one image data is divided into 28 blocks, and one block is composed of 64 pixels. However, the present invention is not limited to this, so the number of blocks is more generally n, Assume that the number of pixels in a block is more generally m. Further, the present invention is not limited to dividing one image data into a plurality of pieces, and the entire image data may be processed as one block.

次に、分割して得られた複数のブロックの内の1つのブロック(具体例としては、図10に示すように画素データが配列されたブロック)を処理対象として、予測部12が、ブロック内の画素の画素データを順に読み出しながら、ブロック内における注目画素の画素データを、ブロック内で既に読み出された画素データに基づき予測する(ステップS2)。ここで、図11に示すように、ブロック内における注目画素をxで示すとすると、この注目画素xよりも以前に読み出されるブロック内の画素は、例えば、注目画素xの左隣の画素aと、注目画素xの上隣の画素bと、注目画素xの左上隣の画素cと、である。なお、ここでは、画素の読み出し順序が、ブロック内のあるラインについて左端の画素から右端の画素へ向けて順に読み出し、そのラインの読み出しが終了したらブロック内の次のラインの読み出しを同様に行う場合を例に説明するが、読み出し順序はこれに限るものではない。   Next, the prediction unit 12 performs processing on one block (a specific example, a block in which pixel data is arranged as shown in FIG. 10) among a plurality of blocks obtained by the division. The pixel data of the pixel of interest in the block is predicted based on the pixel data that has already been read in the block (step S2). Here, as shown in FIG. 11, if the target pixel in the block is denoted by x, the pixel in the block read before the target pixel x is, for example, the pixel a next to the left of the target pixel x. The pixel b adjacent to the upper side of the target pixel x and the pixel c adjacent to the upper left side of the target pixel x. In this case, the pixel reading order is to sequentially read from the leftmost pixel to the rightmost pixel for a certain line in the block, and when the reading of the line is completed, the next line in the block is read in the same manner. However, the reading order is not limited to this.

そして、各画素a,b,cの画素値をそれぞれRa,Rb,Rcとし、注目画素xの予測値(予測データ)をPxとすると、予測値Pxは、このような画素データの空間相関性に基づいて、予測手段たる予測部12により、例えば次の数式1に示すような予測式を用いて算出される。
[数1]
Px=max(Ra,Rb) (Rc<min(Ra,Rb)のとき)
Px=min(Ra,Rb) (Rc>max(Ra,Rb)のとき)
Px=Ra+Rb−Rc (その他のとき)
ここに、記号max(x,y)は、xとyとの小さくない方の値をとることを意味し、記号min(x,y)は、xとyとの大きくない方の値をとることを意味しており、以下でも同様に用いることにする。
Then, assuming that the pixel values of the pixels a, b, and c are Ra, Rb, and Rc, respectively, and the predicted value (predicted data) of the target pixel x is Px, the predicted value Px is the spatial correlation of such pixel data. Based on the above, for example, the prediction unit 12 serving as a prediction unit calculates using a prediction formula as shown in the following Formula 1.
[Equation 1]
Px = max (Ra, Rb) (when Rc <min (Ra, Rb))
Px = min (Ra, Rb) (when Rc> max (Ra, Rb))
Px = Ra + Rb-Rc (at other times)
Here, the symbol max (x, y) means that the smaller value of x and y is taken, and the symbol min (x, y) takes the lesser value of x and y. This is also used in the following.

なお、ここでは、数式1に示すような、エッジ検出に適した予測式を用いる例を説明したが、適用可能な予測式はこれに限るものではなく、その他の種々の予測式を用いることも可能である。例えば、以下の数式2〜数式8を、予測式の幾つかの例として挙げる。まず、数式2は、注目画素の左隣の画素aの画素値Raを、注目画素xの予測値Pxとするものである。これは、水平方向の画素同士の相関性が高い場合に、精度の良い予測値を得ることができると考えられる。
[数2]
Px=Ra
In addition, although the example using the prediction formula suitable for edge detection like Formula 1 was demonstrated here, the applicable prediction formula is not restricted to this, Other various prediction formulas can also be used. Is possible. For example, the following formulas 2 to 8 are given as some examples of prediction formulas. First, Equation 2 sets the pixel value Ra of the pixel a adjacent to the left of the target pixel as the predicted value Px of the target pixel x. This is considered that a highly accurate prediction value can be obtained when the correlation between pixels in the horizontal direction is high.
[Equation 2]
Px = Ra

次に、数式3は、注目画素の上隣の画素bの画素値Rbを、注目画素xの予測値Pxとするものである。これは、垂直方向の画素同士の相関性が高い場合に、精度の良い予測値を得ることができると考えられる。
[数3]
Px=Rb
Next, Equation 3 sets the pixel value Rb of the pixel b above and below the target pixel as the predicted value Px of the target pixel x. This is considered that a highly accurate prediction value can be obtained when the correlation between pixels in the vertical direction is high.
[Equation 3]
Px = Rb

さらに、数式4は、注目画素の左上隣の画素cの画素値Rcを、注目画素xの予測値Pxとするものである。これは、左上から右下にかけての斜め方向の画素同士の相関性が高い場合に、精度の良い予測値を得ることができると考えられる。
[数4]
Px=Rc
Further, Equation 4 sets the pixel value Rc of the pixel c adjacent to the upper left of the target pixel as the predicted value Px of the target pixel x. This is considered that a highly accurate prediction value can be obtained when the correlation between pixels in the diagonal direction from the upper left to the lower right is high.
[Equation 4]
Px = Rc

そして、数式5は、注目画素xの左隣の画素aの画素値Raと注目画素xの上隣の画素bの画素値Rbとを加算し、そこから注目画素xの左上隣の画素cの画素値Rcを減算して、注目画素xの予測値Pxとするものである。これは、左上から右下にかけての斜め方向の画素の画素値の変化率に規則性がある場合に、精度の良い予測値を得ることができると考えられる。
[数5]
Px=Ra+Rb−Rc
Then, Formula 5 adds the pixel value Ra of the pixel a adjacent to the left of the pixel of interest x and the pixel value Rb of the pixel b adjacent to the upper side of the pixel of interest x, and from there, The pixel value Rc is subtracted to obtain the predicted value Px of the target pixel x. This is considered that an accurate predicted value can be obtained when there is regularity in the rate of change of the pixel value in the diagonal direction from the upper left to the lower right.
[Equation 5]
Px = Ra + Rb-Rc

加えて、数式6は、注目画素xの左隣の画素aの画素値Raに、注目画素xの上隣の画素bの画素値Rbから注目画素xの左上隣の画素cの画素値Rcを減算して2で割ったものを加算し、注目画素xの予測値Pxとするものである。これは、水平方向の画素の画素値の変化率に規則性がある場合に、精度の良い予測値を得ることができると考えられる。
[数6]
Px=Ra+{(Rb−Rc)/2}
In addition, Expression 6 calculates the pixel value Ra of the pixel a adjacent to the pixel of interest x to the pixel value Ra of the pixel b adjacent to the pixel of interest x from the pixel value Rb of the pixel b adjacent to the pixel of interest x. The value obtained by subtracting and dividing by 2 is added to obtain the predicted value Px of the target pixel x. This is considered that when the change rate of the pixel value of the pixel in the horizontal direction has regularity, a highly accurate predicted value can be obtained.
[Equation 6]
Px = Ra + {(Rb−Rc) / 2}

また、数式7は、注目画素xの上隣の画素bの画素値Rbに、注目画素xの左隣の画素aの画素値Raから注目画素xの左上隣の画素cの画素値Rcを減算して2で割ったものを加算し、注目画素xの予測値Pxとするものである。これは、垂直方向の画素の画素値の変化率に規則性がある場合に、精度の良い予測値を得ることができると考えられる。
[数7]
Px=Rb+{(Ra−Rc)/2}
Further, Equation 7 subtracts the pixel value Rc of the pixel c adjacent to the upper left of the pixel of interest x from the pixel value Ra of the pixel a adjacent to the left of the pixel of interest x to the pixel value Rb of the upper pixel b of the target pixel x. Then, the value divided by 2 is added to obtain the predicted value Px of the target pixel x. This is considered that when the change rate of the pixel value of the pixel in the vertical direction has regularity, an accurate predicted value can be obtained.
[Equation 7]
Px = Rb + {(Ra−Rc) / 2}

さらに、数式8は、注目画素xの左隣の画素aの画素値Raと注目画素xの上隣の画素bの画素値Rbとの平均値を、注目画素xの予測値Pxとするものである。これは、周辺画素との相関性が高い場合(例えば、比較的平坦な場合)に、精度の良い予測値を得ることができると考えられる。
[数8]
Px=(Ra+Rb)/2
Further, Expression 8 is an average value of the pixel value Ra of the pixel a adjacent to the left of the target pixel x and the pixel value Rb of the pixel b adjacent to the upper side of the target pixel x as the predicted value Px of the target pixel x. is there. This is considered that a highly accurate prediction value can be obtained when the correlation with the surrounding pixels is high (for example, when it is relatively flat).
[Equation 8]
Px = (Ra + Rb) / 2

なお、上述したような各予測式は、1つの画像データに対して1つのみを用いるに限るものではなく、組み合わせて用いることも可能である。すなわち、例えば、基本的には数式2に示すような予測式を用いるとしても、ライン上の左端の画素が注目画素となっているときには、そのさらに左側には画素が存在しないために、数式3に示す予測式を用いる、などの組み合わせが考えられる。そして、上述した各予測式に限るものではなく、注目画素よりも前に読み出される画素であって、注目画素に空間的な距離が近接する画素であれば、任意の1以上の画素の画素データを用いて予測値を算出することが可能である。   In addition, each prediction formula as described above is not limited to using only one for one image data, and may be used in combination. That is, for example, even if a prediction formula as shown in Formula 2 is basically used, when the pixel at the left end on the line is the target pixel, there is no pixel on the left side, so Formula 3 A combination such as using the prediction formula shown in FIG. The pixel data of any one or more pixels is not limited to the above-described prediction formulas, and may be any pixel that is read before the target pixel and has a spatial distance close to the target pixel. It is possible to calculate a predicted value using

また、図10に示す画素データから図12に示すような予測誤差データを算出する例においては、予測誤差データを算出する前の予測値算出の際に、ブロック内の左上角の画素については画素のダイナミックレンジ0〜255の半分の値127を予測値とし、ブロック内の2ライン目から8ライン目までの左端の画素については数式3を用いて予測値を算出し、それ以外の画素については数式2を用いて予測値を算出している。   Further, in the example of calculating the prediction error data as shown in FIG. 12 from the pixel data shown in FIG. 10, when calculating the prediction value before calculating the prediction error data, the pixel at the upper left corner in the block is the pixel. The value 127 of the dynamic range 0 to 255 is a predicted value, and the predicted value is calculated using Equation 3 for the leftmost pixel from the second line to the eighth line in the block, and for the other pixels The predicted value is calculated using Equation 2.

次に、予測誤差演算手段たる減算器13は、数式9に示すように、注目画素の実際の画素値RxからステップS1で予測した予測値Pxを減算することにより、予測誤差値pred_diff を算出する(ステップS3)。
[数9]
pred_diff =Rx−Px
Next, as shown in Equation 9, the subtractor 13 serving as a prediction error calculation unit calculates the prediction error value pred_diff by subtracting the prediction value Px predicted in step S1 from the actual pixel value Rx of the target pixel. (Step S3).
[Equation 9]
pred_diff = Rx-Px

このようにして算出された予測誤差値pred_diff が、ハフマン符号化の対象となるデータであって、後で説明するステップS14の処理に用いられるとともに、ハフマン符号化テーブルを選択するための指標となる平坦度を決定するために、以下に説明するように用いられるようになっている。なお、図10に示したようなブロックの画素データについて、上述したように予測値Pxを算出したときには、図12に示すような予測誤差値pred_diff が得られる。   The prediction error value pred_diff calculated in this way is data to be subjected to Huffman coding, and is used for the processing in step S14 described later, and serves as an index for selecting a Huffman coding table. In order to determine the flatness, it is used as described below. Note that when the prediction value Px is calculated as described above for the pixel data of the block as shown in FIG. 10, the prediction error value pred_diff as shown in FIG. 12 is obtained.

続いて、絶対値化部14が、予測誤差値pred_diff を絶対値化して、絶対値化された予測誤差値abs_pred_diff を算出する(ステップS4)。図12に示す予測誤差値pred_diff を図13に示す予測誤差値abs_pred_diff に変換する絶対値化は、負の値である場合に、その負符号を取り除くことにより行っている。   Subsequently, the absolute value converting unit 14 converts the prediction error value pred_diff into an absolute value, and calculates an absolute value of the prediction error value abs_pred_diff (step S4). The absolute value conversion for converting the prediction error value pred_diff shown in FIG. 12 into the prediction error value abs_pred_diff shown in FIG. 13 is performed by removing the negative sign when it is a negative value.

なお、絶対値化の手段はこれに限るものではなく、例えば、次の数式10に示すように行っても構わない。
[数10]
abs_pred_diff =pred_diff (pred_diff ≧0のとき)
abs_pred_diff =abs(pred_diff )−1 (pred_diff <0のとき)
ここに、第2式右辺のabs()は、絶対値をとることを示している。
Note that the absolute value conversion means is not limited to this, and may be performed as shown in the following Expression 10, for example.
[Equation 10]
abs_pred_diff = pred_diff (when pred_diff ≥ 0)
abs_pred_diff = abs (pred_diff) −1 (when pred_diff <0)
Here, abs () on the right side of the second expression indicates that it takes an absolute value.

そして、絶対値化にはこれら以外にも種々の手段があるために、こうした他の手段を適用するようにしても勿論構わない。   Since there are various means other than these for absolute value conversion, it is of course possible to apply such other means.

次に、平坦度検出部15が、第1の閾値との比較に基づく平坦度検出1の処理の画素単位分の処理(ステップS5)と、第2の閾値との比較に基づく平坦度検出2の処理の画素単位分の処理(ステップS6)と、を行う。   Next, the flatness detection unit 15 performs flatness detection 2 based on the comparison of the flatness detection 1 process based on the comparison with the first threshold (step S5) and the second threshold. This process is performed for each pixel unit (step S6).

なお、ステップS5の平坦度検出1の処理と、ステップS6の平坦度検出2の処理とは、所定の範囲を示す閾値thの値が異なる以外は同一の処理を行うものであるために、図6を参照して、これらの処理をまとめて説明する。また、具体的な閾値thとしては、図14に示すように、ステップS5の平坦度検出1の処理では3(閾値th1)を、ステップS6の平坦度検出2の処理では31(閾値th2、ここにth2>th1を満たす)を、それぞれ用いるようになっている。そして、後述するような所定のラン長を示す閾値th_runとしては、具体的には、ステップS5とステップS6とで共通して4を用いるようになっている。   Note that the flatness detection 1 process in step S5 and the flatness detection 2 process in step S6 are the same process except that the value of the threshold th indicating a predetermined range is different. These processes will be described together with reference to FIG. Further, as shown in FIG. 14, the specific threshold th is 3 (threshold th1) in the flatness detection 1 process in step S5, and 31 (threshold th2 here) in the flatness detection 2 process in step S6. (Th2> th1 is satisfied). As a threshold th_run indicating a predetermined run length as described later, specifically, 4 is commonly used in step S5 and step S6.

この平坦度検出の処理の画素単位分の処理を開始すると、まず、比較部31が、絶対値化された予測誤差値abs_pred_diff が所定の閾値th以下であるか否かを判定する(ステップS31)。   When the processing for the pixel unit of the flatness detection processing is started, first, the comparison unit 31 determines whether or not the predicted error value abs_pred_diff converted into an absolute value is equal to or smaller than a predetermined threshold th (step S31). .

ここで、閾値th以下である場合には、ランカウンタ32が、内部に備えるランカウンタrun_count をカウントアップ(ここでは、カウントアップを、記号「run_count +1」により示している)する(ステップS32)。このランカウンタrun_count は、閾値th以下である絶対値化された予測誤差値abs_pred_diff が何画素連続しているかを示すカウンタである。   Here, if it is equal to or less than the threshold th, the run counter 32 counts up the run counter run_count provided therein (here, the count up is indicated by the symbol “run_count + 1”) (step S32). . The run counter run_count is a counter indicating how many pixels the prediction error value abs_pred_diff converted into an absolute value that is equal to or less than the threshold th is continuous.

そして、比較部33は、ランカウンタrun_count が、所定のラン長を示す閾値th_run以上であるか否かを判定する(ステップS34)。   Then, the comparison unit 33 determines whether or not the run counter run_count is equal to or greater than a threshold th_run indicating a predetermined run length (step S34).

ここで、閾値th_run以上である場合には、ランセットカウンタ34が、ランセットカウンタrun_set_count をカウントアップ(ここでも上述と同様に、カウントアップを、記号「run_set_count +1」により示している)する(ステップS35)。このランセットカウンタrun_set_count は、閾値th以下の絶対値化された予測誤差値abs_pred_diff が閾値th_run個連続するセット(ランセット)が、ブロック内で幾つ検出されているかを示すカウンタである。   Here, when the value is equal to or greater than the threshold th_run, the lancet counter 34 counts up the lancet counter run_set_count (again, the count-up is indicated by the symbol “run_set_count + 1” as described above) (step S35). ). The lancet counter run_set_count is a counter indicating how many sets (lancets) in which the prediction error value abs_pred_diff whose absolute value is equal to or less than the threshold th is the threshold th_run are detected in the block.

その後、ランカウンタ32は、ステップS35の結果を受けてランカウンタrun_count を初期化(つまり、「0」を格納)する(ステップS36)。   Thereafter, the run counter 32 initializes the run counter run_count (that is, stores “0”) in response to the result of step S35 (step S36).

一方、ステップS31において、絶対値化された予測誤差値abs_pred_diff が所定の閾値thよりも大きいと判定された場合にも、ランカウンタ32は、ランカウンタrun_count を初期化する(ステップS33)。   On the other hand, if it is determined in step S31 that the absolute value of the prediction error value abs_pred_diff is larger than the predetermined threshold th, the run counter 32 initializes the run counter run_count (step S33).

こうして、ステップS33またはステップS36が終了するか、あるいはステップS34においてランカウンタrun_count が閾値th_run未満であると判定された場合には、この処理から図4に示した処理に復帰する。   Thus, when step S33 or step S36 is completed, or when it is determined in step S34 that the run counter run_count is less than the threshold th_run, the process returns to the process shown in FIG.

上述したようにステップS5およびステップS6の処理が終了したら、続いて、ブロック内における1ライン分の処理が終了したか否かを判定する(ステップS7)。ここで1ライン分の処理が終了していない場合には、ステップS2へ戻って、同一ラインの次の画素について上述したような処理を行う。   As described above, when the processing of step S5 and step S6 is completed, it is subsequently determined whether or not the processing for one line in the block has been completed (step S7). If the processing for one line is not completed, the process returns to step S2 to perform the above-described processing for the next pixel on the same line.

また、1ライン分の処理が終了したと判定された場合には、平坦度検出部15が、上述したステップS5に対応する平坦度検出1の処理のライン単位分の処理(ステップS8)と、上述したステップS6に対応する平坦度検出2の処理のライン単位分の処理(ステップS9)と、を行う。   If it is determined that the processing for one line has been completed, the flatness detection unit 15 performs processing for each line unit (step S8) of the flatness detection 1 processing corresponding to step S5 described above. The flat unit detection process corresponding to step S6 described above is performed for each line unit (step S9).

なお、ステップS8の処理とステップS9の処理とは、基本的に同一の処理を行うものであるために、図7を参照して、これらの処理をまとめて説明する。   In addition, since the process of step S8 and the process of step S9 perform the same process fundamentally, these processes are collectively demonstrated with reference to FIG.

この処理を開始すると、ランカウンタ32が、外部の図示しない制御手段等から入力される外部カウントリセット信号を受けて、内部に備えるランカウンタrun_count をリセットし(ステップS41)、この処理から図4に示した処理に復帰する。   When this process is started, the run counter 32 receives an external count reset signal input from an external control means (not shown), etc., and resets an internal run counter run_count (step S41). Return to the indicated process.

こうしてステップS8およびステップS9の処理が終了したら、続いて、m画素分の処理が終了したか否か、つまり、注目している1つのブロック分の処理が終了したか否かを判定する(ステップS10)。ここで1つのブロック分の処理が終了していない場合には、ステップS2へ戻って、同一ブロック内の次のラインについて上述したような処理を行う。   When the processing in step S8 and step S9 is completed in this way, it is subsequently determined whether the processing for m pixels is completed, that is, whether the processing for one block of interest is completed (step). S10). If the process for one block has not been completed, the process returns to step S2 to perform the process as described above for the next line in the same block.

一方、1つのブロック分の処理が終了したと判定された場合には、平坦度検出部15が、上述したステップS5およびステップS8に対応する平坦度検出1の処理のブロック単位分の処理(ステップS11)と、上述したステップS6およびステップS9に対応する平坦度検出2の処理のブロック単位分の処理(ステップS12)と、を行う。   On the other hand, when it is determined that the processing for one block has been completed, the flatness detection unit 15 performs processing for each block unit of the flatness detection 1 processing corresponding to steps S5 and S8 described above (steps). S11) and the processing for the block unit (step S12) of the flatness detection 2 processing corresponding to steps S6 and S9 described above are performed.

なお、ステップS11の処理とステップS12の処理とは、基本的に同一の処理を行うものであるために、図8を参照して、これらの処理をまとめて説明する。なお、この処理では、所定のランセット数を示す閾値th_run_setが用いられるが、具体的な数値としては、図14に示すように、4を用いるようになっている。   In addition, since the process of step S11 and the process of step S12 perform the same process fundamentally, these processes are demonstrated collectively with reference to FIG. In this process, a threshold th_run_set indicating a predetermined number of lancets is used. As a specific numerical value, 4 is used as shown in FIG.

この処理を開始すると、比較部35が、ランセットカウンタ34によりカウントされたランセットカウンタrun_set_count が上述した閾値th_run_set以上であるか否かを判定する(ステップS51)。   When this process is started, the comparison unit 35 determines whether or not the lancet counter run_set_count counted by the lancet counter 34 is equal to or greater than the above-described threshold th_run_set (step S51).

ここで、比較部35は、閾値th_run_set以上であると判定した場合には、平坦度検出結果を示すランフラグrun_flagに1を代入して出力し(ステップS52)、閾値th_run_set未満であると判定した場合には、平坦度検出結果を示すランフラグrun_flagに0を代入して出力する(ステップS53)。ここに、図14に示したような閾値や設定値に基づいて、図13に示したような絶対値化された予測誤差値abs_pred_diff の判定を行った結果は、図15に示すようになり、1ブロック分の処理を終えたところで、平坦度検出1によるランセットカウンタrun_set_count は、平坦度検出2によるランセットカウンタrun_set_count は8となる。そして、閾値th_run_setは上述したように4に設定されているために、平坦度検出1によるランフラグrun_flagと、平坦度検出2によるランフラグrun_flagと、の何れもが、図15に示すように1となる。 When the comparison unit 35 determines that the threshold value is equal to or greater than the threshold th_run_set, the comparison unit 35 outputs 1 by substituting 1 for the run flag run_flag indicating the flatness detection result (step S52), and determines that the threshold value is less than the threshold th_run_set. In this case, 0 is assigned to the run flag run_flag indicating the flatness detection result and output (step S53). Here, based on the threshold value and the set value as shown in FIG. 14, the determination result of the prediction error value abs_pred_diff that has been converted into an absolute value as shown in FIG. 13 is as shown in FIG. When the processing for one block is completed, the lancet counter run_set_count based on flatness detection 1 is 6 and the lancet counter run_set_count based on flatness detection 2 is 8. Since the threshold th_run_set is set to 4 as described above, both the run flag run_flag by flatness detection 1 and the run flag run_flag by flatness detection 2 are 1 as shown in FIG. .

こうしてステップS52またはステップS53の処理が終了したら、この処理から図4に示した処理に復帰する。   When the process of step S52 or step S53 is thus completed, the process returns to the process shown in FIG.

上述したようにステップS11およびステップS12の処理が終了したら、次に、ステップS11の処理により出力されたランフラグrun_flag(これをrun_flag1 とする)と、ステップS12の処理により出力されたランフラグrun_flag(これをrun_flag2 とする)と、に基づき、ハフマンテーブル選択部16が、ハフマン符号化テーブルの選択を行う(ステップS13)。ここに、ハフマン符号化テーブルは、図16に示すように、ブロックの平坦度に応じて3つが用意されており、1つは高い平坦度に応じたハフマン符号化テーブル、もう1つは中程度の平坦度に応じたハフマン符号化テーブル、最後の1つは低い平坦度に応じたハフマン符号化テーブルとなっている。   As described above, when the processes of step S11 and step S12 are completed, the run flag run_flag output by the process of step S11 (this is referred to as run_flag1) and the run flag run_flag output by the process of step S12 (this) Huffman table selection unit 16 selects a Huffman encoding table (step S13). Here, as shown in FIG. 16, three Huffman coding tables are prepared according to the flatness of the block, one is a Huffman coding table according to high flatness, and the other is medium. A Huffman coding table corresponding to the flatness of the image and the last one is a Huffman coding table corresponding to the low flatness.

なお、高い平坦度に応じたハフマン符号化テーブルは、予測誤差が0となるときに最も短い符号長のカテゴリ符号(符号語)を割り当て、0に近い予測誤差に対して短い符号長のカテゴリ符号を割り当てるようなハフマン符号化テーブルとなっている。   The Huffman coding table corresponding to the high flatness assigns the shortest code length category code (codeword) when the prediction error becomes 0, and the short code length category code for the prediction error close to 0. Is a Huffman coding table.

また、中程度の平坦度に応じたハフマン符号化テーブルは、絶対値が2または3となる予測誤差に対して最も短い符号長のカテゴリ符号を割り当て、絶対値が2または3に近い予測誤差に対してなるべく短い符号長のカテゴリ符号を割り当てるようなハフマン符号化テーブルとなっている。   In addition, the Huffman coding table corresponding to the medium flatness assigns a category code having the shortest code length to a prediction error with an absolute value of 2 or 3, and the absolute value is close to 2 or 3. On the other hand, the Huffman coding table is such that a category code with a code length as short as possible is assigned.

さらに、低い平坦度に応じたハフマン符号化テーブルは、絶対値が16〜31となる予測誤差に対して最も短い符号長のカテゴリ符号を割り当て、絶対値が16〜31に近い予測誤差に対してなるべく短い符号長のカテゴリ符号を割り当てるようなハフマン符号化テーブルとなっている。   Further, the Huffman coding table corresponding to the low flatness assigns a category code having the shortest code length to a prediction error with an absolute value of 16 to 31, and for a prediction error with an absolute value close to 16 to 31. The Huffman coding table is such that a category code with a code length as short as possible is assigned.

そして、ハフマンテーブル選択部16は、ランフラグrun_flag1 が1であるとき(このときには、ランフラグrun_flag2 も1となる)にはブロックの平坦度が高いと判定し、ランフラグrun_flag1 が0であってかつランフラグrun_flag2 が1であるときにはブロックの平坦度は中程度であると判定し、ランフラグrun_flag2 が0であるとき(このときには、ランフラグrun_flag1 も0となる)にはブロックの平坦度は低いと判定するようになっている。こうした平坦度の判定に基づき、ハフマンテーブル選択部16は、図16に示したようなハフマン符号化テーブルの何れかを選択する。   Then, when the run flag run_flag1 is 1 (in this case, the run flag run_flag2 is also 1), the Huffman table selection unit 16 determines that the flatness of the block is high, the run flag run_flag1 is 0, and the run flag run_flag2 is When it is 1, it is determined that the flatness of the block is medium, and when the run flag run_flag2 is 0 (in this case, the run flag run_flag1 is also 0), the block flatness is determined to be low. Yes. Based on the determination of the flatness, the Huffman table selection unit 16 selects one of the Huffman coding tables as shown in FIG.

続いて、ハフマンテーブル選択部16により選択された符号化テーブルを用いて、符号化手段たるハフマン符号化部17が、上記ステップS3において算出された予測誤差値pred_diff のハフマン符号化を行う(ステップS14)。   Subsequently, using the coding table selected by the Huffman table selection unit 16, the Huffman coding unit 17 as coding means performs Huffman coding of the prediction error value pred_diff calculated in Step S3 (Step S14). ).

ハフマン符号は、よく知られているように、カテゴリ符号と、有意ビット(ここでは、予測誤差データの有意ビット)と、により構成されている(図17参照)。カテゴリ符号は、有意ビット部分の符号長を示す符号となっており、例えば図18に示すような9ビットの予測誤差データ「000001011」(10進数で表して「11」となる)が得られたとすると、有意ビットは下位4ビット分であるために、図16を参照して、カテゴリは「4」となる。このカテゴリ4に対して、平坦度が高い場合および平坦度が中程度である場合のハフマン符号化テーブルではカテゴリ符号「101」が割り当てられ、平坦度が低い場合のハフマン符号化テーブルではカテゴリ符号「100」が割り当てられるようになっている。そして、上述した例においては、平坦度が高いハフマン符号化テーブルが選択されているために、カテゴリ符号としては「101」が用いられ、従って、ハフマン符号化データは、図19に示すように、「1011011」の7ビットとなって、データの圧縮が行われていることが分かる。   As is well known, the Huffman code includes a category code and significant bits (here, significant bits of prediction error data) (see FIG. 17). The category code is a code indicating the code length of the significant bit portion, and for example, 9-bit prediction error data “000001011” (decimal number “11”) as shown in FIG. 18 is obtained. Then, since the significant bits are the lower 4 bits, the category is “4” with reference to FIG. For this category 4, the category code “101” is assigned in the Huffman coding table when the flatness is high and the flatness is medium, and the category code “101” is assigned in the Huffman coding table when the flatness is low. 100 "is assigned. In the above-described example, since the Huffman coding table having a high flatness is selected, “101” is used as the category code. Therefore, the Huffman coded data is as shown in FIG. It becomes 7 bits of “1011011” and it can be seen that data compression is performed.

こうして、1つのブロック内の各画素データについて、ハフマン符号化の処理が終了したら、次に、n個のブロックについて処理が終了したか否か、つまり、処理対象の画像データ全体の処理が終了したか否かを判定する(ステップS15)。ここで画像データ全体の処理が終了していない場合には、ブロック単位での処理に用いる各種のパラメータ等のリセットを必要に応じて行ってから、ステップS2へ戻って、同一画像データ内の次のブロックについて上述したような処理を行う。また、画像データ全体の処理が終了している場合には、この圧縮処理の終了となる。   Thus, when the Huffman encoding process is completed for each pixel data in one block, whether or not the process has been completed for n blocks, that is, the process of the entire image data to be processed is completed. Is determined (step S15). If the processing of the entire image data has not been completed, various parameters used for processing in units of blocks are reset as necessary, and the process returns to step S2 to return to the next in the same image data. The above-described processing is performed for this block. In addition, when the processing of the entire image data has been completed, this compression processing ends.

圧縮処理が行われた画像データは、ファイルシステム等を介して記録媒体等へ記録するために、所定のファイルフォーマットに基づいたファイル化が行われる。図20は、圧縮された画像データを記録するためのファイルフォーマットの一例を示す図である。   The compressed image data is filed based on a predetermined file format in order to be recorded on a recording medium or the like via a file system or the like. FIG. 20 is a diagram illustrating an example of a file format for recording compressed image data.

圧縮された画像ファイルは、符号化データと、この符号化データに付随して設けられるヘッダおよびタグと、を有して構成されている。   The compressed image file includes encoded data, and a header and a tag provided along with the encoded data.

そして、上述したような3つのハフマン符号化テーブルの内の、どのハフマン符号化テーブルがどのブロックに対して適用されたかの情報は、例えば、圧縮画像ファイルを生成する際に、タグ部分に記録されるようになっている。   Then, of the three Huffman coding tables as described above, information indicating which Huffman coding table is applied to which block is recorded in the tag portion when, for example, a compressed image file is generated. It is like that.

ここで、図21は、ファイルフォーマットにおけるタグの構造を示す図である。   Here, FIG. 21 is a diagram showing a tag structure in the file format.

タグは、タグの種類を示すタグIDと、タグの中に記録されている値の型を示すタイプと、このタイプで示される型の値が何個あるかを示すカウントと、タグ中において値が格納されているアドレスを示す値へのオフセットと、を含んで構成されている。   The tag has a tag ID indicating the type of tag, a type indicating the type of the value recorded in the tag, a count indicating how many values of the type indicated by this type, and a value in the tag And an offset to a value indicating an address in which is stored.

そして、ブロックに対して用いられたハフマン符号化テーブルの種類を示すために、タグ情報として、例えば以下のような情報が格納される。   Then, in order to indicate the type of the Huffman coding table used for the block, for example, the following information is stored as tag information.

まず、タグIDに、例えば「値として格納されているのがブロック毎のハフマン符号化テーブルの種類の情報であること」を実質的に示す情報が格納される。   First, in the tag ID, for example, information substantially indicating that “the value is stored is the information of the type of the Huffman coding table for each block” is stored.

次に、タイプとして、データ量を示す型(具体的な例としては、プログラミング言語Cにおいて用いられているような、1バイトのデータを示す「char」など)が格納される。なお、上述した例においては、ハフマン符号化テーブルの種類が3種類(例えば、平坦度高に「0」、平坦度中に「1」、平坦度低に「2」を割り当てるなど)であり、2ビット分のデータ量で済むために、なるべくデータ量の小さな型を用いる方がファイルサイズを小さくするのに有効である。ただし、実用上は、データが1バイト単位で格納されることが多いために、上述した例においては、例えば4ブロック分のデータをまとめて1バイト中に格納することも考えられる。   Next, a type indicating the amount of data (as a specific example, “char” indicating 1-byte data as used in the programming language C) is stored as the type. In the example described above, there are three types of Huffman coding tables (for example, “0” is assigned to high flatness, “1” is assigned to flatness, “2” is assigned to low flatness, etc.) Since a data amount of 2 bits is sufficient, it is more effective to reduce the file size by using a type with a data amount as small as possible. However, in practice, since data is often stored in units of 1 byte, in the example described above, for example, data for 4 blocks may be stored together in 1 byte.

さらに、カウントとしては、例えば、ブロック数が格納される。ただし、4ブロック分のデータをまとめて1バイト中に格納する例では、ブロック数を4で割って、その数を超えない最大の整数に1を加えた値を格納する、等になる。   Furthermore, as the count, for example, the number of blocks is stored. However, in an example in which data for 4 blocks are stored together in 1 byte, the number of blocks is divided by 4, and a value obtained by adding 1 to the maximum integer not exceeding the number is stored.

そして、オフセットとしては、例えばタグIDの先頭から値が格納されているアドレスまでの相対的なデータ移動量、あるいは、図20に示すタグ領域の先頭から値が格納されているアドレスまでのデータ移動量、などが格納される。   As the offset, for example, the relative data movement amount from the head of the tag ID to the address where the value is stored, or the data movement from the head of the tag area shown in FIG. 20 to the address where the value is stored. Quantity, etc. are stored.

このようにして、各ブロックに対応する値の組として格納された、ブロック毎のハフマン符号化テーブルの種類の情報が、上述した符号化テーブルデータ(ハフマンテーブル選択部16から出力されるデータであり、復号テーブル作成部21へ入力されるデータ)である。   Thus, the Huffman coding table type information for each block stored as a set of values corresponding to each block is the above-described coding table data (data output from the Huffman table selection unit 16). , Data input to the decryption table creation unit 21).

なお、データ符号化装置1に記憶されている平坦度に応じた複数のハフマン符号化テーブル(つまり、例えば図16に示したようなハフマン符号化テーブル)がデータ復号化装置2(の例えば復号テーブル作成部21)にも記憶されている場合には、各ブロックに適用されたハフマン符号化テーブルの種類の情報のみを上述したようにタグに記録すれば、データ復号化装置2においてハフマン符号化テーブルの種類の情報に基づき記憶している複数のハフマン符号化テーブルから一のハフマン符号化テーブルを選択することにより、符号化に用いられたハフマン符号化テーブルを再現することが可能である。これに対して、データ復号化装置2にデータ符号化装置1と同一の複数のハフマン符号化テーブルが存在しない場合、あるいは存在しない可能性があると想定する場合(例えば、複数のハフマン符号化テーブルが存在するデータ復号化装置と、複数のハフマン符号化テーブルが存在しないデータ復号化装置と、の何れにおいても復号化を行うと想定する場合など)には、これらに加えて、さらに各ハフマン符号化テーブル自体をタグ情報として記録する必要がある。このときには、データ復号化装置2は、ハフマン符号化テーブルの種類の情報に基づき、タグ情報として記録されている複数のハフマン符号化テーブルから一のハフマン符号化テーブルを選択して読み出すことにより、符号化に用いられたハフマン符号化テーブルを再現することが可能である。   Note that a plurality of Huffman coding tables (that is, for example, a Huffman coding table as shown in FIG. 16) corresponding to the flatness stored in the data coding device 1 is the data decoding device 2 (for example, the decoding table). If the information is also stored in the creating unit 21), if only the information of the type of the Huffman coding table applied to each block is recorded in the tag as described above, the data decoding apparatus 2 will use the Huffman coding table. By selecting one Huffman encoding table from a plurality of stored Huffman encoding tables based on the type of information, it is possible to reproduce the Huffman encoding table used for encoding. On the other hand, when it is assumed that the data decoding apparatus 2 does not have a plurality of Huffman encoding tables identical to the data encoding apparatus 1 or may not exist (for example, a plurality of Huffman encoding tables). In addition to these, in addition to these, each Huffman code is further assumed to be decoded in a data decoding apparatus in which there is a plurality of Huffman coding tables. It is necessary to record the conversion table itself as tag information. At this time, the data decoding device 2 selects one Huffman encoding table from a plurality of Huffman encoding tables recorded as tag information based on the information of the type of the Huffman encoding table, and reads out the code. It is possible to reproduce the Huffman coding table used for the conversion.

次に、図5は、データ復号化装置2による伸張処理を示すフローチャートである。   Next, FIG. 5 is a flowchart showing the decompression process performed by the data decoding apparatus 2.

この処理を開始すると、まず、復号テーブル作成部21が、画像ファイルから符号化テーブルデータを読み込んで、ブロック毎に対応するハフマン符号化テーブルを再現し、ハフマン復号化部22へ出力する(ステップS21)。   When this process starts, first, the decoding table creation unit 21 reads the encoding table data from the image file, reproduces the Huffman encoding table corresponding to each block, and outputs it to the Huffman decoding unit 22 (step S21). ).

続いて、ハフマン復号化部22が、画像ファイルから符号化データを読み込んで、ブロック内の画素毎に、ハフマン符号化テーブルに基づいて復号化することにより予測誤差値pred_diff を再現する(ステップS22)。   Subsequently, the Huffman decoding unit 22 reads the encoded data from the image file and decodes the prediction error value pred_diff for each pixel in the block based on the Huffman encoding table (step S22). .

そして、予測部25が、メモリ24に記憶されている既に算出された画素値に基づいて、図4のステップS2において説明したのと同様に予測値Pxの算出を行う(ステップS23)。   Then, the prediction unit 25 calculates the predicted value Px based on the already calculated pixel value stored in the memory 24 as described in step S2 of FIG. 4 (step S23).

次に、ステップS22で復号化された予測誤差値pred_diff と、ステップS23で算出された予測値Pxと、に基づいて、次の数式11に示すように、画素値Rxを算出する(ステップS24)。
[数11]
Rx=Px+pred_diff
Next, based on the prediction error value pred_diff decoded in step S22 and the prediction value Px calculated in step S23, a pixel value Rx is calculated as shown in the following equation 11 (step S24). .
[Equation 11]
Rx = Px + pred_diff

その後、ブロック内における1ライン分の処理が終了したか否かを判定し(ステップS25)、終了していない場合にはステップS22へ戻って同一ライン内の次の画素について、上述したような処理を繰り返して行う。   Thereafter, it is determined whether or not the processing for one line in the block has been completed (step S25). If it has not been completed, the process returns to step S22 to perform the processing as described above for the next pixel in the same line. Repeat this step.

また、ステップS25において、ブロック内における1ライン分の処理が終了したと判定された場合には、次に、m画素分の処理が終了したか否か、つまり1つのブロック分の処理が終了したか否かを判定し(ステップS26)、終了していない場合には、上記ステップS22へ戻って、同一ブロック内の次のラインについて、上述したような処理を繰り返して行う。   If it is determined in step S25 that the processing for one line in the block has been completed, then whether or not the processing for m pixels has been completed, that is, the processing for one block has been completed. (Step S26), if not completed, the process returns to step S22, and the above-described processing is repeated for the next line in the same block.

一方、ステップS26において、1つのブロック分の処理が終了したと判定された場合には、n個のブロックの全てについて処理が終了したか否か、つまり1枚の画像データ全体の処理が終了したか否かを判定し(ステップS27)、終了していない場合には、上記ステップS21へ戻って、次のブロックに係る符号化テーブルデータを読み込むなどを行って、上述したような処理を行う。   On the other hand, if it is determined in step S26 that the processing for one block has been completed, whether or not the processing has been completed for all n blocks, that is, the processing of the entire image data has been completed. (Step S27), and if not completed, the process returns to step S21 to read the encoding table data related to the next block and perform the above-described processing.

こうしてステップS27において、画像データ全体の処理が終了したと判定された場合には、この伸張処理を終了する。   In this way, when it is determined in step S27 that the processing of the entire image data has been completed, this expansion processing is ended.

なお、上述では、処理対象となるデータとして、画像データを例に挙げたが、データ符号化装置1やデータ復号化装置2により処理し得るデータは、これに限るものではないことは勿論である。   In the above description, image data is taken as an example of data to be processed. However, data that can be processed by the data encoding device 1 or the data decoding device 2 is not limited to this. .

また、上述では、データ符号化装置1やデータ復号化装置2により処理を行っているが、既存の演算器等にデータ符号化方法やデータ復号化方法を適用することにより処理するようにしても構わない。あるいは、データ符号化装置1やデータ復号化装置2と同等の処理を行うためのプログラムにより、コンピュータで処理させるようにしても良い。   In the above description, processing is performed by the data encoding device 1 and the data decoding device 2, but processing may be performed by applying a data encoding method or a data decoding method to an existing arithmetic unit or the like. I do not care. Or you may make it make it process with a computer by the program for performing the process equivalent to the data encoding apparatus 1 or the data decoding apparatus 2. FIG.

さらに、上述では、予測誤差データを絶対値化してから所定の閾値と比較して平坦度を検出しているが、これに限るものではない。例えば、絶対値化していない予測誤差データが所定範囲内に入るか否かに応じて、平坦度を検出するようにしても構わない。   Furthermore, in the above description, the prediction error data is converted into an absolute value and then compared with a predetermined threshold value to detect the flatness, but the present invention is not limited to this. For example, the flatness may be detected according to whether prediction error data that has not been converted to an absolute value falls within a predetermined range.

そして、上述では、ハフマン符号化を行う対象であり平坦度を検出する対象であるデータを、予測誤差データとしているが、これに限るものではなく、その他の種々のデータを対象とすることが可能である。   In the above description, the data to be subjected to Huffman coding and the flatness detection target is the prediction error data. However, the present invention is not limited to this, and other various data can be targeted. It is.

加えて、上述では、選択する符号化テーブルとしてハフマン符号化テーブルを例に挙げたが、これに限るものではなく、その他の符号化方式における符号化テーブルを予め複数用意しておいて、平坦度に応じて符号化に使用するテーブルを選択することも可能である。   In addition, in the above description, the Huffman coding table is exemplified as the coding table to be selected. However, the present invention is not limited to this, and a plurality of coding tables in other coding schemes are prepared in advance, and the flatness It is also possible to select a table to be used for encoding according to the above.

このような実施形態1によれば、ブロック単位で平坦度を検出し、複数の平坦度に対応して予め設定されている複数のハフマン符号化テーブルの中から、検出された平坦度に応じたハフマン符号化テーブルを選択してハフマン符号化するようにしたために、高い圧縮性能を発揮することが可能となる。   According to the first embodiment, the flatness is detected in units of blocks, and the flatness corresponding to the detected flatness is selected from a plurality of Huffman coding tables set in advance corresponding to the plurality of flatnesses. Since the Huffman coding table is selected and Huffman coding is performed, high compression performance can be exhibited.

そして、所定の閾値以下の絶対値化された予測誤差が所定数連続してなるランセット、の数を検出し、ランセットが所定数以上である場合に平坦である、と判定するようにしているために、複雑な処理を要することなく、短い時間で高速に平坦度を検出することが可能となる。   And, because the number of lancets in which a predetermined number of prediction errors converted into absolute values equal to or less than a predetermined threshold value are detected, it is determined that the lancet is flat when the lancet is equal to or greater than the predetermined number. In addition, flatness can be detected at high speed in a short time without requiring complicated processing.

さらに、絶対値化された予測誤差と比較する所定の閾値を複数種類用意しているために、平坦度の検出を、きめ細かく行うことが可能となる。   Furthermore, since a plurality of predetermined threshold values to be compared with the prediction error converted to the absolute value are prepared, the flatness can be detected finely.

加えて、平坦度を検出する際に、ランカウンタやランセットカウンタによるカウントを行うだけで良いために、ハフマン符号化テーブルを選択する際に必要なメモリ量の増加をほぼ抑制することができ、省メモリで構成することが可能となる。   In addition, since it is only necessary to perform the count by the run counter or the lancet counter when detecting the flatness, an increase in the amount of memory necessary for selecting the Huffman coding table can be substantially suppressed, which can be saved. It can be configured with a memory.

また、圧縮されたデータを、短い処理時間、かつ、小さな必要なメモリ量で復号化することが可能となる。   In addition, the compressed data can be decoded with a short processing time and a small necessary memory amount.

なお、本発明は上述した実施形態に限定されるものではなく、発明の主旨を逸脱しない範囲内において種々の変形や応用が可能であることは勿論である。   It should be noted that the present invention is not limited to the above-described embodiments, and various modifications and applications can be made without departing from the spirit of the invention.

本発明は、符号化テーブルに基づいてデータを符号化または復号化するデータ符号化装置、データ復号化装置、データ符号化方法、データ復号化方法、プログラムに好適に利用することができる。   The present invention can be suitably used for a data encoding device, a data decoding device, a data encoding method, a data decoding method, and a program for encoding or decoding data based on an encoding table.

本発明の実施形態1におけるデータ符号化装置の構成を示すブロック図。1 is a block diagram showing a configuration of a data encoding device according to Embodiment 1 of the present invention. 上記実施形態1におけるデータ復号化装置の構成を示すブロック図。The block diagram which shows the structure of the data decoding apparatus in the said Embodiment 1. FIG. 上記実施形態1における平坦度検出部の構成を示すブロック図。The block diagram which shows the structure of the flatness detection part in the said Embodiment 1. FIG. 上記実施形態1のデータ符号化装置による圧縮処理を示すフローチャート。6 is a flowchart showing compression processing by the data encoding apparatus according to the first embodiment. 上記実施形態1のデータ復号化装置による伸張処理を示すフローチャート。7 is a flowchart showing decompression processing by the data decoding apparatus according to the first embodiment. 上記実施形態1における平坦度検出の処理の画素単位分の処理を示すフローチャート。5 is a flowchart showing processing for pixel units in flatness detection processing in the first embodiment. 上記実施形態1における平坦度検出の処理のライン単位分の処理を示すフローチャート。5 is a flowchart showing processing for line units in flatness detection processing in the first embodiment. 上記実施形態1における平坦度検出の処理のブロック単位分の処理を示すフローチャート。5 is a flowchart showing processing for a block unit of flatness detection processing in the first embodiment. 上記実施形態1において画像データをブロックに分割する様子を示す図。The figure which shows a mode that image data is divided | segmented into a block in the said Embodiment 1. FIG. 上記実施形態1におけるブロックの画素データの例を示す図。FIG. 3 is a diagram illustrating an example of pixel data of a block in the first embodiment. 上記実施形態1において注目画素と注目画素以前に読み出される近傍画素との配置を示す図。The figure which shows arrangement | positioning with the attention pixel in the said Embodiment 1, and the neighboring pixel read before an attention pixel. 上記図10の画素データから得られるブロックの予測誤差データを示す図。The figure which shows the prediction error data of the block obtained from the pixel data of the said FIG. 上記図12の予測誤差データを絶対値化して得られる絶対値化された予測誤差データを示す図。The figure which shows the prediction error data converted into the absolute value obtained by converting the prediction error data of the said FIG. 12 into an absolute value. 上記実施形態1の平坦度検出において用いられる各閾値や設定値を示す図表。The chart which shows each threshold value and setting value used in the flatness detection of the said Embodiment 1. FIG. 上記図13の絶対値化された予測誤差データに対して図14の各閾値や設定値を適用して得られる平坦度検出の結果を示す図表。FIG. 15 is a table showing flatness detection results obtained by applying the threshold values and setting values shown in FIG. 14 to the absolute value prediction error data shown in FIG. 上記実施形態1において平坦度の高中低に応じて予め設定された符号化テーブルの例を示す図表。The table | surface which shows the example of the encoding table preset according to the said Embodiment 1 according to high / low / high of flatness. 上記実施形態1におけるハフマン符号の構造を示す図。The figure which shows the structure of the Huffman code | symbol in the said Embodiment 1. FIG. 上記実施形態1における予測誤差データの一例を示す図。The figure which shows an example of the prediction error data in the said Embodiment 1. FIG. 上記図18の予測誤差データを符号化して得られるハフマン符号を示す図。The figure which shows the Huffman code | cord | chord obtained by encoding the prediction error data of the said FIG. 上記実施形態1において圧縮された画像データを記録するためのファイルフォーマットの一例を示す図。FIG. 3 is a diagram showing an example of a file format for recording image data compressed in the first embodiment. 上記実施形態1のファイルフォーマットにおけるタグの構造を示す図。The figure which shows the structure of the tag in the file format of the said Embodiment 1. FIG.

符号の説明Explanation of symbols

1…データ符号化装置
2…データ復号化装置
11…ブロック化部
12…予測部(予測手段)
13…減算器(予測誤差演算手段)
14…絶対値化部
15…平坦度検出部
16…ハフマンテーブル選択部(符号化テーブル記憶手段、符号化テーブル選択手段)
17…ハフマン符号化部(符号化手段)
21…復号テーブル作成部(符号化テーブル再現手段)
22…ハフマン復号化部(復号化手段)
23…加算器
24…メモリ
25…予測部
31…比較部
32…ランカウンタ
33…比較部
34…ランセットカウンタ
35…比較部
DESCRIPTION OF SYMBOLS 1 ... Data encoding apparatus 2 ... Data decoding apparatus 11 ... Blocking part 12 ... Prediction part (prediction means)
13: Subtracter (prediction error calculation means)
DESCRIPTION OF SYMBOLS 14 ... Absolute value conversion part 15 ... Flatness detection part 16 ... Huffman table selection part (a coding table storage means, a coding table selection means)
17 ... Huffman encoder (encoding means)
21 ... Decoding table creation unit (encoding table reproduction means)
22 ... Huffman decoding unit (decoding means)
DESCRIPTION OF SYMBOLS 23 ... Adder 24 ... Memory 25 ... Prediction part 31 ... Comparison part 32 ... Run counter 33 ... Comparison part 34 ... Lancet counter 35 ... Comparison part

Claims (10)

予め設定された複数の符号化テーブルを記憶する符号化テーブル記憶手段と、
データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、
上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、
上記ランセットカウンタにより検出したランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段と、
上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段と、
を具備し
上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、
上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、
上記所定の範囲は複数種類設定可能となっており、
上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、
上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、
上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものである
ことを特徴とするデータ符号化装置。
Encoding table storage means for storing a plurality of preset encoding tables;
A run counter for detecting the continuous number of the data whose value continuously falls within a predetermined range, and repeatedly performing the detection every time the continuous number of the data reaches a predetermined number ;
A lancet counter for detecting the number of lancets that is the number of times that the continuation number of the data has been detected to have reached the predetermined number by the lance counter;
Encoding table selecting means for selecting any one of the plurality of encoding tables stored in the encoding table storage means according to the number of lancets detected by the lancet counter;
Encoding means for generating the encoded data by encoding the data based on the encoding table selected by the encoding table selecting means;
Equipped with,
The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category,
The encoding means generates encoded data by associating the code word with a significant bit part of the data,
A plurality of types of the predetermined range can be set,
The run counter detects, for each of a plurality of set predetermined ranges, the continuous number of the data whose data value is continuously within the predetermined range, and the continuous number of the data is predetermined. Each time the number is reached, the detection is repeated.
The lancet counter detects the number of lancets corresponding to each of the predetermined ranges of the plurality of types, which is the number of times that the continuous number of the data detected by the run counter is detected to reach the predetermined number. Is what
The encoding table selection means includes a plurality of encoding tables stored in the encoding table storage means according to the number of lancets detected by the lancet counter corresponding to each of the plurality of types of predetermined ranges. To select one of the encoding tables
A data encoding apparatus characterized by that.
過去に読み出された符号化対象データに基づき、注目する符号化対象データを予測し予測データを算出する予測手段と、
注目する符号化対象データと、上記予測手段により算出された予測データと、の差分をとることにより予測誤差データを生成する予測誤差演算手段と、
をさらに具備し、
上記データは、上記予測誤差演算手段により生成された予測誤差データであることを特徴とする請求項1に記載のデータ符号化装置。
Prediction means for predicting the encoding target data of interest based on the encoding target data read in the past and calculating prediction data;
Prediction error calculation means for generating prediction error data by taking the difference between the target encoding target data and the prediction data calculated by the prediction means;
Further comprising
The data encoding apparatus according to claim 1, wherein the data is prediction error data generated by the prediction error calculation means.
上記所定の範囲は、上記データの絶対値が所定の閾値以下となる範囲であり、
上記ランカウンタは、設定された複数種類の閾値のそれぞれに対して、データの絶対値が連続して該所定の閾値以下となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであることを特徴とする請求項1に記載のデータ符号化装置。
The predetermined range is a range in which the absolute value of the data is a predetermined threshold value or less,
The run counter detects, for each of a plurality of set thresholds, the number of consecutive data whose absolute value is continuously less than or equal to the predetermined threshold, and the number of consecutive data is predetermined. 2. The data encoding apparatus according to claim 1, wherein the detection is repeated every time the number is reached .
上記符号化テーブル記憶手段は、最も符号長の短い符号語が割り当てられるカテゴリが異なる複数の符号化テーブルを記憶するものであり、
上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の閾値のそれぞれに対応して検出された上記ランセットの数が所定数以上であるか否かを各々判定し、所定数以上となった最も低い閾値が、低いときには平坦度が高く、高いときには平坦度が低いと判定し、平坦度が高いときには平坦度が低いときに比して、最も符号長の短い符号語が割り当てられるカテゴリがより小さい有意ビット数を表すカテゴリとなる符号化テーブルを選択するものであることを特徴とする請求項3に記載のデータ符号化装置。
The encoding table storage means stores a plurality of encoding tables having different categories to which codewords with the shortest code length are assigned,
The encoding table selection means determines whether or not the number of the lancets detected corresponding to each of the plurality of types of thresholds by the lancet counter is greater than or equal to a predetermined number, and has reached the predetermined number or more. When the lowest threshold is low, the flatness is high, and when it is high, the flatness is low. When the flatness is high, the category to which the codeword with the shortest code length is assigned is higher than when the flatness is low. 4. The data encoding apparatus according to claim 3, wherein an encoding table that is a category representing a small number of significant bits is selected .
上記符号化テーブル選択手段により選択された符号化テーブルの種類を示す情報と、上記符号化手段により生成された符号化データと、は一のファイルとして出力されるものであることを特徴とする請求項1に記載のデータ符号化装置。 The information indicating the type of the encoding table selected by the encoding table selection unit and the encoded data generated by the encoding unit are output as one file. Item 4. The data encoding device according to Item 1 . ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップと、  A first step of detecting, by a run counter, a continuous number of the data whose data value is continuously within a predetermined range, and repeatedly performing the detection every time the continuous number of the data reaches a predetermined number;
ランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと、  A second step of detecting, by the lancet counter, the number of lancets, which is the number of times that the continuation number of the data is detected by the lance counter to reach the predetermined number;
符号化テーブル選択手段により、上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する第3ステップと、  A third step of selecting any one of a plurality of preset encoding tables stored by the encoding table selection means according to the number of lancets detected by the lancet counter;
符号化手段により、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する第4ステップと、   A fourth step of generating the encoded data by encoding the data based on the encoding table selected by the encoding table selecting means by the encoding means;
を有し、  Have
上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、  The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category,
上記第4ステップは、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、  The fourth step is to generate encoded data by associating the code word with a significant bit part of the data,
上記所定の範囲は複数種類設定可能となっており、  A plurality of types of the predetermined range can be set,
上記第1ステップは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、  In the first step, for each of a plurality of set predetermined ranges, the continuous number of the data in which the data value is continuously within the predetermined range is detected, and the continuous number of the data is The detection is repeated every time a predetermined number is reached,
上記第2ステップは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、  In the second step, the number of lancets, which is the number of times that the continuous number of the data detected by the run counter is detected to reach the predetermined number, is determined corresponding to each of the predetermined ranges of the plurality of types. Is to detect,
上記第3ステップは、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものである  The third step is any one of the plurality of preset encoding tables stored according to the number of lancets detected by the lancet counter corresponding to each of the plurality of predetermined ranges. Select one encoding table
ことを特徴とするデータ符号化方法。  A data encoding method characterized by the above.
コンピュータを、  Computer
データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、  A run counter for detecting the continuous number of the data whose value continuously falls within a predetermined range and repeatedly performing the detection every time the continuous number of the data reaches a predetermined number;
上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、  A lancet counter for detecting the number of lancets, which is the number of times that the continuation number of the data is detected to have reached the predetermined number by the lance counter;
上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段、  A coding table selecting means for selecting any one of a plurality of coding tables set and stored in advance according to the number of lancets detected by the lancet counter;
上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段、  Encoding means for encoding the data and generating encoded data based on the encoding table selected by the encoding table selecting means;
として機能させるためのプログラムであって、  Is a program for functioning as
上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、  The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category,
上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、  The encoding means generates encoded data by associating the code word with a significant bit part of the data,
上記所定の範囲は複数種類設定可能となっており、  A plurality of types of the predetermined range can be set,
上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、  The run counter detects, for each of a plurality of set predetermined ranges, the continuous number of the data whose data value is continuously within the predetermined range, and the continuous number of the data is predetermined. Each time the number is reached, the detection is repeated.
上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して、検出するものであり、  The lancet counter indicates the number of lancets, which is the number of times that the continuous number of the data detected by the run counter is detected to reach the predetermined number, corresponding to each of the predetermined ranges of the plurality of types, Is to detect,
上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものである  The encoding table selection means is configured to select one of a plurality of encoding tables stored in advance according to the number of lancets detected by the lancet counter corresponding to each of the plurality of predetermined ranges. Select one encoding table
ことを特徴とするプログラム。  A program characterized by that.
予め設定された複数の符号化テーブルを記憶する符号化テーブル記憶手段と、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、上記ランセットカウンタにより検出したランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段と、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段と、を具備し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して、検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記符号化テーブル記憶手段に記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするデータ符号化装置によって生成された符号化データ、を復号化するためのデータ復号化装置であって、  Encoding table storage means for storing a plurality of preset encoding tables, and detecting the continuous number of the data whose data values are continuously within a predetermined range, and the continuous number of the data is a predetermined number And a lancet counter for detecting the number of lancets, which is the number of times that the continuation number of the data is detected to have reached the predetermined number by the run counter, Encoding table selection means for selecting any one of the plurality of encoding tables stored in the encoding table storage means according to the number of lancets detected by the lancet counter; and Encoding means for encoding the data based on the encoding table selected by the encoding table selection means and generating encoded data; The encoding table is a table showing a correspondence relationship between a category representing the number of significant bits of the data and a code word corresponding to the category, and the encoding means includes the code word And the significant bit part of the data are associated with each other to generate encoded data. The predetermined range can be set to a plurality of types, and the run counter can be set to a plurality of types of predetermined ranges. For each of the above, the number of continuous data whose data values are continuously within a predetermined range is detected, and each time the number of continuous data reaches a predetermined number, the detection is repeated. The lancet counter indicates the number of lancets, which is the number of times that the continuous number of the data detected by the run counter is detected to reach the predetermined number, and the predetermined range of the plurality of types. The encoding table selecting means detects the encoding according to the number of lancets detected by the lancet counter corresponding to each of the plurality of predetermined ranges. Decoding encoded data generated by a data encoding device, wherein one of the plurality of encoding tables stored in the table storage means is selected. The data decryption device of
上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現する符号化テーブル再現手段と、  Based on the information indicating the type of the selected encoding table, encoding table reproducing means for reproducing the encoding table used for encoding;
上記符号化テーブル再現手段により再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する復号化手段と、  Decoding means for decoding the encoded data and reproducing the data based on the encoding table reproduced by the encoding table reproducing means;
を具備したことを特徴とするデータ復号化装置。  A data decoding apparatus comprising:
ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップと、ランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと、符号化テーブル選択手段により、上記ランセットカウンタにより検出したランセットの数に応じて予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する第3ステップと、符号化手段により、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する第4ステップと、を有し、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記第4ステップは、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記第1ステップは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記第2ステップは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記第3ステップは、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするデータ符号化方法により生成された符号化データ、を復号化するためのデータ復号化方法であって、  A first step of detecting a continuous number of the data whose value continuously falls within a predetermined range by a run counter, and repeatedly detecting the data every time the continuous number of data reaches the predetermined number; A second step of detecting the number of lancets, which is the number of times that the continuation number of the data has reached the predetermined number by the ran counter, and a detection by the lancet counter by the encoding table selection means A third step of selecting any one of a plurality of encoding tables set and stored in advance according to the number of lancets, and the encoding means selected by the encoding table selecting means. And a fourth step of generating the encoded data by encoding the data based on the encoded table. The table shows the correspondence between the category representing the number of significant bits of the data and the code word corresponding to the category, and the fourth step includes the significant bit portion of the code word and the data. Are generated in association with each other, and a plurality of types of the predetermined ranges can be set, and the first step is performed for each of the set types of predetermined ranges. The continuous value of the data in which the value of the data is continuously within a predetermined range is detected, and the detection is repeated every time the continuous number of the data reaches a predetermined number. The number of lancets, which is the number of times the number of consecutive data detected by the run counter has been detected to reach the predetermined number, is detected corresponding to each of the plurality of predetermined ranges. In the third step, among the plurality of encoding tables stored in advance according to the number of lancets detected by the lancet counter corresponding to each of the plurality of types of predetermined ranges. A data decoding method for decoding encoded data generated by a data encoding method, characterized by selecting any one of the encoding tables,
上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現し、  Based on the information indicating the type of the selected encoding table, reproduce the encoding table used for encoding,
再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する  Based on the reproduced encoding table, the encoded data is decoded and the data is reproduced.
ことを特徴とするデータ復号化方法。  A data decoding method characterized by the above.
コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出したランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択する符号化テーブル選択手段、上記符号化テーブル選択手段により選択された符号化テーブルに基づいて上記データを符号化し符号化データを生成する符号化手段、として機能させるためのプログラムであって、上記符号化テーブルは、上記データの有意ビット数を表すカテゴリと、このカテゴリに対応する符号語と、の対応関係を表にしたものであり、上記符号化手段は、上記符号語と上記データの有意ビット部分とを対応付けて符号化データを生成するものであり、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより検出した上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記符号化テーブル選択手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、予め設定し記憶された複数の符号化テーブルの中の何れか一の符号化テーブルを選択するものであることを特徴とするプログラムによって生成された符号化データ、を復号化する処理をコンピュータに実行させるためのプログラムであって、  A run counter for detecting a continuous number of the data whose data values are continuously within a predetermined range, and repeatedly performing the detection every time the continuous number of data reaches the predetermined number; A lancet counter for detecting the number of lancets, which is the number of times that the counter has detected that the number of consecutive data has reached the predetermined number, and preset and stored according to the number of lancets detected by the lancet counter Coding table selecting means for selecting any one of the plurality of coded tables, and coding data obtained by coding the data based on the coding table selected by the coding table selecting means A program for functioning as an encoding means for generating the data, wherein the encoding table includes the presence of the data. The correspondence between the category representing the number of bits and the code word corresponding to this category is tabulated, and the coding means codes the code word and the significant bit part of the data in association with each other. A plurality of types of the predetermined range can be set, and the run counter has a predetermined data value for each of the set types of predetermined ranges. The continuous number of the data falling within the range is detected, and the detection is repeated every time the continuous number of the data reaches a predetermined number. The lancet counter detects the data detected by the run counter. The number of lancets, which is the number of times that it has been detected that the continuous number has reached the predetermined number, is detected corresponding to each of the predetermined ranges of the plurality of types, and the code The table selection means is any one of a plurality of encoding tables set and stored in advance according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. A program for causing a computer to execute a process of decoding encoded data generated by a program characterized by selecting an encoding table,
上記選択された符号化テーブルの種類を示す情報に基づいて、符号化に用いられた符号化テーブルを再現し、  Based on the information indicating the type of the selected encoding table, reproduce the encoding table used for encoding,
再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する処理をコンピュータに実行させるためのプログラム。  A program for causing a computer to execute a process of decoding the encoded data and reproducing the data based on the reproduced encoding table.
JP2005170122A 2005-06-09 2005-06-09 Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program Expired - Fee Related JP4493551B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005170122A JP4493551B2 (en) 2005-06-09 2005-06-09 Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005170122A JP4493551B2 (en) 2005-06-09 2005-06-09 Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program

Publications (2)

Publication Number Publication Date
JP2006345320A JP2006345320A (en) 2006-12-21
JP4493551B2 true JP4493551B2 (en) 2010-06-30

Family

ID=37641921

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005170122A Expired - Fee Related JP4493551B2 (en) 2005-06-09 2005-06-09 Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program

Country Status (1)

Country Link
JP (1) JP4493551B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8615138B2 (en) * 2011-11-03 2013-12-24 Google Inc. Image compression using sub-resolution images

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03235477A (en) * 1990-02-09 1991-10-21 Nec Corp Compression encoding device
JPH04322561A (en) * 1991-04-22 1992-11-12 Fujitsu Ltd Variable rate picture coding system
JPH08172522A (en) * 1994-12-20 1996-07-02 Oki Data:Kk Resolution switching device
JPH08329190A (en) * 1995-03-24 1996-12-13 Fuji Xerox Co Ltd Character recognition device
JPH0937271A (en) * 1995-07-18 1997-02-07 Hewlett Packard Co <Hp> Image compressing method
JPH0965334A (en) * 1995-08-29 1997-03-07 Matsushita Electric Ind Co Ltd Image coder and image decoder
JPH09186883A (en) * 1995-12-28 1997-07-15 Ricoh Co Ltd Multi-value image encoding device
JPH104551A (en) * 1996-06-17 1998-01-06 Canon Inc Image processing unit, method for the unit and storage medium storing the method
JPH11225335A (en) * 1998-02-05 1999-08-17 Hitachi Ltd Image compressing method and mail processing system using it
JP2000333020A (en) * 1999-05-20 2000-11-30 Matsushita Electric Ind Co Ltd Binary image coding method, binary image coder and recording medium
JP2005012495A (en) * 2003-06-19 2005-01-13 Olympus Corp Image processing apparatus, image processing method, and image processing program
JP2006033508A (en) * 2004-07-16 2006-02-02 Olympus Corp Adaptive variable length coding device, adaptive variable length decoding device, adaptive variable length coding/decoding method, and adaptive variable length coding/decoding program

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH03235477A (en) * 1990-02-09 1991-10-21 Nec Corp Compression encoding device
JPH04322561A (en) * 1991-04-22 1992-11-12 Fujitsu Ltd Variable rate picture coding system
JPH08172522A (en) * 1994-12-20 1996-07-02 Oki Data:Kk Resolution switching device
JPH08329190A (en) * 1995-03-24 1996-12-13 Fuji Xerox Co Ltd Character recognition device
JPH0937271A (en) * 1995-07-18 1997-02-07 Hewlett Packard Co <Hp> Image compressing method
JPH0965334A (en) * 1995-08-29 1997-03-07 Matsushita Electric Ind Co Ltd Image coder and image decoder
JPH09186883A (en) * 1995-12-28 1997-07-15 Ricoh Co Ltd Multi-value image encoding device
JPH104551A (en) * 1996-06-17 1998-01-06 Canon Inc Image processing unit, method for the unit and storage medium storing the method
JPH11225335A (en) * 1998-02-05 1999-08-17 Hitachi Ltd Image compressing method and mail processing system using it
JP2000333020A (en) * 1999-05-20 2000-11-30 Matsushita Electric Ind Co Ltd Binary image coding method, binary image coder and recording medium
JP2005012495A (en) * 2003-06-19 2005-01-13 Olympus Corp Image processing apparatus, image processing method, and image processing program
JP2006033508A (en) * 2004-07-16 2006-02-02 Olympus Corp Adaptive variable length coding device, adaptive variable length decoding device, adaptive variable length coding/decoding method, and adaptive variable length coding/decoding program

Also Published As

Publication number Publication date
JP2006345320A (en) 2006-12-21

Similar Documents

Publication Publication Date Title
JP4427003B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program
AU2010200907B2 (en) Variable length coding method and variable length decoding method
US7304590B2 (en) Arithmetic decoding apparatus and method
JP4682102B2 (en) Image coding apparatus and image coding method
WO1998020680A1 (en) Image encoder and image decoder
DK1530374T3 (en) Method for encoding and decoding moving images
CN103918261A (en) Signal processing and inheritance in a tiered signal quality hierarchy
TW201342919A (en) Data encoding and decoding
US7715639B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and recording medium recorded with program
JP4493551B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program
JP4493552B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program
JP4241588B2 (en) Moving picture encoding apparatus and moving picture decoding apparatus
JP2008187694A (en) Image encoder and method thereof
JP4415651B2 (en) Image encoding apparatus and image decoding apparatus
JP4125642B2 (en) Adaptive variable length coding apparatus, adaptive variable length coding method, and adaptive variable length coding program
JPH0686247A (en) Receiver/reproducer for digital picture signal
JP2005045527A (en) Method for compressing still image and method for compressing video signal
JP4394558B2 (en) Image processing apparatus, image processing method, and image processing program
JP3228943B2 (en) Encoding device and decoding device, their methods and image processing device
JP2003230138A (en) Apparatus and method for coding processing and decoding processing, and computer program
JP5872804B2 (en) Encoding apparatus and encoding method
JP4319895B2 (en) Time series signal encoding device
JP4979355B2 (en) Image coding apparatus and image coding method
JP2006246062A5 (en)
JP2008124931A (en) Data converting device, data converting program and data converting method, and data decoding device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080208

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20091126

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091201

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100201

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100316

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100406

R151 Written notification of patent or utility model registration

Ref document number: 4493551

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130416

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140416

Year of fee payment: 4

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees