JP2010074444A - Image compression apparatus and method, image decoding apparatus and method, and computer program - Google Patents
Image compression apparatus and method, image decoding apparatus and method, and computer program Download PDFInfo
- Publication number
- JP2010074444A JP2010074444A JP2008238712A JP2008238712A JP2010074444A JP 2010074444 A JP2010074444 A JP 2010074444A JP 2008238712 A JP2008238712 A JP 2008238712A JP 2008238712 A JP2008238712 A JP 2008238712A JP 2010074444 A JP2010074444 A JP 2010074444A
- Authority
- JP
- Japan
- Prior art keywords
- pixel
- value
- difference
- run
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
本発明は、画像圧縮装置、画像圧縮方法、画像復号装置、画像復号方法、及び、コンピュータプログラムに関する。 The present invention relates to an image compression apparatus, an image compression method, an image decoding apparatus, an image decoding method, and a computer program.
従来から、画像形成装置等において画像処理を行う際に、画像データをメモリに格納する際に、画像データを圧縮することがある。これにより、大容量のメモリを要しない装置構成とすることができる。 Conventionally, when image processing is performed in an image forming apparatus or the like, image data may be compressed when the image data is stored in a memory. As a result, a device configuration that does not require a large capacity memory can be obtained.
例えば、2値画像を高圧縮率で圧縮する2次元圧縮方式の国際標準であるJBIG(Joint Bi−level Image Expert Group, ISO/IEC 11544)等が有名である。JBIGは、エントロピ符号として算術符号器であるQM_コーダを使用している。しかし、QM_コーダは、コンテキストメモリや、コンテキストを生成するラインメモリ等の装備が必要であり、ハードウェアコストが高くなる課題と、処理の高速化が難しいという課題とがある。 For example, JBIG (Joint Bi-level Image Expert Group, ISO / IEC 11544), which is an international standard of a two-dimensional compression method for compressing binary images at a high compression rate, is well known. JBIG uses a QM_coder, which is an arithmetic encoder, as an entropy code. However, the QM_coder needs to be equipped with a context memory, a line memory for generating a context, and the like, and has a problem that the hardware cost is high and a high-speed process is difficult.
また、多値画像を可逆符号化するJPEG(Joint Photgraphic Expert Group, ISO/IEC 11172)の可逆符号化モード等がある。JPEGの可逆符号化モードは、予測符号化にハフマン符号や算術符号を組み合わせた方式である。より詳細には、この方式は、7つの予測式で予測誤差の統計を作成し、最も良い予測式を1つ選択し、予測符号化方式で圧縮する。しかしながら、高い圧縮率が望めないという課題がある。
ところで、画像データを圧縮する際には、画像データのラスタ順において、同一の画素値が連続する数を求めることにより、画像データを圧縮する方法がある。
In addition, there is a lossless encoding mode of JPEG (Joint Photographic Expert Group, ISO / IEC 11172) that performs lossless encoding of multi-valued images. The JPEG lossless encoding mode is a method in which Huffman code or arithmetic code is combined with predictive encoding. More specifically, this method creates prediction error statistics with seven prediction formulas, selects one of the best prediction formulas, and compresses with the prediction encoding scheme. However, there is a problem that a high compression rate cannot be expected.
Incidentally, when compressing image data, there is a method of compressing image data by obtaining the number of consecutive identical pixel values in the raster order of the image data.
例えば、特開2003−198379号公報(特許文献1)には、Move to Front法(以下、「MTF法」という。)による符号化方法が記載されている。MTF法による符号化では、既出の文字の中で、前回出現した文字が、今回出現する確率が最も高いとみなす。すなわち、ブロックソート法と同様に、同じ文字が繰り返される長い連(以下、「ラン」という。)を生成させる符号化法である。MTF法は、ブロックソート法により得られた「同一バイトデータが近接して局在する」ような冗長性の高いデータにおいて、特に高い効果が望まれる。 For example, Japanese Patent Application Laid-Open No. 2003-198379 (Patent Document 1) describes an encoding method using the Move to Front method (hereinafter referred to as “MTF method”). In the encoding by the MTF method, it is considered that the previously appearing character has the highest probability of appearing this time among the already described characters. That is, like the block sort method, this is an encoding method that generates a long sequence (hereinafter referred to as “run”) in which the same characters are repeated. The MTF method is desired to have a particularly high effect on highly redundant data obtained by the block sort method such that “the same byte data is located close to each other”.
また、例えば、特許第3842914号公報(特許文献2)には、複数の画素単位に、ラン長とラン長の繰り返し数とを符号化する方法が開示されている。また、例えば、特開2005−27081号公報(特許文献3)には、注目画素の連続数及び参照画素の連続数を用いて、予測処理の一部を省略し、符号化処理における処理付加を軽減させる符号化装置等の技術が開示されている。なお、特許文献3における、画素の「連続数」は、「ラン長」に対応する。
Further, for example, Japanese Patent No. 3842914 (Patent Document 2) discloses a method of encoding a run length and the number of repetitions of the run length in a plurality of pixel units. Further, for example, in Japanese Patent Laid-Open No. 2005-27081 (Patent Document 3), by using the continuous number of target pixels and the continuous number of reference pixels, a part of the prediction process is omitted, and a process addition in the encoding process is added. Techniques such as an encoding device to be reduced are disclosed. Note that the “continuous number” of pixels in
しかしながら、上記特許文献1及び2に開示の発明は、2値画像の圧縮方法であり、RGB等の多値画像を圧縮することには適さない。また、上記特許文献3に開示の発明は、ライン間の相関が高い文書画像に対しては、ラン長を予測することが容易であるが、ライン間の相関が低い写真画像においては、色コンポーネント毎のラン長を予測することが困難である。写真画像は、また、一般にラン長が短いため、ラン長による圧縮よりも画素値そのものの情報量を減じる圧縮が望ましいが、上記特許文献3に開示の発明は、そのようなことが考慮されていない。
However, the inventions disclosed in
本発明は、上記の点に鑑みて、これらの問題を解消するために発明されたものであり、画像のラスタ順における同一の画素値が連続する数であるラン長が短い画像データを、高効率に圧縮する画像圧縮装置、画像圧縮方法、画像復号装置、画像復号方法、コンピュータプログラム、及び、情報記録媒体を提供することを目的としている。 The present invention has been invented in order to solve these problems in view of the above points. Image data having a short run length, which is the number of consecutive identical pixel values in the raster order of an image, is reduced. An object of the present invention is to provide an image compression apparatus, an image compression method, an image decoding apparatus, an image decoding method, a computer program, and an information recording medium that are efficiently compressed.
上記目的を達成するために、本発明の画像圧縮装置は次の如き構成を採用した。 In order to achieve the above object, the image compression apparatus of the present invention employs the following configuration.
本発明の画像圧縮装置は、画像を構成する画素毎に、該画素の画素値と、異なる画素値毎に対応づけられる画素インデックスを有する画素値と、の差を取得する差取得手段と、前記画像を構成する画素毎に、前記差に基づいて、一の画素値に対応する画素インデックスを選択する画素インデックス手段と、前記画像のラスタ順において前記画素インデックスが同一である画素が連続する数であるラン長を取得するラン長取得手段と、選択された前記画素インデックス、前記差、及び、前記ラン長を符号化する符号化手段と、を有する構成とすることができる。
これにより、画像のラスタ順における同一の画素値が連続する数であるラン長が短い画像データを、高効率に圧縮する画像圧縮装置を提供することができる。
The image compression device according to the present invention includes, for each pixel constituting the image, a difference acquisition unit that acquires a difference between a pixel value of the pixel and a pixel value having a pixel index associated with each different pixel value; A pixel index means for selecting a pixel index corresponding to one pixel value based on the difference for each pixel constituting the image, and a number of consecutive pixels having the same pixel index in the raster order of the image. It may be configured to include a run length acquisition unit that acquires a certain run length, and an encoding unit that encodes the selected pixel index, the difference, and the run length.
Accordingly, it is possible to provide an image compression apparatus that compresses image data with a short run length, which is the number of consecutive identical pixel values in the raster order of an image, with high efficiency.
なお、上記課題を解決するため、本発明は、上記画像圧縮装置における画像圧縮方法、及び、その画像圧縮方法をコンピュータに実行させるためのコンピュータプログラム、又は、そのコンピュータプログラムを記録した情報記録媒体としてもよい。 In order to solve the above problems, the present invention provides an image compression method in the image compression apparatus, a computer program for causing a computer to execute the image compression method, or an information recording medium on which the computer program is recorded. Also good.
本発明の画像圧縮装置、画像圧縮方法、画像復号装置、画像復号方法、コンピュータプログラム、及び、情報記録媒体によれば、画像のラスタ順における同一の画素値が連続する数であるラン長が短い画像データを、高効率に圧縮する画像圧縮装置、画像圧縮方法、画像復号装置、画像復号方法、コンピュータプログラム、及び、情報記録媒体を提供することが可能になる。 According to the image compression device, the image compression method, the image decoding device, the image decoding method, the computer program, and the information recording medium of the present invention, the run length that is the number of consecutive identical pixel values in the raster order of the image is short. It is possible to provide an image compression apparatus, an image compression method, an image decoding apparatus, an image decoding method, a computer program, and an information recording medium that compress image data with high efficiency.
以下、本発明の実施の形態を図面に基づき説明する。なお、以下の実施の形態において画像データの「圧縮」を「符号化」ともいい、圧縮又は符号化された画像データの「伸張」を「復号」ともいう。また、以下の実施の形態により処理される画像データは、1枚の画像に対応する「ページ」、ページのうち、所定数の主走査ラインからなる部分である「バンド」を有する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following embodiments, “compression” of image data is also referred to as “encoding”, and “decompression” of compressed or encoded image data is also referred to as “decoding”. Further, the image data processed in the following embodiment has a “page” corresponding to one image, and a “band” that is a portion composed of a predetermined number of main scanning lines in the page.
〔本発明の実施の形態〕
図1は、本発明の実施の形態に係る画像処理装置を実装する画像形成装置の機構部の構成例を示す図である。図1では、画像形成装置としてカラープリンタ1を示す。カラープリンタ1は、4色(Y、M、C、K)の画像をそれぞれ独立の作像系で形成し、この4色の画像を合成する4ドラムタンデムエンジンタイプの画像形成装置である。
Embodiment of the present invention
FIG. 1 is a diagram illustrating a configuration example of a mechanism unit of an image forming apparatus in which an image processing apparatus according to an embodiment of the present invention is mounted. In FIG. 1, a
(カラープリンタ1における電装・制御部のブロック)
図2は、カラープリンタ1における電装・制御部の装置構成を示すブロック図である。図2の電装・制御部100は、プリンタASIC110、プリンタエンジン120、メインメモリ130、及び、CPU190を有し、ネットワークを介してパーソナルコンピュータ(以下、「PC」という。)900に接続されている。
(Block of electrical / control unit in color printer 1)
FIG. 2 is a block diagram illustrating a device configuration of the electrical / control unit in the
CPU190は、カラープリンタ1の全体の制御を行う。プリンタエンジン120は、画像を媒体上に形成して出力する。メインメモリ130は、CPU190が出力する描画コマンド、CPU190が実行するプログラム、及び、画像データのうちバンド毎の画像データであるバンドデータ、ページ毎の圧縮データ等の各種データ等を格納する。
The
プリンタASIC110は、入力される画像データに対して所定の処理を行い、プリンタエンジン120に対して出力する。プリンタASIC110は、例えば、CPU インタフェース(以下、「I/F」という。)112、メインメモリアービタ113、メインメモリコントローラ114、符号化部115、復号部116、画像処理部117、エンジンコントローラ118、及び、通信処理部119を有する。
The printer ASIC 110 performs predetermined processing on the input image data and outputs it to the
CPU I/F112は、メインメモリアービタ113を介してメインメモリコントローラ114に接続され、CPU190とメインメモリコントローラ114との間のインタフェース処理を行う。メインメモリアービタ113は、符号化部115、復号部116、通信処理部119、及び、CPU190からの、メインメモリ130へのアクセス順等を管理する。メインメモリコントローラ114は、メインメモリ130へのデータの書き込み及び読み出しを制御する。
The CPU I /
符号化部115は、メインメモリ130に格納されている画像データのうち、例えば、バンドデータを符号化する。符号化部115は、メインメモリ130が有する符号化されたページが格納されるページメモリ領域に、符号化したバンドデータを格納させる。
The
復号部116は、符号化部115により符号化された符号データを受信して復号する。復号部116は、復号した画像データを画像処理部117に対して出力する。復号部116は、復号処理を、プリンタエンジン120の処理速度に同期させて行う。
The
画像処理部117は、復号部116により復号された画像データに対して所定の画像処理を行い、エンジンコントローラ118に対して出力する。エンジンコントローラ118は、プリンタエンジン120を制御する。
The
通信処理部119は、通信コントローラであり、ネットワークを介して接続されたPC900から画像データを受信する。画像データは、例えば、PDL(page description language)の形式を有する。通信処理部119は、受信した画像データを、メインメモリ130に対して出力する。
The
(カラープリンタ1における処理の概略)
図3は、カラープリンタ1における処理の概略を示す図である。図3では、入力された画像データが解析され、画像処理された後、プリンタエンジン120に対して出力される。図3における処理は、PDL記憶ステップS201、PDL解析ステップS202、RGBA描画処理ステップS203、RGBAバンド画像記憶ステップS204、RGBA符号化ステップS205、RGBA符号化ステップS205、RGBAページ符号記憶ステップS206、RGBA復号ステップS207、及び、画像処理ステップS210を有し、上記の順に各ステップの処理が実行される。
(Outline of processing in the color printer 1)
FIG. 3 is a diagram showing an outline of processing in the
PDL記憶ステップS201では、通信処理部119から出力されたPDLがメインメモリ130に記憶される。PDL解析ステップS202では、CPU190が、メインメモリ130からPDLを読み込み、PDLを解析して、RGBA描画処理ステップS203に対し、描画コマンドを出力する。
In PDL storage step S <b> 201, the PDL output from the
RGBA描画処理ステップS203では、CPU190が、PDL解析ステップS202から入力された描画コマンドにより、バンド画像を描画する。RGBAバンド画像記憶ステップS204では、RGBA描画処理ステップS203において描画されたバンド画像が、メインメモリ130に格納される。
In RGBA drawing processing step S203, the
RGBA符号化ステップS205では、符号化部115が、メインメモリ130のバンド画像を格納する領域から、RGBAバンド画像記憶ステップS204において格納された画像を読み込み、符号化し、符号データを生成する。RGBAページ符号記憶ステップS206では、RGBA符号化ステップS205において生成された符号データがメインメモリ130に格納される。符号データが格納される領域は、例えば、メインメモリ130が有するページ符号を格納する領域である。
In the RGBA encoding step S205, the
RGBA復号ステップS207では、復号部116が、RGBAページ符号記憶ステップS206において格納された符号データを、メインメモリ130から読み出し、復号する。RGBA復号ステップS207では、さらに、復号された画像データが、画像処理ステップS210に対して出力される。
In the RGBA decoding step S207, the
画像処理ステップS210は、RGB→CMY色変換処理ステップS211、UCR処理ステップS212、及び、階調処理ステップS213を有し、上記の順に各ステップの処理が実行される。画像処理ステップS210の各ステップは、画像処理部117により実行される。
The image processing step S210 includes an RGB → CMY color conversion processing step S211, a UCR processing step S212, and a gradation processing step S213, and the processing of each step is executed in the order described above. Each step of the image processing step S210 is executed by the
RGB→CMY色変換処理ステップS211では、RGBA復号ステップS207で復号されたRGB色空間の画像データの色空間が、CMY色空間に変換される。UCR処理ステップS212では、CMY色空間に変換された画像データの各画素の画素値に対し、下色除去の処理が行われる。階調処理ステップS213では、下色除去処理された画像データに対し、階調補正処理が行われる。 In the RGB → CMY color conversion processing step S211, the color space of the image data in the RGB color space decoded in the RGBA decoding step S207 is converted into the CMY color space. In the UCR processing step S212, an under color removal process is performed on the pixel value of each pixel of the image data converted into the CMY color space. In the gradation processing step S213, gradation correction processing is performed on the image data that has undergone the undercolor removal processing.
画像処理ステップS210における各ステップの処理が行われた画像データは、プリンタエンジン120に対して出力され、プリンタエンジン120において媒体上に形成される画像となる。
The image data subjected to the processing in each step in the image processing step S210 is output to the
(メインメモリ130における記憶領域)
図4は、メインメモリ130における記憶領域を説明する図である。図4のメインメモリ130は、プログラム領域131、PDL格納メモリ領域132、RGBAバンドメモリ格納領域133、ページ符号格納領域134、及び、その他領域135を有する。
(Storage area in main memory 130)
FIG. 4 is a diagram for explaining a storage area in the
プログラム領域131は、CPU190が実行するコンピュータプログラムが展開され格納される。PDL格納メモリ領域132は、PC900から送信されるPDLデータが格納される。
In the
RGBAバンドメモリ格納領域133は、RGBAバンドデータを格納する。RGBAバンドデータとは、RGBA色空間により表現される画像データであって、バンド毎のデータである。ページ符号格納領域134は、符号データを、ページ毎に複数ページ格納する。ページ毎の符号データは、バンド単位の符号データからなる。その他領域135は、例えば、描画コマンド等の上記の各領域に格納されない諸データが格納される。
The RGBA band
(メインメモリ130における各記憶領域とカラープリンタ1が有する電装・制御ブロックとの関係)
図5は、メインメモリ130における各記憶領域と、カラープリンタ1が有する電装・制御ブロックとの関係を説明する図である。
(Relationship between storage areas in
FIG. 5 is a diagram for explaining the relationship between each storage area in the
PC900は、PDLを生成し、ネットワークを介してカラープリンタ1に対してPDLを転送させる。通信処理部119は、PC900から受信したPDLデータを、メインメモリ130が有するPDL格納メモリ領域132に格納させる。
The
CPU190は、PDL格納メモリ領域132に格納されたPDLデータを読み出し、描画コマンドを生成する。生成された描画コマンドは、メインメモリ上の図示しない描画コマンド領域に格納される。CPU190は、さらに、描画コマンド領域に格納された描画コマンドにより、バンドデータを生成する。生成されたバンドデータは、RGBAバンドメモリ格納領域133に格納される。
The
符号化部115は、RGBAバンドメモリ格納領域133に格納されたバンドデータ毎に、符号化を行い、符号データを生成する。生成された符号データは、ページ符号格納領域134に格納される。
The
復号部116は、ページ符号格納領域134に格納された符号データを復号し、復号された画像データを画像処理部117に転送させる。画像処理部117は、復号されたRGBA色空間による画像データに対し、色空間の変換、下色除去、及び、階調処理等の画像処理を行う。画像処理部117は、画像処理された画像データを、エンジンコントローラ118に対して転送させる。
エンジンコントローラ118は、受信した画像データをプリンタエンジン120に転送させる。
The
The
(符号化部115の機能構成)
図6は、符号化部115の機能構成を説明するブロック図である。図6の符号化部115は、メインメモリ130が有するRGBAバンドメモリ格納領域133に格納されたバンドデータを読み込み、符号化して、符号データをメインメモリ130が有するページ符号格納領域134に対して出力する。
(Functional configuration of encoding unit 115)
FIG. 6 is a block diagram illustrating a functional configuration of the
符号化部115は、画像読み込み部501、ランレングス生成処理部502、繰り返し処理部503、辞書変換部504、差分生成処理部505、符号フォーマット生成処理部506、及び、符号書き込み部507を有する。
The
画像読み込み部501は、RGBAバンドメモリ格納領域133から、RGBA色空間によるバンドデータを読み込む。バンドデータは、スキャンライン毎に読み込まれる。図7は、スキャンライン毎にバンドデータが読み込まれることを説明する図である。図7において、バンドデータは、バンドの幅(M+1)とバンドの高さ(N+1)とを有する。すなわち、バンドデータは、主走査方向の(M+1)個の画素と、副走査方向に(N+1)個のラインとからなる。画像読み込み部501は、ライン0の画素0から順にMまでの画素を読み込む。ライン毎に(M+1)個の画素を読み込む処理を、ラインNまで繰り返す。
The
ランレングス処理部502は、画像読み込み部501により読み込まれたRGBA色空間からなるバンドデータに対し、図7の読み込み順におけるRGB値のラン長のデータに変換する。より詳細には、図7の読み込み順において、RGB値が同一の画素が連続する個数であるラン長を取得する。
The run
図8は、ランレングス生成処理の詳細を説明する図である。図8では、一のラインにおいて、RGB値が同一の画素が連続する個数をカウントする処理の例が示されている。より詳細には、画素0から画素2までの画素値が同一である場合には、そのラン長を3とし、そのRGB値を対応づけて取得する。同様に、画素3から画素5までの画素値が同一である場合には、そのラン長を3とする。
FIG. 8 is a diagram for explaining the details of the run length generation process. FIG. 8 shows an example of processing for counting the number of consecutive pixels having the same RGB value in one line. More specifically, when the pixel values from
図6に戻り、繰り返し処理部503は、ランレングス生成処理部502で生成されたランレングスのデータに対し、繰り返し処理を行う。図9は、繰り返し処理を説明する図である。図9では、一のラインにおいて、同一のランレングスが繰り返される個数をカウントしている。より詳細には、画素0及び画素1が同一の画素値を有し、画素2及び画素3が画素0とは異なる同一の画素値を有する場合には、画素0及び画素1に対応するラン長が2であり、画素2及び画素3に対応するラン長が2である。
Returning to FIG. 6, the
以下の説明を簡単にするため、画素0及び画素1に対応するランレングスデータを(A)とし、画素2及び画素3に対応するランレングスデータを(B)とする。ランレングスデータ(A)は、画素0と同一の画素値とラン長2との情報を有する。ランレングスデータ(B)は、画素2と同一の画素値とラン長2との情報を有する。
In order to simplify the following description, the run-length data corresponding to the
次に、画素4、画素5、画素8、画素9、画素12、及び、画素13の画素値が、画素0と同一であり、画素6、画素7、画素10、及び、画素11の画素値が、画素2と同一であることにより、ランレングスデータ(A)とランレングスデータ(B)とが、交互に連続して連なる。すなわち、画素4を先頭として、ランレングスデータ(A)とランレングスデータ(B)とが交互に連なるランレングスデータの連続の個数が5となる。この5を繰り返しの数とする。
繰り返し処理部503は生成された繰り返しの数と対応するランレングスデータとを、辞書変換部504に対して出力する。
Next, the pixel values of the
The
辞書変換部504は、繰り返し処理部503から出力されたランレングスデータに対し、辞書に基づく画素インデックスへの変換を行う。この処理は、FIFO方式により行われるとよい。図10は、辞書変換部504による処理の例を示す図である。図10において、入力された一のRGBA値aと同一の値が、RGBA辞書に格納されている場合には、RGBA辞書において対応づけられているインデックス値3が出力される。
The
一方、辞書変換部504において、入力された画素値に対応する画素値がRGBA辞書に格納されていない場合には、差分生成処理部505による処理が行われる。図11は、差分生成処理部505による処理の例を示す図であって、入力された画素値に対応する画素値がRGBA辞書に格納されていない場合の例である。図11において、入力された位置のRGBA値bと同一の値が、RGBA辞書に格納されていない場合には、RGBA辞書に格納されている各画素値との差分が計算される。各差分のうち、最小の値を有する画素値に対応するインデックス値を、RGBA値bに対するインデックス値として出力し、さらに、そのインデックスに対応する差分が出力される。
On the other hand, in the
図6に戻り、符号フォーマット生成処理部506が、辞書変換部504から出力されたインデックス値、差分生成処理部505から出力されたインデックス値と差分、及び、繰り返し処理部503から出力されたラン長及び繰り返し数とに基づいて、符号データを生成する。
Returning to FIG. 6, the code format
図12は、符号データのフォーマットを説明する図である。図12の符号フォーマットは、制御コードcと、データの本体である、ランレングスデータd、繰り返しe、カラー値f、インデックスg、及び、差分hと、の各情報に対して、ビット長及び値の範囲等が示されている。 FIG. 12 is a diagram for explaining the format of code data. The code format of FIG. 12 includes a bit length and a value for each information of the control code c, the data body, run-length data d, repetition e, color value f, index g, and difference h. The range is shown.
制御コードcは、画素ヘッダ、画素差分ヘッダ、インデックスヘッダ、インデックス差分ヘッダ、及び、符号終端の各コードを有する。画素ヘッダは、画素ヘッダ、ラン長、及び、カラー値の符号規則に対するヘッダである。インデックスヘッダは、インデックスヘッダ、ラン長、及び、インデックスの符号規則に対するヘッダである。画素差分ヘッダは、画素差分ヘッダ、ラン長、差分値の符号規則に対するヘッダである。インデックス差分ヘッダは、インデックスヘッダ、ラン長、インデックス、及び、差分値の符号規則に対するヘッダである。また、符号終端は,符号の終端を表現している。 The control code c includes each code of a pixel header, a pixel difference header, an index header, an index difference header, and a code end. The pixel header is a header for the code rule of the pixel header, the run length, and the color value. The index header is a header for an index header, a run length, and an index code rule. The pixel difference header is a header for the code rule of the pixel difference header, the run length, and the difference value. The index difference header is a header for the code rule of the index header, the run length, the index, and the difference value. The code end represents the end of the code.
ランレングスデータdは、RGBA画素値が同一の画素が連続する際のラン長に対する符号である。ランレングスデータdは、ラン長と画素値との組で表現される。ランレングスデータdにおいて、短い4BITのL1符号はラン長が1〜8までを表現する。8BITのL2符号はラン長が9〜40までを表現する。L3は段階的に長くなる符号であり、41〜1048576までのラン長を表現する。 The run-length data d is a code for the run length when pixels having the same RGBA pixel value continue. The run length data d is expressed as a set of run length and pixel value. In the run-length data d, a short 4-bit L1 code expresses run lengths from 1 to 8. The 8-bit L2 code expresses run lengths of 9-40. L3 is a code that becomes longer in steps, and expresses run lengths from 41 to 1048576.
繰り返しeは、2つのランレングスデータが交互に連続する際の、繰り返し数の符号である。繰り返しeは、複数のランレングス符号と繰り返しとの組で表現され、短い4BITのN1符号は繰り返し1を、N2符号は繰り返し2を表現する。また、N3は段階的に長くなる符号であり,3〜1048576までの繰り返しを表現することができる。
カラー値fは、ランレングスデータにおけるRGB値のデータである。
The repetition e is a code of the number of repetitions when two run-length data are alternately continued. The repetition e is expressed as a combination of a plurality of run-length codes and repetitions. A short 4-bit N1 code represents
The color value f is RGB value data in the run-length data.
インデックスgは、辞書に保持されているインデックス値であり、短い4BITのI1符号はインデックス値の1〜8までを表現する。また、8BITのI2符号はインデックス値が9〜136までを表現することができる。
差分値hは、図11に示す辞書の内容とランレングスのRGBA値との差分である。差分値hは、また、1つ前のランレングスのRGBAとの差分でもよい。
The index g is an index value held in the dictionary, and a short 4-bit I1 code represents 1 to 8 of the index value. Further, the 8-bit I2 code can express index values of 9 to 136.
The difference value h is a difference between the contents of the dictionary shown in FIG. 11 and the run-length RGBA value. The difference value h may be a difference from the previous run-length RGBA.
図13は、符号データの構成の例を説明する図である。図13(A)は、符号データの全体の構成を示す図である。図13(A)において、符号は内部符号と符号終端とを有する。符号終端は符号の終端を表す符号である。 FIG. 13 is a diagram illustrating an example of the configuration of code data. FIG. 13A is a diagram showing an overall configuration of code data. In FIG. 13A, the code has an internal code and a code end. The code end is a code representing the end of the code.
図13(B)は、内部符号の構成の例を示す図である。図13(B)では、各符号が連結している。図13(B)において、()で括られた数は、符号化の優先順位を示す数である。より詳細には、(1)において、繰り返しがあれば繰り返し値を符号化し、そうでなければ、(2)へ移る。(2)において、辞書にランレングスのRGBAの値があれば、Indexの符号化を行ない、そうでなければ(3)に移る。 FIG. 13B is a diagram illustrating an example of the configuration of the internal code. In FIG. 13B, the respective symbols are connected. In FIG. 13B, the number enclosed in parentheses is a number indicating the priority of encoding. More specifically, in (1), if there is a repetition, the repetition value is encoded, and if not, the process proceeds to (2). In (2), if there is a run-length RGBA value in the dictionary, Index encoding is performed. Otherwise, the process proceeds to (3).
(3)において、1つ前のランレングスのRGBAとの画素差分が差分上限値より小さい場合に画素差分で符号化を行ない、そうでなければ(4)に移る。(4)において、辞書とランレングスのRGBAの差分が差分上限値よりも小さい場合に、Index差分で符号化を行ない、そうでなければ(5)に移る。(5)において、ランレングスのRGBAを符号化する。全ての画像を符号化した後に、(6)において、符号終端を符号化する。 In (3), if the pixel difference from the previous run-length RGBA is smaller than the difference upper limit value, encoding is performed using the pixel difference; otherwise, the process proceeds to (4). In (4), if the difference between the dictionary and the run-length RGBA is smaller than the difference upper limit value, encoding is performed using the Index difference, and if not, the process proceeds to (5). In (5), run-length RGBA is encoded. After all the images are encoded, the code end is encoded in (6).
なお、符号フォーマット生成部506は、所定の条件により、RGBA辞書に含まれない画素値が入力された場合には、その画素値に対応するインデックス値を生成し、辞書に登録することにより、辞書を更新してもよい。図14は、入力されたRGBA画素値jが、RGBA辞書に含まれていない場合に、その画素値jが、RGBA辞書に登録されることを説明する図である。図中、符号kを付した箇所に、画素値jが登録され、RGBA辞書が更新されている。
When a pixel value that is not included in the RGBA dictionary is input under a predetermined condition, the code
図6に戻り、符号書き込み部507は、符号フォーマット生成部506により生成された符号データを、メインメモリ130のページ符号格納領域134に格納させる。
Returning to FIG. 6, the
(符号化部115の機能構成)
図15は、復号部116の機能構成を説明するブロック図である。復号部116は、メインメモリ130が有するページ符号格納領域134に格納された符号データを読み込み、復号して得られる画像データをメインメモリ130に対して出力する。
(Functional configuration of encoding unit 115)
FIG. 15 is a block diagram illustrating a functional configuration of the
復号部116は、符号読み込み部601、符号フォーマット解析部602、差分処理部603、辞書変換部604、繰り返し処理部605、ランレングス復号処理部606、及び、画像書き込み部607を有する。
The
符号読み込み部601は、ページ符号格納領域134から符号データを読み込む。符号フォーマット解析部602は、符号読み込み部601により読み込まれた符号データを解析し、ラン長、繰り返し、カラー値、インデックス、及び、差分等の各値を取得し、差分処理部603に対して出力する。
The
差分処理部603は、符号フォーマット解析部602により取得された差分の値と、1つ前のランにおけるカラー値とを加算し、そのランにおけるRGB値を求める。差分処理部603は、また、インデックスによりRGB値を求める。
The
図16は、差分処理部603による復号処理を説明する図であって、インデックスによる復号の例である。図16では、符号フォーマット解析部602により取得されたインデックスに対し、RGBA辞書に保持されているインデックス値に対応するRGBA値が出力される。図16では、さらに、出力されたRGBA値と、符号フォーマット解析部602により取得された差分と、が加算され、そのランに対応するRGBA値が出力される。
FIG. 16 is a diagram for explaining the decoding process by the
辞書変換部604は、辞書変換処理を行う。辞書変換部604は、差分処理部603においてRGBA値が求められた場合には、その値を、RGBA辞書に追加する。辞書変換部604は、また、符号フォーマット解析部602によって得られたランレングスデータの中に、差分が含まれていない場合には、インデックスに対応するRGBA値を求める。図17は、インデックスに対応するRGBA値を求める処理を説明する図である。図17では、符号データから取得されたインデックスである符号インデックスに対し、RGBA辞書により対応づけられているRGBA値が出力される。RGBA値は、繰り返し処理部605に対して出力される。
The
繰り返し処理部605は、符号フォーマット解析部602において取得された繰り返しの値とラン長とから、ランレングスデータを生成し、ランレングス復号処理部606に転送させる。
The
図18は、繰り返し処理部605における繰り返しの復号処理を説明する図である。図18は、ラン長2の画素値v1と、ラン長2の画素値v2と、のランレングスデータの後に続いて、繰り返しの値5を有する符号データが示されている。繰り返しの値5の部分の復号により、ラン長2の画素値v1のランとラン長2の画素値v2のランとが、交互に計5個連なる画像データが得られる。
FIG. 18 is a diagram for explaining repetitive decoding processing in the
図15に戻り、ランレングス復号処理部606は、辞書変換部604により得られたRGBA値により、画素毎の画素値を決定し、画像の描画を行う。図19は、ランレングス復号処理部606による復号処理を説明する図である。図19では、ラン長3の画素値v4が2回繰り返され、その後に、ラン長4の画素値v5、ラン長4の画素値v6等が続く。この符号データをランレングス復号処理部606が復号することにより、ラインmの各画素に対する画素値が決定される。復号された画像データは、画像書き込み部607に転送される。
なお、繰り返し処理部605とランレングス復号処理部606とは、一の処理部として構成されてもよい。
Returning to FIG. 15, the run-length
Note that the
画像書き込み部607は、ランレングス復号処理部606により復号された画像データを、メインメモリ130に格納させる。画像データは、例えば、RGBAバンドメモリ格納領域133に格納される。
The
(符号化部115の各部におけるデータの入出力)
図20は、符号化部115が有する各部におけるデータの入出力を説明する図である。図20の符号化部115は、画像読み込み部501、ランレングス生成処理部502、繰り返し処理部503、辞書変換部504、差分生成処理部505、符号フォーマット生成処理部506、符号書き込み部507、差分上限記憶部508、メモリアービタインタフェース(以下、「メモリアービタI/F」という。)509、画像アドレス生成部511、及び、符号アドレス生成部517を有する。図20において、図6の符号化部115と同一の機能及び構成を有する各部は、同一の符号を付し、ここでは説明を省略する。
(Data input / output in each unit of the encoding unit 115)
FIG. 20 is a diagram for explaining input / output of data in each unit included in the
メモリアービタI/F509は、メインメモリアービタ113に対するデータの入出力等を行うインタフェースである。メモリアービタI/F509は、メインメモリ130に対し、アドレスを指定してデータの読み出しと書き込みとを行う。メモリアービタI/F509は、メインメモリに対し、読み出し及び書き込みの何れの処理を行わせるかを示すR/W信号を出力する。
The memory arbiter I /
画像アドレス生成部511は、メインメモリ130における画像データのアドレスを生成する。画像アドレス生成部511は、画像読み込み部501がメインメモリ130のRGBAバンドメモリ格納領域133に格納されたバンドデータを読み出す際の、バンドデータのアドレスを生成する。生成されたアドレスは、画像読み込み部501に対して出力される。なお、図20中、メインメモリ上のアドレスを「メモリアドレス」と表記する。
The image
画像読み込み部501は、画像アドレス生成部511からアドレスが入力され、そのアドレスをメモリアービタI/F509に対して出力する。画像読み込み部501は、メモリアービタI/F509を介してバンドデータである画像データを取得する。画像読み込み部501は、取得した画像データを、ランレングス生成処理部502に対して出力する。画像データは、RGBA色空間による画像データであり、図中では、RGBAデータと表記されている。
The
ランレングス生成処理部502は、画像読み込み部501からRGBAデータが入力され、繰り返し処理部503に対し、ラン長の値とRGBAデータとを出力する。繰り返し処理部503は、ランレングス生成処理部502からラン長の値とRGBAデータとが入力され、辞書変換部504に対し、繰り返しの値、ラン長の値、及び、RGBAデータが出力される。なお、ランレングス生成処理部502と繰り返し処理部503とは、一の処理部として構成されてもよい。
The run length
辞書変換部504は、繰り返し処理部503から、繰り返しの値、ラン長の値、及び、RGBAデータが入力され、差分処理部505に対し、辞書データ、インデックス、繰り返しの値、ラン長の値、及び、RGBAデータを出力する。
The
差分処理部505は、辞書変換部504から、辞書データ、インデックス、繰り返しの値、ラン長の値、及び、RGBAデータが入力される。差分処理部505は、符号フォーマット生成部506に対し、差分データ、インデックス、繰り返しの値、ラン長の値、RGBAデータを出力する。
The
差分上限記憶部508は、入力された画素値とRGBA辞書に保持されている画素値との差分の上限の値を保持する。すなわち、入力された画素値とRGBA辞書に保持されている画素値との差分の値が、差分上限記憶部508に保持されている値以上の場合には、入力された画素値が、RGBA辞書に新たに登録される。差分上限記憶部508は、符号フォーマット生成部506に対し、差分の上限の値を出力する。
The difference upper
符号フォーマット生成部506は、差分処理部505から、差分データ、インデックス、繰り返しの値、ラン長の値、及び、RGBAデータが入力され、差分上限記憶部508から、差分の上限の値が入力される。符号フォーマット生成部506は、符号書き込み部507に対し、符号データを出力する。
The code
符号アドレス生成部517は、メインメモリ130における符号データのアドレスを生成する。符号アドレス生成部517は、符号書き込み部507がメインメモリ130のページ符号格納領域134に符号データを書き込ませる際の、符号データのアドレスを生成する。符号アドレス生成部517は、符号書き込み部507に対し、生成したアドレスを出力する。
The code
符号書き込み部507は、符号フォーマット生成部506から符号データが入力され、符号アドレス生成部517から、符号データをメインメモリ130に格納させる際のアドレスが入力される。符号書き込み部507は、メモリアービタI/F509を介してメインメモリ130に対し、アドレスと符号データとを出力する。
The
(符号化処理のフロー)
図21から図23は、符号化部115における符号化処理の例を説明するフロー図である。図21は、ランレングス生成処理部502と繰り返し処理部503とにおける処理の例である。ステップS101では、処理の開始を示すラインの初期値フラグが1に初期化される。ステップS101に続いてステップS102に進み、繰り返しの値が0に設定される。
(Encoding process flow)
FIG. 21 to FIG. 23 are flowcharts for explaining an example of the encoding process in the
ステップS102に続いてステップS103に進み、画像読み込み部501がメインメモリ130から読み出したRGBAデータのうち最初のラインの最初の画素の値を取得し、変数RGBADATAの値とする。なお、2回目以降のステップS103では、メインメモリ130から読み出されたRGBAデータのうち、前回のステップS103で値が取得された画素の次の画素の値を、変数RGBADATAの値とする。
Progressing to step S103 following step S102, the
ステップS103に続いてステップS104に進み、ラインの初期値フラグが1の場合には、ステップS105に進む判断がなされ、ラインの初期値フラグが1ではない場合には、ステップS107に進む判断がなされる。 Following step S103, the process proceeds to step S104. If the line initial value flag is 1, a determination is made to proceed to step S105. If the line initial value flag is not 1, the process proceeds to step S107. The
ステップS104に続くステップS105では、変数ORGの値に、ステップS103で取得されたRGBADATAの値の2倍の値が代入される。変数ORGの値に、RGBADATAの値の2倍の値を用いることにより、ラン長を取得する処理において、隣接する画素との差の値を演算する際に、正の数にレベルシフトされた演算処理を行うことができる。ステップS105に続いてステップS106に進み、ラインの初期値フラグが0に設定される。ステップS106の後、ステップS103に戻って処理を繰り返す。 In step S105 subsequent to step S104, a value twice as large as the value of RGBADATA acquired in step S103 is substituted for the value of variable ORG. An operation that is level-shifted to a positive number when calculating the difference value between adjacent pixels in the process of obtaining the run length by using a value that is twice the RGBADATA value as the value of the variable ORG. Processing can be performed. Progressing to step S106 following step S105, the initial value flag of the line is set to 0. After step S106, the process returns to step S103 to repeat the process.
一方、ステップS104に続くステップS107では、変数ORGの値が、ステップS103で取得されたRGBADATAの値の2倍の値であるか否かの判断がなされる。2倍ではない場合には、ステップS108に進み、2倍である場合には、ステップS109に進む。 On the other hand, in step S107 following step S104, it is determined whether or not the value of the variable ORG is twice the value of RGBADATA acquired in step S103. If it is not double, the process proceeds to step S108, and if it is double, the process proceeds to step S109.
ステップS107に続くステップS108では、ラン長の値を1インクリメントする。一方、ステップS107に続くステップS109では、2つ前のランにおけるラン長の値が、現在のランにおけるラン長の値と等しいか否かの判断がなされ、さらに、2つ前のランにおけるRGBADATAの値と、現在のランにおけるRGBADATAの値とが等しいか否かの判断がなされる。上記2つの判断において、両者とも「等しい」場合には、ステップS110に進み、そうではない場合には、図22の処理に進む。 In step S108 following step S107, the run length value is incremented by one. On the other hand, in step S109 subsequent to step S107, it is determined whether or not the run length value in the previous run is equal to the run length value in the current run, and further, RGBADATA in the second run is determined. A determination is made whether the value and the RGBADATA value in the current run are equal. In the above two determinations, if both are “equal”, the process proceeds to step S110, and if not, the process proceeds to the process of FIG.
ステップS109に続くステップS110では、繰り返しの値が1インクリメントされる。ステップS110に続いてステップS111に進み、変数ORGの値が、現在のランにおけるRGBADATAの値の2倍に設定される。 In step S110 following step S109, the repeat value is incremented by one. Progressing to step S111 following step S110, the value of the variable ORG is set to twice the value of RGBADATA in the current run.
ステップS111に続いてステップS112に進み、2つ前のランにおけるラン長が、1つ前のランにおけるラン長とされ、さらに、2つ前のランにおけるRGBADATAの値が、1つ前のランにおけるRGBADATAの値とされる。ステップS112に続いてステップS113に進み、1つ前のランにおけるラン長が、現在のランのラン長とされ、1つ前のランにおけるRGBADATAの値が、現在のランにおけるRGBADATAの値とされる。ステップS113の処理の後、ステップS103に戻って処理を繰り返す。 Proceeding to step S112 following step S111, the run length in the previous run is set as the run length in the previous run, and the RGBADATA value in the previous run is further changed in the previous run. The value is RGBADATA. Progressing to step S113 following step S112, the run length in the previous run is the run length of the current run, and the RGBADATA value in the previous run is the RGBADATA value in the current run. . After the process of step S113, the process returns to step S103 to repeat the process.
図22は、辞書変換部504、差分処理部505、及び、符号フォーマット生成部506における処理を説明する図である。図22のステップS114は、図21のステップS109の処理において、「両者とも等しい」ではない、の判断がなされた場合に、ステップS109に続いて行われる。
FIG. 22 is a diagram illustrating processing in the
ステップS114では、繰り返しの値が0より大きいか否かの判断がなされる。0より大きい場合には、ステップS115に進み、そうではない場合には、ステップS116に進む。ステップS114に続くステップS115では、繰り返しの値が、図12及び図13に示す符号フォーマットに従って符号化される。なお、以下の図22及び図23の説明では、符号フォーマットは、全て、図12及び図13に示すものとする。 In step S114, it is determined whether the repetition value is greater than zero. If it is greater than 0, the process proceeds to step S115, and if not, the process proceeds to step S116. In step S115 following step S114, the repeated value is encoded in accordance with the code format shown in FIGS. In the following description of FIGS. 22 and 23, the code formats are all shown in FIGS.
ステップS114又はステップS115に続くステップS116では、RGBADATAの値が、辞書に含まれているか否かの判断がなされる。辞書に含まれている場合には、ステップS117に進み、辞書に含まれていない場合には、ステップS121に進む。 In step S116 following step S114 or step S115, it is determined whether or not the RGBADATA value is included in the dictionary. If it is included in the dictionary, the process proceeds to step S117. If it is not included in the dictionary, the process proceeds to step S121.
ステップS116に続くステップS117では、辞書に含まれているRGBADATAの値に対応するインデックスの値が取得される。ステップS117に続いてステップS118に進み、符号フォーマットに従い、インデックスヘッダが符号化される。ステップS118に続いてステップS119に進み、符号フォーマットに従い、ラン長が符号化される。ステップS119に続いてステップS120に進み、符号フォーマットに従い、インデックスの値が符号化される。 In step S117 subsequent to step S116, an index value corresponding to the RGBADATA value included in the dictionary is acquired. Progressing to step S118 following step S117, the index header is encoded according to the code format. Progressing to step S119 following step S118, the run length is encoded according to the code format. Progressing to step S120 following step S119, the value of the index is encoded according to the code format.
一方、ステップS116に続くステップS121では、前のランにおけるRGBADATAの値と、現在のランにおけるRGBADATAの値との差分である画素差分値が取得される。ステップS121に続いてステップS122に進み、ステップS121で取得された画素差分値が、所定の値より小さいか否かの判断がなされる。なお、この判断は、所定の値以上であるか否かの判断でもよい。所定の値より小さい場合には、ステップS123に進み、所定の値より小さくない場合には、ステップS126に進む。 On the other hand, in step S121 following step S116, a pixel difference value that is the difference between the RGBADATA value in the previous run and the RGBADATA value in the current run is acquired. Progressing to step S122 following step S121, it is determined whether or not the pixel difference value acquired in step S121 is smaller than a predetermined value. This determination may be a determination as to whether or not the value is equal to or greater than a predetermined value. If it is smaller than the predetermined value, the process proceeds to step S123. If it is not smaller than the predetermined value, the process proceeds to step S126.
ステップS122に続くステップS123では、符号フォーマットに従い、画素差分ヘッダが符号化される。ステップS123に続いてステップS124に進み、符号フォーマットに従い、ラン長が符号化される。ステップS124に続いてステップS125に進み、符号フォーマットに従い、画素差分値が符号化される。 In step S123 following step S122, the pixel difference header is encoded according to the code format. Progressing to step S124 following step S123, the run length is encoded according to the code format. Progressing to step S125 following step S124, the pixel difference value is encoded according to the code format.
一方、ステップS122に続くステップS126では、辞書に保持されている複数の画素値と、RGBADATAの値との差分が最小となる差分の値が取得される。ステップS126に続いてステップS127に進み、ステップS126で取得された最小の差分の値が、所定の上限の値より小さいか否かの判断がなされる。小さい場合には、ステップS128に進み、小さくない場合には、ステップS131に進む。 On the other hand, in step S126 following step S122, a difference value that minimizes the difference between the plurality of pixel values held in the dictionary and the RGBADATA value is acquired. Progressing to step S127 following step S126, it is determined whether or not the minimum difference value acquired in step S126 is smaller than a predetermined upper limit value. If it is smaller, the process proceeds to step S128. If it is not smaller, the process proceeds to step S131.
ステップS127に続くステップS128では、符号フォーマットに従い、辞書差分ヘッダが符号化される。ステップS128に続いてステップS129に進み、符号フォーマットに従い、ラン長が符号化される。ステップS129に続いてステップS130に進み、符号フォーマットに従い、画素差分値が符号化される。 In step S128 following step S127, the dictionary difference header is encoded according to the code format. Progressing to step S129 following step S128, the run length is encoded according to the code format. Progressing to step S130 following step S129, the pixel difference value is encoded according to the code format.
一方、ステップS127に続くステップS131では、符号フォーマットに従い、画素ヘッダが符号化される。ステップS131に続いてステップS132に進み、符号フォーマットに従い、ラン長が符号化される。ステップS132に続いてステップS133に進み、符号フォーマットに従い、画素差分値が符号化される。ステップS133に続いてステップS134に進み、辞書の画素値に現在のRGBADATAの値が追加される。
ステップS120、ステップS125、ステップS130、及び、ステップS134の各処理の後、図23の処理に進む。
On the other hand, in step S131 following step S127, the pixel header is encoded according to the code format. Progressing to step S132 following step S131, the run length is encoded according to the code format. Progressing to step S133 following step S132, the pixel difference value is encoded according to the code format. Progressing to step S134 following step S133, the current RGBADATA value is added to the pixel value of the dictionary.
After the processing of step S120, step S125, step S130, and step S134, the process proceeds to the processing of FIG.
図23では、次のランに進む前に、ラン長の値等が更新する処理が行われる。図23のステップS135の処理は、図22のステップS120、ステップS125、ステップS130、及び、ステップS134に続いて行われる。ステップS135では、2つ前のランのラン長の値が、1つ前のランのラン長の値に更新され、2つ前のランのRGBADATAの値が、1つ前のランのRGBADATAの値に更新される。 In FIG. 23, the process of updating the run length value and the like is performed before proceeding to the next run. The process of step S135 in FIG. 23 is performed subsequent to step S120, step S125, step S130, and step S134 in FIG. In step S135, the run length value of the previous run is updated to the run length value of the previous run, and the RGBADATA value of the previous run is the RGBADATA value of the previous run. Updated to
ステップS135に続いてステップS136に進み、1つ前のランのラン長の値が、現在のランのラン長の値に更新され、1つ前のランのRGBADATAの値が、現在のランのRGBADATAの値に更新される。ステップS136に続いてステップS137に進み、変数ORGの値が、現在のランのRGBADATAの値の2倍に設定される。 Proceeding to step S136 following step S135, the run length value of the previous run is updated to the run length value of the current run, and the RGBADATA value of the previous run is updated to RGBADATA of the current run. Is updated to the value of. Proceeding to step S137 following step S136, the value of variable ORG is set to twice the value of RGBADATA for the current run.
ステップS137に続いてステップS138に進み、全ての画素に対する処理が終了したか否かの判断がなされる。全ての画素に対する処理が終了している場合には、ステップS139に進み、終了していない場合には、図21のステップS103に戻って処理を繰り返す。ステップS138に続くステップS139では、符号フォーマットに従い、符号終端が符号化される。 Progressing to step S138 following step S137, it is determined whether or not the processing for all the pixels has been completed. If the process for all the pixels has been completed, the process proceeds to step S139. If the process has not been completed, the process returns to step S103 in FIG. 21 to repeat the process. In step S139 following step S138, the code end is encoded according to the code format.
(符号化部115における辞書変換部504のハードウェア構成の例)
図24は、符号化部115における辞書変換部504のハードウェア構成の例を説明する図である。図24の辞書変換部504は、レジスタ10aないし10f、比較器11aないし11f、インデックス生成部13、OR演算器14、レジスタ15、レジスタ16、及び、制御部17を有する。
(Example of hardware configuration of
FIG. 24 is a diagram for explaining an example of the hardware configuration of the
レジスタ10aないし10fは、繰り返し処理部503から入力されるランのRGBA値のデータを受け取り辞書データとして記憶する。比較器11aないし11fは、レジスタ10aないし10fに格納された辞書データと、繰り返し処理部503からのランのRGBAデータにおけるRGBA値のデータとを、それぞれ比較する。複数の比較器が設けられていることにより、比較処理を並列に行うことができる。
The
比較の結果は、OR演算器14により判定され、さらに、インデックス生成部13に転送される。これにより、入力されるRGBA値のデータに対し、インデックスの生成と、既に生成されたインデックスに対応する画素値との一致の判定によるインデックスの対応づけとが行われる。
The result of the comparison is determined by the
図25は、インデックス生成部13におけるインデックスを生成する処理を説明する図である。図25では、入力されるRGBA値に対し、辞書に保持されているRGBA値毎に、比較結果の判定が行われる。より詳細には、ステップS11において、最初のインデックスに対応する画素値との一致が判定される。一致する場合には、入力されたRGBA値に対し、インデックスの値0が設定される。一致しない場合には、ステップS12以降に進み、辞書に保持されているインデックス毎に、対応する画素値が一致するか否かの判定の処理と、一致する画素値に対応するインデックスの対応づけの処理とが行われる。
FIG. 25 is a diagram illustrating processing for generating an index in the
この処理により、辞書に登録されているインデックスの中で、優先順に基づく対応づけを行うことができる。対応付けの処理により、一致する画素値に対応するインデックスの値が、一致インデックス値として出力される。 By this processing, it is possible to perform association based on the priority order among the indexes registered in the dictionary. By the association process, the index value corresponding to the matching pixel value is output as the matching index value.
図24に戻り、OR演算器14は、比較器11aないし11fからの比較結果に基づいて、入力されたRGBA値と辞書に保持されているRGBA値とが一致するものの有無を判定する。
Returning to FIG. 24, the
レジスタ15は、繰り返し処理部503から入力される繰り返しの値を一時的に保持する。レジスタ16は、繰り返し処理部503から入力されるラン長の値を一時的に保持する。制御部17は、OR演算器14からの判定結果に基づいて、インデックス生成部13の制御を行う。
The
(差分生成処理部505のハードウェア構成の例)
図26は、差分生成処理部505のハードウェア構成の例を説明する図である。差分生成処理部505は、レジスタ20,減算器21、減算器22aないし22f、最小値選択部23、及び、レジスタ24ないし26を有する。
(Example of hardware configuration of difference generation processing unit 505)
FIG. 26 is a diagram illustrating an example of a hardware configuration of the difference
レジスタ20は、1つ前のランにおけるRGBA値を格納する。減算器21は、現在のランにおけるRGBA値と1つ前のランにおけるRGBA値との差分を求める。減算器22aないし22fは、辞書に格納されているRGBA値と現在のランのRGBA値との差分を求める。複数の減算器を有することにより、減算処理を並列に行うことができる。減算された結果である各差分は、最小値選択部23に対して出力される。
The register 20 stores the RGBA value in the previous run. The subtracter 21 obtains a difference between the RGBA value in the current run and the RGBA value in the previous run. The subtractors 22a to 22f obtain the difference between the RGBA value stored in the dictionary and the RGBA value of the current run. By having a plurality of subtractors, subtraction processing can be performed in parallel. Each difference as a result of the subtraction is output to the minimum
最小値選択部23は、減算器22aないし22fからの出力を比較し、最小の差分値を選択し、その差分値が基づく画素値に対応するインデックスを、辞書から取得する。
The minimum
レジスタ24ないし26は、辞書変換部504から出力される値のうち、所定の変数の値を一時的に保持する。レジスタ24は、RGBA値に一致するインデックス値を一時的に保持する。レジスタ25は、繰り返しの値を一時的に保持する。レジスタ26は、ラン長の値を一時的に保持する。
The
図27は、差分からインデックスを取得する処理を説明するフロー図である。図27のステップS31では、減算器22aから出力された差分結果0と、減算器22bから出力された差分結果1との比較が行われる。差分結果0が差分結果1より大きい場合には、ステップS32に進み、そうではない場合には、ステップS33に進む。
FIG. 27 is a flowchart illustrating processing for acquiring an index from a difference. In step S31 of FIG. 27, the
ステップS31に続くステップS32では、変数である辞書差分データ値に、差分結果1を代入し、変数である差分インデックスデータ値に値1を代入する。一方、ステップS31に続くステップS33では、辞書差分データ値に、差分結果0を代入し、差分インデックスデータ値に値0を代入する。
In step S32 following step S31, the
ステップS32又はステップS33に続くステップS34では、辞書差分データ値と減算器22cから出力される差分結果2との比較が行われる。差分結果2がより小さい場合には、ステップS35に進み、そうではない場合には、ステップS36に進む。ステップS35では、辞書差分データ値と差分インデックスデータ値とが、差分結果2に対応する値に、それぞれ更新される。ステップS35に続いてステップS36に進む。
In step S34 following step S32 or step S33, the dictionary difference data value is compared with the
以下のステップでは、各減算器から出力される差分結果と、辞書差分データ値との比較に基づき、辞書差分データ値と差分インデックスデータ値とが更新される。全ての減算器から出力される差分結果に基づく処理が行われた後、辞書差分データ値の値が、最小の差分として出力され、その差分に対応する差分インデックスデータ値が出力される。 In the following steps, the dictionary difference data value and the difference index data value are updated based on the comparison between the difference result output from each subtracter and the dictionary difference data value. After the processing based on the difference results output from all the subtracters is performed, the value of the dictionary difference data value is output as the minimum difference, and the difference index data value corresponding to the difference is output.
図26に戻り、レジスタ24は、辞書変換部504から出力されるインデックス値を一時的に保持する。レジスタ25は、辞書変換部504から出力される繰り返しの値を一時的に保持する。レジスタ26は、辞書変換部504から出力されるラン長の値を一時的に保持する。
Returning to FIG. 26, the
(復号部116の各部におけるデータの入出力)
図28は、復号部116の各部におけるデータの入出力を説明する図である。図28の復号部116は、符号読み込み部601、符号フォーマット解析部602、差分処理部603、辞書変換部604、繰り返し処理部605、ランレングス復号処理部606、画像処理部I/F609、及び、符号アドレス生成部611を有する。図28において、図15の復号部116と同一の機能及び構成を有する各部は、同一の符号を付し、ここでは説明を省略する。
(Data input / output in each unit of the decoding unit 116)
FIG. 28 is a diagram for explaining input / output of data in each unit of the
符号アドレス生成部611は、符号読み込み部601がメインメモリ130から符号データを読み込む際の、アドレスを生成する。符号アドレス生成部611が生成したアドレスは、符号読み込み部601に対して出力される。
The code
符号読み込み部601は、符号アドレス生成部611からメインメモリ130に対するアドレスが入力さる。符号読み込み部601は、メインメモリアービタ113に対して、入力されたアドレスと、メインメモリ130に対する読み出し及び書き込みの何れかの処理を指定するR/W信号とを出力する。符号読み込み部601は、メインメモリアービタ113を介して、メインメモリ130が有するページ符号格納領域134から、符号データを取得する。符号読み込み部601は、さらに、取得した符号データを、符号フォーマット解析部602に対して出力する。
The
符号フォーマット解析部602は、符号読み込み部601から符号データが入力される。符号フォーマット解析部602は、差分処理部603に対し、ラン長の値、RGBAによるカラー値、インデックスの値、繰り返しの値、及び、差分の値を出力する。
The code
差分処理部603は、符号フォーマット解析部602から、ラン長の値、カラー値、インデックスの値、繰り返しの値、及び、差分の値が入力される。差分処理部603は、さらに、辞書変換部604から、RGBA色空間による差分の値の辞書データが入力される。このデータは、辞書変換部604が、一のランに対する処理を行い辞書が更新される毎に、入力されるとよい。差分処理部603は、辞書変換部604に対し、ラン長の値、RGBA色空間による差分の値の辞書データ、RGBA色空間による差分の値、及び、繰り返しの値を出力する。
The
辞書変換部604は、差分処理部603から、ラン長の値、差分の値の辞書データ、RGBA色空間による差分の値、及び、繰り返しの値が入力される。辞書変換部604は、繰り返し処理部605に対し、ラン長の値、カラー値、及び、繰り返しの値を出力する。辞書変換部604は、さらに、差分処理部603に対し、更新された差分の値の辞書データを出力する。この辞書データは、RGBA色空間による画素値に対応し、例えば、N個の要素を有する。
The
繰り返し処理部605は、辞書変換部604から、ラン長の値、カラー値、及び、繰り返しの値が入力され、ランレングス復号処理部606に対し、ラン長の値、及び、カラー値を出力する。ランレングス復号処理部606は、繰り返し処理部605から、ラン長の値、及び、カラー値が入力される。ランレングス復号処理部606は、画像処理部I/F609に対し、RGBA色空間からなる画像データを出力する。
画像処理部I/F609は、ランレングス復号処理部606から画像データが入力され、画像処理部117に対し、画像データを出力する。
The
The image processing unit I /
(復号部116の処理の例)
図29から図31は、復号部116における処理の例を示すフロー図である。図29では、入力された符号データに基づいて、ラン長の値等が取得される。図29の処理は、符号読み込み部601、及び、符号フォーマット解析部602により実行される。
(Example of processing of decoding unit 116)
FIG. 29 to FIG. 31 are flowcharts showing examples of processing in the
図29のステップS301では、符号フォーマット解析部602が、符号データから符号ヘッダを取得する。ステップS301に続いてステップS302に進み、符号フォーマット解析部602が、ステップS301で取得された符号ヘッダの種別を判断する。符号ヘッダが、インデックスヘッダ、辞書差分ヘッダ、画素ヘッダ、又は、画素差分ヘッダの何れかである場合には、ステップS303に進み、そうではない場合には、ステップS309に進む。
In step S301 in FIG. 29, the code
ステップS302に続くステップS303では、符号フォーマット解析部602が、符号データのランレングスデータを読み込む。ステップS303に続いてステップS304に進み、2つ前のランのラン長を、1つ前のランのラン長に置き換える。ステップS304に続いてステップS305に進み、1つ前のランのラン長を、現在のランのラン長に置き換える。
In step S303 following step S302, the code
ステップS305に続いてステップS306に進み、2つ前のランのRGBADATAの値を、1つ前のランのRGBADATAの値に置き換える。ステップS306に続いてステップS307に進み、1つ前のランのRGBADATAの値を、現在のランのRGBADATAの値に置き換える。 Proceeding to step S306 following step S305, the RGBADATA value of the previous run is replaced with the RGBADATA value of the previous run. Progressing to step S307 following step S306, the RGBADATA value of the previous run is replaced with the RGBADATA value of the current run.
ステップS307に続いてステップS308に進み、ステップS303で読み込まれたランレングスデータから、ラン長の値、及び、RGBADATAの値を取得する。ステップS308の処理の後、図30の処理に進む。 Progressing to step S308 following step S307, the run length value and RGBADATA value are acquired from the run length data read in step S303. After the process of step S308, the process proceeds to the process of FIG.
一方、ステップS302に続くステップS309では、ステップS301で読み込まれた符号ヘッダに基づいて、符号が繰り返し符号であるか否かを判断する。繰り返し符号の場合にはステップS310に進み、そうではない場合には、処理を終了する。なお、処理を終了する場合には、符号は終端符号である。 On the other hand, in step S309 following step S302, it is determined whether the code is a repetitive code based on the code header read in step S301. If it is a repetitive code, the process proceeds to step S310. If not, the process ends. When the process is terminated, the code is a terminal code.
ステップS309に続くステップS310では、符号フォーマット解析部602が、符号データのランレングスデータを読み込む。ステップS310に続いてステップS311に進み、ランレングスデータから繰り返しの値が取得される。ステップS311の処理の後、図32の処理に進む。
In step S310 following step S309, the code
図30は、符号フォーマット解析部602、差分処理部603、及び、辞書変換部604による処理を説明するフロー図である。図30の処理は、図29のステップS308の処理に続いて行われる。
FIG. 30 is a flowchart illustrating processing performed by the code
図30のステップS312では、符号ヘッダが、インデックスヘッダであるか否かの判断がなされる。インデックスヘッダである場合には、ステップS313に進み、そうではない場合には、ステップS315に進む。 In step S312 of FIG. 30, it is determined whether or not the code header is an index header. If it is an index header, the process proceeds to step S313; otherwise, the process proceeds to step S315.
ステップS312に続くステップS313では、符号フォーマット解析部602が、符号データのランレングスデータから、インデックスの値を取得する。ステップS313に続いてステップS314に進み、ステップS313で取得されたインデックスの値に対応するRGB値を辞書から取得し、その値を、変数RGBADATAの値とする。ステップS314の処理に続いて図31の処理に進む。
In step S313 following step S312, the code
一方、ステップS312に続くステップS315では、符号ヘッダが、辞書差分ヘッダであるか否かの判断がなされる。辞書差分ヘッダである場合には、ステップS316に進み、そうではない場合には、ステップS320に進む。 On the other hand, in step S315 following step S312, it is determined whether or not the code header is a dictionary difference header. If it is a dictionary difference header, the process proceeds to step S316; otherwise, the process proceeds to step S320.
ステップS315に続くステップS316では、符号フォーマット解析部602が、符号データのランレングスデータから、インデックスの値を読み込んで取得する。ステップS316に続いてステップS317に進み、ステップS316で取得されたインデックスの値に対応するRGB値を辞書から取得し、その値を、変数DRGBADATAの値とする。
In step S316 following step S315, the code
ステップS317に続いてステップS318に進み、符号フォーマット解析部602が、ランレングスデータの中の差分の値を取得する。ステップS318に続いてステップS319に進み、変数RGBADATAの値を、DRGBADATAの値にステップS318で取得された差分の値を加算した値で更新する。ステップS319の処理の後、図31の処理に進む。
Progressing to step S318 following step S317, the code
また、ステップS315に続くステップS320では、符号ヘッダが画素ヘッダであるか否かの判断がなされる。画素ヘッダである場合には、ステップS321に進み、そうではない場合には、ステップS322に進む。 In step S320 following step S315, it is determined whether the code header is a pixel header. If it is a pixel header, the process proceeds to step S321; otherwise, the process proceeds to step S322.
ステップS320に続くステップS321では、符号フォーマット解析部602が、ランレングスデータの中のカラー値を取得し、その値を、変数RGBADATAに代入する。一方、ステップS320に続くステップS322では、符号フォーマット解析部602が、ランレングスデータから差分の値を取得する。ステップS322に続いてステップS323に進み、変数RGBADATAの値を、1つ前のランにおけるRGBADATAの値に、ステップS322で取得された差分の値を加算した値で更新する。
In step S321 following step S320, the code
ステップS321又はステップS323に続くステップS324では、新たに取得されたカラー値に基づいて、辞書を更新する。ステップS324の処理の後、図31の処理に進む。 In step S324 following step S321 or step S323, the dictionary is updated based on the newly acquired color value. After the process of step S324, the process proceeds to the process of FIG.
図31は、ランレングス復号処理部606における復号処理の例を説明するフロー図である。図31のステップS325では、変数LOOPの値をラン長の値とする。ステップS325に続いてステップS326に進み、ラインメモリに格納されている画素データのうち、ライン0からRGBADATAの値を読み込み、画像処理部I/F609に対して出力する。
FIG. 31 is a flowchart illustrating an example of decoding processing in the run-length
ステップS326に続いてステップS327に進み、変数LOOPの値から1を減じる。ステップS327に続いてステップS328に進み、変数LOOPの値が0か否かの判断を行う。変数LOOPの値が0である場合には、図29のステップS301に戻って新たなランレングスデータを取得して処理を繰り返す。一方、変数LOOPの値が0ではない場合には、ステップS326に戻ってRGBA値を出力する処理を繰り返す。 Progressing to step S327 following step S326, 1 is subtracted from the value of the variable LOOP. Progressing to step S328 following step S327, it is determined whether or not the value of the variable LOOP is zero. If the value of the variable LOOP is 0, the process returns to step S301 in FIG. 29 to acquire new run length data and repeat the process. On the other hand, when the value of the variable LOOP is not 0, the process returns to step S326 and the process of outputting the RGBA value is repeated.
図32は、繰り返し処理部605における処理の例を説明するフロー図である。図32のステップS51は、図29のステップS311の処理に続いて行われる。ステップS51では、変数LOOPの値に対し、2つ前のランのラン長の値が設定される。
FIG. 32 is a flowchart illustrating an example of processing in the
ステップS51に続いてステップS52に進み、2つ前のランにおけるRGBADATAの値を取得する。ステップS52に続いてステップS53に進み、変数LOOPの値から1を減じる。ステップS53に続いてステップS54に進み、変数LOOPの値が0か否かを判断する。0である場合には、ステップS55に進み、0ではない場合には、ステップS52に戻って処理を繰り返す。 Progressing to step S52 following step S51, the value of RGBADATA in the previous run is acquired. Progressing to step S53 following step S52, 1 is subtracted from the value of the variable LOOP. Progressing to step S54 following step S53, it is determined whether or not the value of the variable LOOP is zero. When it is 0, it progresses to step S55, and when it is not 0, it returns to step S52 and repeats a process.
ステップS54に続くステップS55では、ランレングスデータから取得された繰り返しの値を、繰り返しの値から1減じた値で更新する。ステップS55に続いてステップS56に進み、繰り返しの値が0か否かの判断がなされる。繰り返しの値が0の場合には、繰り返し処理部605による処理を終了し、図29のステップS301に戻り、新たなランレングスデータを取得して処理を繰り返す。一方、繰り返しの値が0ではない場合には、ステップS57に進む。
In step S55 following step S54, the repetition value acquired from the run-length data is updated with a value obtained by subtracting 1 from the repetition value. Progressing to step S56 following step S55, it is determined whether or not the repeated value is zero. If the repeat value is 0, the process by the
ステップS56に続くステップS57では、変数LOOPの値を、1つ前のランのラン長の値とする。ステップS57に続いてステップS58に進み、ラインメモリにおけるライン0に、1つ前のランレングスデータのRGBA値を書き込む。
In step S57 following step S56, the value of the variable LOOP is set to the run length value of the previous run. Progressing to step S58 following step S57, the RGBA value of the previous run-length data is written to
ステップS58に続いてステップS59に進み、変数LOOPの値を、変数LOOPの値から1減じた値で更新する。ステップS59に続いてステップS60に進み、変数LOOPの値が0であるか否かの判断がなされる。0である場合には、ステップS61に進み、0ではない場合には、ステップS58に戻って処理を繰り返す。 Progressing to step S59 following step S58, the value of the variable LOOP is updated with a value obtained by subtracting 1 from the value of the variable LOOP. Progressing to step S60 following step S59, it is determined whether or not the value of the variable LOOP is zero. When it is 0, it progresses to step S61, and when it is not 0, it returns to step S58 and repeats a process.
ステップS60に続いてステップS61に進み、繰り返しの値を、繰り返しの値から1減じた値で更新する。ステップS61に続いてステップS62に進み、繰り返しの値が0であるか否かの判断がなされる。0である場合には、繰り返し処理部605の処理を終了し、図29のステップS301に戻る。0ではない場合には、ステップS51に戻って繰り返しの復号処理を続ける。
Progressing to step S61 following step S60, the repeated value is updated with a value obtained by subtracting 1 from the repeated value. Progressing to step S62 following step S61, it is determined whether or not the repeated value is zero. If it is 0, the process of the
(差分処理部603のハードウェア構成の例)
図33は、復号部116が有する差分処理部603のハードウェア構成の例を示す図である。差分処理部603は、レジスタ30,加算器31、加算器32aないし32f、選択部33、及び、レジスタ34ないし36を有する。
(Example of hardware configuration of difference processing unit 603)
FIG. 33 is a diagram illustrating an example of a hardware configuration of the
レジスタ30は、1つ前のランにおけるRGBA値を格納する。加算器31は、1つ前のランにおけるRGBA値に対し差分を加算することにより、現在のランにおけるRGBA値を求める。加算器32aないし32fは、入力される差分データと、辞書に格納されているRGBA値と入力される差分値を加算することにより、現在のランのRGBA値を求める。複数の加算器を有することにより、減算処理を並列に行うことができる。減算された結果は、選択部33に対して出力される。
選択部33は、加算器32aないし32fからの出力を比較し、差分インデックス値に対応する加算結果の値を選択する。
The register 30 stores the RGBA value in the previous run. The
The
レジスタ34ないし36は、符号フォーマット解析部602から出力される値のうち、所定の変数の値を一時的に保持する。レジスタ34は、RGBA値に一致するインデックス値を一時的に保持する。レジスタ35は、繰り返しの値を一時的に保持する。レジスタ36は、ラン長の値を一時的に保持する。
The
(復号部116における辞書変換部604のハードウェア構成の例)
図34は、復号部116における辞書変換部604のハードウェア構成の例を説明する図である。図34の辞書変換部604は、レジスタ40aないし40f、マルチプレクサ41及び43、制御部42、レジスタ45、及び、レジスタ46を有する。
(Example of hardware configuration of
FIG. 34 is a diagram for explaining an example of the hardware configuration of the
レジスタ40aないし40fは、差分処理部603から入力される1以上前のランのRGBA値のデータを受け取り辞書データとして記憶する。マルチプレクサ41は、差分処理部603から入力される現在のランにおけるインデックス値により、レジスタ40aないし40fに格納されている辞書データを選択して出力する。制御部42は、辞書データが選択される処理の制御を行う。
The registers 40a to 40f receive the RGBA value data of one or more previous runs input from the
マルチプレクサ43は、マルチプレクサ41から出力される辞書データによるRGBA値と、符号フォーマット解析部602により取得された差分値とを加算して現在のランのRGBA値を出力する。マルチプレクサ43は、また、差分処理部603から出力される差分処理により得られたRGBA値と、符号フォーマット解析部602により取得された差分値とを加算して現在のランのRGBA値を出力する。何れの処理を行うかは、符号ヘッダにより決定される。
The
レジスタ45は、差分処理部603から入力される繰り返しの値を一時的に保持する。レジスタ46は、差分処理部603から入力されるラン長の値を一時的に保持する。
The
(コンピュータによる実現)
図35は、本発明の実施の形態に係る画像処理装置を実現するコンピュータの構成を説明する図である。図35のコンピュータは、主処理部400、入力装置410、表示装置420、スキャナ430、プロッタ440、NIC460、ドライブ装置480、ハードディスク装置490、入力I/F419、表示I/F429、スキャナI/F439、プロッタI/F449、ドライブI/F489、及び、HDDI/F499を有する。
(Realization by computer)
FIG. 35 is a diagram illustrating the configuration of a computer that implements the image processing apparatus according to the embodiment of the present invention. 35 includes a
主処理部400は、コンピュータプログラムを実行して各機能を実現する。主処理部400は、例えば、CPU401、ROM408、及び、RAM409を有する。CPU401は、コンピュータプログラムを実行することにより、コンピュータが有する各デバイス等の制御を行う。ROM408は、例えば、コンピュータプログラムやパラメータ等が格納され、CPU401にそれらが供せられる。RAM409は、例えば、CPU401がコンピュータプログラムを実行する際のワークメモリとして供せられる。
The
入力装置410は、例えば、キーボードやマウス等の入力デバイスとして構成され、コンピュータに対する指示等が入力される。表示装置420は、コンピュータの状態等が表示される。スキャナ430は、画像を光学的に読み取って、画像データを生成する。プロッタ440は、媒体上に画像を形成して出力する。
The
NIC460は、コンピュータと外部とをネットワークを介して接続する際のインタフェースの機能を実現し、その制御を行う。ドライブ装置480は、記録媒体が挿入され、その記録媒体に記録された情報を読み出し、またその記録媒体に情報を記録する。HDD490は、大容量のデータを格納する記憶手段である。
The
入力I/F419、表示I/F429、スキャナI/F439、プロッタI/F449、ドライブI/F489、及び、HDD−I/F499は、それぞれ、入力装置410、表示装置420、スキャナ430、プロッタ440、ドライブ装置480、及び、HDD490がバスを介して主処理部400と接続される際のインタフェースである。
The input I /
(本実施の形態における効果)
本実施形態における画像圧縮装置は、画像のラスタ順における同一の画素値が連続する数であるラン長に基づく画像データの圧縮を行う際に、写真画像のように、ラン長が小さく、画素値そのものによる情報量が大きい場合に、より効率よく圧縮することができる。
(Effect in this Embodiment)
When compressing image data based on a run length, which is the number of consecutive identical pixel values in the raster order of an image, the image compression apparatus in the present embodiment has a small run length and a pixel value as in a photographic image. When the amount of information by itself is large, compression can be performed more efficiently.
より詳細には、例えば、グラフィックス画像と写真画像との差異について、以下、考察する。グラフィック画像は、一般に、予測符号化を行う際に、注目画素とその注目画素に隣接する画素との相関が高い。そのため、注目画素との差分を符号化することにより、高効率に圧縮することができる。一方、写真画像は、注目画素と隣接する画素との間の相関が低いため、差分による予測符号化の効率が低下する。 More specifically, for example, the difference between a graphics image and a photographic image will be considered below. In general, a graphic image has a high correlation between a pixel of interest and a pixel adjacent to the pixel of interest when predictive coding is performed. Therefore, it is possible to perform compression with high efficiency by encoding the difference from the pixel of interest. On the other hand, since the correlation between the target pixel and the adjacent pixel is low in the photographic image, the efficiency of predictive encoding based on the difference is reduced.
本実施の形態では、また、画素値に対応するインデックスを辞書に保持させ、辞書中の画素値との差分を符号化する。また、差分値が所定の値以上の場合には、その画素値に対応するインデックスを生成し、新たに辞書に登録する。これにより、辞書に保持されるインデックスを有する画素値は、複数の画素値が偏ることなく、好適な辞書となる。 In the present embodiment, an index corresponding to the pixel value is held in the dictionary, and a difference from the pixel value in the dictionary is encoded. If the difference value is greater than or equal to a predetermined value, an index corresponding to the pixel value is generated and newly registered in the dictionary. Thereby, the pixel value having the index held in the dictionary becomes a suitable dictionary without a plurality of pixel values being biased.
本実施の形態では、また、辞書に登録されている画素値のうち、処理する画素の画素値との差分が最も小さな画素値を選択し、その差分を符号化することにより、効率的に圧縮することができる。 In the present embodiment, among pixel values registered in the dictionary, the pixel value having the smallest difference from the pixel value of the pixel to be processed is selected, and the difference is encoded, thereby efficiently compressing the pixel value. can do.
本実施の形態は、また、注目画素に対して1ライン上の画素の値を使用しない。したがって、ラインメモリが不要であり、本実施の形態による画像処理装置をASICに内蔵することが容易である。 In this embodiment, the value of the pixel on one line is not used for the target pixel. Therefore, no line memory is required, and it is easy to incorporate the image processing apparatus according to the present embodiment in the ASIC.
(実施の形態のその他の例)
本実施の形態においては、RGBA色空間による画像データについて説明したが、RGB、CMY、CMYK、又は、Lab等の多値データでも、同様に実施することが可能である。また,CMY色空間におけるCコンポーネントのみの場合、又は、RGB色空間におけるRのみの多値の場合等、1つのコンポーネントの多値でも同様に実施することができる。
(Other examples of embodiment)
In the present embodiment, image data in the RGBA color space has been described. However, multi-value data such as RGB, CMY, CMYK, or Lab can be similarly implemented. Further, the same can be applied to multi-values of one component, such as only C components in the CMY color space or multi-values of only R in the RGB color space.
また、本実施の形態においては、FIFO(First_In_First_Out)方式により実現したが、辞書を使用する方式であれば、何れの方式でもよい。 Further, in the present embodiment, it is realized by the FIFO (First_In_First_Out) method, but any method may be used as long as it uses a dictionary.
以上、発明を実施するための最良の形態について説明を行ったが、本発明は、この最良の形態で述べた実施の形態に限定されるものではない。本発明の主旨をそこなわない範囲で変更することが可能である。 Although the best mode for carrying out the invention has been described above, the present invention is not limited to the embodiment described in the best mode. Modifications can be made without departing from the spirit of the present invention.
1 カラープリンタ
10a レジスタ
11a 比較器
13 インデックス生成部
14 演算器
15 レジスタ
16 レジスタ
17 制御部
20 レジスタ
21 減算器
22a、22b、22c 減算器
23 最小値選択部
24 レジスタ
25 レジスタ
26 レジスタ
30 レジスタ
31 加算器
32a 加算器
33 選択部
34 レジスタ
35 レジスタ
36 レジスタ
40a レジスタ
41 マルチプレクサ
42 制御部
43 マルチプレクサ
45 レジスタ
46 レジスタ
100 電装・制御部
110 プリンタASIC
113 メインメモリアービタ
114 メインメモリコントローラ
115 符号化部
116 復号部
117 画像処理部
118 エンジンコントローラ
119 通信処理部
120 プリンタエンジン
130 メインメモリ
131 プログラム領域
132 PDL格納メモリ領域
133 RGBAバンドメモリ格納領域
134 ページ符号格納領域
135 その他領域
400 主処理部
410 入力装置
419 入力I/F
420 表示装置
429 表示I/F
430 スキャナ
439 スキャナI/F
440 プロッタ
449 プロッタI/F
480 ドライブ装置
489 ドライブI/F
490 ハードディスク装置
501 画像読み込み部
502 ランレングス生成処理部
503 繰り返し処理部
504 辞書変換部
505 差分処理部
506 符号フォーマット生成部
507 符号書き込み部
508 差分上限記憶部
509 メモリアービタI/F
511 画像アドレス生成部
517 符号アドレス生成部
601 符号読み込み部
602 符号フォーマット解析部
603 差分処理部
604 辞書変換部
605 繰り返し処理部
606 ランレングス復号処理部
607 画像書き込み部
609 画像処理部I/F
611 符号アドレス生成部
DESCRIPTION OF
113
420
430
440
480
490
511 Image
611 Code address generator
Claims (15)
前記画像を構成する画素毎に、前記差に基づいて、一の画素値に対応する画素インデックスを選択する画素インデックス手段と、
前記画像のラスタ順において前記画素インデックスが同一である画素が連続する数であるラン長を取得するラン長取得手段と、
選択された前記画素インデックス、前記差、及び、前記ラン長を符号化する符号化手段と、
を有する画像圧縮装置。 Difference obtaining means for obtaining a difference between a pixel value of the pixel and a pixel value having a pixel index associated with each different pixel value for each pixel constituting the image;
Pixel index means for selecting a pixel index corresponding to one pixel value based on the difference for each pixel constituting the image;
A run length acquisition means for acquiring a run length that is a number of consecutive pixels having the same pixel index in the raster order of the image;
Encoding means for encoding the selected pixel index, the difference, and the run length;
An image compression apparatus.
前記画素の画素値と対応づけられる画素インデックスが前記辞書記憶手段に保持されない場合に、
前記画素の画素値に対応する画素インデックスを生成する画素インデックス生成手段と、
生成された前記画素インデックスと前記画素の画素値とを対応づけて前記辞書記憶手段に保持させることにより前記辞書を更新する辞書更新手段と、
を有する請求項1又は2記載の画像圧縮装置。 Dictionary storage means for holding a dictionary in which the pixel index and the pixel value are associated with each other;
When the pixel index associated with the pixel value of the pixel is not held in the dictionary storage means,
Pixel index generation means for generating a pixel index corresponding to the pixel value of the pixel;
A dictionary update unit that updates the dictionary by causing the dictionary storage unit to store the generated pixel index and the pixel value of the pixel in association with each other;
The image compression apparatus according to claim 1 or 2, further comprising:
前記画素の画素値と対応づけられる画素インデックスが前記辞書記憶手段に保持されない場合、かつ、前記画素の画素値と前記差が最小となる画素値との差が所定の上限値以上の場合に、
前記符号化手段は、前記画素の画素値を符号化する請求項1又は2記載の画像圧縮装置。 Dictionary storage means for holding a dictionary in which the pixel index and the pixel value are associated with each other;
When the pixel index associated with the pixel value of the pixel is not held in the dictionary storage unit, and when the difference between the pixel value of the pixel and the pixel value at which the difference is minimum is equal to or greater than a predetermined upper limit value,
The image compression apparatus according to claim 1, wherein the encoding unit encodes a pixel value of the pixel.
前記符号化手段は、さらに、前記繰り返しの値を符号化する請求項1ないし5何れか一項に記載の画像圧縮装置。 The first run having a predetermined run length having a first pixel index and the second run having the predetermined run length having a second pixel index are alternately continuous. Repetitive value acquisition means for acquiring a repetitive value based on the number of runs and the second number of runs,
6. The image compression apparatus according to claim 1, wherein the encoding unit further encodes the repeated value.
前記画素インデックスに対応する画素値を、前記画素インデックスと画素値とが対応づけられた辞書から取得する辞書処理手段と、
前記画素値と前記差との和による復号画素の画素値を取得する差分処理手段と、
前記ラン長と前記復号画素の画素値とによりランレングス復号を行うランレングス復号手段と、
を有する画像復号装置。 Analyzing code data obtained by compressing image data by a run-length encoding method, the pixel index corresponding to a predetermined pixel value, a difference from the predetermined pixel value, and the pixel value in the raster order of the image data Code data analysis means for obtaining a run length that is a continuous number;
Dictionary processing means for obtaining a pixel value corresponding to the pixel index from a dictionary in which the pixel index and the pixel value are associated;
Difference processing means for obtaining a pixel value of a decoded pixel by a sum of the pixel value and the difference;
Run-length decoding means for performing run-length decoding based on the run length and the pixel value of the decoded pixel;
An image decoding apparatus.
前記ランレングス復号手段は、前記ラン長と前記画素値とによりランレングス復号を行う請求項7又は8記載の画像復号装置。 When the code data includes a pixel value and a run length corresponding to the pixel value,
The image decoding device according to claim 7 or 8, wherein the run-length decoding means performs run-length decoding based on the run length and the pixel value.
前記符号データ解析手段は、前記繰り返しの値を取得し、
前記ランレングス復号手段は、前記繰り返しの値に基づいてランレングス復号を行う請求項7ないし9何れか一項に記載の画像復号装置。 When the code data includes a first run having a predetermined run length having a first pixel index and a second run having the predetermined run length having a second pixel index alternately. Including a repeat value based on the number of the first run and the number of the second run,
The code data analysis means acquires the repetition value,
The image decoding apparatus according to claim 7, wherein the run-length decoding unit performs run-length decoding based on the repetition value.
前記画像を構成する画素毎に、前記差に基づいて、一の画素値に対応する画素インデックスを選択する画素インデックスステップと、
前記画像のラスタ順において前記画素インデックスが同一である画素が連続する数であるラン長を取得するラン長取得ステップと、
選択された前記画素インデックス、前記差、及び、前記ラン長を符号化する符号化ステップと、
を有する画像圧縮方法。 A difference acquisition step of acquiring a difference between a pixel value of the pixel and a pixel value having a pixel index associated with each different pixel value for each pixel constituting the image;
A pixel index step for selecting a pixel index corresponding to one pixel value based on the difference for each pixel constituting the image;
A run length acquisition step of acquiring a run length, which is the number of consecutive pixels having the same pixel index in the raster order of the image;
An encoding step for encoding the selected pixel index, the difference, and the run length;
An image compression method.
前記画素インデックスに対応する画素値を、前記画素インデックスと画素値とが対応づけられた辞書から取得する辞書処理ステップと、
前記画素値と前記差との和による復号画素の画素値を取得する差分処理ステップと、
前記ラン長と前記復号画素の画素値とによりランレングス復号を行うランレングス復号ステップと、
を有する画像復号方法。 Analyzing code data obtained by compressing image data by a run-length encoding method, the pixel index corresponding to a predetermined pixel value, a difference from the predetermined pixel value, and the pixel value in the raster order of the image data A code data analysis step for obtaining a run length which is a continuous number;
A dictionary processing step of obtaining a pixel value corresponding to the pixel index from a dictionary in which the pixel index and the pixel value are associated;
A difference processing step of obtaining a pixel value of a decoded pixel by a sum of the pixel value and the difference;
A run-length decoding step for performing run-length decoding based on the run length and the pixel value of the decoded pixel;
An image decoding method comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008238712A JP2010074444A (en) | 2008-09-17 | 2008-09-17 | Image compression apparatus and method, image decoding apparatus and method, and computer program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008238712A JP2010074444A (en) | 2008-09-17 | 2008-09-17 | Image compression apparatus and method, image decoding apparatus and method, and computer program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2010074444A true JP2010074444A (en) | 2010-04-02 |
Family
ID=42205831
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008238712A Pending JP2010074444A (en) | 2008-09-17 | 2008-09-17 | Image compression apparatus and method, image decoding apparatus and method, and computer program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2010074444A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013026661A (en) * | 2011-07-15 | 2013-02-04 | Axell Corp | Image data encoding method |
CN115955569A (en) * | 2023-03-14 | 2023-04-11 | 海伦市动物防疫检疫中心 | Monitoring video data transmission method for animal quarantine center |
-
2008
- 2008-09-17 JP JP2008238712A patent/JP2010074444A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013026661A (en) * | 2011-07-15 | 2013-02-04 | Axell Corp | Image data encoding method |
CN115955569A (en) * | 2023-03-14 | 2023-04-11 | 海伦市动物防疫检疫中心 | Monitoring video data transmission method for animal quarantine center |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2012332327B2 (en) | Method and apparatus for image compression storing encoding parameters in 2D matrices | |
US7899262B2 (en) | Data compression apparatus and data compressing program storage medium | |
US20060262982A1 (en) | Image encoding apparatus and method, computer program, and computer-readable storage medium | |
JP2010103681A (en) | Image processing device and method | |
JP4801778B2 (en) | Video compression / encoding device, video restoration device, video compression program, and video restoration program | |
JP2010074444A (en) | Image compression apparatus and method, image decoding apparatus and method, and computer program | |
US20080025620A1 (en) | Data compression apparatus and data compressing program storage medium | |
JP4093200B2 (en) | Data compression method and program, and data restoration method and apparatus | |
JP3675429B2 (en) | Adaptive predictive encoding and decoding method and apparatus thereof, and recording medium recording adaptive predictive encoding and decoding program | |
JP4093193B2 (en) | Data compression method and program, and data restoration method and apparatus | |
JP2007295130A (en) | Image data encoder, program, computer-readable recording medium, and image data encoding method | |
JP4743884B2 (en) | Image coding apparatus and control method thereof | |
JP2005277932A (en) | Device and program for compressing data | |
JP4343863B2 (en) | Image encoding device, image decoding device, and control method thereof | |
JP4699307B2 (en) | Data compression apparatus and data compression program | |
JP4629512B2 (en) | Data compression apparatus and data compression program | |
JP4131969B2 (en) | Data compression apparatus and data compression program | |
JP2010220131A (en) | Apparatus and method for encoding image | |
JP2011019096A (en) | Image processor and image processing method | |
JP2006060490A (en) | Image compressor and image compression program | |
JP4743883B2 (en) | Image coding apparatus and control method thereof | |
JP4377352B2 (en) | Data compression apparatus and data compression program | |
JP6142552B2 (en) | Image processing apparatus, image processing method, and image processing program | |
JP4529681B2 (en) | Image data compression method and apparatus | |
JP2002077627A (en) | Image coding method and apparatus, image decoding method and apparatus, image forming apparatus and recording medium |