JP2008311792A - Device for encoding image and control method therefor - Google Patents
Device for encoding image and control method therefor Download PDFInfo
- Publication number
- JP2008311792A JP2008311792A JP2007155723A JP2007155723A JP2008311792A JP 2008311792 A JP2008311792 A JP 2008311792A JP 2007155723 A JP2007155723 A JP 2007155723A JP 2007155723 A JP2007155723 A JP 2007155723A JP 2008311792 A JP2008311792 A JP 2008311792A
- Authority
- JP
- Japan
- Prior art keywords
- block
- data
- encoding
- unit
- palette
- 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.)
- Withdrawn
Links
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Image Processing (AREA)
Abstract
Description
本発明は、画像データを符号化する技術に関するものである。 The present invention relates to a technique for encoding image data.
従来、静止画像の非可逆圧縮方式には、離散コサイン変換を利用したJPEG方式や、Wavelet変換を利用した方式が多く使われている。また可逆圧縮方式としては、Runlength方式、予測符号化を使う方式などが広く知られている。 Conventionally, as an irreversible compression method for still images, a JPEG method using discrete cosine transform and a method using Wavelet transform are often used. Also, as a lossless compression method, a Runlength method, a method using predictive coding, and the like are widely known.
また、可逆圧縮方式として、Pakcbitsや国際標準化方式であるJPEG−LS、JPEG2000符号化方式などが用いられてきた。予測符号化を用いた可逆符号化方式において、符号化効率をあげるためには、予測精度をあげることである。例えば、予測をするために参照する範囲を広くするや、出現した頻度を記録することによって、予測精度を高めて符号化効率をあげることが出来る。 As reversible compression methods, Pakcbits, international standardized methods such as JPEG-LS and JPEG2000 encoding methods have been used. In a lossless encoding method using predictive encoding, in order to increase encoding efficiency, it is necessary to increase prediction accuracy. For example, when the range to be referred to for prediction is widened or the frequency of appearance is recorded, the prediction accuracy can be improved and the coding efficiency can be increased.
さらに、予測誤差を小さくする方法として、出現画素値がまばらな画像に対して、出現画素値をまとめて、予測誤差を抑えようとする方式が提案されている(例えば、特許文献1)。
この特許文献1では、出現画素をまとめるための適用レベル数を可変にする事が可能になっているが、この適用レベル数によっては、符号化効率が悪くなることもあり、未だ改善の余地がある。
In
本発明はかかる問題点に鑑みなされたものであり、ブロックサイズに応じて、パレット化を行なうか否かの閾値を決定することで、符号化効率を更に向上させる技術を提供しようとするものである。 The present invention has been made in view of such a problem, and intends to provide a technique for further improving the coding efficiency by determining a threshold value for determining whether or not to palletize according to the block size. is there.
この課題を解決するため、例えば、本発明の画像符号化装置は以下の構成を備える。すなわち、
画像データを符号化し、符号化データを生成する画像符号化装置であって、
符号化単位のブロックのサイズを設定する設定手段と、
設定されたブロックのサイズに応じて閾値を決定する決定手段と、
設定されたサイズのブロックを単位に、画像データを入力する入力手段と、
入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成手段と、
作成されたヒストグラムから、着目ブロック内に出現する色数を算出し、前記決定手段で決定した閾値と前記色数とを比較し、前記色数が前記閾値以下であるかを判定する比較手段と、
前記比較手段で前記色数が前記閾値以下であると判定された場合、前記着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換手段と、
前記比較手段で前記色数が前記閾値以下と判定された場合、前記変換手段で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較手段で前記色数が閾値よりも大きいと判定された場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化手段とを備える。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device that encodes image data and generates encoded data,
Setting means for setting the block size of the encoding unit;
Determining means for determining a threshold according to the set block size;
Input means for inputting image data in units of blocks of a set size;
A histogram creation means for creating a histogram of the color of the input block of interest;
Comparing means for calculating the number of colors appearing in the block of interest from the created histogram, comparing the threshold value determined by the determining means with the number of colors, and determining whether the number of colors is equal to or less than the threshold value; ,
A conversion means for assigning a palette number to each color appearing in the block of interest and converting each pixel data in the block of interest into a palette number when the comparison means determines that the number of colors is equal to or less than the threshold;
When the comparison unit determines that the number of colors is equal to or less than the threshold value, the palette number converted by the conversion unit is losslessly encoded as pixel data, and the code obtained by encoding together with information indicating palette conversion. Output data,
If the comparison means determines that the number of colors is greater than the threshold value, each pixel data constituting the block of interest is losslessly encoded and the encoded data obtained by encoding is output together with information indicating non-palette conversion. Encoding means.
本発明によれば、符号化単位のブロックサイズに応じて、パレット化を行なうか否かの閾値を決定することで、符号化効率を更に向上させることが可能になる。 According to the present invention, it is possible to further improve the encoding efficiency by determining a threshold value for determining whether or not to perform palletization according to the block size of the encoding unit.
以下、添付図面に従って本発明に係る実施形態を詳細に説明する。 Hereinafter, embodiments according to the present invention will be described in detail with reference to the accompanying drawings.
なお、以下では、画像符号化技術を印刷装置に適用する例を説明するが、画像符号化装置単独でも構わないし、他の情報処理装置内に搭載されるものでも構わない。 In the following, an example in which the image encoding technique is applied to a printing apparatus will be described. However, the image encoding apparatus alone or an apparatus installed in another information processing apparatus may be used.
<第1の実施形態>
図2は、本実施形態によるシステム概略図である。図中、10は印刷装置であり、50は印刷データを出力するホストコンピュータである。印刷装置10は、印刷データの受信やレンダリングを行なうプリンタ制御部11、ハードディスク等の大容量の記憶装置105、及び、記録紙上に可視画像を印刷するプリンタエンジン部110を有する。プリンタ制御部11には、各種処理回路が含まれるが、その中には、CPU、及びCPUが実行するプログラム、及び、ワークエリアとして使用するメモリが含まれる。また、ホストコンピュータ50と印刷装置10は、ネットワークを介して接続されるものとするが、他のインタフェース(例えば、USB)でも構わず、その種類は問わない。また、プリンタエンジン部110は、本実施形態では、電子写真方式を採用するものとして説明するが、インクジェット、感熱記録等でも良く、その種類も問わない。また、ホストコンピュータ50は、例えばパーソナルコンピュータである。ホストコンピュータ50上では、例えば文書編集アプリケーションプログラムを実行されるものとする。ユーザがホストコンピュータ50のキーボードやマウス等を用いて印刷指示を行なったとする。このとき、ホストコンピュータ50のOS(オペレーティングシステム)にインストールされたプリンタドライバがアプリケーションから印刷対象のデータを入力し、印刷装置10が解釈可能なページ記述言語(PDL)で記述した印刷データを生成する。そして、OSを介して、その印刷データが印刷装置10に送信されてくる。印刷装置10のプリンタ制御部11は、ホストコンピュータ50から受信した印刷データを解釈し、ページ単位にレンダリングし記憶装置105に格納しつつ、記憶装置105に格納されたレンダリング結果をプリンタエンジン部110に出力する。また、印刷装置10は、他のホストコンピュータからも印刷データを受信可能である。
<First Embodiment>
FIG. 2 is a system schematic diagram according to the present embodiment. In the figure, 10 is a printing apparatus, and 50 is a host computer that outputs print data. The
図1は、主として、実施形態における印刷装置10のプリンタ制御部11のブロック構成図である。
FIG. 1 is a block diagram of the
図示において、100はホストコンピュータ50から受信した印刷データ(PDLデータ)を解釈し、ビットマップイメージを生成するレンダリング部である。このレンダリング部100内には、1ページ分の描画メモリと、各画素毎の属性を格納する属性フラグメモリが内蔵されている。そして、PDLデータで指定された文字コードについては、指定されたフォント種類に従って、不図示のフォントメモリからデータを読出し、文字パターンを生成し、描画メモリへ展開する。また、PDLデータで指定された線画や各種図形の描画処理も行なう。更に、PDLデータに自然画等の画像データが含まれる場合には、その画像データの展開処理も行なう。また、レンダリング部100は、描画メモリへのレンダリング処理を行なう際、該当する画素位置毎にその属性フラグ(文字線画、自然画、CGを識別する情報、有彩色/無彩色を示す情報、網点であるか否かを示す情報の属性)を属性フラグメモリに格納する。この属性フラグメモリは、描画メモリ中の1画素に対して、1バイト(8ビット)単位に属性フラグを記憶管理する。そして、8ビット中の何ビットかを用いて、上記の各属性を表わす。
In the figure,
101は圧縮処理用のバッファメモリ、102は属性フラグ符号化部、103はカラー画像符号化部、104は書き込み用のバッファメモリ、105はハードディスク装置等の大容量の記憶装置である。106は復号処理用のバッファ、107は属性フラグ復号部、108はカラー画像復号部、109は復号された属性フラグ、画像データを展開するためのバッファメモリである。また110は画像処理部であり、復号された画像データを属性データを参照した色変換(記録色成分CMYKへの変換)、階調補正を行ない、得られたデータをプリンタエンジン110に出力する。
上記構成において、印刷データ(PDLデータ)を不図示のインタフェースを介して受信したとする。この場合、レンダリング部100はその印刷データを解釈し、ページ単位に画像データの描画(レンダリング)すると共に、その際に属性フラグメモリに該当する画素位置の属性フラグを格納する。なお、レンダリングする際には、各画素はRGBの色空間であって、1成分は8ビットであるものとする。この色空間、ビット数は一例であり、他の色空間でも構わない。
In the above configuration, it is assumed that print data (PDL data) is received via an interface (not shown). In this case, the
1ページ分の画像データ及び属性フラグの格納が完了すると、レンダリング部100は、バッファメモリ101にそのデータを出力する共に、次ページのレンダリング処理を開始する。
When the storage of the image data for one page and the attribute flag is completed, the
画像符号化処理部103はバッファメモリに格納された画像データを、属性フラグ符号化部102はバッファメモリに格納された属性フラグをそれぞれ符号化する。生成された符号化画像データ及び符号化属性フラグは、バッファメモリ104を介して、記憶装置105にそれぞれファイルとして格納される。
The image
一方、属性フラグ復号部107、及び、画像復号処理部108は、プリンタエンジン部111の印刷出力処理に同期して、記憶装置105に格納された符号化画像データファイル、符号化属性フラグファイルをバッファメモリ106に読込む。そして、それぞれが、復号処理を行ない、復号結果をバッファメモリ109に格納する。画像処理部110は、復号された属性フラグを参照し、復号された画像データ(RGBデータ)から、属性に応じたYMCK色空間への変換、補正処理を行ない、プリンタエンジン部111の印刷処理に同期して出力する処理を行なう。
On the other hand, the attribute
上記の結果、画像及び属性フラグの符号化処理と、その復号処理は、記憶装置105を介在させることで、互いに非同期にできる。従って、レンダリング部100、画像符号化部103、属性フラグ符号化部102は、プリンタエンジン部111の印刷速度とは無関係に、各ページの画像及び属性フラグを符号化できる。この結果、ホストコンピュータ50は、本実施形態の印刷装置10への印刷データの出力処理から素早く解放される。また、本印刷装置は、不図示の他のコンピュータからの印刷データの受信に対処することも可能となる。
As a result, the image and attribute flag encoding process and the decoding process can be made asynchronous with each other through the
次に、上記構成を備えた本実施形態の印刷装置10における制御部150の符号化処理を、図3のフローチャートを参照して以下に説明する。
Next, the encoding process of the
ホストコンピュータ50より印刷ジョブ(PDLデータ)を受信すると、まず、ステップS11にて、レンダリング部100は、PDL解析を行なう。そして、ステップS12にて、レンダリング部100は、PDLに基づいてレンダリングすることによりビットマップイメージを生成する。また、レンダリング部100は、ステップS13にて、PDL解析時に各画素毎の属性情報を得て属性フラグを生成し、属性メモリに格納する。なお、レンダリング処理と、属性フラグの生成及び格納は、並列的に行われる。
When a print job (PDL data) is received from the
このように、レンダリング部100は、ホストコンピュータ50から受信したPDLで記述された印刷データを解析し、その中に含まれるPDLコマンドを解釈してプリントのための画像(ビットマップイメージ)を生成する。このとき、PDLコマンドにおけるコマンドの種別を示す情報を参照して、各画素の属性を判定し、それを属性フラグとして属性フラグメモリに格納する。
As described above, the
1ページ分のレンダリングが完了すると、レンダリングされたビットマップイメージは画像符号化処理部103によって可逆圧縮符号化(本実施形態では、JPEG―LSを採用した)に従って符号化が行われる(ステップS14)。一方、属性フラグデータは符号化器102によって可逆圧縮される(ステップS15)。属性フラグデータの符号化としては、ランレングス符号化を用いるものとするが、他の符号化技術(例えば予測符号化、パックビッツ符号化等)でも構わない。そして、それぞれで生成された符号化データは、バッファ104を介して、記憶装置105に格納される(ステップS16)。
When the rendering for one page is completed, the rendered bitmap image is encoded by the image
上記処理における、属性フラグ符号化部102については、1ページ分の属性フラグをラスタースキャンし、ランレングする符号化するだけであるので、その説明については省略する。以下では、実施形態における画像符号化処理部103について更に詳細に説明する。
In the above process, the attribute
図4は、実施形態における画像符号化処理部103の詳細ブロック構成図を示している。
FIG. 4 is a detailed block diagram of the image
画像符号化装置部103は、図示の如く、ブロック化部200、バッファメモリ201、ヒストグラム作成部202、判定部203、置換部204、及び、符号化部205とを備える。以下、同図に従って、実施形態の画像符号化処理部103の処理内容を説明する。
The image
制御部150は、操作部151からの指示、もしくは印刷データ中に格納された制御情報に従い、画像データの符号化単位であるブロックサイズ(m×n画素のm、n)を特定する制御信号を生成する。そして、制御部150は生成した制御信号を、1ページの符号化処理に先立って、画像符号化処理部103に出力する。なお、操作部151から指示されたブロックサイズと、印刷データに含まれる制御情報で特定されるブロックサイズが異なる場合もありえる。制御部150は、印刷データ中に、ブロックサイズを指定するコマンドが含まれていれば、それに従って符号化単位のブロックサイズを決定する。また、印刷データ中にブロックサイズを指定するコマンドが存在しなかった場合には、操作部151から指示されたサイズを符号化単位のブロックサイズとして決定する。
In accordance with an instruction from the
ブロック化部200は、バッファメモリ101(図1参照)から、制御部150からの上記制御信号に従ったサイズのブロック(m×n画素分)の画像データ(以下、ブロックデータという)を読込み、バッファ201に格納する。なお、ブロック化部200が読込むブロックの順序は、ブロックを単位とするラスタースキャン順とする。
The blocking
ヒストグラム作成部202は、バッファメモリ201に格納されたブロックデータのヒストグラム情報(色毎の出現頻度)を作成し、その作成されたヒストグラムの情報を判定部203に出力する。
The
判定部203は、内部に閾値記憶部としてのルックアップテーブルを内蔵し、制御部150からの制御情報で示されるブロックサイズに基づき閾値Thをそのルックアップテーブルから読込む。また、判定部203は、ヒストグラム作成部202からのヒストグラム情報に基づき、着目ブロック内に出現する色の数Ncを算出する。そして、判定部203は、その算出した色数Ncと閾値Thとを比較し、色数Ncは閾値Th以下であるか否かを判定し、その判定結果に応じて以下の処理を行なう。
・色数Ncが閾値以下の場合;
判定部203は、置換部204、符号化部205に、置換処理を有効にする信号(色数≦閾値Thであることを示す信号でもある)を出力する。そして、判定部203は、着目ブロック内に出現する頻度の大きい順に色を並べ替える。そして、判定部203は、並べ替え後の各色データ(RGBの値)と、0、1、2、…、Nc−1のパレット番号を対にして、図5に示すように変換テーブル(以下、パレット変換テーブル)を作成し、置換部204及び符号化部205に出力する。
・色数Ncが閾値よりも大きい場合;
判定部203は、置換部204に対して置換処理を無効にする信号(色数>閾値Thを示す信号でもある)を出力する。
The
-When the number of colors Nc is less than or equal to the threshold value;
The
When the number of colors Nc is greater than the threshold;
The
置換部204は、制御部150からの制御信号で示されるブロックサイズ毎にバッファメモリ201からブロックデータを読込み、置換処理を行ない、符号化部205に出力する。より具体的には、次の通りである。
The
判定部203からの信号が、置換処理無効を示す場合、置換部203は、バッファメモリ201に格納された着目ブロック内をラスタースキャンして各画素データを読込み、その読込んだ画素データをそのまま符号化部205に出力する。
When the signal from the
一方、判定部203からの信号が置換処理を有効を示す場合、置換部204は判定部203からのパレット変換テーブルを内部の書き込み可能なメモリにルックアップテーブルとして格納する。そして、置換部204は、バッファ201に格納された着目ブロックのラスタースキャンして各画素データを読込み、読込んだ画素データをルックアップテーブルを用いてパレット番号に変換する。また、置換部204は、その変換後のデータ(パレット番号)を、RGBのうちの1つの成分(実施形態ではR成分とする)のデータとして符号化部205に出力する。また、置換部204は、他の成分(G、B成分)用のバスにはダミーとして“0”を出力する。
On the other hand, when the signal from the
次に符号化部205について説明する。
Next, the
符号化部205は、1つの画像の符号化に先立ち、ファイルヘッダを生成し、出力する。このファイルヘッダには、符号化対象の画像データのサイズ(水平、垂直方向の方向画素数)、色空間の種別、各成分のビット数、ブロックのサイズを特定する情報等、復号処理に必要な情報が格納される。符号化部205は、ブロック単位に符号化する際には次の処理を行なう。
The
符号化部205は、判定部203から置換処理無効を示す制御信号を受信した場合、置換無し(非パレット変換)を示す識別情報(例えば“0”)を格納したブロックヘッダを出力する。また、判定部203から置換処理有効を示す制御信号を受信した場合、置換色有り(パレット変換)を示す識別情報(例えば“1”)、及び、パレット変換テーブルを格納したブロックヘッダを生成し出力する。なお、ブロックヘッダに格納するパレット変換テーブルには、色数Ncと、各色成分値で構わない。理由は、各色に対するパレット番号が、0、1、…、Nc−1となっていることが約束されているためである。図10は、実施形態における符号化部205が生成する符号化データファイルの構造を示している。1つのブロックの符号化データは、図示の参照番号301、302のいずれかのタイプである。
When receiving the control signal indicating that the replacement process is invalid from the
この後、符号化部205は、置換部204から出力されるラスタースキャン順の各画素データ(カラー画像データ)をJPEG−LS符号化方法に従って可逆符号化し、符号化データを生成する。そして、符号化部205は、生成した符号化データを、先に示したブロックヘッダに後続するデータとして出力する。
Thereafter, the
図6は実施形態における符号化部205の詳細ブロック構成図である。符号化部205は、図示のように、コンテクスト生成部251、予測補佐生成部252、予測誤差符号化部253、ランレングス変換部254、ランレングス符号化部255、及び、セレクタ256を有する。
FIG. 6 is a detailed block diagram of the
先に説明したように、符号化部205はJPEG−LS符号化方法に従って、入力した画像データを可逆符号化する。JPEG−LSは、ブロック内をラスタースキャン中、図7に示すように、着目画素Xの近傍の既に符号化済み近傍画素Xa,Xb,Xc,Xdの色からコンテクスト値を算出する。そして、その算出したコンテクスト値に従い、予測符号化するか、ランレングス符号化するのかを決定する。なお、着目ブロックがブロックの先頭ライン上にあるとき、又は、着目画素位置がラインの左端、右端位置である場合、近傍画素Xa,Xb,Xc,Xdの全部、もしくは一部はブロック外の位置になってしまう。このようなブロック外の画素の各成分値は“0”であるものとして符号化処理を行なうものとする。なお、ここではブロック外の画素の成分値を“0”としているが、復号処理と同じにすればよいわけであるから、必ずしも“0”でなくても構わない。
As described above, the
さて、図6に示すように、コンテクスト生成部251は、着目画素Xの近傍画素の画素データを参照するため、内部に2ライン分のメモリを有する。そして、コンテキスト生成部251は、着目画素Xの近傍画素Xa,Xb,Xc,Xdを内部メモリから読込み、着目画素Xにおけるコンテクス値を算出する。そして、そのコンテクスト値に基づき、コンテクスト生成部251は、着目画素Xをランレングする符号化すべきか、予測誤差符号化すべきかを判定し、入力した着目画素Xを予測誤差算出部252、ランレングス変換部254のいずれかに出力する。
Now, as shown in FIG. 6, the
実施形態では、簡単なものとするため、近傍画素Xa=Xb=Xc=Xdを満たか否か、すなわち、近傍画素{Xa,Xb,Xc,Xd}で表わされる色数が“1”であるか否かを示す情報をコンテクスト値とする。 In the embodiment, for simplicity, whether or not the neighboring pixel Xa = Xb = Xc = Xd is satisfied, that is, the number of colors represented by the neighboring pixel {Xa, Xb, Xc, Xd} is “1”. Information indicating whether or not is a context value.
近傍画素{Xa,Xb,Xc,Xd}で合わされる色数が“1”以外(2以上)である場合、コンテクスト生成部251は、着目画素Xを予測符号化するため、着目画素Xの各画素成分値を予測誤差算出部252に出力する。
When the number of colors combined by the neighboring pixels {Xa, Xb, Xc, Xd} is other than “1” (2 or more), the
また、近傍画素{Xa,Xb,Xc,Xd}で合わされる色数が“1”である場合、着目画素Xがその直前の画素Xaと同色である確率が非常に高い。従って、コンテクスト生成部251は、着目画素Xからランレングス符号化を開始するため、着目画素Xの各画素成分値をランレング変換部254に出力する。
Further, when the number of colors combined by the neighboring pixels {Xa, Xb, Xc, Xd} is “1”, the probability that the pixel of interest X is the same color as the immediately preceding pixel Xa is very high. Accordingly, the
なお、一旦、着目画素Xをランレングス変換部254に出力した場合、着目画素Xに後続して同じ画素が入力さてる限り、コンテクスト値の算出は行なわず、入力される画素データをランレングス変換部254に出力する。
Once the target pixel X is output to the run
また、ランレングス符号化処理中、着目画素Xがその直前の画素Xaと非同一色となった場合、或いは、着目画素Xはブロック右端に到達した場合、コンテクスト生成部251はランが終端したと判定する。そして、ラン終端を示す信号をランレングス変換部254に通知し、着目画素Xのコンテクスト値の算出も行なう。
In addition, during the run-length encoding process, when the pixel of interest X becomes the same color as the immediately preceding pixel Xa, or when the pixel of interest X reaches the right end of the block, the
予測誤差算出部252は、着目画素Xの近傍画素{Xa,Xb,Xc}から、着目画素の各成分の予測値を算出し、その各成分の予測値と、着目画素の各成分値との差を算出し、予測誤差符号化部253に出力する。実施形態では、簡単のため、近傍Xaの各成分値が着目画素の各成分値の予測値として用いるものとする。予測誤差符号化部253は、着目画素の各成分の予測誤差に対してハフマン符号化、もしくは、算術符号化等の手法を利用して符号語を生成し、セレクタ205に出力する。
The prediction
また、ランレングス変換部254は、コンテクスト生成部251から、近傍画素{Xa,Xb,Xc,Xd}で表わされる色数が“1”であることを示す信号を入力すると、ランの計数を開始する。そして、ランレングス変換部254は、ランをカウント中に、コンテクスト生成部251から、着目画素Xがその直前の画素Xaと非同一色となった、着目画素Xはブロック右端に到達したことを示す信号を受信した場合、ランの計数を終了する。そして、それまでカウントした値をランレングス符号化部255に出力する。ランレングス符号化部255は、ランレングス変換部254から入力したカウントした値に対応する符号語を生成し、セレクタ256に出力する。
When the run
セレクタ256は、コンテクスト生成部251によって、着目画素についてランレングス符号化を中か、予測誤差符号化中かを示す信号を受信する。従って、セレクタ256は、その受信する信号に従い、予測誤差符号化部253、ランレングス符号化部255のいずれか一方からの符号化データを選択し、出力する。なお、予測誤差符号化部253は、1画素単位に符号化データを出力するのに対し、ランレングス符号化部255は1つのランがラン終端になって初めて符号化データを出力することになる。それ故、セレクタ256は各タイミングに応じて入力、出力の制御を行なうことになる。
The
以上実施形態における符号化に係る構成とその処理を説明した。ここで、ブロック内に出現する色の数Ncが、そのブロックのサイズによって決まる閾値Th以下の場合にパレット化する理由を以下に説明する。 The configuration and processing related to encoding in the embodiment have been described above. Here, the reason why the palette is formed when the number Nc of colors appearing in the block is equal to or smaller than the threshold Th determined by the size of the block will be described below.
1つのブロック内に出現する色の数Ncが閾値Th以下というのは、そのブロック内に出現する色が、比較的少なくいことを意味する。色数が少ない場合、各色の差が大きくなる確率が高い傾向にある。特に、CG(コンピュータグラフィックス)の場合に、ブロック内の色数は比較的少なく、この傾向が強い。 The number Nc of colors appearing in one block being equal to or less than the threshold Th means that there are relatively few colors appearing in that block. When the number of colors is small, the probability that the difference between the colors is large tends to be high. In particular, in the case of CG (computer graphics), the number of colors in a block is relatively small, and this tendency is strong.
説明を単純なものとするため、モノクロ画像(明度の濃淡画像)を例にして説明する。図8(a)は、ブロック内に出現する画素値が4種類{C1、C2、C3、C4)であり、それぞれの頻度がC1>C2>C0>C4の順番になっている例を示している。 In order to simplify the description, a monochrome image (lightness gradation image) will be described as an example. FIG. 8A shows an example in which there are four types of pixel values {C1, C2, C3, C4) appearing in the block, and the respective frequencies are in the order of C1> C2> C0> C4. Yes.
予測誤差符号化する場合、着目画素値(ここでは明度)と、その近傍の符号化済みの画素値(予測値)との差分を算出し、その差分に応じた符号語を生成する。一般に、差分が小さい確率が高いから、差分が小さい場合には短い符号語を生成し、差分値が大きくなるにしたがって長い符号語を生成している。 When predictive error encoding is performed, a difference between a pixel value of interest (in this case, brightness) and an encoded pixel value (predicted value) in the vicinity thereof is calculated, and a code word corresponding to the difference is generated. In general, since the probability that the difference is small is high, a short codeword is generated when the difference is small, and a long codeword is generated as the difference value increases.
しかしながら、図8(a)に示すような状態の場合、同じ画素値であれば差分値が“0”となるものの、異なる画素値の差分値は、無視できない程大きな値になってしまう。仮に、画素値C0、C1間の距離が“50”とするなら、差分が1乃至49までの符号語は未使用となり、高い符号化効率は望めない。 However, in the state shown in FIG. 8A, the difference value is “0” if the pixel values are the same, but the difference value between the different pixel values is too large to be ignored. If the distance between the pixel values C0 and C1 is “50”, codewords with a difference of 1 to 49 are unused, and high coding efficiency cannot be expected.
そこで、実際に出現する各画素の値を、0で始めるシーケンシャルなパレット番号を割り当てる。この結果、図8(a)のヒストグラムを、図8(b)のヒストグラムに変換できる。このパレット番号を画素値と見立てれば、色C0、C1、C2、C3はパレット番号0、1、2、3に置き換えられる。従って、このパレット番号を用いれば、予測誤差の絶対値は最大でも“3”であることが約束され、高い符号化効率が期待できる。
Therefore, a sequential palette number starting with 0 is assigned to the value of each pixel that actually appears. As a result, the histogram of FIG. 8A can be converted into the histogram of FIG. If this palette number is regarded as a pixel value, the colors C0, C1, C2, and C3 are replaced with
更に、本実施形態では、CGの場合、画素値C0、C1、C2、C3の画素がランダムに配置される確率が低く、C0→C1→C2→C3(又はその逆)の画素値を持つ領域が連続する確率が高いことを確かめた。換言すれば、予測誤差を算出する際、着目画素の画素値がC0である場合、その予測値がC0となる確率が一番高く、次いで、C1、C2、C3の順番になる。また、着目画素がC1である場合、予測値がC1なる確率が一番高く、その次に{C0、C2}、次いで、C3の順番になる。 Furthermore, in the present embodiment, in the case of CG, there is a low probability that pixels of pixel values C0, C1, C2, and C3 are randomly arranged, and an area having pixel values of C0 → C1 → C2 → C3 (or the reverse) It is confirmed that there is a high probability that In other words, when calculating the prediction error, if the pixel value of the pixel of interest is C0, the probability that the predicted value is C0 is the highest, and then the order is C1, C2, and C3. When the pixel of interest is C1, the probability that the predicted value is C1 is the highest, followed by {C0, C2}, and then C3.
上記をまとめると、出現頻度順にパレット番号を割り当てると、予測誤差を小さくできる確率を更に高めることができることに他ならない。そこで、本実施形態では、図8(a)のようなヒストグラムが作成された場合、図8(b)ではなく、更にその頻度をキーにして色データを並べ替え、図8(c)のヒストグラムを作成する。そして、その並べ替え後の画素値にパレット番号を割り当てる。判定部203が、着目ブロック内に出現する頻度の大きい順に色を並べ替え、並べ替え後の各色データ(RGBの値)と、0、1、2、…、Nc−1のパレット番号を対にして、図5に示すようなパレット変換テーブルを作成したのは、上記理由によるものである。なお、図8(c)は頻度をキーにして降順に並べ替える例を示したが、昇順でも構わない。
To summarize the above, if the palette numbers are assigned in the order of appearance frequency, the probability that the prediction error can be reduced can be further increased. Therefore, in the present embodiment, when a histogram as shown in FIG. 8A is created, color data is rearranged using the frequency as a key instead of FIG. 8B, and the histogram shown in FIG. Create Then, a palette number is assigned to the rearranged pixel value. The
上記処理を行なうため、図3のステップS14の処理の詳細を示すと図11のようになる。 FIG. 11 shows details of the process in step S14 in FIG. 3 for performing the above process.
先ず、制御部150は、ステップS21において、ブロックのサイズを決定する。この処理では、ステップS11(図3)のPDLデータの解析処理によって、印刷データ中にブロックサイズの指定があった場合には、その指定されたサイズに従う。また、印刷データ中にそのブロックサイズの指定がなかった場合には、操作部151で設定されたサイズに従う。また、ステップS21では、ブロックサイズによって、色数判定のための閾値を決定する処理も行なう。
First, in step S21, the
この後、ステップS22にて、画像符号化処理部103のブロック化部200は、決定したサイズのブロックデータを、バッファメモリ101から読込み、バッファメモリ201に格納する。ステップS223にて、ヒストグラム作成部202は、バッファメモリ201に格納されたブロックをスキャンし、ヒストグラムを作成し、作成したヒストグラムに関する情報を判定部203に出力する。
Thereafter, in step S <b> 22, the blocking
ステップS24では、判定部203は、入力したヒストグラム情報に基づき、出現する色数を算出する。そして、判定部203は、ステップS25にて、算出した色数が、制御部150より設定された閾値以下であるか否かを判定する。算出した色数が、閾値よりも大きいと判断した場合には、判定部203は算出した色数が閾値よりも大きいことを示す制御信号を置換部204、及び、符号化部205に出力する。この結果、符号化部205は、ステップS26にて、パレット変換無しを示す識別情報を持つブロックヘッダを生成し、出力する。また、置換部204は、バッファ201内の階調画像データをそのまま符号化部205に出力することになる。従って、符号化部205は、ステップS30にて、入力した階調画像データをそのまま符号化し、生成された符号化データを出力する。
In step S24, the
一方、判定部203が、ステップS25にて、色数が閾値以下であると判定した場合、処理はステップS27に進む。このステップS27では、判定部203が、ヒストグラムの色を、頻度順に並べ替え、並べ替え後の色に対してパレット番号を符番し、パレット変換テーブルを作成する。そして、判定部203は算出した色数が閾値以下であることを示す信号、及び、生成されたパレット変換テーブルの情報を、置換部204、及び、符号化部205に出力する。
On the other hand, when the
符号化部205は、これらの情報を入力した場合、パレット変換を行なったことを
示す識別情報、及び、色数、各色の成分のデータを含むブロックヘッダを生成し、出力する(ステップS28)。
When these pieces of information are input, the
また、置換部204は、バッファ201内の階調画像データを、パレット番号に置換し、その置換後のデータを符号化部205に出力する(ステップS29)。従って、符号化部205は、ステップS30にて、入力したパレット化したデータを符号化し、生成された符号化データを出力することになる。
The
ステップS30の処理を終えると、ステップS31に進み、制御部150は、全ブロックの符号化が終了したのか否かを判定する。否の場合には、次のブロックの符号化を行なうため、ステップS22以降の処理を行なう。また、全ブロックの符号化処理が行なったと判定した場合、着目ページの符号化処理を終了する。
When the process of step S30 is completed, the process proceeds to step S31, and the
以上、本実施形態における符号化処理について説明したが、次に復号処理について説明する。属性フラグ復号部107については説明するまでもないので、以下では画像復号処理部108について説明する。
The encoding process according to this embodiment has been described above. Next, the decoding process will be described. Since the attribute
図9は画像復号処理部108のブロック構成図である。画像復号処理部は、ヘッダ解析部270、コンテクスト生成部271、予測誤差復号部272、ランレングス復号部273、セレクタ274、置換部275、及び、メモリ276を有する。
FIG. 9 is a block diagram of the image
メモリ276は、1ブロック中の少なくとも着目画素Xの近傍画素の復号結果を2ライン分格納する容量を有する。また、1ブロック分の復号開始時には、このメモリ276はゼロクリアされる。これは、ブロック外の画素値の各成分値を“0”とするためである。
The
ヘッダ解析部270は、符号化ブロックデータのブロックヘッダの識別情報を解析し、注目ブロックがパレット番号に置換後に符号化されているか否かの判定、及び、パレット番号に変換されている場合にはその色の数と、画素値とを抽出する処理を行なう。そして、パレット番号の符号化データであると判定した場合、パレット番号の符号化データであることを示す制御信号を置換部275に出力する。また、ブロックヘッダに格納されている画素値とパレット番号(色の数によって幾つの画素値が存在するのかは容易にわかる)とを対にして、置換部275に出力する。また、着目ブロックが階調画像として符号化されていると判定した場合には、階調画像の符号化であることを示す制御信号を置換部275に出力する。この後、ヘッダ解析部270は、ブロックヘッダに後続する符号化データをコンテクスト生成部271に出力する。
The
コンテクスト生成部271は、着目画素Xを復号する際、メモリ270を参照し、近傍画素Xa,Xb,Xc,Xdからコンテクスト値を算出する。そして、コンテクスト生成部271は、この算出結果に基づき、着目画素Xがランレング符号化されているのか、予測誤差符号化されているのかは判定する。実施形態では、4つの近傍画素で示される色数が2以上の場合には予測符号化、色数が1の場合にはランレングス符号化されていると判定する。着目画素が予測誤差符号化されていると判定した場合(近傍画素が2色以上の場合)、コンテクスト生成部271は符号化データを予測誤差復号部272に出力する。また、着目画素がランレングス符号化されていると判定した場合(近傍画素が1色の場合)、コンテクスト生成部271は符号化データをランレングス復号部273に出力する。また、コンテキスト生成部271は、符号化種別の判定結果を制御信号としてセレクタ275にも出力する。
When decoding the pixel of interest X, the
予測誤差復号部272は、符号化データから予測誤差に復号する。そして、予測誤差復号部272は、メモリ210を参照し、着目画素Xの予測値を算出し、その予測値に、復号した予測誤差を加算することで、着目画素Xの1つの成分値を復号し、セレクタ274に出力する。そして、この処理を残りの2成分についても同様に行なうことで、1画素分の復号が完了する。
The prediction
また、ランレングス復号部273は、ランを復号し、そのランをセレクタ275に出力する。
The run length decoding unit 273 decodes the run and outputs the run to the
セレクタ275は、着目画素が予測誤差符号化されていることを示す制御信号を入力した場合には、予測誤差復号部272からの復号結果を置換部275に出力すると共に、メモリ276に格納する。また、セレクタ275は、着目画素がランレングス符号化されていることを示す制御信号を入力した場合には、ランレングス復号部273から入力したランの直前の画素の値を、ランで示される個数分だけ、置換部275、及び、メモリ276に出力する。
The
置換部275は、ヘッダ解析部270から、注目ブロックが階調画像データのまま符号化されていることを示す制御信号を入力した場合には、セレクタ274からの画素値をそのままバッファメモリ109に出力する。
The
一方、ヘッダ解析部270から、注目ブロックがパレット番号に変換した後に符号化されていることを示す制御信号と、パレット番号と画素値とを入力したとする。この場合、置換部275は、セレクタ274からの画素値のR成分のみを着目し、そのR成分の値がパレット番号であるものとし、該当する画素値で置換し、出力する。
On the other hand, it is assumed that a control signal indicating that the block of interest is encoded after being converted into a palette number, a palette number, and a pixel value are input from the
以上説明したように本実施形態によれば、画像をブロック単位に符号化する際、そのブロック中に出現する色の数に応じて、画像データをパレット番号に変換して符号化するか否かを切り替えることで、高い圧縮率で可逆符号化することが可能になる。 As described above, according to the present embodiment, when an image is encoded in units of blocks, whether or not the image data is converted into a palette number and encoded according to the number of colors that appear in the block. By switching between, lossless encoding can be performed at a high compression rate.
<第2の実施形態>
上記実施形態では、パレット化するか否かの閾値をブロックサイズによって決定した。パレット化して符号化効率の上がる画像は、文字線画及びコンピュータグラフィクスである。そこで、ブロックサイズに加え、更に、ブロック内の各画素の属性フラグを参照して、パレット化するか否かを決定するようにしても良い。
<Second Embodiment>
In the above embodiment, the threshold value for determining whether or not to palletize is determined based on the block size. The images that are palletized to increase the encoding efficiency are character line drawings and computer graphics. Therefore, in addition to the block size, the attribute flag of each pixel in the block may be referred to determine whether to make a palette.
1つの属性フラグは1つの画素に対して生成されるものである。従って、ブロックのサイズがm×nの場合、属性フラグの個数もm×n個である。そこで、文字線画の属性フラグ+CGの属性フラグ(非自然画の属性を持つ画素数)の個数をMとしたとき、その比率Mrを次式によって算出する。
Mr=100×M/(n×m)
そして、Mrが予め設定された閾値Th1を以上の場合、着目ブロックをパレットするものとして決定する。
One attribute flag is generated for one pixel. Therefore, when the block size is m × n, the number of attribute flags is m × n. Therefore, when the number of character line drawing attribute flags + CG attribute flags (the number of pixels having non-natural image attributes) is M, the ratio Mr is calculated by the following equation.
Mr = 100 × M / (n × m)
If Mr is equal to or greater than the threshold value Th1 set in advance, the block of interest is determined to be palletized.
図12は、本第2の実施形態における画像符号化処理部103のブロック構成図である。図4と異なる点は、ブロック化部200は、制御部150からの制御信号によって決定されたサイズの画像データと、そのサイズ分の属性フラグデータをバッファメモリ101から入力し、バッファメモリ201に格納する点である。また、図4の構成に、比率算出部206を設けた点、及び、判定部203の処理内容が変更された点も異なる。
FIG. 12 is a block configuration diagram of the image
比率算出部206は、バッファメモリ201に格納された1ブロック分の属性フラグデータを参照し、文字線画、又は、コンピュータグラフィックスの属性を持つ画素数Mをカウントする。そして、制御部150からの制御信号で特定されたブロックサイズ(m×n)に対するMの比率Mrを算出し、その結果を判定部203に出力する。
The
判定部203は、ブロックサイズに従って閾値Th1を決定する。そして、算出した比率が閾値以上であるか否か、すなわち、Mr≧Th1を満たすか否かを判定し、その判定結果を置換部204、符号化部205に出力する。そして、特に、Mr≧Th1の場合、着目ブロックの各画素データをパレット変換するため、ヒストグラムを作成し、パレット変換テーブルを作成する。そして、作成したパレット変換テーブルを置換部204、符号化部205に出力する。また、算出した比率が閾値未満の場合には、パレット変換は行なわない。
The
この後の処理は、第1の実施形態と同様である。なお、符号化データのデータ構造については特に変更はない。また、復号処理は第1の実施形態と同じで良い。 The subsequent processing is the same as in the first embodiment. There is no particular change in the data structure of the encoded data. The decoding process may be the same as in the first embodiment.
以上説明したように本第2の実施形態によっても、第1の実施形態と同様の作用効果を奏することが可能になる。 As described above, according to the second embodiment, it is possible to achieve the same operational effects as those of the first embodiment.
<第3の実施形態>
第1、第2の実施形態では、置換部204がパレット変換を実行した際、そのパレット番号の情報を転送するバスを1色成分(実施形態ではR成分)を用い、他の成分(実施形態ではG、B成分)のバスには“0”をであるものとして符号化した。パレット変換した場合、G、B成分は0であるので、G、B成分の符号化データは効率の良いライレングス符号化されることになるが、それでも、G、Bの各成分はライン単位に符号化データが生成されることに変わりはない。そこで、パレット変換する場合、1つの成分しか利用しないわけであるから、そのパレット番号の符号化データのみを出力し、他の2つの成分の符号化データは出力しないようにしても構わない。このようにすると、更に圧縮率を高めることが可能になる。
<Third Embodiment>
In the first and second embodiments, when the
また、上記実施形態では、印刷装置に適用する例を示した。印刷装置であるため、符号化処理を行なう構成と、復号処理を行なう構成が1つの装置内に存在することになる。しかしながら、それぞれ単独の装置に適用しても構わない。例えば、パーソナルコンピュータ等の情報処理装置で画像を符号化し、他の情報処理に装置にそれを転送し、そこで復号する場合にも適用できよう。また、パーソナルコンピュータ等の情報処理装置の場合、当然、上記各処理部に相当する部分を、コンピュータプログラムの関数やサブルーチンで機能させ、各バッファはRAMに確保して利用することになる。従って本発明はコンピュータプログラムをもその範疇とする。更に、通常、コンピュータプログラムはCD−ROM等のコンピュータ可読記憶媒体に格納されており、それを装置の読取部(CD−ROMドライブ等)にセットし、システムにコピーもしくはインストールすることで実行可能になる。従って、本発明はかかるコンピュータ可読記憶媒体をもその範疇とすることも明らかである。 In the above-described embodiment, an example applied to a printing apparatus has been described. Since this is a printing apparatus, a configuration for performing an encoding process and a configuration for performing a decoding process exist in one apparatus. However, each may be applied to a single device. For example, the present invention can also be applied to a case where an image is encoded by an information processing apparatus such as a personal computer, transferred to another apparatus for information processing, and decoded there. Further, in the case of an information processing apparatus such as a personal computer, naturally, the portions corresponding to the above-described processing units are made to function by computer program functions and subroutines, and the respective buffers are secured and used in the RAM. Therefore, the present invention also includes computer programs. Further, the computer program is usually stored in a computer-readable storage medium such as a CD-ROM, and can be executed by setting it in a reading unit (CD-ROM drive or the like) of the apparatus and copying or installing it in the system. Become. Therefore, it is obvious that the present invention also includes such a computer-readable storage medium.
また、実施形態では、画像データの符号化処理に、JPEG−LSを用いる例を説明したが、予測誤差符号化のみを利用しても構わないので、必ずしもJPEG−LSを必須とはしない。 In the embodiment, an example in which JPEG-LS is used for image data encoding processing has been described. However, since only prediction error encoding may be used, JPEG-LS is not necessarily required.
Claims (13)
符号化単位のブロックのサイズを設定する設定手段と、
設定されたブロックのサイズに応じて閾値を決定する決定手段と、
設定されたサイズのブロックを単位に、画像データを入力する入力手段と、
入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成手段と、
作成されたヒストグラムから、着目ブロック内に出現する色数を算出し、前記決定手段で決定した閾値と前記色数とを比較し、前記色数が前記閾値以下であるかを判定する比較手段と、
前記比較手段で前記色数が前記閾値以下であると判定された場合、前記着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換手段と、
前記比較手段で前記色数が前記閾値以下と判定された場合、前記変換手段で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較手段で前記色数が閾値よりも大きいと判定された場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化手段と
を備えることを特徴とする画像符号化装置。 An image encoding device that encodes image data and generates encoded data,
Setting means for setting the block size of the encoding unit;
Determining means for determining a threshold according to the set block size;
Input means for inputting image data in units of blocks of a set size;
A histogram creation means for creating a histogram of the color of the input block of interest;
Comparing means for calculating the number of colors appearing in the block of interest from the created histogram, comparing the threshold value determined by the determining means with the number of colors, and determining whether the number of colors is equal to or less than the threshold value; ,
A conversion means for assigning a palette number to each color appearing in the block of interest and converting each pixel data in the block of interest into a palette number when the comparison means determines that the number of colors is equal to or less than the threshold;
When the comparison unit determines that the number of colors is equal to or less than the threshold value, the palette number converted by the conversion unit is losslessly encoded as pixel data, and the code obtained by encoding together with information indicating palette conversion. Output data,
If the comparison means determines that the number of colors is greater than the threshold value, each pixel data constituting the block of interest is losslessly encoded and the encoded data obtained by encoding is output together with information indicating non-palette conversion. An image encoding apparatus comprising: an encoding unit configured to
前記比較手段で前記色数が前記閾値以下であると判定された場合、前記パレット変換したことを示す情報と、前記着目ブロック内に出現する色数、及び、各パレット番号と画素データとの対応を示すテーブルとを、ブロックヘッダに格納し、前記符号化データを前記ブロックヘッダに後続して格納することを特徴とする請求項1に記載の画像符号化装置。 The encoding means includes
When the comparison means determines that the number of colors is equal to or less than the threshold, the information indicating that the palette conversion has been performed, the number of colors that appear in the block of interest, and the correspondence between each palette number and pixel data The image encoding apparatus according to claim 1, wherein a table indicating the image data is stored in a block header, and the encoded data is stored subsequent to the block header.
前記変換手段は、前記並べ替え手段による並べ替え後の順番に従って、各色にパレット番号を割り当てて、パレット変換を行なうことを特徴とする請求項1又は2に記載の画像符号化装置。 Furthermore, it comprises sorting means for sorting the histogram created by the histogram creating means in order of frequency,
3. The image encoding apparatus according to claim 1, wherein the conversion unit assigns a palette number to each color in accordance with an order after rearrangement by the rearrangement unit and performs palette conversion.
前記入力手段は、前記生成手段で生成された1ページ分の画像データから、前記ブロック単位の画像データを入力することを特徴とする請求項1乃至3のいずれか1項に記載の画像符号化装置。 Furthermore, it comprises generation means for interpreting print data described in a page description language and generating image data for one page,
4. The image encoding according to claim 1, wherein the input unit inputs the block-unit image data from one page of image data generated by the generation unit. 5. apparatus.
符号化単位のブロックのサイズを設定する設定工程と、
設定された前記ブロックのサイズに応じて閾値を決定する決定工程と、
設定されたサイズのブロックを単位に、画像データを入力する入力工程と、
入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成工程と、
作成されたヒストグラムから、着目ブロック内に出現する色数を算出し、前記決定工程で決定した閾値と前記色数とを比較し、前記色数が前記閾値以下であるかを判定する比較工程と、
前記比較工程で前記色数が前記閾値以下であると判定した場合、前記着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換工程と、
前記比較工程で前記色数が前記閾値以下と判定された場合、前記変換工程で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較工程で前記色数が閾値よりも大きいと判定された場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化工程と
を備えることを特徴とする画像符号化装置の制御方法。 A method of controlling an image encoding device that encodes image data and generates encoded data,
A setting step for setting the block size of the encoding unit;
A determination step of determining a threshold according to the set size of the block;
An input process for inputting image data in units of a set size block;
A histogram creation step for creating a histogram of the color of the input block of interest;
A comparison step of calculating the number of colors appearing in the target block from the created histogram, comparing the threshold value determined in the determination step with the number of colors, and determining whether the number of colors is equal to or less than the threshold value; ,
A conversion step of assigning a palette number to each color appearing in the block of interest and converting each pixel data in the block of interest into a palette number when it is determined in the comparison step that the number of colors is equal to or less than the threshold value;
If the number of colors is determined to be equal to or less than the threshold value in the comparison step, the palette number converted in the conversion step is losslessly encoded as pixel data, and the code obtained by encoding together with information indicating that the palette conversion has been performed Output data,
When it is determined in the comparison step that the number of colors is larger than the threshold value, each pixel data constituting the block of interest is losslessly encoded and the encoded data obtained by encoding is output together with information indicating non-palette conversion An image encoding device control method comprising: an encoding step for:
符号化単位のブロックのサイズを設定する設定手段と、
設定された前記ブロックのサイズに応じて閾値を決定する決定手段と、
設定されたサイズのブロックを単位に、画像データと、当該画像データを構成する各画素が自然画と非自然画のいずれに属するかを示す属性データとを入力する入力手段と、
前記ブロック内の画素数に対する、前記非自然画を示す属性を持つ画素数の比率を算出し、前記比率と前記閾値とを比較する比較手段と、
前記比較手段が前記比率が前記閾値以上であることを示す場合、入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成手段と、
作成されたヒストグラムから、着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換手段と、
前記比較手段が前記比率が前記閾値以上と判定した場合、前記変換手段で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較手段が前記比率が前記閾値未満と判定した場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化手段と
を備えることを特徴とする画像符号化装置。 An image encoding device that encodes image data and generates encoded data,
Setting means for setting the block size of the encoding unit;
Determining means for determining a threshold according to the set size of the block;
Input means for inputting image data and attribute data indicating whether each pixel constituting the image data belongs to a natural image or a non-natural image in units of blocks of a set size;
A comparison means for calculating a ratio of the number of pixels having an attribute indicating the non-natural image to the number of pixels in the block, and comparing the ratio with the threshold;
If the comparison means indicates that the ratio is greater than or equal to the threshold, a histogram creation means for creating a histogram of the color of the input block of interest;
Conversion means for assigning a palette number to each color appearing in the block of interest from the created histogram, and converting each pixel data in the block of interest into a palette number;
When the comparison means determines that the ratio is equal to or greater than the threshold value, the palette number converted by the conversion means is losslessly encoded as pixel data, and encoded data obtained by encoding together with information indicating that the palette conversion has been performed. Output
When the comparison means determines that the ratio is less than the threshold, each pixel data constituting the block of interest is losslessly encoded and outputs encoded data obtained by encoding together with information indicating non-palette conversion An image encoding apparatus comprising: means.
前記比較手段で前記比率が前記閾値以上であると判定した場合、前記パレット変換したことを示す情報と、前記着目ブロック内に出現する色数、及び、各パレット番号と画素データとの対応を示すテーブルとを、ブロックヘッダに格納し、前記符号化データを前記ブロックヘッダに後続して格納することを特徴とする請求項7に記載の画像符号化装置。 The encoding means includes
When the comparison means determines that the ratio is equal to or greater than the threshold, the information indicating that the palette conversion has been performed, the number of colors that appear in the block of interest, and the correspondence between each palette number and pixel data are indicated. 8. The image encoding apparatus according to claim 7, wherein a table is stored in a block header, and the encoded data is stored subsequent to the block header.
前記変換手段は、前記並べ替え手段による並べ替え後の順番にパレット番号を割り当てて、パレット変換を行なうことを特徴とする請求項7又は8に記載の画像符号化装置。 Furthermore, it has sorting means for sorting the histogram created by the histogram creating means in order of frequency,
The image encoding apparatus according to claim 7 or 8, wherein the converting unit performs palette conversion by assigning palette numbers in the order after rearrangement by the rearranging unit.
前記入力手段は、前記生成手段で生成された1ページ分の画像データと属性データから、前記ブロック単の画像データ及び属性データを入力することを特徴とする請求項7乃至9のいずれか1項に記載の画像符号化装置。 Furthermore, the printing data described in the page description language is interpreted, generating image data for one page, and generating means for generating attribute data of each pixel when generating,
The said input means inputs the said block single image data and attribute data from the image data and attribute data for one page produced | generated by the said production | generation means, The any one of Claim 7 thru | or 9 characterized by the above-mentioned. The image encoding device described in 1.
設定された前記ブロックのサイズに応じて閾値を決定する決定工程と、
設定されたサイズのブロックを単位に、画像データと、当該画像データを構成する各画素が自然画と非自然画のいずれに属するかを示す属性データとを入力する入力工程と、
前記ブロック内の画素数に対する、前記非自然画を示す属性を持つ画素数の比率を算出し、前記比率と前記閾値とを比較する比較工程と、
前記比較工程が前記比率が前記閾値以上であることを示す場合、入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成工程と、
作成されたヒストグラムから、着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換工程と、
前記比較工程が前記比率が前記閾値以上と判定した場合、前記変換工程で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較工程が前記比率が前記閾値未満と判定した場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化工程と
を備えることを特徴とする画像符号化装置の制御方法。 A control method for an image encoding apparatus that encodes image data and generates encoded data, and a setting step for setting a size of a block of an encoding unit;
A determination step of determining a threshold according to the set size of the block;
An input step for inputting image data and attribute data indicating whether each pixel constituting the image data belongs to a natural image or a non-natural image in units of blocks of a set size;
A comparison step of calculating a ratio of the number of pixels having an attribute indicating the non-natural image to the number of pixels in the block, and comparing the ratio with the threshold;
If the comparison step indicates that the ratio is equal to or greater than the threshold, a histogram creation step for creating a histogram of the color of the input block of interest;
A conversion step of assigning a palette number to each color appearing in the block of interest from the created histogram, and converting each pixel data in the block of interest into a palette number;
When the comparison step determines that the ratio is equal to or greater than the threshold value, the palette number converted in the conversion step is losslessly encoded as pixel data, and encoded data obtained by encoding together with information indicating palette conversion. Output
When the comparison step determines that the ratio is less than the threshold, each pixel data constituting the block of interest is losslessly encoded, and the encoded data obtained by encoding together with information indicating non-palette conversion is output. A control method for an image encoding device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007155723A JP2008311792A (en) | 2007-06-12 | 2007-06-12 | Device for encoding image and control method therefor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007155723A JP2008311792A (en) | 2007-06-12 | 2007-06-12 | Device for encoding image and control method therefor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2008311792A true JP2008311792A (en) | 2008-12-25 |
Family
ID=40239033
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007155723A Withdrawn JP2008311792A (en) | 2007-06-12 | 2007-06-12 | Device for encoding image and control method therefor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2008311792A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010101015A1 (en) * | 2009-03-05 | 2010-09-10 | Canon Kabushiki Kaisha | Image processing apparatus and method |
JP2010220127A (en) * | 2009-03-18 | 2010-09-30 | Ricoh Co Ltd | Image processing apparatus and method, and program |
JP2012134807A (en) * | 2010-12-22 | 2012-07-12 | Konica Minolta Business Technologies Inc | Image processing device, and image processing method |
US10116962B2 (en) | 2014-03-14 | 2018-10-30 | Fujitsu Limited | Image coding device, image decoding device, image coding method and image decoding method |
US10397582B2 (en) | 2015-11-24 | 2019-08-27 | Fujitsu Limited | Image encoding device and image encoding method |
US10609393B2 (en) | 2016-04-14 | 2020-03-31 | Canon Kabushiki Kaisha | Image encoding apparatus and method of controlling the same |
CN112235575A (en) * | 2015-04-08 | 2021-01-15 | 寰发股份有限公司 | Encoding method, encoding apparatus and computer-readable storage medium therefor |
-
2007
- 2007-06-12 JP JP2007155723A patent/JP2008311792A/en not_active Withdrawn
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2010101015A1 (en) * | 2009-03-05 | 2010-09-10 | Canon Kabushiki Kaisha | Image processing apparatus and method |
JP2010206721A (en) * | 2009-03-05 | 2010-09-16 | Canon Inc | Device and method for processing image |
US9025167B2 (en) | 2009-03-05 | 2015-05-05 | Canon Kabushiki Kaisha | Image processing apparatus and method |
JP2010220127A (en) * | 2009-03-18 | 2010-09-30 | Ricoh Co Ltd | Image processing apparatus and method, and program |
JP2012134807A (en) * | 2010-12-22 | 2012-07-12 | Konica Minolta Business Technologies Inc | Image processing device, and image processing method |
US10116962B2 (en) | 2014-03-14 | 2018-10-30 | Fujitsu Limited | Image coding device, image decoding device, image coding method and image decoding method |
CN112235575A (en) * | 2015-04-08 | 2021-01-15 | 寰发股份有限公司 | Encoding method, encoding apparatus and computer-readable storage medium therefor |
CN112235575B (en) * | 2015-04-08 | 2024-01-12 | 寰发股份有限公司 | Encoding method, encoding device and corresponding computer readable storage medium |
US10397582B2 (en) | 2015-11-24 | 2019-08-27 | Fujitsu Limited | Image encoding device and image encoding method |
US10609393B2 (en) | 2016-04-14 | 2020-03-31 | Canon Kabushiki Kaisha | Image encoding apparatus and method of controlling the same |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7826670B2 (en) | Data compression apparatus and data compression program storage medium | |
US7183950B2 (en) | Data compression apparatus, and data compression program storage medium | |
KR20120065394A (en) | Image processing apparatus and processing method therefor | |
JP2008311792A (en) | Device for encoding image and control method therefor | |
JP2008042688A (en) | Image processing apparatus and control method thereof, and computer program and computer readable storage medium | |
JP4781198B2 (en) | Image processing apparatus and method, computer program, and computer-readable storage medium | |
JP4633576B2 (en) | Data compression apparatus and data compression program | |
JPH11168632A (en) | Binary expression processing method for dither image, method for uncompressing dither image expressed in compression binary representation and compression and uncompression system for dither image | |
JP4173505B2 (en) | Data compression apparatus and data compression program | |
JP4173498B2 (en) | Data compression apparatus and data compression program | |
JP4377351B2 (en) | Data compression apparatus and data compression program | |
JP4131970B2 (en) | Data compression apparatus and data compression program | |
JP4131969B2 (en) | Data compression apparatus and data compression program | |
JP4741317B2 (en) | Data compression apparatus and data compression program | |
JP2005277932A (en) | Device and program for compressing data | |
JP4435586B2 (en) | Data compression apparatus and data compression program | |
JP4181147B2 (en) | Data compression apparatus and data compression program | |
JP4629512B2 (en) | Data compression apparatus and data compression program | |
JP4699307B2 (en) | Data compression apparatus and data compression program | |
CN110913223B (en) | Image decompression apparatus, control method thereof, and computer-readable storage medium | |
JP2005252531A (en) | Device and program for compressing data | |
JP4579793B2 (en) | Data compression apparatus and data compression program | |
JP2005260408A (en) | Data compression apparatus and data compression program | |
JP4377352B2 (en) | Data compression apparatus and data compression program | |
JP4633577B2 (en) | Data compression apparatus and data compression program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20100907 |