JP4493552B2 - 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
JP4493552B2
JP4493552B2 JP2005170123A JP2005170123A JP4493552B2 JP 4493552 B2 JP4493552 B2 JP 4493552B2 JP 2005170123 A JP2005170123 A JP 2005170123A JP 2005170123 A JP2005170123 A JP 2005170123A JP 4493552 B2 JP4493552 B2 JP 4493552B2
Authority
JP
Japan
Prior art keywords
data
category
code length
counter
predetermined
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
JP2005170123A
Other languages
Japanese (ja)
Other versions
JP2006345321A (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 JP2005170123A priority Critical patent/JP4493552B2/en
Publication of JP2006345321A publication Critical patent/JP2006345321A/en
Application granted granted Critical
Publication of JP4493552B2 publication Critical patent/JP4493552B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

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, the data encoding apparatus according to the first invention detects the continuous number of the data whose data values are continuously within a predetermined range, and the continuous number of the data is predetermined. And a lancet counter for detecting the number of lancets that is the number of times that the continuation number of the data is detected to have reached the predetermined number by the run counter. And a minimum code length category determination that determines a minimum code length category that is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of lancets detected by the lancet counter. means a minimum code length thus significant number of bits represented in the category determined by the minimum code length category determination means For a category representing the closest number significantly bits, to assign a shorter code length category codes, and the coding table creation means for creating a coding table showing the correspondence between the category and the category code, the coding table Encoding means for generating encoded data by associating the category code with the significant bit portion of the data based on the encoding table created by the creating means, and setting the plural types of the predetermined range The run counter detects the continuous number of the data in which the data value is continuously within the predetermined range for each of the plurality of predetermined ranges set, The detection is repeated every time the continuous number of the data reaches a predetermined number, and the lancet counter is The number of lancets, which is the number of times that the number of consecutive data reaches the predetermined number, is detected corresponding to each of the predetermined ranges of the plurality of types, and the minimum code length category determination is performed. A means for assigning a category code having a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. The minimum code length category is determined .

また、第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.

の発明によるデータ符号化装置は、上記第の発明によるデータ符号化装置において、上記最小符号長カテゴリ決定手段が、上記ランセットカウンタにより検出されたランセットの数が所定数以上であるときは、所定数未満であるときに比して、より小さい有意ビット数を表すカテゴリに、最小符号長のカテゴリ符号を割り当てるように最小符号長カテゴリを決定するものである。 A data encoding apparatus according to a third invention is the data encoding apparatus according to the first invention, wherein the minimum code length category determining means is configured such that the number of lancets detected by the lancet counter is equal to or greater than a predetermined number. The minimum code length category is determined so that the category code having the minimum code length is assigned to the category representing the smaller number of significant bits than when the number is less than the predetermined number.

の発明によるデータ符号化装置は、上記第の発明によるデータ符号化装置において、上記所定の範囲が、上記データの絶対値が所定の閾値以下となる範囲であって、該所定の閾値は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の閾値のそれぞれに対して、データの絶対値が連続して該所定の閾値以下となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の閾値のそれぞれに対応して、検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の閾値のそれぞれに対応して検出されたランセットの数が所定数以上であるか否かを各々判定し、所定数以上となった最も低い閾値が、低いときには高いときに比して、最小符号長のカテゴリ符号を割り当てるカテゴリがより小さい有意ビット数を表すカテゴリとなるように、最小符号長カテゴリを決定するものである。 A data encoding device according to a fourth invention is the data encoding device according to the third invention, wherein the predetermined range is a range in which an absolute value of the data is equal to or less than a predetermined threshold, and the predetermined threshold Can be set for a plurality of types, and the run counter has a continuous number of data for which the absolute value of the data is continuously equal to or less than the predetermined threshold for each of the set types of predetermined thresholds. And the detection is repeated every time the continuous number of the data reaches a predetermined number . The lancet counter detects that the continuous number of the data has reached the predetermined number by the run counter. the number of the lancet which is the number of times that is, in correspondence with each of the plurality of types of predetermined threshold is used to detect, the minimum code length category determination means, the lancet mosquito When the number of lancets detected corresponding to each of the plurality of types of predetermined threshold values is greater than or equal to a predetermined number, and the lowest threshold value that is greater than or equal to the predetermined number is high when it is low The minimum code length category is determined so that the category to which the category code of the minimum code length is assigned is a category representing a smaller number of significant bits.

の発明によるデータ符号化装置は、上記第1の発明によるデータ符号化装置において、上記符号化テーブル作成手段により作成された符号化テーブルに係る情報と、上記符号化手段により生成された符号化データと、は一のファイルとして出力されるものである。 A data encoding device according to a fifth aspect of the present invention is the data encoding device according to the first aspect of the present invention, wherein the information relating to the encoding table created by the encoding table creating means and the code generated by the encoding means The digitized data is output as a single file.

の発明によるデータ符号化方法は、ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップとランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと最小符号長カテゴリ決定手段により、上記ランセットカウンタにより検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する第3ステップと上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリに対してより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する第4ステップと上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する第5ステップと、を有し、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する方法である。 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, which is the number of times that the continuation number of the data is detected by the lance counter, and a minimum the code length category determination unit, according to the number of the detected lancet by the lancet counter, to determine the minimum code length category is a category to assign a minimum code length category code of the category representing the number of significant bits of the data a third step, thus the table the minimum code length categories determined by the minimum code length category determination means For a category representing the closest number significant bits of the number of significant bits, to allocate shorter code length category code, and a fourth step of creating a coding table showing the correspondence between the category and the category code, A fifth step of generating encoded data by associating the category code with the significant bit portion of the data based on the encoding table generated by the encoding table generating means , and the predetermined range A plurality of types can be set, and the run counter calculates, for each of the set types of predetermined ranges, the continuous number of the data in which the data values are continuously within the predetermined range. And the detection is repeated each time the number of consecutive data reaches a predetermined number. The lancet counter The number of lancets, which is the number of times that the number of consecutive data has been detected to reach the predetermined number, is detected corresponding to each of the plurality of predetermined ranges, and the minimum code length category The determining means assigns a category code having a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. This is a method for determining a minimum code length category that is a category .

の発明によるプログラムは、コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリに対してより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段、として機能させるためのプログラムであって、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するためのプログラムである。 According to a seventh aspect of the invention, there is provided a program for detecting a continuous number of data in which a data value continuously falls within a predetermined range and repeating the detection every time the continuous number of 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 that the continuation number of the data is detected to have reached the predetermined number by the run counter, and the lancet counter detected by the lancet counter depending on the number determined, the minimum code length category determination means for determining a minimum code length category is a category to assign a minimum code length category code of the category representing the number of significant bits of the data, by the minimum code length category determination means Table number significant bits close to the minimum code length thus significant number of bits represented in the category that is For a category, to assign a shorter code length category code, the coding table creation means for creating a coding table showing the correspondence between the category and the category code, the code created by the coding table creation means A program for functioning as an encoding means for generating encoded data by associating the category code with a significant bit portion of the data based on an encoding table, wherein 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 values are continuously within the predetermined range, and the data The detection is repeated every time the continuous number reaches a predetermined number, and the lancet counter is The number of lancets, which is the number of times that the continuous number of data reaches the predetermined number, is detected corresponding to each of the predetermined ranges of the plurality of types, and the minimum code length category determination A means for assigning a category code having a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. Is a program for determining a minimum code length category .

の発明によるデータ復号化装置は、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、上記ランセットカウンタにより検出されたランセットの数に応じて上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段と上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリほどより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段と上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段と、を具備し、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするデータ符号化装置によって生成された符号化データ、を復号化するためのデータ復号化装置であって、上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現する符号化テーブル再現手段と、上記符号化テーブル再現手段により再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する復号化手段と、を具備したものである。 According to an eighth aspect of the present invention, the data decoding apparatus detects the number of consecutive data whose data values are continuously within a predetermined range, and repeats the detection every time the number of continuous data reaches a predetermined number. A lancet counter for performing, a lancet counter for detecting the number of lancets, which is the number of times that the continuation number of the data has been detected to reach the predetermined number by the run counter, and the lancet counter Minimum code length category determining means for determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of lancets, and the minimum code length category determining means catheter representing the closest number significant bits Thus the number of significant bits represented the minimum code length categories determined by A coding table creation means for creating a coding table showing the correspondence between the category and the category code to allocate shorter code length category code from the more Li, the coding table created by said coding table creation means Encoding means for associating the category code with the significant bit portion of the data to generate encoded data, and the predetermined range can be set to a plurality of types, and the run counter is , 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 reaches the predetermined number The detection is repeated every time, and the lancet counter has reached the predetermined number of continuous data by the run counter. The number of detected lancets is detected in correspondence with each of the plurality of types of predetermined ranges, and the minimum code length category determination means uses the lancet counter to determine the plurality of types of predetermined ranges. In accordance with the number of lancets detected corresponding to each of the above, the minimum code length category, which is a category to which the category code of the minimum code length is assigned among the categories representing the number of significant bits of the data, is determined. A data decoding device for decoding encoded data generated by a featured data encoding device , wherein the code used for encoding is based on the information related to the generated encoding table. An encoding table reproducing means for reproducing the encoding table, and an encoding table reproduced by the encoding table reproducing means Decoding means for decoding the encoded data and reproducing the data.

の発明によるデータ復号化方法は、ランカウンタにより、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なう第1ステップと、ランセットカウンタにより、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出する第2ステップと最小符号長カテゴリ決定手段により、上記ランセットカウンタにより検出されたランセットの数に応じて上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する第3ステップと上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリほど、より短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する第4ステップと上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する第5ステップと、を有し、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするデータ符号化方法によって生成された符号化データ、を復号化するためのデータ復号化方法であって、上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現し、再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する方法である。 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 repeatedly performing the detection, 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 has been detected by the lance counter, and a minimum The code length category determining means determines a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of lancets detected by the lancet counter . 3 and step, thus the table the minimum code length categories determined by the minimum code length category determination means More categories representing the closer number significant bits of the number of significant bits, and a fourth step of creating a coding table showing the correspondence between the category and the category code to allocate shorter code length category code, the coding table anda fifth step of generating coded data in association with the significant bit part of the category code and the data on the basis of the coding table created by the creating means, the predetermined range is a plurality of types set The run counter detects the continuous number of the data in which the data value is continuously within the predetermined range for each of the plurality of predetermined ranges set, The detection is repeated every time the number of consecutive data reaches a predetermined number, and the lancet counter is incremented by the run counter. Detecting the number of lancets, which is the number of times that it has been detected that the number of consecutive data has reached the predetermined number, corresponding to each of the predetermined ranges of the plurality of types, and determining the minimum code length category Is a category to which a category code having a minimum code length is assigned among categories representing the number of significant bits of the data 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 in that a certain minimum code length category is determined , wherein the encoded table includes Based on such information, the encoding table used for encoding is reproduced, and the encoded data is reproduced based on the reproduced encoding table. This is a method of decoding data and reproducing data.

10の発明によるプログラムは、コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出されたランセットの数に応じて上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリほどより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段として機能させるためのプログラムであって、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするプログラムによって生成された符号化データ、を復号化する処理をコンピュータに実行させるためのプログラムであって、上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現し、再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する、処理をコンピュータに実行させるためのプログラムである。 According to a tenth aspect of the invention, the computer detects the number of consecutive data whose data values are continuously within a predetermined range, and repeatedly performs the detection every time the number of consecutive data reaches the predetermined number. run counter, the number of the lancet consecutive number of the data by the run counter is detected lancet counter for detecting the number of the lancet which is the number of times that has been detected to have reached the predetermined number, by the lancet counter for determined by the minimum code length category determination unit, the minimum code length category determination means for determining a minimum code length category is a category to assign a minimum code length category code of the category representing the number of significant bits of the data in accordance with the It represents the number of significant bits close to the minimum code length thus significant number of bits represented in the category Encoding table generating means for generating an encoding table showing the correspondence between the category and the category code to allocate shorter code length category code from more categories, based on the coding table created by said coding table creation means The category code and a significant bit part of the data are associated with each other to generate encoded data, and a program for causing the predetermined range to be set in a plurality of types. 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 is The detection is repeated every time the predetermined number is reached, and the lancet counter is 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 plurality of predetermined ranges, and the minimum code length category determining means includes: The minimum which is a category to which a category code having a minimum code length is assigned among categories representing the number of significant bits of the data 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 determining a code length category, the information relating to the generated encoding table Based on the above, the encoding table used for encoding is reproduced, and based on the reproduced encoding table, the above A program for causing a computer to execute a process of decoding encoded data and reproducing the data.

本発明のデータ符号化装置、データ符号化方法、プログラムによれば、短い処理時間、かつ、小さな必要なメモリ量で、高い圧縮性能を発揮することが可能となる。   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から図24は本発明の実施形態1を示したものであり、図1はデータ符号化装置の構成を示すブロック図、図2はデータ復号化装置の構成を示すブロック図である。
[Embodiment 1]
1 to 24 show Embodiment 1 of the present invention. FIG. 1 is a block diagram showing a configuration of a data encoding device, and FIG. 2 is a block diagram showing a configuration of the data decoding device.

図1に示すように、データ符号化装置1は、ブロック化部11と、予測部12と、減算器13と、絶対値化部14と、平坦度検出部15と、カテゴリ決定部16と、ハフマンテーブル作成部17と、ハフマン符号化部18と、を含んで構成されている。これらの内の、ブロック化部11には画像データが入力され、ハフマンテーブル作成部17からは符号化テーブルデータが出力され、符号化手段たるハフマン符号化部18からは符号化データが出力されるようになっている。このデータ符号化装置1の詳細については、後で図4、図6〜図9等を参照しながら作用に沿って説明する。   As shown in FIG. 1, the data encoding apparatus 1 includes a blocking unit 11, a prediction unit 12, a subtractor 13, an absolute value conversion unit 14, a flatness detection unit 15, a category determination unit 16, A Huffman table creation unit 17 and a Huffman encoding unit 18 are included. Of these, image data is input to the blocking unit 11, encoding table data is output from the Huffman table creation unit 17, and encoded data is output from the Huffman encoding unit 18, which is an encoding unit. It is like that. Details of the data encoding device 1 will be described later along the operation with reference to FIGS. 4 and 6 to 9.

また、このデータ符号化装置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は注目画素と注目画素以前に読み出される近傍画素との配置を示す図、図13は図11の画素データから得られるブロックの予測誤差データを示す図、図14は図13の予測誤差データを絶対値化して得られる絶対値化された予測誤差データを示す図、図15は平坦度検出において用いられる各閾値や設定値と閾値に対応する最小符号長シンボルとを示す図表、図16は図14の絶対値化された予測誤差データに対して図15の各閾値や設定値を適用して得られる平坦度検出の結果を示す図表、図17はカテゴリパターンを示す図表、図18は最小符号長シンボルに対応するカテゴリと符号長との関係を示す図表、図19は符号長とカテゴリ符号との対応を示す図表、図20はハフマン符号の構造を示す図、図21は予測誤差データの一例を示す図、図22は図21の予測誤差データを符号化して得られるハフマン符号を示す図である。   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 flowchart showing processing for creating a Huffman coding table, and FIG. 10 is a diagram showing how image data is divided into blocks. 11 is a diagram illustrating an example of pixel data of a block, FIG. 12 is a diagram illustrating an arrangement of a target pixel and neighboring pixels read before the target pixel, and FIG. 13 is a block prediction error obtained from the pixel data of FIG. FIG. 14 is a diagram showing data, FIG. 14 is a diagram showing prediction error data converted into absolute values obtained by converting the prediction error data in FIG. 13 into absolute values, and FIG. 15 is a diagram showing flatness detection. FIG. 16 is a chart showing the thresholds and setting values used and the minimum code length symbols corresponding to the thresholds, and FIG. 16 applies the thresholds and setting values of FIG. 15 to the absolute prediction error data of FIG. FIG. 17 is a chart showing the category pattern, FIG. 18 is a chart showing the relationship between the category corresponding to the minimum code length symbol and the code length, and FIG. 19 is the code length and category code. FIG. 20 is a diagram illustrating the structure of the Huffman code, FIG. 21 is a diagram illustrating an example of the prediction error data, and FIG. 22 is a diagram illustrating the Huffman code obtained by encoding the prediction error data in FIG. It is.

図4に示すような圧縮処理を開始すると、まず、ブロック化部11が、入力される画像データを図10に示すようにブロックに分割する(ステップS1)。この図10には、縦32×横56画素でなる画像データを、8×8画素でなるブロックに分割する例を示し、分割した結果、B1〜B28までの横7×縦4個のブロックが生成される。なお、ここでは1つの画像データを28個のブロックに分割し、かつ1ブロックを64画素で構成しているが、これに限るものではないために、ブロックの個数をより一般的にn個、ブロック内の画素数をより一般的にm個、であるとする。また、1つの画像データを複数に分割するに限るものではなく、画像データ全体を1つのブロックとして処理しても構わない。   When the compression process as shown in FIG. 4 is started, the blocking unit 11 first divides the input image data into blocks as shown in FIG. 10 (step S1). FIG. 10 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つのブロック(具体例としては、図11に示すような8ビット(0〜255)の画素データが配列されたブロック)を処理対象として、予測部12が、ブロック内の画素の画素データを順に読み出しながら、ブロック内における注目画素の画素データを、ブロック内で既に読み出された画素データに基づき予測する(ステップS2)。ここで、図12に示すように、ブロック内における注目画素をxで示すとすると、この注目画素xよりも以前に読み出されるブロック内の近傍画素は、例えば、注目画素xの左隣の画素aと、注目画素xの上隣の画素bと、注目画素xの左上隣の画素cと、である。なお、ここでは、画素の読み出し順序が、ブロック内のあるラインについて左端の画素から右端の画素へ向けて順に読み出し、そのラインの読み出しが終了したらブロック内の次のラインの読み出しを同様に行う場合を例に説明するが、読み出し順序はこれに限るものではない。   Next, one block among a plurality of blocks obtained by division (specifically, a block in which pixel data of 8 bits (0 to 255) as shown in FIG. 11 is arranged) is processed. The prediction unit 12 predicts the pixel data of the pixel of interest in the block based on the pixel data already read in the block while sequentially reading out the pixel data of the pixels in the block (step S2). Here, as shown in FIG. 12, if the target pixel in the block is denoted by x, the neighboring pixel in the block read before the target pixel x is, for example, the pixel a adjacent to the left of the target pixel x. And a pixel b on the upper side of the target pixel x and a pixel c on 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

また、図11に示す画素データから図13に示すような予測誤差データを算出する例においては、予測誤差データを算出する前の予測値算出の際に、ブロック内の左上角の画素については画素のダイナミックレンジ0〜255の半分の値127を予測値とし、ブロック内の2ライン目から8ライン目までの左端の画素については数式3を用いて予測値を算出し、それ以外の画素については数式2を用いて予測値を算出している。   Further, in the example of calculating the prediction error data as shown in FIG. 13 from the pixel data shown in FIG. 11, 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 が、ハフマン符号化の対象となるデータであって、後で説明するステップS17の処理に用いられるとともに、ハフマン符号化テーブルを作成するための指標となる平坦度を決定するために、以下に説明するように用いられるようになっている。なお、図11に示したようなブロックの画素データについて、上述したように予測値Pxを算出したときには、図13に示すような予測誤差値pred_diff が得られる。   The prediction error value pred_diff calculated in this way is data to be subjected to Huffman coding, and is used as an index for creating a Huffman coding table as well as used in the processing of Step S17 described later. 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. 11, the prediction error value pred_diff as shown in FIG. 13 is obtained.

続いて、絶対値化部14が、予測誤差値pred_diff を絶対値化して、絶対値化された予測誤差値abs_pred_diff を算出する(ステップS4)。図13に示す予測誤差値pred_diff を図14に示す予測誤差値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. 13 into the prediction error value abs_pred_diff shown in FIG. 14 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)と、第3の閾値との比較に基づく平坦度検出3の処理の画素単位分の処理(ステップS7)と、を行う。   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. The process for the pixel unit of the process (step S6) and the process for the pixel unit of the process of flatness detection 3 based on the comparison with the third threshold value (step S7) are performed.

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

この平坦度検出の処理の画素単位分の処理を開始すると、まず、比較部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以上であるか否かを判定する(ステップS33)。   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 S33).

ここで、閾値th_run以上である場合には、ランセットカウンタ34が、ランセットカウンタrun_set_count をカウントアップ(ここでも上述と同様に、カウントアップを、記号「run_set_count +1」により示している)する(ステップS34)。このランセットカウンタ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 S34). ). 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は、ステップS34の結果を受けてランカウンタrun_count を初期化(つまり、「0」を格納)する(ステップS35)。   Thereafter, the run counter 32 initializes the run counter run_count (that is, stores “0”) in response to the result of step S34 (step S35).

一方、ステップS31において、絶対値化された予測誤差値abs_pred_diff が所定の閾値thよりも大きいと判定された場合にも、ランカウンタ32は、ランカウンタrun_count を初期化する(ステップS36)。   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 S36).

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

上述したようにステップS5、ステップS6、およびステップS7の処理が終了したら、続いて、ブロック内における1ライン分の処理が終了したか否かを判定する(ステップS8)。ここで1ライン分の処理が終了していない場合には、ステップS2へ戻って、同一ラインの次の画素について上述したような処理を行う。   As described above, when the processing of step S5, step S6, and step S7 is completed, it is subsequently determined whether or not the processing for one line in the block has been completed (step S8). 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の処理のライン単位分の処理(ステップS9)と、上述したステップS6に対応する平坦度検出2の処理のライン単位分の処理(ステップS10)と、上述したステップS7に対応する平坦度検出3の処理のライン単位分の処理(ステップS11)と、を行う。   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 S9) of the flatness detection 1 processing corresponding to step S5 described above. Processing for the line unit of the flatness detection 2 process corresponding to step S6 described above (step S10), processing for the line unit of the flatness detection 3 process corresponding to step S7 described above (step S11), I do.

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

こうしてステップS9、ステップS10、およびステップS11の処理が終了したら、続いて、m画素分の処理が終了したか否か、つまり、注目している1つのブロック分の処理が終了したか否かを判定する(ステップS12)。ここで1つのブロック分の処理が終了していない場合には、ステップS2へ戻って、同一ブロック内の次のラインについて上述したような処理を行う。   When the processing in step S9, step S10, and step S11 is completed in this way, subsequently, whether or not the processing for m pixels is completed, that is, whether or not the processing for one focused block is completed. Determination is made (step S12). 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およびステップS9に対応する平坦度検出1の処理のブロック単位分の処理(ステップS13)と、上述したステップS6およびステップS10に対応する平坦度検出2の処理のブロック単位分の処理(ステップS14)と、上述したステップS7およびステップS11に対応する平坦度検出3の処理のブロック単位分の処理(ステップS15)と、を行う。   On the other hand, if 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 S9 described above (steps). S13), the block unit processing (step S14) of the flatness detection 2 processing corresponding to steps S6 and S10 described above, and the flatness detection 3 processing block corresponding to steps S7 and S11 described above. Processing for unit (step S15) is performed.

なお、ステップS13の処理とステップS14の処理とステップS15の処理とは、基本的に同一の処理を行うものであるために、図8を参照して、これらの処理をまとめて説明する。なお、この処理では、所定のランセット数を示す閾値th_run_setが用いられるが、具体的な数値としては、図15に示すように、4を用いるようになっている。   In addition, since the process of step S13, the process of step S14, and the process of step S15 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)。ここに、図15に示したような閾値や設定値に基づいて、図14に示したような絶対値化された予測誤差値abs_pred_diff の判定を行った結果は、図16に示すようになり、1ブロック分の処理を終えたところで、平坦度検出1によるランセットカウンタrun_set_count は0、平坦度検出2によるランセットカウンタrun_set_count は3、平坦度検出3によるランセットカウンタrun_set_count は5となる。そして、閾値th_run_setは上述したように4に設定されているために、図16に示すように、平坦度検出1によるランフラグrun_flagは0、平坦度検出2によるランフラグrun_flagも0、平坦度検出3によるランフラグrun_flagは1となる。   Here, if the comparison unit 35 determines that the threshold value is equal to or greater than the threshold th_run_set, the comparison unit 35 substitutes and outputs 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. 15, the determination result of the prediction error value abs_pred_diff converted into the absolute value as shown in FIG. 14 is as shown in FIG. When the processing for one block is completed, the lancet counter run_set_count by flatness detection 1 is 0, the lancet counter run_set_count by flatness detection 2 is 3, and the lancet counter run_set_count by flatness detection 3 is 5. Since the threshold value th_run_set is set to 4 as described above, the run flag run_flag based on the flatness detection 1 is 0, the run flag run_flag based on the flatness detection 2 is 0, and the flatness detection 3 is performed, as shown in FIG. The run flag run_flag is 1.

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

上述したようにステップS13、ステップS14、およびステップS15の処理が終了したら、次に、ステップS13の処理により出力されたランフラグrun_flagと、ステップS14の処理により出力されたランフラグrun_flagと、ステップS15の処理により出力されたランフラグrun_flagと、に基づき、最小符号長カテゴリ決定手段たるカテゴリ決定部16が、図15に示すような最小符号長シンボルの何れを用いるかを決定し、符号化テーブル作成手段たるハフマンテーブル作成部17が決定されたカテゴリに従ってハフマン符号化テーブルの作成を行う(ステップS16)。ここに、カテゴリ決定部16は、ランフラグrun_flagが1となる最も小さい閾値thに対応した最小符号長シンボルを用いるようになっており、図15および図16に示す例においては、ランフラグrun_flagが1になるのは閾値がth3となるときのみであるために、最小符号長シンボルとしては6が設定される。また、閾値th1〜th3に各係るランフラグrun_flagの全てが0になる場合には、図示はしないが、例えば最小符号長シンボルとして7(あるいは8)を設定することが考えられる。   As described above, after the processes of step S13, step S14, and step S15 are completed, the run flag run_flag output by the process of step S13, the run flag run_flag output by the process of step S14, and the process of step S15 15 determines which of the minimum code length symbols as shown in FIG. 15 is to be used by the category determination unit 16 as the minimum code length category determination means based on the run flag run_flag output by Huffman as the encoding table creation means. The table creation unit 17 creates a Huffman coding table according to the determined category (step S16). Here, the category determination unit 16 uses the minimum code length symbol corresponding to the smallest threshold th at which the run flag run_flag is 1, and in the example illustrated in FIGS. 15 and 16, the run flag run_flag is set to 1. Since only when the threshold value is th3, 6 is set as the minimum code length symbol. In addition, when all the run flags run_flag related to the thresholds th1 to th3 are 0, it is conceivable that, for example, 7 (or 8) is set as the minimum code length symbol, although not shown.

上記ハフマン符号化テーブル作成の処理の詳細について、図9を参照して説明する。   Details of the Huffman coding table creation process will be described with reference to FIG.

この処理を開始すると、まず、変数iを初期化(つまり、「0」を格納)する(ステップS61)。ここに、変数iは、図19に示すようなカテゴリ符号を上から下へ向かって0番目から8番目までとすると、何番目のカテゴリ符号に割り振ろうとするカテゴリの処理を行っているかを示す変数となっている。なお、ここでは8ビットの値を取り扱っているために、変数iは0≦i≦8の範囲を変化するが、より一般に、k(kは1以上の整数)ビットの値を取り扱う場合には、変数iは0≦i≦kの範囲を変化することになる(このkは、後述において最大カテゴリ値max_categoryとして参照されるために、変数iが変化する範囲は、0≦i≦max_categoryと書くこともできる)。   When this process is started, first, the variable i is initialized (that is, “0” is stored) (step S61). Here, the variable i indicates the category code to be assigned to which category code when the category codes as shown in FIG. 19 are from 0 to 8 from top to bottom. It is a variable. Note that since an 8-bit value is handled here, the variable i changes in the range of 0 ≦ i ≦ 8. More generally, however, when a k (k is an integer of 1 or more) bit value is handled. , The variable i changes in the range of 0 ≦ i ≦ k (this k is referred to as the maximum category value max_category in the following, so the range in which the variable i changes is written as 0 ≦ i ≦ max_category. Can also).

次に、変数iが0に等しいか否かを判定し(ステップS62)、0に等しくない場合には1つ前のリミットフラグlimit_flag[i-1] が0に等しくない(ここに、図9の記号「!=」は等しくないことを表している)か否かを判定する(ステップS63)。また、リミットフラグlimit_flagは、後述するような、最小符号長のカテゴリ符号が割り当てられるカテゴリ(最小符号長となるカテゴリ)category_minに図17に示すようなカテゴリパターン中のi番目のカテゴリパターンcategory_pattern[i] を加算したものが、取り得るカテゴリの値の範囲(0以上max_category以下)内である(後述するように、リミットフラグlimit_flagは「0」となる)か、あるいは取り得るカテゴリの値の上限(後述する最大カテゴリ値max_categoryであり、この例に示すような8ビットの値を扱う場合にはmax_category=8)を超えている(後述するように、リミットフラグlimit_flagは「1」となる)か、または取り得るカテゴリの値の下限(「0」となる)を下回っている(後述するように、リミットフラグlimit_flagは「−1」となる)か、を判定するためのフラグである。   Next, it is determined whether or not the variable i is equal to 0 (step S62). If the variable i is not equal to 0, the previous limit flag limit_flag [i-1] is not equal to 0 (here, FIG. 9). The symbol “! =” Indicates that they are not equal) (step S63). Further, the limit flag limit_flag is an i-th category pattern category_pattern [i] in the category pattern as shown in FIG. 17 in a category (category having the minimum code length) category_min to which a category code of the minimum code length is assigned as described later. ] Is within the range of possible category values (0 or more and max_category or less) (the limit flag limit_flag is “0” as will be described later), or the upper limit of possible category values ( It is a maximum category value max_category to be described later, and exceeds the max_category = 8 when handling an 8-bit value as shown in this example (the limit flag limit_flag is “1” as described later), Or it is below the lower limit of the possible category value (becomes “0”) (as described later, the limit flag limit_flag is “−1”), Is a flag for determining.

ここで、リミットフラグlimit_flag[i-1] が0でない場合には、前回または前回以前に、既にcategory_min+category_patternが最大カテゴリ値max_categoryよりも大きくなってしまったか、あるいは0よりも小さくなってしまったことを意味するために、注目するリミットフラグlimit_flag[i] に、1つ前のリミットフラグlimit_flag[i-1] と同一の値を代入(ここに、図9の記号「=」は代入を表している。以下同様。)する(ステップS64)。   Here, if the limit flag limit_flag [i-1] is not 0, it means that the category_min + category_pattern has already become larger than the maximum category value max_category or has become smaller than 0 before or before the previous time. For the sake of meaning, the same value as the previous limit flag limit_flag [i-1] is substituted for the limit flag limit_flag [i] of interest (here, the symbol “=” in FIG. 9 represents substitution) (The same applies hereinafter) (step S64).

また、ステップS62において変数iが0である場合、またはステップS63において1つ前のリミットフラグlimit_flag[i-1] が0である場合には、最小符号長となるカテゴリcategory_minにi番目のカテゴリパターンcategory_pattern[i] を加算したものが、最大カテゴリ値max_categoryよりも大きいか否かを判定する(ステップS65)。ここに、最小符号長となるカテゴリcategory_minは、0≦category_min≦max_categoryの範囲内で、例えば図15や図18に示すように、閾値thの値に応じて最小符号長シンボルとして予め定められている。これらの図に示す例においては、閾値th1に対しては3の最小符号長シンボル、閾値th2に対しては5の最小符号長シンボル、閾値th3に対しては6の最小符号長シンボル、がそれぞれ与えられている。   If the variable i is 0 in step S62 or if the previous limit flag limit_flag [i-1] is 0 in step S63, the i-th category pattern is included in the category category_min that is the minimum code length. It is determined whether the sum of category_pattern [i] is larger than the maximum category value max_category (step S65). Here, the category category_min that is the minimum code length is predetermined as a minimum code length symbol within the range of 0 ≦ category_min ≦ max_category, for example, as shown in FIGS. 15 and 18, according to the value of the threshold th. . In the examples shown in these figures, a minimum code length symbol of 3 for the threshold th1, a minimum code length symbol of 5 for the threshold th2, and a minimum code length symbol of 6 for the threshold th3, respectively. Is given.

このステップS65において、大きいと判定された場合には、注目するリミットフラグlimit_flag[i] に、1を代入する(ステップS66)。   If it is determined in step S65 that the value is large, 1 is substituted into the limit flag limit_flag [i] of interest (step S66).

一方、ステップS65において、最大カテゴリ値max_category以下であると判定された場合には、最小符号長となるカテゴリcategory_minにi番目のカテゴリパターンcategory_pattern[i] を加算したものが、0未満であるか否かを判定する(ステップS67)。   On the other hand, if it is determined in step S65 that it is less than or equal to the maximum category value max_category, the value obtained by adding the i-th category pattern category_pattern [i] to the category category_min that is the minimum code length is less than zero. Is determined (step S67).

ここで、0未満である場合には注目するリミットフラグlimit_flag[i] に−1を代入し(ステップS68)、0以上である場合には、注目するリミットフラグlimit_flag[i] に0を代入する(ステップS69)。   Here, if it is less than 0, −1 is assigned to the limit flag limit_flag [i] to be noticed (step S68), and if it is 0 or more, 0 is assigned to the limit flag limit_flag [i] to be noticed. (Step S69).

上述した、ステップS64、ステップS66、ステップS68、またはステップS69の何れかの処理が終了したら、リミットフラグlimit_flag[i] の判定を行う(ステップS70)。   When any of the above-described processing of step S64, step S66, step S68, or step S69 is completed, the limit flag limit_flag [i] is determined (step S70).

そして、リミットフラグlimit_flag[i] が0であると判定された場合(つまり、0≦(category_min+category_pattern[i] )≦max_categoryとなる場合)には、最小符号長となるカテゴリcategory_minにi番目のカテゴリパターンcategory_pattern[i] を加算したものをi番目のカテゴリcategory[i] とする(ステップS71)。   When it is determined that the limit flag limit_flag [i] is 0 (that is, when 0 ≦ (category_min + category_pattern [i]) ≦ max_category), the i th category pattern in the category category_min that is the minimum code length The sum of category_pattern [i] is set as the i-th category category [i] (step S71).

また、ステップS70において、リミットフラグlimit_flag[i] が1であると判定された場合(つまり、1度でもmax_category<(category_min+category_pattern[i] )となった場合)には、0番目のカテゴリcategory[0] から(i−1)番目のカテゴリcategory[i-1] までの内の最小のものから1を引いたものを、i番目のカテゴリcategory[i] とする(ステップS72)。   If it is determined in step S70 that the limit flag limit_flag [i] is 1 (that is, if max_category <(category_min + category_pattern [i]) even once), the 0th category category [0] ] To the (i−1) th category category [i−1] minus 1 is defined as the i th category category [i] (step S72).

さらに、ステップS70において、リミットフラグlimit_flag[i] が−1であると判定された場合(つまり、1度でも(category_min+category_pattern[i] )<0となった場合)には、0番目のカテゴリcategory[0] から(i−1)番目のカテゴリcategory[i-1] までの内の最大のものに1を足したものを、i番目のカテゴリcategory[i] とする(ステップS73)。   Furthermore, if it is determined in step S70 that the limit flag limit_flag [i] is −1 (that is, if (category_min + category_pattern [i]) <0 even once), the 0th category category [ 0] to (i-1) th category category [i-1] plus 1 is defined as i-th category category [i] (step S73).

ステップS71〜S73までの何れかの処理が終了したら、変数iは最大カテゴリ値max_category未満であるか否かを判定し(ステップS74)、最大カテゴリ値max_category未満である場合には、iをインクリメント(図9においては、記号「++」により表している)してから(ステップS75)、ステップS62へ戻って上述したような処理を繰り返して行う。   When any of the processes from step S71 to S73 is completed, it is determined whether or not the variable i is less than the maximum category value max_category (step S74). If it is less than the maximum category value max_category, i is incremented ( In FIG. 9, (represented by the symbol “++”) (step S75), the process returns to step S62 to repeat the above-described processing.

また、ステップS74において、変数iが最大カテゴリ値max_category以上であると判定された場合には、このハフマン符号化テーブル作成処理から、図4に示した処理に復帰する。   If it is determined in step S74 that the variable i is greater than or equal to the maximum category value max_category, the process returns to the process shown in FIG. 4 from the Huffman coding table creation process.

この図9に示したような処理を簡潔に述べれば、図19に示すようなカテゴリ符号に対して、有意ビットの符号長を表すカテゴリを割り振っていく際に、最小符号長となるカテゴリcategory_minにまず最小符号長(図19に示す例においては、符号長2)のカテゴリ符号(図19に示す例では「00」)を与え、その後、最小符号長となるカテゴリcategory_minに図17に示すようなカテゴリパターンcategory_patternを順に加算して、図19に示すカテゴリ符号を順に割り振っていく。このとき、(category_min+category_pattern)が、最大カテゴリ値max_categoryを超えてしまう場合には、まだ割り当てを行っていないカテゴリの内の最大のカテゴリから降べきに残りのカテゴリ符号を割り当て、一方、0未満となってしまう場合には、まだ割り当てを行っていないカテゴリの内の最小のカテゴリから昇べきに残りのカテゴリ符号を割り当てるようにしたものとなっている。   If the process as shown in FIG. 9 is briefly described, when a category representing the code length of a significant bit is assigned to the category code as shown in FIG. 19, the category category_min that is the minimum code length is assigned. First, the category code (“00” in the example shown in FIG. 19) of the minimum code length (code length 2 in the example shown in FIG. 19) is given, and then the category category_min that becomes the minimum code length is shown in FIG. The category patterns category_pattern are added in order, and the category codes shown in FIG. 19 are assigned in order. At this time, if (category_min + category_pattern) exceeds the maximum category value max_category, the remaining category codes are assigned to descend from the largest category among the categories that have not yet been assigned. In such a case, the remaining category codes are assigned in ascending order from the smallest category among the categories not yet assigned.

具体的な処理の例として、最小符号長シンボルが3であるときには、まず、有意ビットの符号長が3であることを表すカテゴリ「3」にカテゴリ符号「00」を割り振り、次に、「3」にカテゴリパターン「1」を加算したカテゴリ「4」にカテゴリ符号「010」を割り振り、「3」にカテゴリパターン「−1」を加算したカテゴリ「2」にカテゴリ符号「011」を割り振り、「3」にカテゴリパターン「2」を加算したカテゴリ「5」にカテゴリ符号「100」を割り振り、「3」にカテゴリパターン「−2」を加算したカテゴリ「1」にカテゴリ符号「101」を割り振り、「3」にカテゴリパターン「3」を加算したカテゴリ「6」にカテゴリ符号「110」を割り振り、「3」にカテゴリパターン「−3」を加算したカテゴリ「0」にカテゴリ符号「1110」を割り振り、「3」にカテゴリパターン「4」を加算したカテゴリ「7」にカテゴリ符号「11110」を割り振り、「3」にカテゴリパターン「−4」を加算すると「−1」となって該当するカテゴリが存在しないために、既に出現した最大のカテゴリ「7」に1を加えたカテゴリ「8」にカテゴリ符号「111110」を割り振り、ここで8ビットの値を扱うのに必要なカテゴリ「0」からカテゴリ「8」までの全てのカテゴリへの割り当てが行われたために、処理を終了する、という動作を行う。   As a specific example of processing, when the minimum code length symbol is 3, first, category code “00” is assigned to category “3” indicating that the code length of significant bits is 3, and then “3” ”Is assigned a category code“ 010 ”to a category“ 4 ”obtained by adding a category pattern“ 1 ”, and a category code“ 011 ”is assigned to a category“ 2 ”obtained by adding a category pattern“ −1 ”to“ 3 ”. The category code “100” is assigned to the category “5” obtained by adding the category pattern “2” to the “3”, the category code “101” is assigned to the category “1” obtained by adding the category pattern “−2” to the “3”, A category code “110” is assigned to a category “6” obtained by adding a category pattern “3” to “3”, and a category “6” obtained by adding a category pattern “−3” to “3”. ”Is assigned a category code“ 1110 ”, a category pattern“ 4 ”is added to“ 3 ”, a category code“ 11110 ”is assigned to“ 7 ”, and a category pattern“ −4 ”is added to“ 3 ”. Since the corresponding category does not exist with “1”, the category code “111110” is assigned to the category “8” obtained by adding 1 to the maximum category “7” that has already appeared, and an 8-bit value is handled here. Since the assignment to all the categories from “0” to “8” necessary for the process is performed, an operation of terminating the processing is performed.

また、例えば、最小符号長シンボルが6であるときにも同様に処理を行うが、i=5のときに、「6」にカテゴリパターン「3」を加算すると「9」となって該当するカテゴリが存在しないために、既に出現した最小のカテゴリ「4」から1を引いたカテゴリ「3」にカテゴリ符号「110」を割り振り、以降は、カテゴリ「2」、カテゴリ「1」、カテゴリ「0」に、カテゴリ符号を順に割り振るという動作を行う。   For example, the same processing is performed when the minimum code length symbol is 6, but when i = 5, adding “6” to the category pattern “3” results in “9” and the corresponding category. Therefore, the category code “110” is assigned to the category “3” obtained by subtracting 1 from the minimum category “4” that has already appeared. Thereafter, the category “2”, the category “1”, and the category “0” are allocated. In addition, an operation of sequentially assigning category codes is performed.

なお、上述した例においては、閾値th3に対応する最小符号長シンボル「6」が設定されるために、図19に示すカテゴリ符号に対して、図18における最小符号長シンボルが6となる場合の各カテゴリが割り振られることになる。   In the above-described example, since the minimum code length symbol “6” corresponding to the threshold th3 is set, the minimum code length symbol in FIG. 18 is 6 with respect to the category code shown in FIG. Each category will be assigned.

図4の説明に戻って、ステップS16の処理が終了したら、ハフマンテーブル作成部17により作成された符号化テーブルを用いて、符号化手段たるハフマン符号化部18が、上記ステップS3において算出された予測誤差値pred_diff のハフマン符号化を行う(ステップS17)。   Returning to the description of FIG. 4, when the processing of step S <b> 16 is completed, the Huffman encoding unit 18 as the encoding unit is calculated in step S <b> 3 by using the encoding table generated by the Huffman table generating unit 17. Huffman coding of the prediction error value pred_diff is performed (step S17).

ハフマン符号は、よく知られているように、カテゴリ符号と、有意ビット(ここでは、予測誤差データの有意ビット)と、により構成されている(図20参照)。カテゴリ符号は、有意ビット部分の符号長を示す符号となっており、例えば図21に示すような9ビットの予測誤差データ「000001011」(10進数で表して「11」となる)が得られたとすると、有意ビットは下位4ビット分であるためにカテゴリは「4」となる。このカテゴリ4に対して、上述したように、最小符号長シンボルが6であるときに割り振られるカテゴリ符号は、図18および図19を参照して「101」となるために、ハフマン符号化データは、図22に示すように「1011011」となる。この符号化データ「1011011」は、7ビットであり、データの圧縮が行われていることが分かる。   As is well known, the Huffman code is composed of a category code and significant bits (here, significant bits of prediction error data) (see FIG. 20). The category code is a code indicating the code length of the significant bit part. For example, 9-bit prediction error data “000001011” (decimal number “11”) as shown in FIG. 21 is obtained. Then, since the significant bits are for the lower 4 bits, the category is “4”. As described above, the category code assigned to the category 4 when the minimum code length symbol is 6 is “101” with reference to FIGS. 18 and 19, so the Huffman encoded data is As shown in FIG. 22, “1011011” is obtained. This encoded data “1011011” has 7 bits, and it can be seen that the data is compressed.

こうして、1つのブロック内の各画素データについて、ハフマン符号化の処理が終了したら、次に、n個のブロックについて処理が終了したか否か、つまり、処理対象の画像データ全体の処理が終了したか否かを判定する(ステップS18)。ここで画像データ全体の処理が終了していない場合には、ブロック単位での処理に用いる各種のパラメータ等のリセットを必要に応じて行ってから、ステップ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 S18). 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.

圧縮処理が行われた画像データは、ファイルシステム等を介して記録媒体等へ記録するために、所定のファイルフォーマットに基づいたファイル化が行われる。図23は、圧縮された画像データを記録するためのファイルフォーマットの一例を示す図である。   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. 23 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.

そして、ブロック毎に作成されたハフマン符号化テーブルは、圧縮画像ファイルを生成する際に、例えば、タグ部分に記録されるようになっている。   The Huffman coding table created for each block is recorded in, for example, a tag portion when generating a compressed image file.

ここで、図24は、ファイルフォーマットにおけるタグの構造を示す図である。   Here, FIG. 24 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.

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

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

次に、タイプとして、データ量を示す型(具体的な例としては、プログラミング言語Cにおいて用いられているような、1バイトのデータを示す「char」や整数の型を示す「int」 など)が格納される。なお、ここでは、ハフマン符号化テーブルを格納するのに必要なデータサイズの型が格納されることになる。   Next, as a type, a type indicating the amount of data (specific examples include “char” indicating 1-byte data and “int” indicating an integer type as used in the programming language C). Is stored. Here, the type of data size required to store the Huffman coding table is stored.

さらに、カウントとしては、例えば、ブロック数が格納される。   Furthermore, as the count, for example, the number of blocks is stored.

そして、オフセットとしては、例えばタグIDの先頭から値が格納されているアドレスまでの相対的なデータ移動量、あるいは、図23に示すタグ領域の先頭から値が格納されているアドレスまでのデータ移動量、などが格納される。   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. 23 to the address where the value is stored. Quantity, etc. are stored.

これにより、復号化時にはブロックに対応するハフマン符号化テーブルを読み出して、伸張処理を行うことが可能となる。   Thereby, at the time of decoding, it is possible to read the Huffman coding table corresponding to the block and perform the expansion process.

なお、上述した例においては、3種類の閾値th1〜th3を用いており、各閾値に対応する最小符号長シンボルが3種類、全ての閾値に対応するランフラグrun_flagが0になる場合の最小符号長シンボルが1種類、の合計4種類となるために、作成されるハフマン符号化テーブルの種類も4種類となる。従って、各ブロックに対応してハフマン符号化テーブルをそのままブロック数だけ記録するのは、データ量的に有利であるとはいえない。そこで、例えば、まず作成された全てのハフマン符号化テーブルをまずタグに記録しておき、ハフマン符号化テーブルに適当な符号を割り当てて(例えば、閾値th1の最小符号長シンボル「3」に対応するハフマン符号化テーブルに符号「0」を、閾値th2の最小符号長シンボル「5」に対応するハフマン符号化テーブルに符号「1」を、閾値th3の最小符号長シンボル「6」に対応するハフマン符号化テーブルに符号「2」を、全ての閾値に対応するランフラグrun_flagが0になる場合の最小符号長シンボル「7」(あるいは「8」)に対応するハフマン符号化テーブルに符号「3」を、それぞれ割り当てるなど)、タグ内に各ブロックに対してこれらの符号「0」〜「3」の何れかを記録するようにすれば、1つのブロックに対して2ビット分のデータ量で済むために、データサイズを小さくすることが可能となる。ただし、実用上は、データが1バイト単位で格納されることが多いために、上述した例において、さらに、例えば4ブロック分のデータをまとめて1バイト中に格納することも考えられる。   In the above-described example, three types of threshold values th1 to th3 are used, and the minimum code length when three types of minimum code length symbols corresponding to each threshold value and run flags run_flag corresponding to all threshold values are 0 is used. Since there are a total of four types of symbols, one type, there are four types of Huffman coding tables to be created. Therefore, it is not advantageous in terms of data amount to record the Huffman coding table as many as the number of blocks corresponding to each block. Therefore, for example, all the created Huffman coding tables are first recorded in tags, and appropriate codes are assigned to the Huffman coding tables (for example, corresponding to the minimum code length symbol “3” of the threshold th1). The code “0” in the Huffman coding table, the code “1” in the Huffman coding table corresponding to the minimum code length symbol “5” of the threshold th2, and the Huffman code corresponding to the minimum code length symbol “6” in the threshold th3. Code “2” in the encoding table, code “3” in the Huffman encoding table corresponding to the minimum code length symbol “7” (or “8”) when the run flag run_flag corresponding to all threshold values is 0, If any one of these codes “0” to “3” is recorded for each block in the tag, for each block, etc. To requires only data of bits, it is possible to reduce the data size. However, in practice, data is often stored in units of 1 byte. Therefore, in the above-described example, for example, it is also possible to store data for 4 blocks collectively in 1 byte.

このようにして、各ブロックに対応する値の組として格納された、ブロック毎のハフマン符号化テーブル、あるいは全てのハフマン符号化テーブルおよびブロック毎のハフマン符号化テーブルの種類を示す情報、が、上述した符号化テーブルデータ(ハフマンテーブル作成部17から出力されるデータであり、復号テーブル作成部21へ入力されるデータ)である。   Thus, the Huffman coding table for each block, or the information indicating the types of all Huffman coding tables and the Huffman coding tables for each block, stored as a set of values corresponding to each block, is described above. Encoding table data (data output from the Huffman table creation unit 17 and data input to the decoding table creation unit 21).

次に、図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 taken as an example of the coding table to be created. However, the present invention is not limited to this, and coding tables in other coding methods can be created according to flatness. It is.

このような実施形態1によれば、ブロック単位で平坦度を検出し、平坦度に応じてハフマン符号化テーブルを作成するようにしたために、検出された平坦度に適したハフマン符号化テーブルを用いてハフマン符号化を行うことが可能となり、高い圧縮性能を発揮することが可能となる。   According to the first embodiment, since the flatness is detected in units of blocks and the Huffman coding table is generated according to the flatness, the Huffman coding table suitable for the detected flatness is used. Huffman coding can be performed, and 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 count by a run counter or a lancet counter when detecting flatness, an increase in the amount of memory required when creating a Huffman coding table can be substantially suppressed, saving It can be configured with a memory.

そして、ハフマン符号化テーブルは適応的に作成されるものであるために、予め複数のハフマン符号化テーブルを記憶しておくための記憶手段等も不要となり、より省メモリ化を図ることができる。   Since the Huffman coding table is adaptively created, a storage means for storing a plurality of Huffman coding tables in advance is not necessary, and the memory can be further reduced.

また、圧縮されたデータを、短い処理時間、かつ、小さな必要なメモリ量で復号化することが可能となる。   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におけるハフマン符号化テーブル作成の処理を示すフローチャート。5 is a flowchart showing processing for creating a Huffman coding table 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. 上記図11の画素データから得られるブロックの予測誤差データを示す図。The figure which shows the prediction error data of the block obtained from the pixel data of the said FIG. 上記図13の予測誤差データを絶対値化して得られる絶対値化された予測誤差データを示す図。The figure which shows the prediction error data converted into the absolute value obtained by converting the prediction error data of the said FIG. 13 into an absolute value. 上記実施形態1の平坦度検出において用いられる各閾値や設定値と閾値に対応する最小符号長シンボルとを示す図表。FIG. 5 is a chart showing thresholds and setting values used in flatness detection according to Embodiment 1 and minimum code length symbols corresponding to the thresholds. FIG. 上記図14の絶対値化された予測誤差データに対して図15の各閾値や設定値を適用して得られる平坦度検出の結果を示す図表。The chart which shows the result of the flatness detection obtained by applying each threshold value and setting value of FIG. 15 to the absolute value prediction error data of FIG. 上記実施形態1におけるカテゴリパターンを示す図表。The chart which shows the category pattern in the said Embodiment 1. FIG. 上記実施形態1において、最小符号長シンボルに対応するカテゴリと符号長との関係を示す図表。FIG. 3 is a chart showing a relationship between a category corresponding to a minimum code length symbol and a code length in the first embodiment. 上記実施形態1において、符号長とカテゴリ符号との対応を示す図表。The chart which shows a response | compatibility with code length and a category code in the said Embodiment 1. FIG. 上記実施形態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. 上記図21の予測誤差データを符号化して得られるハフマン符号を示す図。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…ハフマンテーブル作成部(符号化テーブル作成手段)
18…ハフマン符号化部(符号化手段)
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 ... Category determination part (minimum code length category determination means)
17 ... Huffman table creation unit (encoding table creation means)
18 ... Huffman encoding unit (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)

データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、
上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、
上記ランセットカウンタにより検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段と、
上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリに対して、より短い符号長のカテゴリ符号を割り当てるように、カテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段と、
上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段と、
を具備し
上記所定の範囲は複数種類設定可能となっており、
上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、
上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、
上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものである
ことを特徴とするデータ符号化装置。
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;
Minimum code length category determining means for determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of lancets detected by the lancet counter. ,
For a category representing the number of significant bits close to the significant number of bits represented depending on the minimum code length categories determined by the minimum code length category determination means, to allocate shorter code length category codes, category and category code A coding table creating means for creating a coding table indicating the correspondence relationship with
Encoding means for generating encoded data by associating the category code with the significant bit portion of the data based on the encoding table created by the encoding table creating means;
Equipped with,
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 in which the data value is continuously within the predetermined range, and the continuous number of the data is The detection is repeated every time a predetermined number is reached,
The lancet counter detects the number of lancets corresponding to each of the predetermined ranges of the plurality of types, the number of times that the continuation number of the data is detected by the run counter to reach the predetermined number. And
The minimum code length category determining means includes a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. Determines the minimum code length category that is the category to which the category code is assigned
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に記載のデータ符号化装置。 When the number of lancets detected by the lancet counter is greater than or equal to a predetermined number, the minimum code length category determining means determines that the minimum code length category determining means has a minimum number of categories representing a significant number of bits as compared to when the number is less than the predetermined number. The data encoding apparatus according to claim 1, wherein a minimum code length category is determined so as to assign a code code of a code length . 上記所定の範囲は、上記データの絶対値が所定の閾値以下となる範囲であって、該所定の閾値は複数種類設定可能となっており、
上記ランカウンタは、設定された複数種類の所定の閾値のそれぞれに対して、データの絶対値が連続して該所定の閾値以下となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、
上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の閾値のそれぞれに対応して、検出するものであり、
上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の閾値のそれぞれに対応して検出されたランセットの数が所定数以上であるか否かを各々判定し、所定数以上となった最も低い閾値が、低いときには高いときに比して、最小符号長のカテゴリ符号を割り当てるカテゴリがより小さい有意ビット数を表すカテゴリとなるように、最小符号長カテゴリを決定するものである
ことを特徴とする請求項3に記載のデータ符号化装置。
The predetermined range is a range in which the absolute value of the data is equal to or less than a predetermined threshold, and the predetermined threshold can be set in a plurality of types.
The run counter detects, for each of a plurality of predetermined threshold values set, the continuous number of the data whose absolute value is continuously less than or equal to the predetermined threshold, and the continuous number of the data Is repeated every time when the number reaches a predetermined number,
The lancet counter detects the number of lancets, which is the number of times that the continuation number of the data is detected to reach the predetermined number by the run counter, corresponding to each of the plurality of predetermined threshold values. Is,
The minimum code length category determining means determines whether or not the number of lancets detected by the lancet counter corresponding to each of the plurality of types of predetermined thresholds is equal to or greater than a predetermined number. The minimum code length category is determined so that the category to which the category code of the minimum code length is assigned is a category representing a smaller number of significant bits as compared to when the lowest threshold value is high when it is low.
The data encoding apparatus according to claim 3 .
上記符号化テーブル作成手段により作成された符号化テーブルに係る情報と、上記符号化手段により生成された符号化データと、は一のファイルとして出力されるものであることを特徴とする請求項1に記載のデータ符号化装置。 2. The information relating to the coding table created by the coding table creating means and the coded data generated by the coding means are output as one file. The data encoding device described in 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ステップと、  According to the number of lancets detected by the lancet counter, a minimum code length category determining means determines a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data. And a third step
上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリに対して、より短い符号長のカテゴリ符号を割り当てるように、カテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する第4ステップと、  A category and a category code are assigned so that a category code having a shorter code length is assigned to a category representing the number of significant bits close to the number of significant bits represented by the minimum code length category determined by the minimum code length category determining means. A fourth step of creating an encoding table indicating the correspondence relationship of
上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する第5ステップと、  A fifth step of generating encoded data by associating the category code with the significant bit portion of the data based on the encoding table generated by the encoding table generating means;
を有し、  Have
上記所定の範囲は複数種類設定可能となっており、  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 in which the data value is continuously within the predetermined range, and the continuous number of the data is The detection is repeated every time a predetermined number is reached,
上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、  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 continuation number of the data is detected by the run counter to reach the predetermined number. And
上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものである  The minimum code length category determination means includes a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. Determines the minimum code length category that is the category to which the category code is assigned
ことを特徴とするデータ符号化方法。  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 minimum code length category determining means for determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of lancets detected by the lancet counter;
上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリに対して、より短い符号長のカテゴリ符号を割り当てるように、カテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段、  A category and a category code are assigned so that a category code having a shorter code length is assigned to a category representing the number of significant bits close to the number of significant bits represented by the minimum code length category determined by the minimum code length category determining means. A coding table creating means for creating a coding table indicating the correspondence between
上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段、  Encoding means for generating encoded data by associating the category code with the significant bit portion of the data based on the encoding table created by the encoding table creating means;
として機能させるためのプログラムであって、  Is a program for functioning as
上記所定の範囲は複数種類設定可能となっており、  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 in which the data value is continuously within the predetermined range, and the continuous number of the data is The detection is repeated every time a predetermined number is reached,
上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、  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 continuation number of the data is detected by the run counter to reach the predetermined number. And
上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものである  The minimum code length category determination means includes a minimum code length among categories representing the number of significant bits of the data according to the number of lancets detected corresponding to each of the plurality of types of predetermined ranges by the lancet counter. Determines the minimum code length category that is the category to which the category code is assigned
ことを特徴とするプログラム。  A program characterized by that.
データの値が連続して所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタと、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタと、上記ランセットカウンタにより検出されたランセットの数に応じて上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段と、上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリほどより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段と、上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段と、を具備し、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするデータ符号化装置によって生成された符号化データ、を復号化するためのデータ復号化装置であって、 上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現する符号化テーブル再現手段と、  A run counter for detecting the continuous number of the data whose data value is continuously within a predetermined range, and repeatedly performing the detection every time the continuous data number reaches the predetermined number, and the run counter A lancet counter for detecting the number of lancets, which is the number of times that the continuous number of the data has reached the predetermined number, and a significant bit of the data according to the number of lancets detected by the lancet counter A minimum code length category determining means for determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing numbers, and a minimum code length category determined by the minimum code length category determining means. A category code with a shorter code length for a category representing a significant bit number close to the significant bit number A coding table creating means for creating a coding table showing a correspondence relationship between a category and a category code to be assigned, and the significance of the category code and the data based on the coding table created by the coding table creating means Encoding means for generating encoded data in association with the bit part, the predetermined range can be set to a plurality of types, and the run counter can be set to a plurality of set predetermined ranges. For each of the above, the number of continuous data whose data values are continuously within the predetermined range is detected, and the detection is repeated every time the number of continuous data reaches the predetermined number. The lancet counter is the number of lancets that is the number of times that the continuation number of the data is detected by the lance counter to reach the predetermined number. The minimum code length category determining means detects the lancet detected by the lancet counter corresponding to each of the plurality of types of predetermined ranges. The minimum code length category, which is the category to which the category code of the minimum code length is assigned among the categories representing the number of significant bits of the data, is generated by the data encoding device. A data decoding apparatus for decoding the encoded data, wherein the encoding table reproducing means reproduces the encoding table used for encoding based on the information related to the generated encoding table. When,
上記符号化テーブル再現手段により再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現する復号化手段と、  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ステップと、上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する第5ステップと、を有し、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするデータ符号化方法によって生成された符号化データ、を復号化するためのデータ復号化方法であって、  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 minimum code length category determining means, A third step of determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data according to the number of detected lancets; and the minimum code length category determining means The number of significant bits close to the number of significant bits represented by the minimum code length category determined by A fourth step of creating a coding table indicating a correspondence relationship between a category and a category code so that a category code having a shorter code length is assigned to a category to be represented; and a coding table created by the coding table creating means And a fifth step of generating encoded data by associating the category code with the significant bit portion of the data based on the category code, and the predetermined range can be set in a plurality of types. , 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 reaches the predetermined number The detection is repeated every time, and the lancet counter has reached the predetermined number of consecutive data by the run counter. Are detected corresponding to each of the plurality of types of predetermined ranges, and the minimum code length category determination means is configured to detect the plurality of types of predetermined lancets by the lancet counter. In accordance with the number of lancets detected corresponding to each of the ranges, a minimum code length category, which is a category to which a category code of the minimum code length is assigned among categories representing the number of significant bits of the data, is determined. A data decoding method for decoding encoded data generated by a data encoding method characterized by comprising:
上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現し、  Based on the information related to the created encoding table, reproduce the encoding table used for encoding,
再現された符号化テーブルに基づいて、上記符号化データを復号化しデータを再現することを特徴とするデータ復号化方法。  A data decoding method characterized by decoding the encoded data and reproducing the data based on the reproduced encoding table.
コンピュータを、データの値が連続して所定の範囲内となる該データの連続数を検出するとともに該データの連続数が所定数に達する毎に該検出を繰り返し行なうためのランカウンタ、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を検出するためのランセットカウンタ、上記ランセットカウンタにより検出されたランセットの数に応じて上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定する最小符号長カテゴリ決定手段、上記最小符号長カテゴリ決定手段により決定された最小符号長カテゴリによって表わされる有意ビット数に近い有意ビット数を表わすカテゴリほどより短い符号長のカテゴリ符号を割り当てるようにカテゴリとカテゴリ符号との対応関係を示す符号化テーブルを作成する符号化テーブル作成手段、上記符号化テーブル作成手段により作成された符号化テーブルに基づいて上記カテゴリ符号と上記データの有意ビット部分とを対応付けて符号化データを生成する符号化手段、として機能させるためのプログラムであって、上記所定の範囲は複数種類設定可能となっており、上記ランカウンタは、設定された複数種類の所定の範囲のそれぞれに対して、データの値が連続して該所定の範囲内となる該データの連続数を検出するとともに、該データの連続数が所定数に達する毎に該検出を繰り返し行なうものであり、上記ランセットカウンタは、上記ランカウンタにより上記データの連続数が上記所定数に達したことが検出された回数であるランセットの数を、上記複数種類の所定の範囲のそれぞれに対応して検出するものであり、上記最小符号長カテゴリ決定手段は、上記ランセットカウンタにより上記複数種類の所定の範囲のそれぞれに対応して検出されたランセットの数に応じて、上記データの有意ビット数を表わすカテゴリのうち最小符号長のカテゴリ符号を割り当てるカテゴリである最小符号長カテゴリを決定するものであることを特徴とするプログラムによって生成された符号化データ、を復号化する処理をコンピュータに実行させるためのプログラムであって、  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 the data reaches the predetermined number, the run counter A lancet counter for detecting the number of lancets, which is the number of times that the number of consecutive data has reached the predetermined number, and a significant bit of the data according to the number of lancets detected by the lancet counter. A minimum code length category determining means for determining a minimum code length category which is a category to which a category code of the minimum code length is assigned among categories representing numbers, and the significance represented by the minimum code length category determined by the minimum code length category determining means A category representing a significant number of bits close to the number of bits has a shorter code length category. A coding table creating means for creating a coding table showing the correspondence between categories and category codes so as to assign a re-code, and the category code and the data based on the coding table created by the coding table creating means Is a program for functioning as an encoding means for generating encoded data by associating with significant bit portions of the predetermined bit range, and a plurality of types of the predetermined range can be set, and the run counter is set In addition, for each of a plurality of predetermined ranges, the continuous number of the data in which the data value is continuously within the predetermined range is detected, and each time the continuous number of the data reaches the predetermined number, The detection is repeated, and the lancet counter indicates that the number of consecutive data has reached the predetermined number by the lance counter. The number of detected lancets is detected in correspondence with each of the plurality of types of predetermined ranges, and the minimum code length category determination means uses the lancet counter to determine the plurality of types of predetermined ranges. In accordance with the number of lancets detected corresponding to each of the above, the minimum code length category, which is a category to which the category code of the minimum code length is assigned among the categories representing the number of significant bits of the data, is determined. A program for causing a computer to execute a process of decoding encoded data generated by a featured program,
上記作成された符号化テーブルに係る情報に基づいて、符号化に用いられた符号化テーブルを再現し、  Based on the information related to the created 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.
JP2005170123A 2005-06-09 2005-06-09 Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program Expired - Fee Related JP4493552B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005170123A JP4493552B2 (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
JP2005170123A JP4493552B2 (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
JP2006345321A JP2006345321A (en) 2006-12-21
JP4493552B2 true JP4493552B2 (en) 2010-06-30

Family

ID=37641922

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005170123A Expired - Fee Related JP4493552B2 (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) JP4493552B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101415564B1 (en) 2007-10-29 2014-08-06 삼성디스플레이 주식회사 Driving device of display device and driving method thereof
CN102739511B (en) * 2011-04-14 2015-06-24 富士通株式会社 Data processing system and data processing method

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02171083A (en) * 1988-12-23 1990-07-02 Nec Corp Coding system for picture signal
JPH04314266A (en) * 1991-04-12 1992-11-05 Olympus Optical Co Ltd Device and method for encoding picture data
JPH04322561A (en) * 1991-04-22 1992-11-12 Fujitsu Ltd Variable rate picture coding system
JPH05242404A (en) * 1992-12-21 1993-09-21 Hitachi Ltd Resistance change detection circuit
JPH08172522A (en) * 1994-12-20 1996-07-02 Oki Data:Kk Resolution switching device
JPH0937271A (en) * 1995-07-18 1997-02-07 Hewlett Packard Co <Hp> Image compressing method
JPH0937246A (en) * 1995-07-14 1997-02-07 Canon Inc Image processing unit and its method
JPH09116765A (en) * 1995-10-16 1997-05-02 Matsushita Electric Ind Co Ltd Method and device for encoding picture data
JPH11225335A (en) * 1998-02-05 1999-08-17 Hitachi Ltd Image compressing method and mail processing system using it
JP2004007555A (en) * 2002-04-09 2004-01-08 Canon Inc Entropy encoder
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
JPH02171083A (en) * 1988-12-23 1990-07-02 Nec Corp Coding system for picture signal
JPH04314266A (en) * 1991-04-12 1992-11-05 Olympus Optical Co Ltd Device and method for encoding picture data
JPH04322561A (en) * 1991-04-22 1992-11-12 Fujitsu Ltd Variable rate picture coding system
JPH05242404A (en) * 1992-12-21 1993-09-21 Hitachi Ltd Resistance change detection circuit
JPH08172522A (en) * 1994-12-20 1996-07-02 Oki Data:Kk Resolution switching device
JPH0937246A (en) * 1995-07-14 1997-02-07 Canon Inc Image processing unit and its method
JPH0937271A (en) * 1995-07-18 1997-02-07 Hewlett Packard Co <Hp> Image compressing method
JPH09116765A (en) * 1995-10-16 1997-05-02 Matsushita Electric Ind Co Ltd Method and device for encoding picture data
JPH11225335A (en) * 1998-02-05 1999-08-17 Hitachi Ltd Image compressing method and mail processing system using it
JP2004007555A (en) * 2002-04-09 2004-01-08 Canon Inc Entropy encoder
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
JP2006345321A (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
JP4682102B2 (en) Image coding apparatus and image coding method
EP2302931A3 (en) Moving picture encoding method and decoding method
CN1713710B (en) Image processing apparatus and image processing method
US20210084242A1 (en) Image processing device
US20110135009A1 (en) Combined lossy and lossless video compression
JP4493552B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program
US7148822B2 (en) Decoder and decoding method
JP4500213B2 (en) Data encoding apparatus, data decoding apparatus, data encoding method, data decoding method, and program
JP4493551B2 (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
JP2005175872A (en) Motion vector detecting apparatus, motion vector detecting method and computer program
CN114842108A (en) Probability grid map processing method and device and storage device
JP4737665B2 (en) Code processing apparatus, code processing method, program, and information recording medium
JP4125642B2 (en) Adaptive variable length coding apparatus, adaptive variable length coding method, and adaptive variable length coding program
JP2000163438A5 (en)
JP4207764B2 (en) Motion vector detection apparatus, motion vector detection method, and computer program
JP4415651B2 (en) Image encoding apparatus and image decoding apparatus
JP2007049594A (en) Processing method for image data
JP4612831B2 (en) Variable length coding apparatus and variable length coding method
JP7284429B2 (en) Quantization device, quantization method and program
JP2005045527A (en) Method for compressing still image and method for compressing video signal
JP3954032B2 (en) Image coding apparatus, image coding method, image coding program, and computer-readable recording medium on which image coding program is recorded
JP2004222142A (en) Method for compressing and decoding video signal
JP2003230138A (en) Apparatus and method for coding processing and decoding processing, and computer program

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: 4493552

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