JP2007324971A - Encoder, encoding method, and program - Google Patents

Encoder, encoding method, and program Download PDF

Info

Publication number
JP2007324971A
JP2007324971A JP2006153232A JP2006153232A JP2007324971A JP 2007324971 A JP2007324971 A JP 2007324971A JP 2006153232 A JP2006153232 A JP 2006153232A JP 2006153232 A JP2006153232 A JP 2006153232A JP 2007324971 A JP2007324971 A JP 2007324971A
Authority
JP
Japan
Prior art keywords
code
encoding
variable
unit
data file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006153232A
Other languages
Japanese (ja)
Inventor
Taro Yokose
太郎 横瀬
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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co Ltd
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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP2006153232A priority Critical patent/JP2007324971A/en
Publication of JP2007324971A publication Critical patent/JP2007324971A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an encoder achieving encoding processing more efficiently. <P>SOLUTION: The encoder 2 combines a fixed encoding processing without depending on an inputted data file with a variable encoding processing depending on the inputted data file in series to reduce a buffering load. The fixed encoding processing is executed in the pre-stage of buffering processing, thus reducing the size of data to be buffered for reducing the load of the buffering. The variable encoding processing is performed to a buffered symbol additionally, thus achieving the same compression ratio as that of the variable encoding processing. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、データファイルを符号化する符号化方法に関する。   The present invention relates to an encoding method for encoding a data file.

例えば、特許文献1には、求める限定色の色数を指定して、カラー画像の色分布より目的の数の限定色を抽出し、カラー画像より各限定色に割り当てられる画素数の頻度分布を計数し、頻度分布を使って生起確率を求め限定色の各々にハフマン符号を割り当て、画素ごとに、画素の限定色が隣接画素の限定色と同一であれば位置関係の符号を、それ以外は限定色の符号を割り当て、圧縮データとして保存し、最後に圧縮データの付加情報の保存処理を行う方法が開示されている。
特開平6−274609号公報
For example, in Patent Document 1, the number of limited colors to be obtained is specified, a target number of limited colors is extracted from the color distribution of the color image, and the frequency distribution of the number of pixels assigned to each limited color is extracted from the color image. Count and use the frequency distribution to determine the probability of occurrence, assign a Huffman code to each of the limited colors, and for each pixel, if the limited color of the pixel is the same as the limited color of the adjacent pixel, a positional relationship code, otherwise A method is disclosed in which a code of a limited color is assigned and stored as compressed data, and finally, additional information of the compressed data is stored.
JP-A-6-274609

本発明は、上述した背景からなされたものであり、より効率的な符号化処理を実現する符号化装置を提供することを目的とする。   The present invention has been made from the above-described background, and an object thereof is to provide an encoding device that realizes more efficient encoding processing.

[符号化装置]
上記目的を達成するために、本発明にかかる符号化装置は、未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成する第1の符号生成手段と、前記第1の符号生成手段により生成された中間符号に基づいて、入力されたデータファイルの出力符号を生成する第2の符号生成手段とを有する。
[Encoding device]
In order to achieve the above object, an encoding apparatus according to the present invention encodes an input data file using an entropy encoding method that does not depend on unprocessed data, and generates an intermediate code. Generating means and second code generating means for generating an output code of the input data file based on the intermediate code generated by the first code generating means.

好適には、前記第2の符号生成手段は、未処理のデータに依存する符号化方式を用いて、前記出力符号を生成する。   Preferably, the second code generation means generates the output code using an encoding method depending on unprocessed data.

好適には、前記第2の符号生成手段は、データファイル全体に対する統計処理に基づいて、前記出力符号を生成する。   Preferably, the second code generation means generates the output code based on statistical processing for the entire data file.

好適には、前記第1の符号生成手段による符号化処理の少なくとも一部と並行して、前記統計処理を行う統計処理手段をさらに有し、前記第2の符号生成手段は、前記統計処理手段による統計処理の結果に基づいて、前記出力符号を生成する。   Preferably, it further includes statistical processing means for performing the statistical processing in parallel with at least a part of the encoding processing by the first code generating means, and the second code generating means includes the statistical processing means. The output code is generated based on the result of the statistical processing according to the above.

好適には、前記第1の符号生成手段は、前記第2の符号生成手段よりも大きなデータ単位で、符号化処理を行う。   Preferably, the first code generation unit performs an encoding process in a larger data unit than the second code generation unit.

好適には、前記第1の符号生成手段は、予め設計された固定符号表を用いて、入力されたデータファイルを符号化し、前記第2の符号生成手段は、入力されたデータファイルそれぞれに応じて設計される可変符号表を用いて、前記出力符号を生成する。   Preferably, the first code generation means encodes the input data file using a pre-designed fixed code table, and the second code generation means responds to each of the input data files. The output code is generated using a variable code table designed in this way.

好適には、前記第1の符号生成手段により生成された中間符号を記憶する記憶手段をさらに有し、前記第2の符号生成手段は、前記記憶手段に記憶された中間符号を符号化して、前記出力符号を生成する。   Preferably, the apparatus further comprises storage means for storing the intermediate code generated by the first code generation means, and the second code generation means encodes the intermediate code stored in the storage means, The output code is generated.

[符号化方法]
また、本発明にかかる符号化方法は、未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成し、生成された前記中間符号に基づいて、入力されたデータファイルの出力符号を生成する。
[Encoding method]
In addition, the encoding method according to the present invention encodes an input data file using an entropy encoding method that does not depend on unprocessed data, generates an intermediate code, and based on the generated intermediate code The output code of the input data file is generated.

[プログラム]
また、本発明にかかるプログラムは、未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成するステップと、生成された前記中間符号に基づいて、入力されたデータファイルの出力符号を生成するステップとをコンピュータに実行させる。
[program]
In addition, the program according to the present invention encodes an input data file using an entropy encoding method that does not depend on unprocessed data, generates an intermediate code, and based on the generated intermediate code And causing the computer to generate an output code of the input data file.

本発明の符号化装置によれば、より効率的な符号化処理を実現することができる。   According to the encoding apparatus of the present invention, more efficient encoding processing can be realized.

まず、本発明の理解を助けるために、その背景及び概略を説明する。
ハフマン符号は、実現構成が簡単なので、広く使われている符号化方式である。本来は、入力されたデータファイル毎に、各入力シンボルの出現頻度分布を求め、その分布に応じた符号表(可変符号表)を設計する(以下、これを可変的ハフマン符号という)。
しかし、国際標準JPEGをはじめ、一般によく使われているハフマン符号では、事前に想定された出現頻度分布に対して設計した符号表(固定符号表)を、固定的に適用することが多い(以下、これを固定的ハフマン符号という)。
First, in order to help understanding of the present invention, its background and outline will be described.
The Huffman code is a widely used coding method because of its simple implementation configuration. Originally, an appearance frequency distribution of each input symbol is obtained for each input data file, and a code table (variable code table) corresponding to the distribution is designed (hereinafter referred to as a variable Huffman code).
However, in Huffman codes that are commonly used, including the international standard JPEG, a code table (fixed code table) designed for the frequency distribution assumed in advance is often applied fixedly (below) This is called the fixed Huffman code).

画像圧縮にハフマン符号を適用する場合には、前段でソースコーディングと呼ぶ変換処理をかけて、符号化対象となるシンボルを生成する。このとき後段の符号化処理が固定的ハフマン符号を適用すると、ソースコーダの出力(シンボル)が想定出現頻度に合わない場合に圧縮率が低下する。
そのため、例えば、CG画像に対しては効率的であるが、写真画像に対しては比較的効率が悪い、といった偏ったソースコーダは使いづらいという問題があった。
一方、可変的ハフマン符号化処理では、1パス目でシンボルの統計をとり、2パス目で符号化するため、処理速度が固定的ハフマン符号を適用する場合よりも遅い。また、可変的ハフマン符号を適用する場合には、2パス処理のためには入力データを丸ごとバッファリングすることが必要となり、処理時間とメモリコストがネックになる。
When the Huffman code is applied to image compression, a conversion process called source coding is performed in the previous stage to generate a symbol to be encoded. At this time, if the encoding process in the subsequent stage applies a fixed Huffman code, the compression rate decreases when the output (symbol) of the source coder does not match the expected appearance frequency.
Therefore, for example, there is a problem that it is difficult to use a biased source coder that is efficient for a CG image but relatively inefficient for a photographic image.
On the other hand, in the variable Huffman coding process, since the statistics of the symbols are taken in the first pass and coding is done in the second pass, the processing speed is slower than the case where the fixed Huffman code is applied. In addition, when the variable Huffman code is applied, it is necessary to buffer the entire input data for the two-pass processing, and processing time and memory cost become a bottleneck.

図1は、可変的ハフマン符号を適用する符号化プログラム9の機能構成を例示する図である。
可変的ハフマン符号化の処理を遅くする原因のひとつは、バッファリング処理にある。特に画像圧縮に可変的ハフマン符号を適用する場合、ソースコーダ900によるソースコーディングをかけてシンボルを生成することが多いが、画像とは別にこのシンボルをシンボルバッファ910に記憶しておく必要がある。
例えば、予測符号化方式のソースコーディングを行い場合、ソースコーダ900は、入力された画像データの画素値を予測誤差値に変換し、この予測誤差値をシンボルとする。この予測誤差値は、符号表が作成されるまでの間、シンボルバッファ910にバッファリングされる。すなわち、シンボル計数部920は、ソースコーダ900から出力されるシンボルを計数し、符号表生成部930は、シンボル計数部920による計数結果(出現頻度)に基づいて可変符号表を生成し、ハフマン符号化部940は、符号表生成部930により符号表が生成されたことを条件として、シンボルバッファ910からシンボルを読み出し、読み出されたシンボルを符号化していく。
バッファリングされる予測誤差値は、画素数分だけあるので、シンボルバッファ910は画像1ページ分のメモリを要し、このメモリの書込み及び読出しも1ページ分丸ごと必要になる。特に、予測符号化の場合、ソースコーダ900の処理は軽く、並列化も比較的容易なので、バッファリングの相対的処理負荷が高くなる。
FIG. 1 is a diagram illustrating a functional configuration of an encoding program 9 to which a variable Huffman code is applied.
One of the causes for delaying the variable Huffman coding process is the buffering process. In particular, when a variable Huffman code is applied to image compression, symbols are often generated by performing source coding by the source coder 900, but it is necessary to store these symbols in the symbol buffer 910 separately from the image.
For example, when performing source coding using a predictive coding method, the source coder 900 converts a pixel value of input image data into a prediction error value, and uses the prediction error value as a symbol. This prediction error value is buffered in the symbol buffer 910 until the code table is created. That is, the symbol counting unit 920 counts the symbols output from the source coder 900, and the code table generating unit 930 generates a variable code table based on the counting result (appearance frequency) by the symbol counting unit 920, and the Huffman code The conversion unit 940 reads a symbol from the symbol buffer 910 on the condition that the code table is generated by the code table generation unit 930, and encodes the read symbol.
Since there are as many prediction error values as the number of pixels to be buffered, the symbol buffer 910 requires memory for one page of image, and writing and reading of this memory is also required for one page. In particular, in the case of predictive coding, the processing of the source coder 900 is light and parallelization is relatively easy, which increases the relative processing load of buffering.

そこで、本実施形態における符号化装置2は、バッファリングの負荷を削減するために、入力されたデータファイルに依存しない固定的符号化処理(例えば、固定的ハフマン符号化処理)と、入力されたデータファイルに依存する可変的符号化処理(例えば、入力画像に適応した可変的ハフマン符号化処理)とを直列に組み合わせる。このうち固定的符号化処理は、バッファリング処理の前段で実行することにより、バッファリングすべきデータのデータサイズを小さくして、バッファリングの負荷を削減する。そして、バッファリングされたシンボル(固定的符号化処理で符号化された符号)に対しては、可変的符号化処理を追加的に行うことにより、可変的符号化処理と同様の圧縮率を実現する。なお、以下の説明では、固定的符号化処理で符号化された符号(バッファリングされる符号)を中間符号という。   Therefore, in order to reduce the buffering load, the encoding device 2 according to the present embodiment is input with a fixed encoding process (for example, a fixed Huffman encoding process) that does not depend on the input data file. A variable encoding process depending on the data file (for example, a variable Huffman encoding process adapted to the input image) is combined in series. Among these, the fixed encoding process is executed before the buffering process, thereby reducing the data size of the data to be buffered and reducing the buffering load. For buffered symbols (codes encoded in the fixed encoding process), the same compression rate as the variable encoding process is achieved by additionally performing the variable encoding process. To do. In the following description, a code (buffered code) encoded by the fixed encoding process is referred to as an intermediate code.

なお、固定的符号化処理は以下の条件を満たすことが望ましい。
[条件1]
データファイル(本例では画像データ)の大局的性質によらない処理であること。より具体的には、少なくとも、未処理のデータ(符号化されていない部分データ)に依存しない符号化処理であること。換言すると、1パスで処理できるような局所的性質の限度で、他のデータに依存関係を有する符号化処理であること。
[条件2]
可変的符号化処理と比較して、比較的高速であること。
[条件3]
固定的符号化処理と可変的符号化処理とを組み合わせることによるオーバーヘッドが少ないこと。
The fixed encoding process preferably satisfies the following conditions.
[Condition 1]
Processing that does not depend on the global nature of the data file (image data in this example). More specifically, it is an encoding process that does not depend on at least unprocessed data (unencoded partial data). In other words, it is an encoding process having a dependency relationship with other data within the limit of local properties that can be processed in one pass.
[Condition 2]
It must be relatively fast compared to variable encoding.
[Condition 3]
Less overhead due to combining fixed encoding processing and variable encoding processing.

例えば、条件1に関して、可変的ハフマン符号の生成に必要なページ全体の統計処理は大局的性質である。逆に、コンテクストモデリングは後続のデータ(すなわち、未処理のデータ)に依存しないため局所的性質である。
条件2に関して、バッファリングの負荷削減という目的から要請されるものであり、可変的符号化処理は、ビットシフトなどの処理で重くならざるを得ないので、固定的符号化処理は、軽いほうが望ましい。ただし、固定的符号化処理と可変的符号化処理の負荷の和が、もとのエントロピー符号化の処理負荷と同程度であれば、多少固定的符号化処理がバランス的に重くなっても構わない。
条件3に関して、処理単位を揃えることなどがこの条件を満たす手段として考えられる。例えば、可変的符号化処理で可変的ハフマン符号を適用するのに、固定的符号化処理で算術符号を適用する場合に、可変的符号化処理の前に算術符号化の復号化処理が必要となり、オーバーヘッドが大きくなりすぎる。
上記条件を満たす固定的符号化処理及び可変的符号化処理を組み合わせることにより、バッファリングすべきデータ量が削減できるので、バッファリングの処理時間が減り、メモリサイズも統計的に削減することができるようになる。
For example, regarding the condition 1, the statistical processing of the entire page necessary for generating the variable Huffman code is a global property. Conversely, context modeling is a local property because it does not depend on subsequent data (ie, raw data).
Condition 2 is required for the purpose of reducing the load of buffering, and the variable encoding process must be heavy by a process such as bit shift, so that the fixed encoding process should be light. . However, if the sum of the loads of the fixed encoding process and the variable encoding process is approximately the same as the processing load of the original entropy encoding, the fixed encoding process may be slightly heavier in balance. Absent.
As for condition 3, it is conceivable as a means for satisfying this condition to arrange the processing units. For example, when applying a variable Huffman code in a variable encoding process and applying an arithmetic code in a fixed encoding process, a decoding process for the arithmetic encoding is required before the variable encoding process. The overhead becomes too big.
By combining fixed encoding processing and variable encoding processing satisfying the above conditions, the amount of data to be buffered can be reduced, so the buffering processing time can be reduced and the memory size can also be reduced statistically. It becomes like this.

[ハードウェア構成]
まず、本実施形態における符号化装置2のハードウェア構成を説明する。
図2は、本発明にかかる符号化方法が適応される符号化装置2のハードウェア構成を、制御装置20を中心に例示する図である。
図2に例示するように、符号化装置2は、CPU202及びメモリ204などを含む制御装置20、通信装置22、HDD・CD装置などの記録装置24、並びに、LCD表示装置あるいはCRT表示装置及びキーボード・タッチパネルなどを含むユーザインターフェース装置(UI装置)26から構成される。
符号化装置2は、例えば、プリンタ装置10に設けられた処理装置であり、通信装置22又は記録装置24などを介して画像データを取得し、取得された画像データを符号化する。
[Hardware configuration]
First, the hardware configuration of the encoding device 2 in the present embodiment will be described.
FIG. 2 is a diagram illustrating a hardware configuration of the encoding device 2 to which the encoding method according to the present invention is applied, centering on the control device 20.
As illustrated in FIG. 2, the encoding device 2 includes a control device 20 including a CPU 202 and a memory 204, a communication device 22, a recording device 24 such as an HDD / CD device, an LCD display device or a CRT display device, and a keyboard. A user interface device (UI device) 26 including a touch panel and the like is included.
The encoding device 2 is, for example, a processing device provided in the printer device 10, acquires image data via the communication device 22 or the recording device 24, and encodes the acquired image data.

[符号化プログラム]
図3は、制御装置20(図2)により実行され、本発明にかかる符号化方法を実現する符号化プログラム5の機能構成を例示する図である。
図3に例示するように、符号化プログラム5は、ソースコーダ500、第1符号部510、シンボル計数部520、中間符号記憶部530、符号表生成部540、及び第2符号部550を有する。
符号化プログラム5は、例えば、図2に例示した記録媒体240に記録され、この記録媒体240を介して、制御装置20(図2)に供給される。
なお、本例では、画像データを符号化する場合を具体例として説明する。
[Encoding program]
FIG. 3 is a diagram illustrating a functional configuration of the encoding program 5 which is executed by the control device 20 (FIG. 2) and implements the encoding method according to the present invention.
As illustrated in FIG. 3, the encoding program 5 includes a source coder 500, a first encoding unit 510, a symbol counting unit 520, an intermediate code storage unit 530, a code table generation unit 540, and a second encoding unit 550.
The encoding program 5 is recorded on, for example, the recording medium 240 illustrated in FIG. 2, and is supplied to the control device 20 (FIG. 2) via the recording medium 240.
In this example, a case where image data is encoded will be described as a specific example.

符号化プログラム5において、ソースコーダ500は、入力されたデータファイルに基づいて、エントロピー符号化処理の対象となるシンボルを生成し、生成されたシンボルを第1符号部510及びシンボル計数部520に出力する。
本例のソースコーダ500は、既定の予測方法を用いて注目画素の画素値を予測し、この予測値と注目画素値との差分値(以下、予測誤差値)を算出し、算出された予測誤差値をシンボルとする。なお、本例のソースコーダ500は、算出された予測誤差値が0である場合(すなわち、予測が的中した場合)には、予測的中の連続数(ラン)を計数し、計数された連続数(予測誤差値が連続して0となる回数)をシンボルとする。
In the encoding program 5, the source coder 500 generates a symbol to be subjected to entropy encoding processing based on the input data file, and outputs the generated symbol to the first encoding unit 510 and the symbol counting unit 520. To do.
The source coder 500 in this example predicts the pixel value of the target pixel using a predetermined prediction method, calculates a difference value between the predicted value and the target pixel value (hereinafter, prediction error value), and calculates the calculated prediction. The error value is a symbol. Note that the source coder 500 in this example counts the number of consecutive predictions (runs) when the calculated prediction error value is 0 (that is, when the prediction is correct), and is counted. The continuous number (the number of times that the prediction error value is continuously 0) is defined as a symbol.

第1符号部510は、ソースコーダ500から入力されたシンボルを、未処理のデータに依存しないエントロピー符号化方式(例えば、予め設計された固定符号表を用いた符号化方式)を用いて符号化し、生成された符号(すなわち、中間符号)を中間符号記憶部530に出力する。
本例の第1符号部510は、ソースコーダ500から入力されたシンボルを、固定的ハフマン符号で符号化して、中間符号を生成する。
The first encoding unit 510 encodes the symbol input from the source coder 500 using an entropy encoding method that does not depend on unprocessed data (for example, an encoding method using a pre-designed fixed code table). The generated code (that is, the intermediate code) is output to the intermediate code storage unit 530.
The first encoding unit 510 of this example encodes a symbol input from the source coder 500 with a fixed Huffman code to generate an intermediate code.

シンボル計数部520は、ソースコーダ500から入力されたシンボルを計数し、計数結果に基づいて既定の統計処理を行い、統計処理の結果を符号表生成部540に出力する。シンボル計数部520は、本発明にかかる統計処理手段の一例であり、符号表生成に要する統計処理を行う。
本例のシンボル計数部520は、ソースコーダ500から入力される全シンボルの出現頻度を計数して、各シンボル値の出現頻度分布を生成する。
The symbol counting unit 520 counts the symbols input from the source coder 500, performs predetermined statistical processing based on the counting result, and outputs the statistical processing result to the code table generation unit 540. The symbol counting unit 520 is an example of a statistical processing unit according to the present invention, and performs statistical processing required for code table generation.
The symbol counting unit 520 of this example counts the appearance frequencies of all symbols input from the source coder 500, and generates the appearance frequency distribution of each symbol value.

中間符号記憶部530は、第1符号部510から入力された中間符号をメモリに記憶し、記憶された中間符号を第2符号部550に供給する。
本例の中間符号記憶部530は、少なくとも、符号表生成部540により可変的ハフマン符号の符号表が生成されるまでの間、第1符号部510により符号化された中間符号をバッファリングし、第2符号部550が可変的符号化処理を実行可能になったことを条件として、バッファリングしている中間符号を第2符号部550に出力する。
The intermediate code storage unit 530 stores the intermediate code input from the first encoding unit 510 in a memory and supplies the stored intermediate code to the second encoding unit 550.
The intermediate code storage unit 530 of the present example buffers the intermediate code encoded by the first encoding unit 510 until at least the code table of the variable Huffman code is generated by the code table generation unit 540. The buffered intermediate code is output to the second encoding unit 550 on condition that the second encoding unit 550 can execute the variable encoding process.

符号表生成部540は、シンボル計数部520による統計処理の結果に基づいて、可変的符号化処理に用いる符号表を生成し、生成された符号表を第2符号部550に出力する。符号表生成部540により生成される符号表は、入力されるデータファイルそれぞれに応じて設計されるものであり、可変符号表とよぶ。
本例の符号表生成部540は、各シンボルの出現頻度分布に応じて、可変的ハフマン符号の符号表を生成する。
The code table generation unit 540 generates a code table used for variable encoding processing based on the statistical processing result by the symbol counting unit 520 and outputs the generated code table to the second encoding unit 550. The code table generated by the code table generation unit 540 is designed according to each input data file and is called a variable code table.
The code table generation unit 540 of the present example generates a code table of variable Huffman codes according to the appearance frequency distribution of each symbol.

第2符号部550は、符号表生成部540から入力された可変符号表と、中間符号記憶部550に記憶されている中間符号とに基づいて、入力されたデータファイルの出力符号を生成する。
本例の第2符号部550は、符号表生成部540から入力された可変的ハフマン符号の符号表を用いて、中間符号記憶部530にバッファリングされている中間符号を順に符号化して、出力符号を生成する。
The second code unit 550 generates an output code of the input data file based on the variable code table input from the code table generation unit 540 and the intermediate code stored in the intermediate code storage unit 550.
The second encoding unit 550 of this example sequentially encodes the intermediate codes buffered in the intermediate code storage unit 530 using the code table of the variable Huffman code input from the code table generation unit 540, and outputs the result. Generate a code.

図4は、ソースコーダ500(図3)によるソースコーディングを説明する図である。
図4(A)に例示するように、ソースコーダ500は、注目画素Xのシンボルを生成する場合に、走査方向上流の画素A〜Cのいずれか(すなわち、既処理の画素)を参照して、予測誤差値を算出する。
例えば、ソースコーダ500は、図4(B)に例示する(式1)を用いて、予測誤差(シンボル)を算出する。すなわち、注目画素Xの画素値と、主走査方向直前の画素Aの画素値との差分値が、予測誤差値(シンボル)となる。
また、ソースコーダ500は、図4(B)に例示する(式2)を用いて、予測誤差(シンボル)を算出してもよい。この場合、画素A及び画素B(副走査方向直上画素)の画素値の合算値から画素Cの画素値をひいた値が予測値となり、この予測値と注目画素Xの画素値との差分がシンボルとなる。
また、ソースコーダ500は、図4(B)に例示する(式3)を用いて、予測誤差を算出してもよい。この場合、画素A及び画素Bの平均画素値が予測値となり、この予測値と注目画素Xの画素値との差分がシンボルとなる。
FIG. 4 is a diagram for explaining source coding by the source coder 500 (FIG. 3).
As illustrated in FIG. 4A, when generating the symbol of the target pixel X, the source coder 500 refers to any one of the pixels A to C upstream of the scanning direction (that is, the processed pixel). The prediction error value is calculated.
For example, the source coder 500 calculates a prediction error (symbol) using (Formula 1) illustrated in FIG. That is, the difference value between the pixel value of the target pixel X and the pixel value of the pixel A immediately before the main scanning direction is the prediction error value (symbol).
Further, the source coder 500 may calculate a prediction error (symbol) using (Equation 2) illustrated in FIG. In this case, a value obtained by subtracting the pixel value of the pixel C from the sum of the pixel values of the pixel A and the pixel B (pixels directly above in the sub-scanning direction) is the predicted value, and the difference between the predicted value and the pixel value of the target pixel X is Become a symbol.
Further, the source coder 500 may calculate the prediction error using (Equation 3) illustrated in FIG. In this case, the average pixel value of the pixel A and the pixel B becomes a predicted value, and the difference between this predicted value and the pixel value of the target pixel X becomes a symbol.

さらに、ソースコーダ500は、予測誤差が0となる場合に、その連続数(ラン)を計数し、連続数(ラン)をシンボルとする。これにより、図4(C)に例示するように、予測が的中した画素群については、予測的中の連続数(ラン)がシンボルとなり、予測が外れた画素群については、予測誤差値がシンボルとなる。
画像データをソースコーディングした場合、予測誤差値の出現頻度分布が0の近傍に偏ることが期待できる。
Furthermore, when the prediction error becomes 0, the source coder 500 counts the continuous number (run), and uses the continuous number (run) as a symbol. As a result, as illustrated in FIG. 4C, for the pixel group for which the prediction is correct, the predictive number (run) of the prediction is a symbol, and for the pixel group for which the prediction has failed, the prediction error value is Become a symbol.
When image data is source-coded, it can be expected that the appearance frequency distribution of prediction error values is biased to be close to zero.

図5(A)は、第1符号部510(図3)による固定的ハフマン符号を例示し、図5(B)は、中間符号記憶部530(図3)に記憶される中間符号のフォーマットを例示する図である。
本例の第1符号部510は、図5(A)に例示する固定符号表512を用いて、シンボルを符号化する。
すなわち、シンボルが連続数(ラン)である場合に、識別子「00」と8ビット表現された連続数とを組み合わせたビット列が、中間符号となる。本例では、連続数を8ビットで表現するため、最大ラン長256でランが分割される。
シンボルが−8から7までの間の予測誤差値である場合に、識別子「01」と4ビット表現された予測誤差値(すなわち、予測誤差値の下位4ビット)とを組み合わせたビット列が、中間符号となる。
シンボルが−8よりも小さい予測誤差値又は7よりも大きな予測誤差値である場合に、識別子「10」と8ビット表現された予測誤差値とを組み合わせたビット列が、中間符号となる。
この中間符号は、非常に単純だが、−8から7の予測誤差値の出現確率が高いことを想定した固定的ハフマン符号である。
5A illustrates the fixed Huffman code by the first encoding unit 510 (FIG. 3), and FIG. 5B illustrates the format of the intermediate code stored in the intermediate code storage unit 530 (FIG. 3). It is a figure illustrated.
The first encoding unit 510 of this example encodes a symbol using the fixed code table 512 illustrated in FIG.
That is, when a symbol is a continuous number (run), a bit string combining an identifier “00” and a continuous number expressed in 8 bits is an intermediate code. In this example, since the continuous number is expressed by 8 bits, the run is divided by the maximum run length 256.
When the symbol is a prediction error value between −8 and 7, a bit string obtained by combining the identifier “01” and the prediction error value represented by 4 bits (that is, the lower 4 bits of the prediction error value) is intermediate. Sign.
When the symbol is a prediction error value smaller than −8 or a prediction error value larger than 7, a bit string obtained by combining the identifier “10” and the prediction error value expressed in 8 bits is an intermediate code.
Although this intermediate code is very simple, it is a fixed Huffman code that assumes a high probability of occurrence of prediction error values from -8 to 7.

この固定符号表512は、予め設計されたものであり、入力される画像データに依存しないため、上記条件1を満たす。なお、本例の固定符号表512は、符号量を最小化するものではないが、バッファリングすべきデータ量が減少すれば十分であり、必ずしも符号量を最小化する必要はないので、目的に適っている。
また、本例の第2符号部550は、可変ハフマン符号を適用し、この固定符号表512は、予測誤差値が0付近に多くなるという特性に基づいて予め設計された固定ハフマン符号であり、共にハフマン符号であるから、上記条件3を満たす。
The fixed code table 512 is designed in advance and does not depend on input image data, and therefore satisfies the above condition 1. Note that the fixed code table 512 of this example does not minimize the code amount, but it is sufficient if the amount of data to be buffered is reduced, and it is not always necessary to minimize the code amount. Is suitable.
Further, the second encoding unit 550 of this example applies a variable Huffman code, and this fixed code table 512 is a fixed Huffman code designed in advance based on the characteristic that the prediction error value increases near 0, Since both are Huffman codes, the above condition 3 is satisfied.

本例の中間符号記憶部530は、上記条件2を満たすために中間符号を4ビット単位で管理する。すなわち、本例の中間符号記憶部530は、図5(B)に例示するバッファリング符号フォーマット514を用いて、中間符号をバッファリングする。
具体的には、図5(A)に例示する中間符号は、識別子(2ビット)と属性値(4ビット又は8ビット)とからなるので、そのままでは4ビット単位で管理できない。そこで、本例の中間符号記憶部530は、4つの中間符号を1つのフォーマットに統合する。すなわち、中間符号記憶部530は、図5(B)に例示するように、4つの中間符号の識別子(#0〜#3)をまとめ、4つの中間符号の属性値(#0〜#3)をまとめることにより、4ビット単位での管理を実現する。
これにより、過度なビットシフト処理が避けられ、上記条件2が満たしやすくなる。
The intermediate code storage unit 530 of this example manages the intermediate code in units of 4 bits in order to satisfy the above condition 2. That is, the intermediate code storage unit 530 of the present example buffers the intermediate code using the buffering code format 514 illustrated in FIG.
Specifically, since the intermediate code illustrated in FIG. 5A includes an identifier (2 bits) and an attribute value (4 bits or 8 bits), it cannot be managed in units of 4 bits. Therefore, the intermediate code storage unit 530 of this example integrates the four intermediate codes into one format. That is, as illustrated in FIG. 5B, the intermediate code storage unit 530 collects the identifiers (# 0 to # 3) of the four intermediate codes, and attribute values (# 0 to # 3) of the four intermediate codes. As a result, management in units of 4 bits is realized.
As a result, excessive bit shift processing is avoided and the condition 2 is easily satisfied.

[全体動作]
次に、符号化装置2(符号化プログラム5)の全体動作を説明する。
図6は、符号化プログラム5(図3)による符号化処理(S10)のフローチャートである。
図6に示すように、ステップ100(S100)において、符号化プログラム5(図3)は、外部から、画像データが入力されると、入力された画像データにおいて走査順に注目画素Xを設定する。注目画素とは、処理対象となる画素である。
ソースコーダ500(図3)は、注目画素Xの画素値と画素A(図4)の画素値との差分を算出し、算出された差分値(予測誤差値)に基づいてシンボルを生成する。
符号化プログラム5は、注目画素Xの位置を走査順に移動させて、全画素についてシンボルを生成する。生成されたシンボルは、第1符号部510及びシンボル計数部520に出力される。
[Overall operation]
Next, the overall operation of the encoding device 2 (encoding program 5) will be described.
FIG. 6 is a flowchart of the encoding process (S10) by the encoding program 5 (FIG. 3).
As shown in FIG. 6, in step 100 (S100), when image data is input from the outside, the encoding program 5 (FIG. 3) sets a target pixel X in the input image data in the scanning order. A target pixel is a pixel to be processed.
The source coder 500 (FIG. 3) calculates the difference between the pixel value of the target pixel X and the pixel value of the pixel A (FIG. 4), and generates a symbol based on the calculated difference value (prediction error value).
The encoding program 5 moves the position of the target pixel X in the scanning order to generate symbols for all the pixels. The generated symbols are output to the first encoding unit 510 and the symbol counting unit 520.

ステップ110(S110)において、符号化プログラム5は、生成されたシンボル群の中から、順に注目シンボル(すなわち、符号化対象となるシンボル)を設定する。   In step 110 (S110), the encoding program 5 sets attention symbols (that is, symbols to be encoded) in order from the generated symbol group.

ステップ120(S120)において、第1符号部510は、図5(A)の固定符号表512を用いて、注目シンボルを符号化する。   In step 120 (S120), the first encoding unit 510 encodes the symbol of interest using the fixed code table 512 of FIG.

ステップ130(S130)において、中間符号記憶部530は、第1符号部510により符号化された注目シンボル(すなわち、中間符号)を、図5(B)のバッファリング符号フォーマット514に従ってバッファリングする。   In step 130 (S130), the intermediate code storage unit 530 buffers the symbol of interest (that is, the intermediate code) encoded by the first encoding unit 510 according to the buffering code format 514 of FIG. 5B.

ステップ140(S140)において、シンボル計数部520は、第1符号部510の符号化処理(S120)と並行して、ソースコーダ500により生成されるシンボルを計数して、各シンボル値の出現頻度分布を生成する。   In step 140 (S140), the symbol counting unit 520 counts the symbols generated by the source coder 500 in parallel with the encoding process (S120) of the first encoding unit 510, and the appearance frequency distribution of each symbol value. Is generated.

ステップ150(S150)において、符号化プログラム5は、全シンボルが処理されたか否かを判断し、全シンボルが処理された場合に、S160の処理に移行し、未処理のシンボルが存在する場合に、S110の処理に戻る。   In step 150 (S150), the encoding program 5 determines whether or not all symbols have been processed. If all symbols have been processed, the process proceeds to S160, and there is an unprocessed symbol. , The process returns to S110.

ステップ160(S160)において、符号表生成部540は、シンボル計数部520により生成されたシンボル値の出現頻度分布に応じて、可変ハフマン符号の符号表(可変符号表)を生成し、生成された可変符号表を第2符号部550に出力する。   In step 160 (S160), the code table generation unit 540 generates a code table (variable code table) of the variable Huffman code according to the appearance frequency distribution of the symbol values generated by the symbol counting unit 520. The variable code table is output to the second encoding unit 550.

ステップ170(S170)において、第2符号部550は、中間符号記憶部530によりバッファリングされている中間符号の属性値を、符号表生成部540により生成された可変符号表を用いて符号化し、符号化された属性値を出力符号とする。   In Step 170 (S170), the second encoding unit 550 encodes the attribute value of the intermediate code buffered by the intermediate code storage unit 530 using the variable code table generated by the code table generation unit 540, The encoded attribute value is used as an output code.

以上説明したように、本実施形態における符号化装置2は、固定的符号化処理と可変的符号化処理とを直列に組み合わせることにより、シンボルのバッファリングに要する負荷を軽減することができる。これにより、高速なエントロピー符号化処理が実現される。   As described above, the encoding apparatus 2 in the present embodiment can reduce the load required for symbol buffering by combining the fixed encoding process and the variable encoding process in series. Thereby, high-speed entropy encoding processing is realized.

[変形例1]
次に、上記実施形態の変形例1を説明する。
上記実施形態では、第1符号部510及び第2符号部550は、同じ最大ラン長を適用して、ランを符号化しているが、これに限定されるものではない。すなわち、第1符号部510による符号化処理と、第2符号化部550による符号化処理とが、多少相違してもよい。
例えば、固定的符号化処理(すなわち、第1符号部510による符号化処理)で適用される最大ラン長は、可変的符号化処理(すなわち、第2符号部550による符号化処理)で適用される最大ラン長と異なってもよい。
ランレングス化では、最大ラン長をいくつにするかがパラメータとなる。上記実施形態では、可変的ハフマン符号を適用する関係上、シンボル計数部520は、可変的処理での最大ラン長Rに合わせて、ラン長1〜ラン長Rの出現頻度を計数する必要がある。したがって、固定的符号化処理で最大ラン長Rのランレングス化をすることは合理的である。
しかし、固定的符号化処理で最大ラン長をもっと大きくとってもよいケースが存在する。例えば、予測誤差値0のランが、長く続くような画像データを対象とする場合である。そのような場合には、固定的符号化処理における最大ラン長をなるべく長くとることで、バッファリングするデータ量を減らすことができる。
このとき、第2符号部550は、長いランを最大ラン長R単位に切り離す必要があり、これがオーバーヘッドとなる。したがって、そのオーバーヘッドと上記の効果が引き合うようであれば、ラン長を長くとってもよい。このとき固定的符号化処理で適用する最大ラン長が、可変的符号化処理で適用する最大ラン長の倍数になっていると、可変的処理が簡略化できるため好ましい。
[Modification 1]
Next, the modification 1 of the said embodiment is demonstrated.
In the above embodiment, the first encoding unit 510 and the second encoding unit 550 encode the run by applying the same maximum run length, but the present invention is not limited to this. That is, the encoding process by the first encoding unit 510 and the encoding process by the second encoding unit 550 may be slightly different.
For example, the maximum run length applied in the fixed encoding process (that is, the encoding process by the first encoding unit 510) is applied in the variable encoding process (that is, the encoding process by the second encoding unit 550). It may be different from the maximum run length.
In run length conversion, the maximum run length is a parameter. In the embodiment described above, the symbol counting unit 520 needs to count the appearance frequency of the run length 1 to the run length R in accordance with the maximum run length R in the variable processing because of applying the variable Huffman code. . Therefore, it is reasonable to make the run length of the maximum run length R by fixed encoding processing.
However, there is a case where the maximum run length may be increased by fixed encoding processing. For example, this is a case where image data whose prediction error value is 0 continues for a long time. In such a case, the data amount to be buffered can be reduced by setting the maximum run length in the fixed encoding process as long as possible.
At this time, the second encoding unit 550 needs to separate long runs into units of the maximum run length R, which is overhead. Accordingly, the run length may be increased as long as the overhead and the above-described effect are attracted. At this time, it is preferable that the maximum run length applied in the fixed encoding process is a multiple of the maximum run length applied in the variable encoding process because the variable process can be simplified.

図7は、固定的符号化処理で最大ラン長256を適用し、可変的符号化処理で32の最大ラン長32を適用する場合の処理を説明する図である。
例えば、図7(A)に例示する300のランが第1符号部510に入力されると、第1符号部510は、図7(B)に例示するように、300のランを256のランと44のランに分割し、それぞれをシンボルとして符号化する。
そして、第2符号部550は、256のランを8分割して32のランを生成し、44のランを32のランと12のランに分割して、分割された各ランをそれぞれシンボルとして符号化する。この場合に、符号表生成部540は、ラン1からラン32までの出現頻度分布に応じて符号表を生成し、第2符号部550は、この符号表を用いて、ランを可変ハフマン符号で符号化する。
FIG. 7 is a diagram for explaining processing when the maximum run length 256 is applied in the fixed encoding process and the maximum run length 32 of 32 is applied in the variable encoding process.
For example, when 300 runs illustrated in FIG. 7A are input to the first encoding unit 510, the first encoding unit 510 converts the 300 runs into 256 runs as illustrated in FIG. 7B. And 44 runs, each encoded as a symbol.
Then, the second encoding unit 550 divides 256 runs into 8 to generate 32 runs, divides 44 runs into 32 runs and 12 runs, and codes each divided run as a symbol. Turn into. In this case, the code table generation unit 540 generates a code table according to the appearance frequency distribution from run 1 to run 32, and the second code unit 550 uses this code table to identify the run as a variable Huffman code. Encode.

[変形例2]
次に、上記実施形態の変形例2を説明する。
上記実施形態では、第1符号部510及び第2符号部550は、同じデータ単位(シンボル単位)で符号化処理を行っているが、これに限定されるものではなく、例えば、第1の符号部510の処理単位(データ単位)は、第2の符号部550の処理単位(データ単位)よりも大きくてもよい。
そこで、変形例2では、第1符号部510は、複数の画素からなるブロックを処理単位として符号化し、第2符号部550は、1画素を処理単位として符号化する形態を説明する。すなわち、上記実施形態では、固定的符号化処理で識別子を画素ごとに付与するため、例えば全白の画像でも2ビット/画素が必要となる。また画素単位の識別子は、画素単位での処理切替えを意味するため、固定的符号化処理及び可変的符号化処理で分岐処理を多発させ処理速度を低下させる可能性がある。
そこで、本変形例2の第1符号部510は、複数画素を集めたブロック単位に識別子を付与する。近年のCPU(中央演算装置)は、幅の広いレジスタを分割して並列処理を行うことができるので、そのような手法の適用が可能なソースコーダとのマッチングもよい。
[Modification 2]
Next, a second modification of the above embodiment will be described.
In the above embodiment, the first encoding unit 510 and the second encoding unit 550 perform encoding processing in the same data unit (symbol unit), but the present invention is not limited to this. For example, the first encoding unit The processing unit (data unit) of the unit 510 may be larger than the processing unit (data unit) of the second encoding unit 550.
In the second modification, the first encoding unit 510 encodes a block composed of a plurality of pixels as a processing unit, and the second encoding unit 550 describes an embodiment in which one pixel is encoded as a processing unit. That is, in the above embodiment, since the identifier is assigned to each pixel in the fixed encoding process, 2 bits / pixel is required even for an all-white image, for example. In addition, since the identifier in units of pixels means switching of processing in units of pixels, there is a possibility that branch processing is frequently performed in the fixed encoding process and the variable encoding process, thereby reducing the processing speed.
Therefore, the first encoding unit 510 of the second modification example assigns an identifier to each block obtained by collecting a plurality of pixels. Since a recent CPU (central processing unit) can perform parallel processing by dividing a wide register, matching with a source coder to which such a technique can be applied is also good.

図8(A)は、ブロック単位で符号化する場合の固定符号表513を例示し、図8(B)及び(C)は、ブロック単位で生成された中間符号を符号化するときに適用される可変符号表を例示する図である。なお、本変形例では、32画素を1ブロックとする形態を具体例とする。
本変形例の第1符号部510は、ブロック内の画素に対応する全シンボルがランである場合、識別子「00」とラン長(本例では、32)とのセットを、このブロックの中間符号とする。
また、第1符号部510は、ブロック内の画素に対応する全シンボルが−8から7までの予測誤差値である場合に、識別子「01」と、ブロック内の全予測誤差値(4ビット表現)とのセットを、このブロックの中間符号とする。この中間符号に含まれる予測誤差値(4ビット)の中には、予測誤差値0(4ビット表現)も含まれうる。
また、第1符号部510は、ブロック内の画素に対応するシンボルのいずれかが−8よりも小さい予測誤差値又は7よりも大きな予測誤差値である場合に、識別子「10」と、このブロック内の全予測誤差値(8ビット表現)とのセットを、このブロックの中間符号とする。この中間符号に含まれる予測誤差値(8ビット表現)の中には、−8から7までの予測誤差値(8ビット表現)も含まれうる。
FIG. 8A illustrates a fixed code table 513 in the case of encoding in block units, and FIGS. 8B and 8C are applied when encoding an intermediate code generated in block units. It is a figure which illustrates the variable code table. In addition, in this modification, the form which makes 32 pixels 1 block is made into a specific example.
When all symbols corresponding to the pixels in the block are runs, the first coding unit 510 of this modification example sets the set of the identifier “00” and the run length (32 in this example) as the intermediate code of this block. And
In addition, when all symbols corresponding to the pixels in the block have prediction error values from −8 to 7, the first encoding unit 510 and the identifier “01” and the total prediction error value in the block (4-bit representation) )) Is the intermediate code of this block. The prediction error value (4 bits) included in the intermediate code may also include a prediction error value 0 (4-bit representation).
Further, the first encoding unit 510, when any of the symbols corresponding to the pixels in the block has a prediction error value smaller than −8 or a prediction error value larger than 7, the identifier “10” and this block The set of all of the prediction error values (8-bit representation) is the intermediate code of this block. Prediction error values (8-bit representation) from −8 to 7 can be included in the prediction error values (8-bit representation) included in the intermediate code.

次に、可変的符号化処理に用いる符号表であるが、上記のように、予測誤差値0は、ラン表現、4ビット表現、及び8ビット表現の3種類で表現される可能性があり、−8〜7の予測誤差値(0を除く)は、4ビット表現及び8ビット表現の2種類で表現される可能性がある。
そこで、本変形例の符号表生成部540は、図8(B)に例示するように、−8から7までの予測誤差値をシンボルとして含む8ビット入力可変符号表552と、予測誤差値0をシンボルとして含む4ビット入力可変符号表554とを生成する。8ビット入力可変符号表552では、−8から7までの予測誤差値(0も含む)が8ビットのシンボルとして表現されており、4ビット入力可変符号表554は、予測誤差値0も4ビットのシンボルとして表現されている。
この8ビット入力可変符号表552及び4ビット入力可変符号表554は、それぞれ8ビットシンボル又は4ビットシンボルをエントリとするルックアップテーブルである。例えば、8ビット入力可変符号表552として、256個のシンボルに対して256エントリのルックアップテーブルを用意し、4ビット入力可変符号表554として、16エントリのルックアップテーブルを用意すればよい。このように本変形例では2つのルックアップテーブルが必要になるが、4ビット入力可変符号表554のエントリ数が小さいため、影響は小さい。
Next, it is a code table used for variable encoding processing. As described above, the prediction error value 0 may be expressed in three types of run expression, 4-bit expression, and 8-bit expression. There is a possibility that the prediction error values (except 0) of −8 to 7 are expressed by two types of 4-bit expression and 8-bit expression.
Therefore, as illustrated in FIG. 8B, the code table generation unit 540 of the present modification includes an 8-bit input variable code table 552 including prediction error values from −8 to 7 as symbols, and a prediction error value of 0. Is generated as a symbol and a 4-bit input variable code table 554 is generated. In the 8-bit input variable code table 552, prediction error values (including 0) from −8 to 7 are expressed as 8-bit symbols, and the 4-bit input variable code table 554 includes the prediction error value 0 and 4 bits. It is expressed as a symbol.
The 8-bit input variable code table 552 and the 4-bit input variable code table 554 are look-up tables having 8-bit symbols or 4-bit symbols as entries, respectively. For example, a 256-entry lookup table may be prepared for 256 symbols as the 8-bit input variable code table 552, and a 16-entry lookup table may be prepared as the 4-bit input variable code table 554. As described above, in this modification, two lookup tables are required, but the influence is small because the number of entries in the 4-bit input variable code table 554 is small.

なお、固定的符号化処理では、ブロック単位で識別子が付与され、属性値は画素単位である。すなわち、1ブロックの属性値の中に32画素の属性値が含まれている。
したがって、処理単位はブロックであってもデータの粒度は画素単位であって、このため可変的符号化処理との処理単位のミスマッチは生じない。
In the fixed encoding process, identifiers are assigned in units of blocks, and attribute values are in units of pixels. That is, an attribute value of 32 pixels is included in one block attribute value.
Therefore, even if the processing unit is a block, the data granularity is a pixel unit, and therefore, there is no mismatch between the processing unit and the variable encoding process.

[その他の変形例]
また、符号化装置2は、複数のシンボルをエントリとする可変符号表を生成し、この可変符号表を用いて可変的符号化処理を行うことにより、符号化処理を高速化してもよい。
図9は、2シンボルをエントリとする2シンボル可変符号表556を例示する図である。
第2符号部550は、図9に例示する2シンボル可変符号表556を用いて、2シンボルを同時に符号化することにより、符号化処理の高速化を図れる。本例の2シンボル可変符号表556は、−8から7までの予測誤差値(シンボル値0〜15)をエントリとしている。画像データを対象とする場合に、シンボル(予測誤差値)は0近辺に集中する、つまり出現頻度が高いので、このような高速化は効果的である。
[Other variations]
The encoding device 2 may generate a variable code table having a plurality of symbols as entries, and perform the variable encoding process using the variable code table, thereby speeding up the encoding process.
FIG. 9 is a diagram illustrating a 2-symbol variable code table 556 having 2 symbols as entries.
The second encoding unit 550 can increase the speed of the encoding process by encoding two symbols simultaneously using the two-symbol variable code table 556 illustrated in FIG. The 2-symbol variable code table 556 of this example has entries of prediction error values (symbol values 0 to 15) from −8 to 7. When image data is a target, symbols (prediction error values) are concentrated in the vicinity of 0, that is, the appearance frequency is high, and such speeding up is effective.

[実験結果]
図10は、実験結果のグラフである。なお、本図におけるグラフの横軸は、符号化処理に要した時間(処理時間)であり、縦軸は、符号量である。
図10に示すように、固定的ハフマン符号のみを適用した場合には、処理時間が短いが、符号量が大きくなってしまう。一方、可変的ハフマン符号のみを適用した場合には、符号量を小さくすることができるが、処理時間が長くなってしまう。
上記変形例2のように、ブロック単位で固定的ハフマン符号化処理を行い、中間符号を可変的ハフマン符号化すると、比較的短い処理時間で、高い圧縮率を実現することができる。
[Experimental result]
FIG. 10 is a graph of experimental results. The horizontal axis of the graph in this figure is the time (processing time) required for the encoding process, and the vertical axis is the code amount.
As shown in FIG. 10, when only the fixed Huffman code is applied, the processing time is short, but the code amount becomes large. On the other hand, when only the variable Huffman code is applied, the code amount can be reduced, but the processing time becomes longer.
When the fixed Huffman coding process is performed in units of blocks and the intermediate code is variable Huffman coded as in the second modification, a high compression rate can be realized in a relatively short processing time.

可変的ハフマン符号を適用する符号化プログラム9の機能構成を例示する図である。It is a figure which illustrates the function structure of the encoding program 9 to which a variable Huffman code is applied. 本発明にかかる符号化方法が適応される符号化装置2のハードウェア構成を、制御装置20を中心に例示する図である。It is a figure which illustrates the hardware constitutions of the encoding apparatus 2 with which the encoding method concerning this invention is applied centering on the control apparatus 20. FIG. 制御装置20(図2)により実行され、本発明にかかる符号化方法を実現する符号化プログラム5の機能構成を例示する図である。It is a figure which illustrates the functional structure of the encoding program 5 which is performed by the control apparatus 20 (FIG. 2) and implement | achieves the encoding method concerning this invention. ソースコーダ500(図3)によるソースコーディングを説明する図である。It is a figure explaining the source coding by the source coder 500 (FIG. 3). (A)は、第1符号部510(図3)による固定的ハフマン符号を例示し、(B)は、中間符号記憶部530(図3)に記憶される中間符号のフォーマットを例示する図である。(A) illustrates the fixed Huffman code by the first encoding unit 510 (FIG. 3), and (B) illustrates the format of the intermediate code stored in the intermediate code storage unit 530 (FIG. 3). is there. 符号化プログラム5(図3)による符号化処理(S10)のフローチャートである。It is a flowchart of the encoding process (S10) by the encoding program 5 (FIG. 3). 固定的符号化処理で最大ラン長256を適用し、可変的符号化処理で32の最大ラン長32を適用する場合の処理を説明する図である。It is a figure explaining the process in the case of applying the maximum run length 256 by fixed encoding processing, and applying the maximum run length 32 of 32 by variable encoding processing. (A)は、ブロック単位で符号化する場合の固定符号表513を例示し、(B)及び(C)は、ブロック単位で生成された中間符号を符号化するときに適用される可変符号表を例示する図である。(A) illustrates a fixed code table 513 in the case of encoding in block units, and (B) and (C) are variable code tables applied when encoding an intermediate code generated in block units. FIG. 2シンボルをエントリとする2シンボル可変符号表556を例示する図である。It is a figure which illustrates the 2 symbol variable code table 556 which uses 2 symbols as an entry. 実験結果のグラフである。It is a graph of an experimental result.

符号の説明Explanation of symbols

2・・・符号化装置
5・・・符号化プログラム
500・・・ソースコーダ
510・・・第1符号部
520・・・シンボル計数部
530・・・中間符号記憶部
540・・・符号表生成部
550・・・第2符号部
DESCRIPTION OF SYMBOLS 2 ... Encoding apparatus 5 ... Encoding program 500 ... Source coder 510 ... 1st code | symbol part 520 ... Symbol count part 530 ... Intermediate code memory | storage part 540 ... Code table production | generation Part 550 ... second code part

Claims (9)

未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成する第1の符号生成手段と、
前記第1の符号生成手段により生成された中間符号に基づいて、入力されたデータファイルの出力符号を生成する第2の符号生成手段と
を有する符号化装置。
First code generation means for encoding an input data file and generating an intermediate code using an entropy encoding method independent of unprocessed data;
And a second code generation unit configured to generate an output code of the input data file based on the intermediate code generated by the first code generation unit.
前記第2の符号生成手段は、未処理のデータに依存する符号化方式を用いて、前記出力符号を生成する
請求項1に記載の符号化装置。
The encoding apparatus according to claim 1, wherein the second code generation means generates the output code using an encoding method that depends on unprocessed data.
前記第2の符号生成手段は、データファイル全体に対する統計処理に基づいて、前記出力符号を生成する
請求項1に記載の符号化装置。
The encoding apparatus according to claim 1, wherein the second code generation means generates the output code based on statistical processing for the entire data file.
前記第1の符号生成手段による符号化処理の少なくとも一部と並行して、前記統計処理を行う統計処理手段
をさらに有し、
前記第2の符号生成手段は、前記統計処理手段による統計処理の結果に基づいて、前記出力符号を生成する
請求項3に記載の符号化装置。
Statistical processing means for performing the statistical processing in parallel with at least part of the encoding processing by the first code generation means;
The encoding apparatus according to claim 3, wherein the second code generation means generates the output code based on a result of statistical processing by the statistical processing means.
前記第1の符号生成手段は、前記第2の符号生成手段よりも大きなデータ単位で、符号化処理を行う
請求項1に記載の符号化装置。
The encoding apparatus according to claim 1, wherein the first code generation unit performs an encoding process in a data unit larger than the second code generation unit.
前記第1の符号生成手段は、予め設計された固定符号表を用いて、入力されたデータファイルを符号化し、
前記第2の符号生成手段は、入力されたデータファイルそれぞれに応じて設計される可変符号表を用いて、前記出力符号を生成する
請求項1に記載の符号化装置。
The first code generation means encodes the input data file using a pre-designed fixed code table,
The encoding apparatus according to claim 1, wherein the second code generation means generates the output code using a variable code table designed in accordance with each input data file.
前記第1の符号生成手段により生成された中間符号を記憶する記憶手段
をさらに有し、
前記第2の符号生成手段は、前記記憶手段に記憶された中間符号を符号化して、前記出力符号を生成する
請求項1又は4に記載の符号化装置。
Storage means for storing the intermediate code generated by the first code generation means;
The encoding apparatus according to claim 1, wherein the second code generation unit generates the output code by encoding an intermediate code stored in the storage unit.
未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成し、
生成された前記中間符号に基づいて、入力されたデータファイルの出力符号を生成する
符号化方法。
Encode the input data file using an entropy encoding scheme that does not depend on raw data, generate an intermediate code,
An encoding method for generating an output code of an input data file based on the generated intermediate code.
未処理のデータに依存しないエントロピー符号化方式を用いて、入力されたデータファイルを符号化し、中間符号を生成するステップと、
生成された前記中間符号に基づいて、入力されたデータファイルの出力符号を生成するステップと
をコンピュータに実行させるプログラム。
Encoding an input data file using an entropy encoding scheme independent of raw data to generate an intermediate code;
A program for causing a computer to execute an output code of an input data file based on the generated intermediate code.
JP2006153232A 2006-06-01 2006-06-01 Encoder, encoding method, and program Pending JP2007324971A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006153232A JP2007324971A (en) 2006-06-01 2006-06-01 Encoder, encoding method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006153232A JP2007324971A (en) 2006-06-01 2006-06-01 Encoder, encoding method, and program

Publications (1)

Publication Number Publication Date
JP2007324971A true JP2007324971A (en) 2007-12-13

Family

ID=38857365

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006153232A Pending JP2007324971A (en) 2006-06-01 2006-06-01 Encoder, encoding method, and program

Country Status (1)

Country Link
JP (1) JP2007324971A (en)

Similar Documents

Publication Publication Date Title
EP0777386B1 (en) Method and apparatus for encoding and decoding an image
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
US20070217703A1 (en) Image encoding apparatus, image decoding apparatus and control method therefor
JP2008113374A (en) Entropy coding apparatus
JP4893957B2 (en) Encoding device, decoding device, encoding method and program
JP5995864B2 (en) Display data encoding method and system
JP4893956B2 (en) Encoding device, decoding device, encoding method and program
JP2007214998A (en) Coding apparatus, decoding apparatus, coding method, decoding method, and program
US20090080786A1 (en) Image encoding apparatus and method of controlling same
Al-Bahadili et al. An adaptive character wordlength algorithm for data compression
KR20180067956A (en) Apparatus and method for data compression
JP5842357B2 (en) Image processing apparatus and image processing program
JP2007324971A (en) Encoder, encoding method, and program
JP4377351B2 (en) Data compression apparatus and data compression program
JP2008109478A (en) Image encoding device, method, program and storage medium
JP2009171134A (en) Video format converter
JP2006352547A (en) Data compression apparatus and data compression program
JP4131969B2 (en) Data compression apparatus and data compression program
JP4131970B2 (en) Data compression apparatus and data compression program
JP2005260408A (en) Data compression apparatus and data compression program
JP4435586B2 (en) Data compression apparatus and data compression program
JP4377352B2 (en) Data compression apparatus and data compression program
JP2005252531A (en) Device and program for compressing data
JPH10261966A (en) Coding and decoding device
JP2006060490A (en) Image compressor and image compression program