JP2008311792A - Device for encoding image and control method therefor - Google Patents

Device for encoding image and control method therefor Download PDF

Info

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
Application number
JP2007155723A
Other languages
Japanese (ja)
Inventor
Naoki Ito
直樹 伊藤
Hirokazu Tamura
宏和 田村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2007155723A priority Critical patent/JP2008311792A/en
Publication of JP2008311792A publication Critical patent/JP2008311792A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To further improve encoding efficiency, by determining the threshold as to whether a palletization is conducted, according to block sizes of encoding units. <P>SOLUTION: A blocking section 200 inputs an image data while using the set block size as a unit and stores the image data in a buffer memory 201. A histogram preparation section 202 prepares a histogram for the colors of the image data in one block section. A decision section 203 determines the threshold from the set block size, compares a color number appearing in the prepared histogram and the threshold and outputs the result of the comparison to a displacement section 204. The decision section 203 prepares a conversion table that allocates pallet numbers, regarding each color appearing in the block, when the a color number is lower than the threshold, and sets it to the displacement section 204. The displacement section 204 reads the image data corresponding to a single block section from the buffer memory and outputs the image data to an encoding section 205. However, when the conversion table is set from the decision section 203, a pallet conversion is conducted, and the result is output to an encoding section 205 as a pixel data. <P>COPYRIGHT: (C)2009,JPO&INPIT

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)。
特開2005−348390公報
Furthermore, as a method for reducing the prediction error, a method has been proposed in which appearance pixel values are collected for an image with sparse appearance pixel values to suppress the prediction error (for example, Patent Document 1).
JP 2005-348390 A

この特許文献1では、出現画素をまとめるための適用レベル数を可変にする事が可能になっているが、この適用レベル数によっては、符号化効率が悪くなることもあり、未だ改善の余地がある。   In Patent Document 1, it is possible to vary the number of application levels for grouping appearance pixels. However, depending on the number of application levels, the encoding efficiency may deteriorate, and there is still room for improvement. is there.

本発明はかかる問題点に鑑みなされたものであり、ブロックサイズに応じて、パレット化を行なうか否かの閾値を決定することで、符号化効率を更に向上させる技術を提供しようとするものである。   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 printing apparatus 10 includes a printer control unit 11 that receives and renders print data, a large-capacity storage device 105 such as a hard disk, and a printer engine unit 110 that prints a visible image on recording paper. The printer control unit 11 includes various processing circuits, including a CPU, a program executed by the CPU, and a memory used as a work area. Further, the host computer 50 and the printing apparatus 10 are connected via a network, but other interfaces (for example, USB) may be used and the type thereof is not limited. In this embodiment, the printer engine unit 110 is described as adopting an electrophotographic system, but may be ink jet, thermal recording, or the like, and the type thereof is not limited. The host computer 50 is a personal computer, for example. For example, a document editing application program is executed on the host computer 50. Assume that the user gives a print instruction using the keyboard or mouse of the host computer 50. At this time, a printer driver installed in the OS (operating system) of the host computer 50 inputs data to be printed from the application, and generates print data described in a page description language (PDL) that can be interpreted by the printing apparatus 10. . Then, the print data is transmitted to the printing apparatus 10 via the OS. The printer control unit 11 of the printing apparatus 10 interprets the print data received from the host computer 50, renders the data in units of pages, stores it in the storage device 105, and sends the rendering result stored in the storage device 105 to the printer engine unit 110. Output. The printing apparatus 10 can also receive print data from other host computers.

図1は、主として、実施形態における印刷装置10のプリンタ制御部11のブロック構成図である。   FIG. 1 is a block diagram of the printer control unit 11 of the printing apparatus 10 according to the embodiment.

図示において、100はホストコンピュータ50から受信した印刷データ(PDLデータ)を解釈し、ビットマップイメージを生成するレンダリング部である。このレンダリング部100内には、1ページ分の描画メモリと、各画素毎の属性を格納する属性フラグメモリが内蔵されている。そして、PDLデータで指定された文字コードについては、指定されたフォント種類に従って、不図示のフォントメモリからデータを読出し、文字パターンを生成し、描画メモリへ展開する。また、PDLデータで指定された線画や各種図形の描画処理も行なう。更に、PDLデータに自然画等の画像データが含まれる場合には、その画像データの展開処理も行なう。また、レンダリング部100は、描画メモリへのレンダリング処理を行なう際、該当する画素位置毎にその属性フラグ(文字線画、自然画、CGを識別する情報、有彩色/無彩色を示す情報、網点であるか否かを示す情報の属性)を属性フラグメモリに格納する。この属性フラグメモリは、描画メモリ中の1画素に対して、1バイト(8ビット)単位に属性フラグを記憶管理する。そして、8ビット中の何ビットかを用いて、上記の各属性を表わす。   In the figure, reference numeral 100 denotes a rendering unit that interprets print data (PDL data) received from the host computer 50 and generates a bitmap image. The rendering unit 100 includes a drawing memory for one page and an attribute flag memory for storing attributes for each pixel. For the character code specified by the PDL data, data is read from a font memory (not shown) according to the specified font type, a character pattern is generated, and developed into a drawing memory. Also, drawing processing of line drawings and various figures designated by PDL data is performed. Further, when image data such as a natural image is included in the PDL data, the image data is expanded. In addition, when the rendering unit 100 performs rendering processing on the drawing memory, the attribute flag (character / line image, natural image, information identifying CG, information indicating chromatic / achromatic color, halftone dot) for each corresponding pixel position. (Attribute of information indicating whether or not) is stored in the attribute flag memory. This attribute flag memory stores and manages an attribute flag in units of 1 byte (8 bits) for one pixel in the drawing memory. Each of the above-described attributes is represented by using some of the 8 bits.

101は圧縮処理用のバッファメモリ、102は属性フラグ符号化部、103はカラー画像符号化部、104は書き込み用のバッファメモリ、105はハードディスク装置等の大容量の記憶装置である。106は復号処理用のバッファ、107は属性フラグ復号部、108はカラー画像復号部、109は復号された属性フラグ、画像データを展開するためのバッファメモリである。また110は画像処理部であり、復号された画像データを属性データを参照した色変換(記録色成分CMYKへの変換)、階調補正を行ない、得られたデータをプリンタエンジン110に出力する。   Reference numeral 101 denotes a buffer memory for compression processing, 102 denotes an attribute flag encoding unit, 103 denotes a color image encoding unit, 104 denotes a buffer memory for writing, and 105 denotes a large-capacity storage device such as a hard disk device. 106 is a buffer for decoding processing, 107 is an attribute flag decoding unit, 108 is a color image decoding unit, 109 is a decoded attribute flag, and a buffer memory for developing image data. An image processing unit 110 performs color conversion (conversion to the recording color component CMYK) and gradation correction for the decoded image data with reference to attribute data, and outputs the obtained data to the printer engine 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 rendering unit 100 interprets the print data, draws (renders) image data in units of pages, and stores the attribute flag at the pixel position corresponding to the attribute flag memory at that time. In rendering, each pixel is an RGB color space, and one component is 8 bits. This color space and the number of bits are merely examples, and other color spaces may be used.

1ページ分の画像データ及び属性フラグの格納が完了すると、レンダリング部100は、バッファメモリ101にそのデータを出力する共に、次ページのレンダリング処理を開始する。   When the storage of the image data for one page and the attribute flag is completed, the rendering unit 100 outputs the data to the buffer memory 101 and starts the rendering process for the next page.

画像符号化処理部103はバッファメモリに格納された画像データを、属性フラグ符号化部102はバッファメモリに格納された属性フラグをそれぞれ符号化する。生成された符号化画像データ及び符号化属性フラグは、バッファメモリ104を介して、記憶装置105にそれぞれファイルとして格納される。   The image encoding processing unit 103 encodes the image data stored in the buffer memory, and the attribute flag encoding unit 102 encodes the attribute flag stored in the buffer memory. The generated encoded image data and encoding attribute flag are stored as files in the storage device 105 via the buffer memory 104, respectively.

一方、属性フラグ復号部107、及び、画像復号処理部108は、プリンタエンジン部111の印刷出力処理に同期して、記憶装置105に格納された符号化画像データファイル、符号化属性フラグファイルをバッファメモリ106に読込む。そして、それぞれが、復号処理を行ない、復号結果をバッファメモリ109に格納する。画像処理部110は、復号された属性フラグを参照し、復号された画像データ(RGBデータ)から、属性に応じたYMCK色空間への変換、補正処理を行ない、プリンタエンジン部111の印刷処理に同期して出力する処理を行なう。   On the other hand, the attribute flag decoding unit 107 and the image decoding processing unit 108 buffer the encoded image data file and the encoded attribute flag file stored in the storage device 105 in synchronization with the print output process of the printer engine unit 111. Read into the memory 106. Then, each performs decoding processing and stores the decoding result in the buffer memory 109. The image processing unit 110 refers to the decoded attribute flag, converts the decoded image data (RGB data) into a YMCK color space according to the attribute, performs correction processing, and performs printing processing of the printer engine unit 111. A process of outputting in synchronization is performed.

上記の結果、画像及び属性フラグの符号化処理と、その復号処理は、記憶装置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 storage device 105. Therefore, the rendering unit 100, the image encoding unit 103, and the attribute flag encoding unit 102 can encode the image and attribute flag of each page regardless of the printing speed of the printer engine unit 111. As a result, the host computer 50 is quickly released from the print data output process to the printing apparatus 10 of the present embodiment. In addition, the printing apparatus can cope with reception of print data from another computer (not shown).

次に、上記構成を備えた本実施形態の印刷装置10における制御部150の符号化処理を、図3のフローチャートを参照して以下に説明する。   Next, the encoding process of the control unit 150 in the printing apparatus 10 of the present embodiment having the above-described configuration will be described below with reference to the flowchart of FIG.

ホストコンピュータ50より印刷ジョブ(PDLデータ)を受信すると、まず、ステップS11にて、レンダリング部100は、PDL解析を行なう。そして、ステップS12にて、レンダリング部100は、PDLに基づいてレンダリングすることによりビットマップイメージを生成する。また、レンダリング部100は、ステップS13にて、PDL解析時に各画素毎の属性情報を得て属性フラグを生成し、属性メモリに格納する。なお、レンダリング処理と、属性フラグの生成及び格納は、並列的に行われる。   When a print job (PDL data) is received from the host computer 50, the rendering unit 100 first performs PDL analysis in step S11. In step S12, the rendering unit 100 generates a bitmap image by rendering based on the PDL. In step S13, the rendering unit 100 obtains attribute information for each pixel during PDL analysis, generates an attribute flag, and stores the attribute flag in the attribute memory. Note that rendering processing and generation and storage of attribute flags are performed in parallel.

このように、レンダリング部100は、ホストコンピュータ50から受信したPDLで記述された印刷データを解析し、その中に含まれるPDLコマンドを解釈してプリントのための画像(ビットマップイメージ)を生成する。このとき、PDLコマンドにおけるコマンドの種別を示す情報を参照して、各画素の属性を判定し、それを属性フラグとして属性フラグメモリに格納する。   As described above, the rendering unit 100 analyzes the print data described in PDL received from the host computer 50, interprets the PDL command included therein, and generates an image (bitmap image) for printing. . At this time, referring to information indicating the type of command in the PDL command, the attribute of each pixel is determined and stored in the attribute flag memory as an attribute flag.

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 encoding processing unit 103 according to lossless compression encoding (in this embodiment, JPEG-LS is adopted) (step S14). . On the other hand, the attribute flag data is reversibly compressed by the encoder 102 (step S15). As the encoding of the attribute flag data, run-length encoding is used, but other encoding techniques (for example, predictive encoding, packbits encoding, etc.) may be used. The encoded data generated by each is stored in the storage device 105 via the buffer 104 (step S16).

上記処理における、属性フラグ符号化部102については、1ページ分の属性フラグをラスタースキャンし、ランレングする符号化するだけであるので、その説明については省略する。以下では、実施形態における画像符号化処理部103について更に詳細に説明する。   In the above process, the attribute flag encoding unit 102 only performs raster scanning and run-length encoding of the attribute flag for one page, and a description thereof will be omitted. Hereinafter, the image encoding processing unit 103 in the embodiment will be described in more detail.

図4は、実施形態における画像符号化処理部103の詳細ブロック構成図を示している。   FIG. 4 is a detailed block diagram of the image encoding processing unit 103 in the embodiment.

画像符号化装置部103は、図示の如く、ブロック化部200、バッファメモリ201、ヒストグラム作成部202、判定部203、置換部204、及び、符号化部205とを備える。以下、同図に従って、実施形態の画像符号化処理部103の処理内容を説明する。   The image encoding device unit 103 includes a blocking unit 200, a buffer memory 201, a histogram creation unit 202, a determination unit 203, a replacement unit 204, and an encoding unit 205, as illustrated. The processing contents of the image encoding processing unit 103 according to the embodiment will be described below with reference to FIG.

制御部150は、操作部151からの指示、もしくは印刷データ中に格納された制御情報に従い、画像データの符号化単位であるブロックサイズ(m×n画素のm、n)を特定する制御信号を生成する。そして、制御部150は生成した制御信号を、1ページの符号化処理に先立って、画像符号化処理部103に出力する。なお、操作部151から指示されたブロックサイズと、印刷データに含まれる制御情報で特定されるブロックサイズが異なる場合もありえる。制御部150は、印刷データ中に、ブロックサイズを指定するコマンドが含まれていれば、それに従って符号化単位のブロックサイズを決定する。また、印刷データ中にブロックサイズを指定するコマンドが存在しなかった場合には、操作部151から指示されたサイズを符号化単位のブロックサイズとして決定する。   In accordance with an instruction from the operation unit 151 or control information stored in the print data, the control unit 150 generates a control signal for specifying a block size (m × n pixels m and n) that is an encoding unit of image data. Generate. Then, the control unit 150 outputs the generated control signal to the image encoding processing unit 103 prior to the encoding process for one page. Note that the block size specified by the operation unit 151 may differ from the block size specified by the control information included in the print data. If the print data includes a command for specifying the block size, the control unit 150 determines the block size of the encoding unit according to the command. If there is no command for specifying the block size in the print data, the size instructed from the operation unit 151 is determined as the block size of the encoding unit.

ブロック化部200は、バッファメモリ101(図1参照)から、制御部150からの上記制御信号に従ったサイズのブロック(m×n画素分)の画像データ(以下、ブロックデータという)を読込み、バッファ201に格納する。なお、ブロック化部200が読込むブロックの順序は、ブロックを単位とするラスタースキャン順とする。   The blocking unit 200 reads image data (hereinafter referred to as block data) of a block (m × n pixels) having a size according to the control signal from the control unit 150 from the buffer memory 101 (see FIG. 1). Store in the buffer 201. The order of the blocks read by the blocking unit 200 is the raster scan order in units of blocks.

ヒストグラム作成部202は、バッファメモリ201に格納されたブロックデータのヒストグラム情報(色毎の出現頻度)を作成し、その作成されたヒストグラムの情報を判定部203に出力する。   The histogram creation unit 202 creates histogram information (appearance frequency for each color) of block data stored in the buffer memory 201, and outputs the created histogram information to the determination unit 203.

判定部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 determination unit 203 has a built-in lookup table as a threshold storage unit, and reads the threshold Th from the lookup table based on the block size indicated by the control information from the control unit 150. Further, the determination unit 203 calculates the number Nc of colors that appear in the block of interest based on the histogram information from the histogram creation unit 202. Then, the determination unit 203 compares the calculated color number Nc with the threshold Th, determines whether the color number Nc is equal to or less than the threshold Th, and performs the following processing according to the determination result.
-When the number of colors Nc is less than or equal to the threshold value;
The determination unit 203 outputs, to the replacement unit 204 and the encoding unit 205, a signal for validating the replacement process (also a signal indicating that the number of colors ≦ threshold Th). Then, the determination unit 203 rearranges the colors in descending order of frequency of appearance in the block of interest. Then, the determination unit 203 makes a pair of the rearranged color data (RGB values) and the palette numbers 0, 1, 2,..., Nc−1 as shown in FIG. A palette conversion table) is created and output to the replacement unit 204 and the encoding unit 205.
When the number of colors Nc is greater than the threshold;
The determination unit 203 outputs to the replacement unit 204 a signal that invalidates the replacement process (also a signal indicating the number of colors> threshold Th).

置換部204は、制御部150からの制御信号で示されるブロックサイズ毎にバッファメモリ201からブロックデータを読込み、置換処理を行ない、符号化部205に出力する。より具体的には、次の通りである。   The replacement unit 204 reads block data from the buffer memory 201 for each block size indicated by the control signal from the control unit 150, performs replacement processing, and outputs the block data to the encoding unit 205. More specifically, it is as follows.

判定部203からの信号が、置換処理無効を示す場合、置換部203は、バッファメモリ201に格納された着目ブロック内をラスタースキャンして各画素データを読込み、その読込んだ画素データをそのまま符号化部205に出力する。   When the signal from the determination unit 203 indicates that the replacement process is invalid, the replacement unit 203 performs raster scan within the block of interest stored in the buffer memory 201, reads each pixel data, and codes the read pixel data as it is. To the conversion unit 205.

一方、判定部203からの信号が置換処理を有効を示す場合、置換部204は判定部203からのパレット変換テーブルを内部の書き込み可能なメモリにルックアップテーブルとして格納する。そして、置換部204は、バッファ201に格納された着目ブロックのラスタースキャンして各画素データを読込み、読込んだ画素データをルックアップテーブルを用いてパレット番号に変換する。また、置換部204は、その変換後のデータ(パレット番号)を、RGBのうちの1つの成分(実施形態ではR成分とする)のデータとして符号化部205に出力する。また、置換部204は、他の成分(G、B成分)用のバスにはダミーとして“0”を出力する。   On the other hand, when the signal from the determination unit 203 indicates that the replacement process is valid, the replacement unit 204 stores the palette conversion table from the determination unit 203 as a lookup table in an internal writable memory. Then, the replacement unit 204 reads each pixel data by performing a raster scan of the block of interest stored in the buffer 201, and converts the read pixel data into a palette number using a lookup table. Also, the replacement unit 204 outputs the converted data (pallet number) to the encoding unit 205 as data of one component of RGB (in the embodiment, R component). Further, the replacement unit 204 outputs “0” as a dummy to the bus for other components (G, B components).

次に符号化部205について説明する。   Next, the encoding unit 205 will be described.

符号化部205は、1つの画像の符号化に先立ち、ファイルヘッダを生成し、出力する。このファイルヘッダには、符号化対象の画像データのサイズ(水平、垂直方向の方向画素数)、色空間の種別、各成分のビット数、ブロックのサイズを特定する情報等、復号処理に必要な情報が格納される。符号化部205は、ブロック単位に符号化する際には次の処理を行なう。   The encoding unit 205 generates and outputs a file header prior to encoding one image. In this file header, the size of the image data to be encoded (number of pixels in the horizontal and vertical directions), the type of color space, the number of bits of each component, information specifying the block size, etc. are necessary for the decoding process. Information is stored. The encoding unit 205 performs the following processing when encoding in block units.

符号化部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 determination unit 203, the encoding unit 205 outputs a block header storing identification information (for example, “0”) indicating no replacement (non-pallet conversion). When a control signal indicating that the replacement process is valid is received from the determination unit 203, a block header storing the identification information (for example, “1”) indicating the presence of the replacement color (pallet conversion) and the palette conversion table is generated and output. To do. The palette conversion table stored in the block header may be the number of colors Nc and each color component value. The reason is that it is promised that the palette number for each color is 0, 1,..., Nc-1. FIG. 10 shows the structure of the encoded data file generated by the encoding unit 205 in the embodiment. The encoded data of one block is of any of the reference numbers 301 and 302 shown in the figure.

この後、符号化部205は、置換部204から出力されるラスタースキャン順の各画素データ(カラー画像データ)をJPEG−LS符号化方法に従って可逆符号化し、符号化データを生成する。そして、符号化部205は、生成した符号化データを、先に示したブロックヘッダに後続するデータとして出力する。   Thereafter, the encoding unit 205 performs lossless encoding on each pixel data (color image data) in the raster scan order output from the replacement unit 204 according to the JPEG-LS encoding method, and generates encoded data. Then, the encoding unit 205 outputs the generated encoded data as data subsequent to the block header shown above.

図6は実施形態における符号化部205の詳細ブロック構成図である。符号化部205は、図示のように、コンテクスト生成部251、予測補佐生成部252、予測誤差符号化部253、ランレングス変換部254、ランレングス符号化部255、及び、セレクタ256を有する。   FIG. 6 is a detailed block diagram of the encoding unit 205 in the embodiment. As illustrated, the encoding unit 205 includes a context generation unit 251, a prediction assistant generation unit 252, a prediction error encoding unit 253, a run length conversion unit 254, a run length encoding unit 255, and a selector 256.

先に説明したように、符号化部205はJPEG−LS符号化方法に従って、入力した画像データを可逆符号化する。JPEG−LSは、ブロック内をラスタースキャン中、図7に示すように、着目画素Xの近傍の既に符号化済み近傍画素Xa,Xb,Xc,Xdの色からコンテクスト値を算出する。そして、その算出したコンテクスト値に従い、予測符号化するか、ランレングス符号化するのかを決定する。なお、着目ブロックがブロックの先頭ライン上にあるとき、又は、着目画素位置がラインの左端、右端位置である場合、近傍画素Xa,Xb,Xc,Xdの全部、もしくは一部はブロック外の位置になってしまう。このようなブロック外の画素の各成分値は“0”であるものとして符号化処理を行なうものとする。なお、ここではブロック外の画素の成分値を“0”としているが、復号処理と同じにすればよいわけであるから、必ずしも“0”でなくても構わない。   As described above, the encoding unit 205 performs lossless encoding on the input image data according to the JPEG-LS encoding method. The JPEG-LS calculates the context value from the colors of the already encoded neighboring pixels Xa, Xb, Xc, and Xd in the vicinity of the target pixel X as shown in FIG. Then, according to the calculated context value, whether to perform predictive encoding or run-length encoding is determined. When the target block is on the first line of the block, or when the target pixel position is the left end or right end position of the line, all or part of the neighboring pixels Xa, Xb, Xc, Xd are positions outside the block. Become. Assume that the encoding process is performed assuming that the component values of the pixels outside the block are “0”. Here, the component value of the pixel outside the block is set to “0”. However, it may be the same as the decoding process, and thus may not necessarily be “0”.

さて、図6に示すように、コンテクスト生成部251は、着目画素Xの近傍画素の画素データを参照するため、内部に2ライン分のメモリを有する。そして、コンテキスト生成部251は、着目画素Xの近傍画素Xa,Xb,Xc,Xdを内部メモリから読込み、着目画素Xにおけるコンテクス値を算出する。そして、そのコンテクスト値に基づき、コンテクスト生成部251は、着目画素Xをランレングする符号化すべきか、予測誤差符号化すべきかを判定し、入力した着目画素Xを予測誤差算出部252、ランレングス変換部254のいずれかに出力する。   Now, as shown in FIG. 6, the context generation unit 251 internally includes two lines of memory in order to refer to pixel data of pixels near the pixel of interest X. Then, the context generation unit 251 reads neighboring pixels Xa, Xb, Xc, and Xd of the target pixel X from the internal memory, and calculates a context value at the target pixel X. Then, based on the context value, the context generation unit 251 determines whether the target pixel X should be encoded to be run-length or prediction error encoded, and the input target pixel X is converted into the prediction error calculation unit 252 and the run-length conversion. The data is output to one of the units 254.

実施形態では、簡単なものとするため、近傍画素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 context generation unit 251 predictively encodes the target pixel X. The pixel component value is output to the prediction error calculation unit 252.

また、近傍画素{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 context generation unit 251 outputs each pixel component value of the target pixel X to the run length conversion unit 254 in order to start run-length encoding from the target pixel X.

なお、一旦、着目画素Xをランレングス変換部254に出力した場合、着目画素Xに後続して同じ画素が入力さてる限り、コンテクスト値の算出は行なわず、入力される画素データをランレングス変換部254に出力する。   Once the target pixel X is output to the run length conversion unit 254, as long as the same pixel is input after the target pixel X, the context value is not calculated, and the input pixel data is run length converted. Output to the unit 254.

また、ランレングス符号化処理中、着目画素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 context generation unit 251 determines that the run has terminated. judge. Then, a signal indicating the end of the run is notified to the run length conversion unit 254, and the context value of the pixel of interest X is also calculated.

予測誤差算出部252は、着目画素Xの近傍画素{Xa,Xb,Xc}から、着目画素の各成分の予測値を算出し、その各成分の予測値と、着目画素の各成分値との差を算出し、予測誤差符号化部253に出力する。実施形態では、簡単のため、近傍Xaの各成分値が着目画素の各成分値の予測値として用いるものとする。予測誤差符号化部253は、着目画素の各成分の予測誤差に対してハフマン符号化、もしくは、算術符号化等の手法を利用して符号語を生成し、セレクタ205に出力する。   The prediction error calculation unit 252 calculates the predicted value of each component of the target pixel from the neighboring pixels {Xa, Xb, Xc} of the target pixel X, and calculates the predicted value of each component and each component value of the target pixel. The difference is calculated and output to the prediction error encoding unit 253. In the embodiment, for simplicity, each component value in the neighborhood Xa is used as a predicted value of each component value of the pixel of interest. The prediction error encoding unit 253 generates a code word using a technique such as Huffman encoding or arithmetic encoding for the prediction error of each component of the pixel of interest, and outputs the code word to the selector 205.

また、ランレングス変換部254は、コンテクスト生成部251から、近傍画素{Xa,Xb,Xc,Xd}で表わされる色数が“1”であることを示す信号を入力すると、ランの計数を開始する。そして、ランレングス変換部254は、ランをカウント中に、コンテクスト生成部251から、着目画素Xがその直前の画素Xaと非同一色となった、着目画素Xはブロック右端に到達したことを示す信号を受信した場合、ランの計数を終了する。そして、それまでカウントした値をランレングス符号化部255に出力する。ランレングス符号化部255は、ランレングス変換部254から入力したカウントした値に対応する符号語を生成し、セレクタ256に出力する。   When the run length conversion unit 254 receives a signal indicating that the number of colors represented by the neighboring pixels {Xa, Xb, Xc, Xd} is “1” from the context generation unit 251, the run length conversion unit 254 starts counting the run. To do. Then, the run length conversion unit 254 indicates that the target pixel X has reached the right end of the block from the context generation unit 251 while the run is being counted. If a signal is received, the run counting is terminated. Then, the value counted so far is output to the run-length encoding unit 255. The run length encoding unit 255 generates a code word corresponding to the counted value input from the run length conversion unit 254 and outputs the code word to the selector 256.

セレクタ256は、コンテクスト生成部251によって、着目画素についてランレングス符号化を中か、予測誤差符号化中かを示す信号を受信する。従って、セレクタ256は、その受信する信号に従い、予測誤差符号化部253、ランレングス符号化部255のいずれか一方からの符号化データを選択し、出力する。なお、予測誤差符号化部253は、1画素単位に符号化データを出力するのに対し、ランレングス符号化部255は1つのランがラン終端になって初めて符号化データを出力することになる。それ故、セレクタ256は各タイミングに応じて入力、出力の制御を行なうことになる。   The selector 256 receives a signal indicating whether the run length encoding or the prediction error encoding is being performed on the target pixel by the context generation unit 251. Therefore, the selector 256 selects and outputs the encoded data from either the prediction error encoding unit 253 or the run length encoding unit 255 according to the received signal. Note that the prediction error encoding unit 253 outputs encoded data in units of one pixel, whereas the run length encoding unit 255 outputs encoded data only when one run ends in a run. . Therefore, the selector 256 controls input and output according to each timing.

以上実施形態における符号化に係る構成とその処理を説明した。ここで、ブロック内に出現する色の数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 palette numbers 0, 1, 2, and 3, respectively. Therefore, if this palette number is used, the absolute value of the prediction error is promised to be “3” at the maximum, and high coding efficiency can be expected.

更に、本実施形態では、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 determination unit 203 rearranges colors in descending order of appearance in the block of interest, and pairs the rearranged color data (RGB values) with palette numbers 0, 1, 2,..., Nc−1. The reason why the palette conversion table as shown in FIG. 5 is created is as described above. Note that FIG. 8C shows an example of rearranging in descending order using the frequency as a key, but it may be in ascending order.

上記処理を行なうため、図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 control unit 150 determines the block size. In this process, if the block size is specified in the print data by the PDL data analysis process in step S11 (FIG. 3), the specified size is followed. If the block size is not specified in the print data, the size set by the operation unit 151 is followed. In step S21, a process for determining a threshold value for determining the number of colors is also performed according to the block size.

この後、ステップS22にて、画像符号化処理部103のブロック化部200は、決定したサイズのブロックデータを、バッファメモリ101から読込み、バッファメモリ201に格納する。ステップS223にて、ヒストグラム作成部202は、バッファメモリ201に格納されたブロックをスキャンし、ヒストグラムを作成し、作成したヒストグラムに関する情報を判定部203に出力する。   Thereafter, in step S <b> 22, the blocking unit 200 of the image encoding processing unit 103 reads block data of the determined size from the buffer memory 101 and stores it in the buffer memory 201. In step S223, the histogram creation unit 202 scans the blocks stored in the buffer memory 201, creates a histogram, and outputs information about the created histogram to the determination unit 203.

ステップS24では、判定部203は、入力したヒストグラム情報に基づき、出現する色数を算出する。そして、判定部203は、ステップS25にて、算出した色数が、制御部150より設定された閾値以下であるか否かを判定する。算出した色数が、閾値よりも大きいと判断した場合には、判定部203は算出した色数が閾値よりも大きいことを示す制御信号を置換部204、及び、符号化部205に出力する。この結果、符号化部205は、ステップS26にて、パレット変換無しを示す識別情報を持つブロックヘッダを生成し、出力する。また、置換部204は、バッファ201内の階調画像データをそのまま符号化部205に出力することになる。従って、符号化部205は、ステップS30にて、入力した階調画像データをそのまま符号化し、生成された符号化データを出力する。   In step S24, the determination unit 203 calculates the number of appearing colors based on the input histogram information. In step S25, the determination unit 203 determines whether the calculated number of colors is equal to or less than the threshold set by the control unit 150. When determining that the calculated number of colors is greater than the threshold, the determination unit 203 outputs a control signal indicating that the calculated number of colors is greater than the threshold to the replacement unit 204 and the encoding unit 205. As a result, the encoding unit 205 generates and outputs a block header having identification information indicating no palette conversion in step S26. Further, the replacement unit 204 outputs the gradation image data in the buffer 201 to the encoding unit 205 as it is. Accordingly, in step S30, the encoding unit 205 encodes the input gradation image data as it is, and outputs the generated encoded data.

一方、判定部203が、ステップS25にて、色数が閾値以下であると判定した場合、処理はステップS27に進む。このステップS27では、判定部203が、ヒストグラムの色を、頻度順に並べ替え、並べ替え後の色に対してパレット番号を符番し、パレット変換テーブルを作成する。そして、判定部203は算出した色数が閾値以下であることを示す信号、及び、生成されたパレット変換テーブルの情報を、置換部204、及び、符号化部205に出力する。   On the other hand, when the determination unit 203 determines in step S25 that the number of colors is equal to or less than the threshold value, the process proceeds to step S27. In step S27, the determination unit 203 rearranges the colors of the histogram in order of frequency, and assigns palette numbers to the rearranged colors to create a palette conversion table. Then, the determination unit 203 outputs a signal indicating that the calculated number of colors is equal to or less than the threshold and information on the generated palette conversion table to the replacement unit 204 and the encoding unit 205.

符号化部205は、これらの情報を入力した場合、パレット変換を行なったことを
示す識別情報、及び、色数、各色の成分のデータを含むブロックヘッダを生成し、出力する(ステップS28)。
When these pieces of information are input, the encoding unit 205 generates and outputs block information including identification information indicating that palette conversion has been performed, the number of colors, and data of each color component (step S28).

また、置換部204は、バッファ201内の階調画像データを、パレット番号に置換し、その置換後のデータを符号化部205に出力する(ステップS29)。従って、符号化部205は、ステップS30にて、入力したパレット化したデータを符号化し、生成された符号化データを出力することになる。   The replacement unit 204 replaces the gradation image data in the buffer 201 with the palette number, and outputs the replaced data to the encoding unit 205 (step S29). Accordingly, the encoding unit 205 encodes the input palletized data and outputs the generated encoded data in step S30.

ステップS30の処理を終えると、ステップS31に進み、制御部150は、全ブロックの符号化が終了したのか否かを判定する。否の場合には、次のブロックの符号化を行なうため、ステップS22以降の処理を行なう。また、全ブロックの符号化処理が行なったと判定した場合、着目ページの符号化処理を終了する。   When the process of step S30 is completed, the process proceeds to step S31, and the control unit 150 determines whether or not the encoding of all blocks has been completed. If not, the process after step S22 is performed to encode the next block. If it is determined that all blocks have been encoded, the encoding process for the page of interest ends.

以上、本実施形態における符号化処理について説明したが、次に復号処理について説明する。属性フラグ復号部107については説明するまでもないので、以下では画像復号処理部108について説明する。   The encoding process according to this embodiment has been described above. Next, the decoding process will be described. Since the attribute flag decoding unit 107 need not be described, the image decoding processing unit 108 will be described below.

図9は画像復号処理部108のブロック構成図である。画像復号処理部は、ヘッダ解析部270、コンテクスト生成部271、予測誤差復号部272、ランレングス復号部273、セレクタ274、置換部275、及び、メモリ276を有する。   FIG. 9 is a block diagram of the image decoding processing unit 108. The image decoding processing unit includes a header analysis unit 270, a context generation unit 271, a prediction error decoding unit 272, a run length decoding unit 273, a selector 274, a replacement unit 275, and a memory 276.

メモリ276は、1ブロック中の少なくとも着目画素Xの近傍画素の復号結果を2ライン分格納する容量を有する。また、1ブロック分の復号開始時には、このメモリ276はゼロクリアされる。これは、ブロック外の画素値の各成分値を“0”とするためである。   The memory 276 has a capacity for storing at least two lines of decoding results of pixels near the target pixel X in one block. At the start of decoding for one block, the memory 276 is cleared to zero. This is because each component value of the pixel value outside the block is set to “0”.

ヘッダ解析部270は、符号化ブロックデータのブロックヘッダの識別情報を解析し、注目ブロックがパレット番号に置換後に符号化されているか否かの判定、及び、パレット番号に変換されている場合にはその色の数と、画素値とを抽出する処理を行なう。そして、パレット番号の符号化データであると判定した場合、パレット番号の符号化データであることを示す制御信号を置換部275に出力する。また、ブロックヘッダに格納されている画素値とパレット番号(色の数によって幾つの画素値が存在するのかは容易にわかる)とを対にして、置換部275に出力する。また、着目ブロックが階調画像として符号化されていると判定した場合には、階調画像の符号化であることを示す制御信号を置換部275に出力する。この後、ヘッダ解析部270は、ブロックヘッダに後続する符号化データをコンテクスト生成部271に出力する。   The header analysis unit 270 analyzes the identification information of the block header of the encoded block data, determines whether or not the block of interest has been encoded after replacement with the palette number, and if it has been converted to the palette number A process of extracting the number of colors and pixel values is performed. If it is determined that the data is the encoded data of the pallet number, the control signal indicating the encoded data of the pallet number is output to the replacement unit 275. Also, the pixel value stored in the block header and the palette number (how many pixel values exist depending on the number of colors can be easily found) are paired and output to the replacement unit 275. When it is determined that the target block is encoded as a gradation image, a control signal indicating that the gradation image is encoded is output to the replacement unit 275. Thereafter, the header analysis unit 270 outputs the encoded data subsequent to the block header to the context generation unit 271.

コンテクスト生成部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 context generator 271 refers to the memory 270 and calculates a context value from the neighboring pixels Xa, Xb, Xc, and Xd. Then, based on the calculation result, the context generation unit 271 determines whether the pixel of interest X is run-length encoded or prediction error encoded. In the embodiment, it is determined that predictive coding is performed when the number of colors indicated by four neighboring pixels is 2 or more, and run-length coding is performed when the number of colors is 1. When it is determined that the pixel of interest has been encoded with the prediction error (when the neighboring pixels have two or more colors), the context generation unit 271 outputs the encoded data to the prediction error decoding unit 272. When it is determined that the target pixel is run-length encoded (when the neighboring pixel has one color), the context generation unit 271 outputs the encoded data to the run-length decoding unit 273. The context generation unit 271 also outputs the determination result of the encoding type to the selector 275 as a control signal.

予測誤差復号部272は、符号化データから予測誤差に復号する。そして、予測誤差復号部272は、メモリ210を参照し、着目画素Xの予測値を算出し、その予測値に、復号した予測誤差を加算することで、着目画素Xの1つの成分値を復号し、セレクタ274に出力する。そして、この処理を残りの2成分についても同様に行なうことで、1画素分の復号が完了する。   The prediction error decoding unit 272 decodes the encoded data into a prediction error. Then, the prediction error decoding unit 272 refers to the memory 210, calculates a prediction value of the pixel of interest X, and adds a decoded prediction error to the prediction value, thereby decoding one component value of the pixel of interest X. And output to the selector 274. Then, this process is similarly performed for the remaining two components, thereby completing the decoding for one pixel.

また、ランレングス復号部273は、ランを復号し、そのランをセレクタ275に出力する。   The run length decoding unit 273 decodes the run and outputs the run to the selector 275.

セレクタ275は、着目画素が予測誤差符号化されていることを示す制御信号を入力した場合には、予測誤差復号部272からの復号結果を置換部275に出力すると共に、メモリ276に格納する。また、セレクタ275は、着目画素がランレングス符号化されていることを示す制御信号を入力した場合には、ランレングス復号部273から入力したランの直前の画素の値を、ランで示される個数分だけ、置換部275、及び、メモリ276に出力する。   The selector 275 outputs the decoding result from the prediction error decoding unit 272 to the replacement unit 275 and stores it in the memory 276 when a control signal indicating that the pixel of interest is subjected to prediction error encoding is input. When the selector 275 receives a control signal indicating that the target pixel is run-length encoded, the selector 275 sets the value of the pixel immediately before the run input from the run-length decoding unit 273 to the number indicated by the run. The data is output to the replacement unit 275 and the memory 276 by the amount.

置換部275は、ヘッダ解析部270から、注目ブロックが階調画像データのまま符号化されていることを示す制御信号を入力した場合には、セレクタ274からの画素値をそのままバッファメモリ109に出力する。   The replacement unit 275 outputs the pixel value from the selector 274 to the buffer memory 109 as it is when the control signal indicating that the block of interest is encoded as gradation image data is input from the header analysis unit 270. To do.

一方、ヘッダ解析部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 header analysis unit 270. In this case, the replacement unit 275 pays attention only to the R component of the pixel value from the selector 274, assumes that the value of the R component is a palette number, replaces the corresponding pixel value, and outputs the result.

以上説明したように本実施形態によれば、画像をブロック単位に符号化する際、そのブロック中に出現する色の数に応じて、画像データをパレット番号に変換して符号化するか否かを切り替えることで、高い圧縮率で可逆符号化することが可能になる。   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 encoding processing unit 103 in the second embodiment. The difference from FIG. 4 is that the blocking unit 200 inputs image data of a size determined by a control signal from the control unit 150 and attribute flag data corresponding to the size from the buffer memory 101 and stores them in the buffer memory 201. It is a point to do. Moreover, the point which provided the ratio calculation part 206 in the structure of FIG. 4 and the point by which the processing content of the determination part 203 was changed are also different.

比率算出部206は、バッファメモリ201に格納された1ブロック分の属性フラグデータを参照し、文字線画、又は、コンピュータグラフィックスの属性を持つ画素数Mをカウントする。そして、制御部150からの制御信号で特定されたブロックサイズ(m×n)に対するMの比率Mrを算出し、その結果を判定部203に出力する。   The ratio calculation unit 206 refers to the attribute flag data for one block stored in the buffer memory 201 and counts the number M of pixels having a character / line drawing or computer graphics attribute. Then, the ratio Mr of M with respect to the block size (m × n) specified by the control signal from the control unit 150 is calculated, and the result is output to the determination unit 203.

判定部203は、ブロックサイズに従って閾値Th1を決定する。そして、算出した比率が閾値以上であるか否か、すなわち、Mr≧Th1を満たすか否かを判定し、その判定結果を置換部204、符号化部205に出力する。そして、特に、Mr≧Th1の場合、着目ブロックの各画素データをパレット変換するため、ヒストグラムを作成し、パレット変換テーブルを作成する。そして、作成したパレット変換テーブルを置換部204、符号化部205に出力する。また、算出した比率が閾値未満の場合には、パレット変換は行なわない。   The determination unit 203 determines the threshold Th1 according to the block size. Then, it is determined whether or not the calculated ratio is equal to or greater than the threshold, that is, whether or not Mr ≧ Th1 is satisfied, and the determination result is output to the replacement unit 204 and the encoding unit 205. In particular, when Mr ≧ Th1, in order to palette-convert each pixel data of the block of interest, a histogram is created and a palette conversion table is created. Then, the generated palette conversion table is output to the replacement unit 204 and the encoding unit 205. If the calculated ratio is less than the threshold value, palette conversion is not performed.

この後の処理は、第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 replacement unit 204 executes palette conversion, the bus for transferring the information of the palette number uses one color component (R component in the embodiment) and other components (embodiments). In this example, the G and B component buses are encoded as “0”. When the palette conversion is performed, the G and B components are 0, so the encoded data of the G and B components are efficiently subjected to the length-length encoding. However, the components of G and B are still in line units. The encoded data is still generated. Therefore, when palette conversion is performed, only one component is used, so only the encoded data of the palette number may be output and the encoded data of the other two components may not be output. In this way, the compression rate can be further increased.

また、上記実施形態では、印刷装置に適用する例を示した。印刷装置であるため、符号化処理を行なう構成と、復号処理を行なう構成が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.

実施形態におけるプリンタ制御部のブロック構成図である。It is a block diagram of a printer control unit in the embodiment. 実施形態における印刷システムのブロック構成図である。1 is a block configuration diagram of a printing system in an embodiment. 実施形態における画像符号化処理のメインルーチンを示すフローチャートである。It is a flowchart which shows the main routine of the image coding process in embodiment. 第1の実施形態の画像符号化処理部のブロック構成図である。It is a block block diagram of the image coding process part of 1st Embodiment. 判定部が生成するパレット変換テーブルの例を示す図である。It is a figure which shows the example of the palette conversion table which a determination part produces | generates. 図4の符号化部のブロック構成図である。It is a block block diagram of the encoding part of FIG. 着目画素Xとのその近傍画素との相対位置関係を示す図である。It is a figure which shows the relative positional relationship of the pixel of interest and its vicinity pixel. ヒストグラムからパレットへの変換処理を説明するための図である。It is a figure for demonstrating the conversion process from a histogram to a palette. 実施形態における画像復号処理部のブロック構成図である。It is a block block diagram of the image decoding process part in embodiment. 実施形態の画像符号化処理部が生成する符号化画像データのファイルの構造を示す図である。It is a figure which shows the structure of the file of the encoding image data which the image encoding process part of embodiment produces | generates. 図3のステップS14の詳細を示すフローチャートである。It is a flowchart which shows the detail of step S14 of FIG. 第2の実施形態の画像符号化処理部のブロック構成図である。It is a block block diagram of the image coding process part of 2nd Embodiment.

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ページ分の画像データから、前記ブロック単位の画像データを入力することを特徴とする請求項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:
コンピュータが読込み実行することで、前記コンピュータに請求項1乃至4のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。   A computer program that causes a computer to function as the image encoding device according to any one of claims 1 to 4 when the computer reads and executes the computer program. 画像データを符号化し、符号化データを生成する画像符号化装置であって、
符号化単位のブロックのサイズを設定する設定手段と、
設定された前記ブロックのサイズに応じて閾値を決定する決定手段と、
設定されたサイズのブロックを単位に、画像データと、当該画像データを構成する各画素が自然画と非自然画のいずれに属するかを示す属性データとを入力する入力手段と、
前記ブロック内の画素数に対する、前記非自然画を示す属性を持つ画素数の比率を算出し、前記比率と前記閾値とを比較する比較手段と、
前記比較手段が前記比率が前記閾値以上であることを示す場合、入力した着目ブロックの色のヒストグラムを作成するヒストグラム作成手段と、
作成されたヒストグラムから、着目ブロック内に出現する各色にパレット番号を割り当て、着目ブロック内の各画素データをパレット番号に変換する変換手段と、
前記比較手段が前記比率が前記閾値以上と判定した場合、前記変換手段で変換されたパレット番号を画素データとして可逆符号化し、パレット変換したことを示す情報と共に、符号化して得られた符号化データを出力し、
前記比較手段が前記比率が前記閾値未満と判定した場合、着目ブロックを構成する各画素データを可逆符号化し、非パレット変換を示す情報と共に、符号化して得られた符号化データを出力する符号化手段と
を備えることを特徴とする画像符号化装置。
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ページ分の画像データを生成すると共に、生成する際の各画素の属性データを生成する生成手段を備え、
前記入力手段は、前記生成手段で生成された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.
コンピュータが読込み実行することで、前記コンピュータに請求項7乃至10のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。   A computer program that causes a computer to function as the image encoding device according to any one of claims 7 to 10 when the computer reads and executes the computer program. 請求項6又は12に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読記憶媒体。   A computer-readable storage medium storing the computer program according to claim 6 or 12.
JP2007155723A 2007-06-12 2007-06-12 Device for encoding image and control method therefor Withdrawn JP2008311792A (en)

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)

* Cited by examiner, † Cited by third party
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

Cited By (10)

* Cited by examiner, † Cited by third party
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