JP2012015644A - Image processor and image processing method - Google Patents

Image processor and image processing method Download PDF

Info

Publication number
JP2012015644A
JP2012015644A JP2010148079A JP2010148079A JP2012015644A JP 2012015644 A JP2012015644 A JP 2012015644A JP 2010148079 A JP2010148079 A JP 2010148079A JP 2010148079 A JP2010148079 A JP 2010148079A JP 2012015644 A JP2012015644 A JP 2012015644A
Authority
JP
Japan
Prior art keywords
color
data
image
processing
color reduction
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.)
Granted
Application number
JP2010148079A
Other languages
Japanese (ja)
Other versions
JP5595142B2 (en
Inventor
Takeshi Achinami
健 阿知波
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 JP2010148079A priority Critical patent/JP5595142B2/en
Publication of JP2012015644A publication Critical patent/JP2012015644A/en
Application granted granted Critical
Publication of JP5595142B2 publication Critical patent/JP5595142B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To highly efficiently compress an image while minimizing image deterioration due to color reduction, when the image is compressed while suppressing a processing cost, especially, when image compression is repetitively performed.SOLUTION: An information processor divides image data by each block and performs compression processing multiple times with respect to the image data by sequentially defining the divided blocks as processing objects. The information processor determines whether or not to perform subtractive color processing for reducing the number of colors of the blocks based on subtractive color information. When it is determined to perform the subtractive color processing, the subtractive color processing is performed with respect to the blocks to be processed. When the number of colors is reduced as the result of the subtractive color processing, updating that the subtractive color processing has been performed is performed in the subtractive color information.

Description

本発明は、画像処理装置及び画像処理方法に関する。より詳細には、画像データを所定のブロック単位で圧縮処理する技術と、ブロック単位に圧縮された画像データに対して画像処理および伸張処理する技術とに関する。   The present invention relates to an image processing apparatus and an image processing method. More specifically, the present invention relates to a technique for compressing image data in predetermined block units and a technique for performing image processing and decompression processing on image data compressed in block units.

従来、デジタル複合機は、高解像度のカラー画像データに対する需要の高まりに伴い、1200dpi以上の解像度を持つ画像データを扱うことが多くなっている。これを受けて、デジタル複合機に限らずデジタルカメラやファクシミリ装置などの画像処理装置は、メモリやハードディスクの容量を節約したり書き込み時間を短縮したりするために、画像データを圧縮処理して扱うことで、低コスト化や高速化を実現している。   2. Description of the Related Art Conventionally, digital multifunction peripherals handle image data having a resolution of 1200 dpi or more with increasing demand for high-resolution color image data. In response to this, image processing apparatuses such as digital cameras and facsimile machines, not limited to digital multi-function peripherals, handle image data by compressing it in order to save memory and hard disk capacity and reduce writing time. As a result, low cost and high speed are realized.

静止画像データの圧縮処理に用いる符号化方式としては、離散コサイン変換を利用した方式(JPEG方式)やWavelet変換を利用した方式が知られている。この種の符号化方式は、画像データを所定のブロック(例えば、8×8画素や16×16画素)単位で符号化し、離散コサイン変換、量子化及びエントロピー符号化を行うことで、高い圧縮効率を達成している。また、この種の符号化方式は、可変長符号化方式と呼ばれ、符号化対象の画像データ毎に符号量が変化する特徴を持つ。   As an encoding method used for still image data compression processing, a method using discrete cosine transform (JPEG method) and a method using Wavelet transform are known. This type of encoding method encodes image data in units of a predetermined block (for example, 8 × 8 pixels or 16 × 16 pixels), and performs discrete cosine transform, quantization, and entropy encoding, thereby achieving high compression efficiency. Has achieved. In addition, this type of encoding method is called a variable-length encoding method, and has a feature that the code amount changes for each image data to be encoded.

前述した圧縮処理の課題は、ブロック単位の可変長符号化方式を用いているため、小さなエリア参照のためのランダムアクセスが難しい点である。すなわち、アクセス対象となるブロックの位置(メモリアドレス)が不定であるため、その位置を知る何らかの方法が必要になる上に、実際にアクセスするためにはブロック単位での伸張処理が必要になる。また、前述した圧縮処理の別の課題は、ブロック単位の処理が複雑な点である。例えば、JPEG方式での離散コサイン変換ではブロックサイズとして通常8×8画素を必要としているが、このブロック単位での離散コサイン変換処理を高速に行うためには、高速演算器や専用ハードウェア、更にバッファ用のメモリが必要になる。このような圧縮処理に関わる処理コストの課題に対するアプローチとして、ブロックサイズが小さい圧縮率固定の画像圧縮技術(例えば、特許文献1)が開示されている。   The problem of the compression processing described above is that random access for referencing a small area is difficult because a variable-length encoding method in units of blocks is used. That is, since the position (memory address) of the block to be accessed is indefinite, some method of knowing the position is necessary, and in addition, an expansion process in units of blocks is necessary for actual access. Another problem with the above-described compression processing is that the processing in units of blocks is complicated. For example, the discrete cosine transform in the JPEG method normally requires 8 × 8 pixels as a block size. In order to perform the discrete cosine transform processing in units of blocks at a high speed, a high-speed arithmetic unit, dedicated hardware, Buffer memory is required. As an approach to the problem of processing cost related to such compression processing, an image compression technique (for example, Patent Document 1) with a fixed compression ratio with a small block size is disclosed.

また、前述した圧縮処理のさらなる課題は、高解像度化が進むにつれて画像処理を必要とする画素数が飛躍的に増え、その処理負荷が増大する点である。例えば、600dpiから1200dpiに解像度が2倍になることで処理すべき画素数は4倍になる。ここで、前述したJPEG方式やWavelet変換を利用した符号化方式を用いた場合、画像データを参照したり変換したりするためには、上述したように圧縮された画像データの伸張処理が必要になる。つまり、圧縮された画像データのままで画像処理することができないので、高解像度の画像データにおける全ての画素に対して画素毎に画像処理しなければならない結果として、処理時間の増大を招く。   A further problem with the above-described compression processing is that the number of pixels that require image processing increases dramatically as the resolution increases, and the processing load increases. For example, when the resolution is doubled from 600 dpi to 1200 dpi, the number of pixels to be processed is quadrupled. Here, in the case of using the above-described encoding method using the JPEG method or Wavelet conversion, in order to refer to or convert the image data, it is necessary to decompress the compressed image data as described above. Become. That is, since the image processing cannot be performed with the compressed image data as it is, the processing time is increased as a result of performing the image processing for every pixel in all the pixels in the high resolution image data.

伸張処理を行わなずに圧縮された画像データに対する画像処理を目指したアプローチとして、画素データとその連続数を記憶する公知のランレングス圧縮方式がある。また、ブロック単位でエッジを検出し、そのエッジの持つ2色を記憶することで圧縮する画像圧縮技術(例えば、特許文献2)が開示されている。   As an approach aimed at image processing on image data compressed without performing decompression processing, there is a known run-length compression method that stores pixel data and the number of consecutive data. In addition, an image compression technique (for example, Patent Document 2) is disclosed in which an edge is detected in units of blocks and compression is performed by storing two colors of the edge.

特開2004−104621号公報JP 2004-104621 A 特開平10−257488号公報JP-A-10-257488

前述したように、離散コサイン変換を利用したJPEG方式やWavelet変換を用いる方式の場合、処理単位となるブロックサイズが比較的大きいので、処理コストの課題がある。すなわち、ブロック毎に必要とする計算量が多く、処理を実現するための専用ハードウェアが高価になってしまうという課題がある。   As described above, in the case of a JPEG method using discrete cosine transform or a method using Wavelet transform, there is a problem of processing cost because the block size as a processing unit is relatively large. That is, there is a problem that a large amount of calculation is required for each block, and dedicated hardware for realizing processing becomes expensive.

ここで、特許文献1に記載されているようなブロックサイズが小さい圧縮率固定の画像圧縮技術を用いる場合であっても、圧縮された画像データに対して画像処理を行う場合には、必ず伸張処理が必要となる。従って、処理すべき画素数次第では膨大な処理時間を要してしまうという課題がある。これは例えば、JPEG方式などで圧縮された高解像度データから低解像度データを作成するために、必ず伸張処理をした上で縮小処理が必要になってしまう課題である。   Here, even when an image compression technique with a small block size and a fixed compression rate as described in Patent Document 1 is used, when image processing is performed on compressed image data, the image data must be decompressed. Processing is required. Therefore, there is a problem in that an enormous processing time is required depending on the number of pixels to be processed. This is a problem that, for example, in order to create low resolution data from high resolution data compressed by the JPEG method or the like, a decompression process is always required after the decompression process.

また、伸張処理を行わなずに圧縮された画像データに対する画像処理が可能な圧縮方式においても課題がある。すなわち、画像データの画素値を持つのではなく、隣接画素との一致情報のみ保持し画像圧縮を行う圧縮方式(例えば、前述のランレングス圧縮方式)において、色数を削減(減色)し非可逆圧縮する場合には、画質劣化の課題も伴う。これは例えば、前述したランレングス圧縮方式において、色が似ている時に同色のランとみなしてその連続数をカウントし符号化する場合、オリジナルの画像データとの色差が複数画素に伝搬することによって画像劣化してしまう課題である。なお、この画像劣化の課題は、ランレングス圧縮方式に限らず隣接画素との一致情報による圧縮と減色処理を組み合わせる場合における共通の課題であり、特許文献2の技術にも当てはまる。   There is also a problem in a compression method that can perform image processing on compressed image data without performing decompression processing. That is, in the compression method (for example, the above-described run length compression method) that does not have pixel values of image data but retains only matching information with adjacent pixels and performs image compression, the number of colors is reduced (color reduction) and is irreversible. In the case of compression, there is a problem of image quality degradation. This is because, for example, in the above-described run length compression method, when colors are similar and run with the same color is counted and encoded, the color difference from the original image data is propagated to a plurality of pixels. This is a problem that causes image degradation. Note that this image degradation problem is not limited to the run-length compression method, and is a common problem when combining compression based on matching information with adjacent pixels and color reduction processing, and is also applicable to the technique of Patent Document 2.

以上の課題を解決するために、本発明では、画像データに対して画像圧縮を繰り返し実行する場合において、減色による画像劣化を最小限に抑えながら、高効率な画像圧縮を実現する画像処理装置及び画像処理方法を提供することを目的とする。   In order to solve the above-described problems, in the present invention, an image processing apparatus that realizes highly efficient image compression while minimizing image degradation due to color reduction when image compression is repeatedly performed on image data. An object is to provide an image processing method.

本発明の画像処理装置は、画像データをブロック毎に分割し、当該分割されたブロックを順に処理対象にして、画像データに対して複数回の圧縮処理をする画像処理装置であって、ブロックの色数を減色する減色処理を実行するか否かを減色情報に基づいて判定する判定手段と、前記判定手段によって減色処理を実行すると判定された場合に、前記処理対象のブロックに対して前記減色処理を実行する減色処理手段と、前記減色処理の結果に応じて前記減色情報を更新する更新手段と、前記処理対象のブロックの各画素の色データを比較することによって当該ブロックに含まれる色データの配置パターンに対応するパターンフラグを特定する特定手段と、前記特定手段で特定されたパターンフラグと当該ブロックに含まれる色数分の色データとを圧縮された出力データとして出力する出力手段と、所定の解像度に達するまで、当該ブロックの第1色の色データの集合データを更にブロック毎に分割して再び処理対象のブロックとして前記判定手段に入力する入力手段とを備えることを特徴とする。   An image processing apparatus according to the present invention is an image processing apparatus that divides image data into blocks, sequentially processes the divided blocks, and performs compression processing on the image data a plurality of times. A determination unit that determines whether or not to perform a color reduction process for reducing the number of colors based on color reduction information; and when the determination unit determines that the color reduction process is to be executed, the color reduction process is performed on the processing target block. Color data included in the block by comparing color data of each pixel of the block to be processed with a color reduction processing unit that executes processing, an update unit that updates the color reduction information according to a result of the color reduction processing Specifying means for specifying a pattern flag corresponding to the arrangement pattern of the pattern, the pattern flag specified by the specifying means, and color data for the number of colors included in the block Output data as compressed output data, and until the predetermined resolution is reached, the set data of the color data of the first color of the block is further divided into blocks, and again as a processing target block to the determination means Input means for inputting.

本発明によれば、分割されたブロックを順に処理対象にして、画像データに対して複数回の圧縮処理をする場合に、処理コストを抑えつつ、減色処理による画質劣化を最小限に抑えながら、画像データの圧縮率を最大限に高めることができる。   According to the present invention, when the divided blocks are sequentially processed and the image data is subjected to compression processing a plurality of times, the image quality deterioration due to the color reduction processing is minimized while suppressing the processing cost. The compression rate of image data can be maximized.

また、本発明によって圧縮された画像データを用いれば、処理コストを抑えることができるので、画像処理および伸張処理も容易に行うことができる。   Further, if the image data compressed according to the present invention is used, the processing cost can be suppressed, so that the image processing and the expansion processing can be easily performed.

画像処理装置の構成例を示すブロック図である。It is a block diagram which shows the structural example of an image processing apparatus. コントローラの構成例を示すブロック図である。It is a block diagram which shows the structural example of a controller. ラスタ画像データを分割した際のブロックのパターンを示す図である。It is a figure which shows the pattern of the block at the time of dividing | segmenting raster image data. ブロックとそのパターンの識別子(パターンフラグ)の関係を示す図である。It is a figure which shows the relationship between the identifier of a block and its pattern (pattern flag). 第1の実施形態における圧縮処理の全体フローを示す図である。It is a figure which shows the whole flow of the compression process in 1st Embodiment. 第1の実施形態における圧縮処理の詳細フローを示す図である。It is a figure which shows the detailed flow of the compression process in 1st Embodiment. ブロックのパターンをパターンフラグへ変換している様子を示す図である。It is a figure which shows a mode that the pattern of a block is converted into the pattern flag. 圧縮処理における入力データと出力データの関係を示す図である。It is a figure which shows the relationship between the input data and output data in a compression process. 第1の実施形態における減色圧縮処理の詳細フローを示す図である。It is a figure which shows the detailed flow of the color reduction compression process in 1st Embodiment. 画像データのメモリ空間上でのマッピングを示す図である。It is a figure which shows the mapping on the memory space of image data. 第2の実施形態における圧縮処理の全体フローを示す図である。It is a figure which shows the whole flow of the compression process in 2nd Embodiment. ページとタイルとブロックの関係を示す図である。It is a figure which shows the relationship between a page, a tile, and a block. パッキングされたデータ(パケット)のデータ構造を示す図である。It is a figure which shows the data structure of the packed data (packet). パケット管理テーブルの構成例を示す図である。It is a figure which shows the structural example of a packet management table. メモリ空間上にマッピングされた各パケットのアドレスを示す図である。It is a figure which shows the address of each packet mapped on the memory space. 複数段で圧縮処理を行った際のパケットのデータ構造を示す図である。It is a figure which shows the data structure of the packet at the time of performing a compression process in multiple steps. 第3の実施形態における減色圧縮処理の詳細フローを示す図である。It is a figure which shows the detailed flow of the color reduction compression process in 3rd Embodiment. 第3の実施形態における複数回の圧縮処理及び減色圧縮処理を適用した場合の具体例を示す図である。It is a figure which shows the specific example at the time of applying the multiple times compression process and the color reduction compression process in 3rd Embodiment.

以下、図面を参照しながら発明を実施するための形態について詳細に説明する。以下で説明する各実施形態では、画像処理装置として、スキャン、プリント、コピーなどの複数の機能を有するデジタル複合機(MFP)を例に説明する。   Hereinafter, embodiments for carrying out the invention will be described in detail with reference to the drawings. In each embodiment described below, a digital multi-function peripheral (MFP) having a plurality of functions such as scanning, printing, and copying will be described as an example of an image processing apparatus.

[第1の実施形態]
図1は、第1の実施形態における画像処理装置100の構成例を示すブロック図である。図1に示すように、画像処理装置100は、コントローラ101、スキャナ102、プリンタ103、ネットワーク104、HDD記憶部105で構成される。コントローラ101は、スキャナ102、プリンタ103、ネットワーク104、HDD記憶部105と接続され、画像処理装置100全体を制御する制御部である。スキャナ102は、画像入力機器として画像データの入力を行う処理部である。プリンタ103は、画像出力機器として画像データの出力を行う処理部である。また、ネットワーク104は、LANや公衆回線(WAN)などで構成され、画像データやデバイス情報などの入出力を行う通信部である。また、HDD記憶部105は、ハードディスクドライブで構成され、システムソフトウェアやプログラム、画像データなどを格納する記憶部である。
[First Embodiment]
FIG. 1 is a block diagram illustrating a configuration example of an image processing apparatus 100 according to the first embodiment. As illustrated in FIG. 1, the image processing apparatus 100 includes a controller 101, a scanner 102, a printer 103, a network 104, and an HDD storage unit 105. The controller 101 is connected to the scanner 102, printer 103, network 104, and HDD storage unit 105, and is a control unit that controls the entire image processing apparatus 100. The scanner 102 is a processing unit that inputs image data as an image input device. The printer 103 is a processing unit that outputs image data as an image output device. The network 104 includes a LAN, a public line (WAN), and the like, and is a communication unit that inputs and outputs image data and device information. The HDD storage unit 105 includes a hard disk drive and stores system software, programs, image data, and the like.

図2は、図1で示したコントローラ101の構成例を示すブロック図である。図2を用いて、コントローラ101の各部の詳細な処理を説明する。   FIG. 2 is a block diagram illustrating a configuration example of the controller 101 illustrated in FIG. Detailed processing of each unit of the controller 101 will be described with reference to FIG.

まず、スキャナ102によってスキャンされた画像データを読み込む場合を説明する。スキャナ用画像処理部211は、スキャナ102で読み取られたRGB(レッド、グリーン、ブルー)3色の画像データを受け取り、その画像データに対してシェーディング処理やフィルタ処理等の画像処理を行う。そして、画像圧縮部212は、スキャナ用画像処理部211で処理された画像データに対して圧縮処理を行う。その後、DMAC(ダイレクトメモリアクセスコントローラ)213は、画像圧縮部212による圧縮処理で得られた圧縮データを画像メモリバス203を介して転送し、メモリ202に格納する。   First, a case where image data scanned by the scanner 102 is read will be described. The scanner image processing unit 211 receives RGB (red, green, blue) image data read by the scanner 102 and performs image processing such as shading processing and filter processing on the image data. The image compression unit 212 performs compression processing on the image data processed by the scanner image processing unit 211. Thereafter, a DMAC (direct memory access controller) 213 transfers the compressed data obtained by the compression processing by the image compression unit 212 via the image memory bus 203 and stores it in the memory 202.

次に、スキャンされた画像データをプリントする場合を説明する。DMAC261は、メモリ202に格納されている圧縮データを画像メモリバス203を介して色処理部262へ転送する。そして、色処理部262は、DMAC261によって転送された圧縮データをCMYK(シアン、マゼンタ、イエロー、ブラック)色空間へ変換する。その後、更に色処理部262がCMYKの各値に対して濃度調整やプリンタガンマ補正などの色処理を行う。そして、DMAC261は、該色処理後のデータを画像メモリバス203を介して再度メモリ202に格納する。その後、DMAC221は、プリント用の画像処理を行うために、画像メモリバス203を介してメモリ202に格納されている圧縮データを読み込む。画像伸張部222は、該色処理後のデータをラスタ画像データに展開する。そして、プリント用画像処理部223は、CMYKのラスタ画像データに対してディザ法や誤差拡散法による面積階調処理を行い、プリンタ103へ出力する。   Next, a case where the scanned image data is printed will be described. The DMAC 261 transfers the compressed data stored in the memory 202 to the color processing unit 262 via the image memory bus 203. The color processing unit 262 converts the compressed data transferred by the DMAC 261 into a CMYK (cyan, magenta, yellow, black) color space. Thereafter, the color processing unit 262 further performs color processing such as density adjustment and printer gamma correction on each value of CMYK. The DMAC 261 stores the color-processed data in the memory 202 again via the image memory bus 203. Thereafter, the DMAC 221 reads compressed data stored in the memory 202 via the image memory bus 203 in order to perform image processing for printing. The image expansion unit 222 expands the color processed data into raster image data. The print image processing unit 223 performs area gradation processing on the CMYK raster image data using a dither method or an error diffusion method, and outputs the processed image to the printer 103.

次に、スキャンされた画像データをネットワークへ送信する場合を説明する。DMAC261は、メモリ202に格納されている圧縮データを画像メモリバス203を介して色処理部262へ転送する。そして、色処理部262は、ディスプレイガンマ調整や用紙地色調整等を行った後、YCbCr(輝度、BLUE色差、RED色差)色空間へ変換する。その後、DMAC261が、色処理部262で処理されたデータを画像メモリバス203を介してメモリ202に格納する。そして、DMAC231は、送信用の画像処理を行うために、画像メモリバス203を介してメモリ202に格納されている圧縮データを画像伸張部232へ転送する。その後、画像伸張部232は、圧縮データをラスタ画像データに展開する。そして、送受信処理部233は、カラー画像送信であればYCbCrのラスタ画像データに対してJPEG圧縮処理を行い、モノクロ2値画像送信であればYデータを2値化した後にJBIG圧縮処理を行い、ネットワーク104へ出力する。   Next, a case where the scanned image data is transmitted to the network will be described. The DMAC 261 transfers the compressed data stored in the memory 202 to the color processing unit 262 via the image memory bus 203. Then, the color processing unit 262 performs display gamma adjustment, paper background color adjustment, and the like, and then converts to a YCbCr (luminance, BLUE color difference, RED color difference) color space. Thereafter, the DMAC 261 stores the data processed by the color processing unit 262 in the memory 202 via the image memory bus 203. Then, the DMAC 231 transfers the compressed data stored in the memory 202 to the image expansion unit 232 via the image memory bus 203 in order to perform image processing for transmission. Thereafter, the image expansion unit 232 expands the compressed data into raster image data. The transmission / reception processing unit 233 performs JPEG compression processing on YCbCr raster image data in the case of color image transmission, and performs JBIG compression processing after binarizing the Y data in the case of monochrome binary image transmission. Output to the network 104.

次に、スキャンされた画像データを保存する場合を説明する。DMAC241は、メモリ202に格納されている圧縮データを画像メモリバス203を介してスプール用画像圧縮伸張部242へ転送する。そして、スプール用画像圧縮伸張部242は、HDDの書き込みスピードがメモリの書き込みスピードに対して遅いため、更に高圧縮のJPEG圧縮を行う。その後、HDDコントローラ243は、HDD記憶部105へ圧縮データを保存する。なお、HDD記憶部105に保存されている圧縮データを再度メモリ202に転送する場合には、上述した処理を逆に行えば良い。   Next, a case where scanned image data is stored will be described. The DMAC 241 transfers the compressed data stored in the memory 202 to the spool image compression / decompression unit 242 via the image memory bus 203. The spool image compression / decompression unit 242 performs JPEG compression with higher compression because the writing speed of the HDD is slower than the writing speed of the memory. Thereafter, the HDD controller 243 stores the compressed data in the HDD storage unit 105. Note that when the compressed data stored in the HDD storage unit 105 is transferred to the memory 202 again, the above-described processing may be performed in reverse.

次に、図1に示すネットワーク104を介して接続された他の装置から送られてきたPDLデータをメモリ202へ書き込む場合を説明する。図2にはPDL解釈部が図示されていないが、PDL解釈部として機能するCPU201が、PDLデータを解釈し、その結果のディスプレイリストをメモリ202に出力する。そして、レンダリング部251は、メモリ202に格納されているディスプレイリストをRGBのラスタ画像データとしてレンダリングし、画像圧縮部252は、レンダリング結果を圧縮処理する。その後、DMAC253は、圧縮データを画像メモリバス203を介してメモリ202に格納する。   Next, a case where PDL data sent from another device connected via the network 104 shown in FIG. 1 is written to the memory 202 will be described. Although the PDL interpretation unit is not shown in FIG. 2, the CPU 201 functioning as the PDL interpretation unit interprets the PDL data and outputs the display list as a result to the memory 202. The rendering unit 251 renders the display list stored in the memory 202 as RGB raster image data, and the image compression unit 252 compresses the rendering result. Thereafter, the DMAC 253 stores the compressed data in the memory 202 via the image memory bus 203.

なお、PDLデータをプリント、ネットワークへ送信、保存する処理は、スキャンされた画像データの場合と同様の処理を行うことで実現可能である。   Note that the process of printing, transmitting to a network, and storing the PDL data can be realized by performing the same process as that of the scanned image data.

なお、本実施形態は、画像圧縮部252でPDLデータから生成されたラスタ画像データを圧縮し、または、画像圧縮部212でスキャンで得たラスタ画像データを圧縮するものとして説明するが、本実施形態はこのような構成に限らない。例えば、図2のように画像圧縮部212と252を個別に設けるのではなく、共通の画像圧縮部を設けるように構成しても良い。   In the present embodiment, the raster image data generated from the PDL data is compressed by the image compression unit 252 or the raster image data obtained by scanning is compressed by the image compression unit 212. The form is not limited to such a configuration. For example, instead of separately providing the image compression units 212 and 252 as shown in FIG. 2, a common image compression unit may be provided.

次に、本実施形態の特徴であるラスタ画像データの圧縮処理を詳細に説明する。本実施形態では、まずページ単位のラスタ画像データを、2×2画素単位のブロックに分割し、分割して抽出されたブロックを処理単位として画像データの圧縮処理を行う。   Next, raster image data compression processing, which is a feature of this embodiment, will be described in detail. In this embodiment, first, raster image data in units of pages is divided into blocks of 2 × 2 pixels, and image data compression processing is performed using the blocks extracted by division as processing units.

図3は、ラスタ画像データを分割した際のブロックのパターンを示す図である。ここで圧縮処理を説明する前に、図3を用いて2×2の4画素データの中に占める色数に応じてその組み合わせをする場合の数について説明する。図3に示すように、2×2の画素数が4画素であるので、そこに占める色数は最大4色になり、ブロック内で高々1色〜4色の組み合わせしか存在しない。   FIG. 3 is a diagram showing a block pattern when the raster image data is divided. Before describing the compression processing, the number of combinations in accordance with the number of colors occupied in 2 × 2 4-pixel data will be described with reference to FIG. As shown in FIG. 3, since the number of 2 × 2 pixels is 4, the number of colors occupied there is a maximum of 4 colors, and there are only combinations of 1 to 4 colors at most in the block.

まず、ブロック内が1色の場合、4画素が全て同色で構成されていることになるので、その組み合わせは1通りである。   First, when there is one color in the block, all four pixels are composed of the same color, so there are only one combination.

次に、ブロック内が2色の場合を考える。2色が4画素内にレイアウトされる場合の数は、左上の画素を第1色として考えると、左上以外の残りの3画素へ第1色もしくは第2色が入るので、4画素同色の場合を除く7通りの組み合わせが考えられる。   Next, consider the case where the block has two colors. When two colors are laid out in four pixels, if the upper left pixel is considered as the first color, the first color or the second color enters the remaining three pixels other than the upper left. Seven combinations are possible except for.

次に、ブロック内が3色の場合を考える。3色が4画素内にレイアウトされる場合の数は、3色のうち1色だけ2度使われる場合の数と言い換えることが可能であり、4画素の座標のうち、2画素が同じ色になる場合の数を求めれば良い。つまり、3色の場合の数は、4つの座標から2つの座標を取る組み合わせとなり、全部で6通りとなる。   Next, consider the case where the block has three colors. The number of three colors laid out in four pixels can be rephrased as the number of only one of the three colors used twice. Of the four pixel coordinates, two pixels have the same color. What is necessary is just to obtain | require the number of cases. That is, the number in the case of three colors is a combination of taking two coordinates from four coordinates, and there are six ways in total.

最後に、ブロック内が4色の場合は1色の場合と同様で1パターンしか存在しない。   Finally, when there are four colors in the block, there is only one pattern as in the case of one color.

以上、1色〜4色の全ての場合の数を合計すると、全部で15通りのパターンが考えられる。また、これら全てのパターンを識別するために、フラグ(識別子)を付与することを考えると、0〜E(16進数)を識別するためのフラグのデータ量としては4ビット必要となる。この15通りのブロックのパターンとフラグとの関係を図4に示すように定義し、以下、このフラグを「パターンフラグ」と呼ぶ。   As described above, when the numbers in all cases of one color to four colors are totaled, 15 patterns can be considered in total. Considering that a flag (identifier) is added to identify all these patterns, 4 bits are required as the data amount of the flag for identifying 0 to E (hexadecimal number). The relationship between the 15 block patterns and the flags is defined as shown in FIG. 4, and this flag is hereinafter referred to as a “pattern flag”.

図5は、第1の実施形態における圧縮処理全体を示すフローチャートである。   FIG. 5 is a flowchart illustrating the entire compression process according to the first embodiment.

まず、ページ単位で図3に示したラスタ画像データを入力する(S501)。そして、ページ単位で1画素のページ背景画素を設定する(S502)。これは圧縮処理時の初期記憶ブロックとして用いる為の画素データで、通常白色(RGB各色8ビット画像であれば255、CMYK画像であれば0)が用いられる。ここで背景画素に白色を用いた理由は、予め背景画素を設定しておくことで、背景画素と同色の画素データを出力しないで済む可能性があり、通常の原稿画像では背景画素が白色の可能性が最も高いためである。次に、図3に示した2×2画素単位のブロックに対する減色処理の適用履歴を保持するための減色情報である「減色フラグ」を0で初期化する(S503)。次に、1回目のページ圧縮処理で、減色フラグを参照する(S504)。この時、S504で参照した減色フラグが減色処理未適用を示す0に対して、予め定めた減色回数の上限を1とするならば、減色回数が上限に達していないので減色すると判定し(S505でYes)、減色圧縮処理を実行する(S506)。一方で、S504で参照した減色フラグが減色未適用を示す0に対して、予め定めた減色回数の上限を0(減色処理禁止)とするならば、減色回数が上限に達しているので減色しないと判定し(S505でNo)、圧縮処理を実行する(S507)。なお、S506の減色圧縮処理の詳細な説明は、図9を用いて後述する。また、S505の圧縮処理の詳細な説明は、図6を用いて後述する。ここで、1回目のページ圧縮処理が終了した後に、再圧縮するかを判定し、再圧縮しないと判定したならば(S508でNo)、ページ圧縮処理を終了する。一方で、再圧縮すると判定したならば(S508でYes)、S504に遷移し、2回目のページ圧縮処理を開始する。2回目のページ圧縮処理で、再び減色フラグを参照する(S504)。この時、S504で参照した減色フラグが減色処理適用済を示す1に対して、予め定めた減色回数の上限を1とするならば、減色回数が上限に達したので減色しないと判定して(S505でNo)、圧縮処理を実行する(S507)。以上で説明した処理フローに従い、入力されたページ画像データが所望の解像度になるまでページ圧縮処理を繰り返す(S508)。例えば、圧縮回数を2段階と定めた場合には、ページ画像データの解像度は、1回目の圧縮処理で1200dpiから600dpiに変換され、2回目の圧縮処理で600dpiから300dpiに変換されることになる。なお、図5の例では、ページ毎に減色処理を行うかを判定しているが、これは換言すれば、ページ内の処理対象のブロックに対して減色処理を行うかを判定しているともいえる。   First, the raster image data shown in FIG. 3 is input in units of pages (S501). Then, one page background pixel is set for each page (S502). This is pixel data to be used as an initial storage block at the time of compression processing, and normally white (255 for 8-bit RGB color images, 0 for CMYK images) is used. Here, the reason why white is used as the background pixel is that if the background pixel is set in advance, pixel data having the same color as the background pixel may not be output. In a normal document image, the background pixel is white. This is because it is most likely. Next, a “color reduction flag”, which is color reduction information for holding the application history of the color reduction processing for the block of 2 × 2 pixels shown in FIG. 3, is initialized to 0 (S503). Next, the color reduction flag is referred to in the first page compression process (S504). At this time, if the predetermined upper limit of the number of color reductions is 1 with respect to 0 in which the color reduction flag referred to in S504 indicates that the color reduction processing is not applied, it is determined that the color reduction is performed because the number of color reductions has not reached the upper limit (S505). Yes), the subtractive color compression process is executed (S506). On the other hand, if the predetermined upper limit of the number of color reductions is set to 0 (color reduction processing is prohibited) with respect to 0 indicating that the color reduction is not applied, the color reduction flag referred to in S504, the color reduction is not performed because the number of color reductions has reached the upper limit. (No in S505) and the compression process is executed (S507). A detailed description of the color reduction compression processing in S506 will be described later with reference to FIG. A detailed description of the compression processing in S505 will be described later with reference to FIG. Here, after the first page compression process is completed, it is determined whether to recompress, and if it is determined not to recompress (No in S508), the page compression process ends. On the other hand, if it is determined to recompress (Yes in S508), the process proceeds to S504, and the second page compression process is started. In the second page compression process, the color reduction flag is referred again (S504). At this time, if the color reduction flag referred to in step S504 indicates that the color reduction processing has been applied, and if the upper limit of the number of color reductions determined is 1, the color reduction number has reached the upper limit and it is determined that no color reduction will occur ( No in S505), the compression process is executed (S507). In accordance with the processing flow described above, the page compression processing is repeated until the input page image data has a desired resolution (S508). For example, when the number of compressions is set to two stages, the resolution of the page image data is converted from 1200 dpi to 600 dpi in the first compression process, and from 600 dpi to 300 dpi in the second compression process. . In the example of FIG. 5, it is determined whether the color reduction process is performed for each page. In other words, it is determined whether the color reduction process is performed on the processing target block in the page. I can say that.

図6は、画像圧縮部212、252で実行されるS505の圧縮処理を詳細に説明するフローチャートである。図3及び図4で示した前述の2×2画素の取り得る組み合わせを踏まえ、図6を用いて画像圧縮部212、252で実行される処理を説明する。入力としては、例えばRGBそれぞれ8ビットの256階調を持っており、またデータとしては8ビットデータの点順次で1画素当たり24ビットの画像として説明する。   FIG. 6 is a flowchart for explaining in detail the compression processing of S505 executed by the image compression units 212 and 252. Based on the possible combinations of the 2 × 2 pixels shown in FIG. 3 and FIG. 4, processing executed by the image compression units 212 and 252 will be described using FIG. 6. As an input, for example, each of RGB has 256 gradations of 8 bits, and the data is described as an image of 24 bits per pixel in a dot-sequential manner of 8-bit data.

まず、2×2画素のブロックを入力し(S601)、そのブロック内の全ての2画素の組み合わせに対して24ビットを比較する(S602)。ここで比較した結果、全ビットが一致していた場合は1を、不一致の場合は0を出力をする。   First, a 2 × 2 pixel block is input (S601), and 24 bits are compared with all combinations of two pixels in the block (S602). As a result of the comparison, 1 is output when all bits match, and 0 is output when they do not match.

図7は、図6のフローチャートを補足説明するための図である。図7に示すように、2×2画素内の左上、右上、左下、右下の画素位置順に、座標1、2、3、4とする。1ブロック内の任意の2画素の組み合わせの座標は、1−2、1−3、1−4、2−3、2−4、3−4の全部で6通りあるので、S602では6回比較する必要があり、比較結果は6ビット出力される。図7に示す比較結果のように、1ブロック内の全画素が同色であれば、比較結果として全て1を出力し、逆に4画素が全て異なる画素値を持っていれば、比較結果として全て0を出力する。   FIG. 7 is a diagram for supplementarily explaining the flowchart of FIG. 6. As shown in FIG. 7, the coordinates are 1, 2, 3, and 4 in the order of the upper left, upper right, lower left, and lower right pixel positions in the 2 × 2 pixels. Since there are six coordinates of combinations of any two pixels in one block, including 1-2, 1-3, 1-4, 2-3, 2-4, and 3-4, 6 comparisons are made in S602. The comparison result is output as 6 bits. As shown in the comparison result of FIG. 7, if all the pixels in one block are the same color, all 1s are output as the comparison result. Conversely, if all the four pixels have different pixel values, the comparison results are all 0 is output.

この2×2画素のブロックを用いる例では、4画素で色の一致から出現し得るパターンの数は15通りなので、図7に示すように、6ビットの比較結果に応じて、4ビットのパターンフラグを特定する(S603)。次に、4画素内で出現した色数及び色データを抽出する(S604)。図7に示すように、4ビットのパターンフラグ(すなわち6ビットの比較結果)に対して、ブロック内での各色の配置を示す各パターンが対応づけられているので、各ブロックにおける色数と色データを特定することができる。なお、本実施形態の図4では、全てのパターンにおいて、左上の画素の色(画素値)が第1色(1番目の色データ)となるように定義している。従って、パターンフラグが0の場合は、色数1で、左上の画素の色(画素値)を第1色として抽出する。また、パターンフラグが1〜7の場合は、色数2で、左上の画素の色(画素値)を第1色として抽出し、更に、各パターンフラグに応じて定義されている第2色(2番目の色データ)が存在する位置の画素の色(画素値)を抽出する。例えば、パターンフラグが1の場合は、右上の画素の色を第2色として抽出する。また、パターンフラグが8〜Dの場合は、色数3で、左上の画素の色(画素値)を第1色として抽出し、更に、各パターンフラグに応じて定義されている第2色および第3色(2番目、3番目の色データ)が存在する位置の画素の色(画素値)を抽出する。例えば、パターンフラグが8の場合は、右上の画素の色(画素値)を第2色として抽出し、右下の画素の色(画素値)を第3色として抽出する。また、パターンフラグがEの場合は、左上の画素の色を第1色、右上の画素の色を第2色、左下の画素の色を第3色、右下の画素の色を第4色として抽出する。すなわち、パターンフラグ(または比較結果)に基づいて、ブロックの色数が特定され(S605、S607、S609)、それぞれに応じたパターンフラグと色データとを出力する(S606、S608、S610、S611)。   In the example using this 2 × 2 pixel block, there are 15 patterns that can appear from color matching in 4 pixels, and therefore, as shown in FIG. A flag is specified (S603). Next, the number of colors appearing in the four pixels and the color data are extracted (S604). As shown in FIG. 7, since each pattern indicating the arrangement of each color in a block is associated with a 4-bit pattern flag (that is, a 6-bit comparison result), the number of colors and colors in each block Data can be identified. In FIG. 4 of the present embodiment, it is defined that the color (pixel value) of the upper left pixel is the first color (first color data) in all patterns. Accordingly, when the pattern flag is 0, the color (pixel value) of the upper left pixel is extracted as the first color with the number of colors of 1. If the pattern flag is 1 to 7, the number of colors is 2 and the color (pixel value) of the upper left pixel is extracted as the first color, and further, the second color defined according to each pattern flag ( The color (pixel value) of the pixel at the position where the (second color data) exists is extracted. For example, when the pattern flag is 1, the color of the upper right pixel is extracted as the second color. When the pattern flag is 8 to D, the number of colors is 3 and the color (pixel value) of the upper left pixel is extracted as the first color, and further, the second color defined according to each pattern flag and The color (pixel value) of the pixel at the position where the third color (second and third color data) exists is extracted. For example, when the pattern flag is 8, the color (pixel value) of the upper right pixel is extracted as the second color, and the color (pixel value) of the lower right pixel is extracted as the third color. When the pattern flag is E, the color of the upper left pixel is the first color, the color of the upper right pixel is the second color, the color of the lower left pixel is the third color, and the color of the lower right pixel is the fourth color. Extract as That is, based on the pattern flag (or comparison result), the number of colors of the block is specified (S605, S607, S609), and the pattern flag and color data corresponding to each are output (S606, S608, S610, S611). .

図8は、図6のフローチャートを補足説明するための図である。図8を用いて、ここで出力されるデータを説明する。図8に示すように、例えばパターンフラグが0(すなわち4画素内が1色で構成されている)の場合には(S605でYES)、2色目以降は存在しないので、パターンフラグの4ビットと1色目の画素値(24ビット分の色データ)とを出力する(S606)。また、パターンフラグが1〜7(すなわち2色)の場合(S607でYES)には、その2色目が存在する画素の座標をパターンフラグより算出し、パターンフラグの4ビットと2色分の画素値(48ビット分の色データ)を出力する(S608)。出力データは、パターンフラグに続いて第1色目の画素値、第2色目の画素値の順で構成される。また、パターンフラグが8〜D(すなわち3色)の場合(S609でYES)、パターンフラグの4ビットと3色分の画素値(72ビット分の色データ)とを出力する(S610)。そして、パターンフラグがE(すなわち4色)の場合(S609でNO)、パターンフラグの4ビットと4色分の画素値(96ビット分の色データ)とを出力する(S611)。言い換えると、各ブロックから出力される色データは、ブロック内の座標(左上、右上、左下、右下の順に1、2、3、4)順に走査した場合に、ブロック内で出現していなかった色データが第1色から順に出力されることに相当する。   FIG. 8 is a diagram for supplementarily explaining the flowchart of FIG. 6. The data output here will be described with reference to FIG. As shown in FIG. 8, for example, when the pattern flag is 0 (that is, the inside of the four pixels is composed of one color) (YES in S605), the second and subsequent colors do not exist. The pixel value of the first color (24-bit color data) is output (S606). If the pattern flag is 1 to 7 (that is, two colors) (YES in S607), the coordinates of the pixel where the second color exists are calculated from the pattern flag, and the four bits of the pattern flag and the pixels for two colors A value (color data for 48 bits) is output (S608). The output data is configured in the order of the pixel value of the first color and the pixel value of the second color following the pattern flag. If the pattern flag is 8 to D (that is, three colors) (YES in S609), 4 bits of the pattern flag and pixel values for three colors (72-bit color data) are output (S610). If the pattern flag is E (that is, 4 colors) (NO in S609), 4 bits of the pattern flag and pixel values for 4 colors (96-bit color data) are output (S611). In other words, the color data output from each block did not appear in the block when scanned in the order of the coordinates in the block (upper left, upper right, lower left, lower right in the order 1, 2, 3, 4). This corresponds to output of color data in order from the first color.

このように、2×2画素のブロック内の4色(96ビット)の入力データを4ビットのパターンフラグと、そこに存在する色数分だけ画素値を出力することで、比較的簡単な処理で出力データ量を削減することが可能になる。特に、2×2画素のブロック内で同色の画素が存在するブロック(すなわち各ブロック内の色数が少ないブロック)が多いラスタ画像の場合は、出力されるデータ量の圧縮率も大きくなる。また、パターンフラグを参照することで、そのブロック内の色数を特定することが可能になる。このような処理を画像ブロック全てに対して行うことで、画像データ全体を圧縮することが可能になる。   Thus, relatively simple processing is possible by outputting the input data of 4 colors (96 bits) in the block of 2 × 2 pixels to the 4-bit pattern flag and the pixel values corresponding to the number of colors existing there. This makes it possible to reduce the amount of output data. In particular, in the case of a raster image having a large number of blocks having the same color pixel in a 2 × 2 pixel block (that is, a block having a small number of colors in each block), the compression rate of the output data amount is also increased. Also, by referring to the pattern flag, the number of colors in the block can be specified. By performing such processing for all image blocks, the entire image data can be compressed.

図6の処理フローにおいて、最後に、図3に示したページ単位のラスタ画像データの中に2×2画素の次のブロックが存在するかを確認する。ここで、存在するならば(S612でYes)、次のブロックに対して図8に示した入力データから出力データへの変換を繰り返し(S601〜S611)、存在しなければ(S612でNo)、ページ単位の圧縮処理を終了する。   In the processing flow of FIG. 6, finally, it is confirmed whether or not the next block of 2 × 2 pixels exists in the page-unit raster image data shown in FIG. 3. Here, if it exists (Yes in S612), the conversion from the input data to the output data shown in FIG. 8 is repeated for the next block (S601 to S611), and if it does not exist (No in S612), Ends the compression process for each page.

次に、本実施形態の特徴であるラスタ画像データの減色圧縮処理を詳細に説明する。減色圧縮処理では、ブロック内の画素が数レベルの違いしかないのであれば同色と見なして、各ブロックで減色処理を行うことで、4色と判断されるブロックを減らし、圧縮率の向上を図る。   Next, raster image data color reduction compression processing, which is a feature of this embodiment, will be described in detail. In subtractive color compression processing, if there are only a few levels of pixels in a block, it is regarded as the same color, and by performing subtractive color processing in each block, the number of blocks judged to be four colors is reduced, and the compression rate is improved. .

図9は、画像圧縮部212、252で実行されるS506の減色圧縮処理を詳細に説明するフローチャートである。図9を用いて、各ブロックの減色処理を行った後、前述したように2×2画素の取りうる組み合わせを踏まえて、画像圧縮を行う処理を説明する。   FIG. 9 is a flowchart for explaining in detail the color-reduction compression processing of S506 executed by the image compression units 212 and 252. Using FIG. 9, after performing the color reduction processing for each block, the processing for image compression will be described based on the possible combinations of 2 × 2 pixels as described above.

まず、処理対象となる2×2画素のブロックを入力し(S901)、4画素の画素値から1色へと減色処理を行う(S902)。ここでは、例えば4画素の平均画素値を算出することで1色への減色を実現する。つまり、その減色した画素値と入力の4画素の画素値との差分を算出し(S903)、誤差の大小を判定する(S904)。例えば、入力された各画素の画素値と減色後のRGB値との差の絶対値の和を取り、その値が閾値以下である場合には差が小さいと判断できる。差が小さいということは、そのブロック内での画素が数レベルの違いしかないので、同色とみなすことができる。従って、差が小さいと判定された場合には(S904でYes)、1色に減色すると判断し、減色処理を適用したことを示す減色フラグを生成する(S905)。その後、パターンフラグを0に特定し(S906)、その減色した1色の画素値とパターンフラグを出力する(S907)。   First, a 2 × 2 pixel block to be processed is input (S901), and a color reduction process is performed from a pixel value of 4 pixels to one color (S902). Here, for example, a color reduction to one color is realized by calculating an average pixel value of four pixels. That is, the difference between the pixel value after the color reduction and the pixel values of the four input pixels is calculated (S903), and the magnitude of the error is determined (S904). For example, the absolute value of the difference between the input pixel value of each pixel and the RGB value after color reduction is taken, and if the value is less than or equal to the threshold value, it can be determined that the difference is small. If the difference is small, the pixels in the block can be regarded as the same color because there are only a few levels of difference. Therefore, if it is determined that the difference is small (Yes in S904), it is determined that the color is reduced to one color, and a color reduction flag indicating that the color reduction processing is applied is generated (S905). Thereafter, the pattern flag is specified as 0 (S906), and the pixel value and pattern flag of the reduced color are output (S907).

また、誤差が大きいと判定された場合には(S904でNo)、続いて2色へ減色処理を行う(S908)。ここでは、例えば4画素のうちRGB値の差が最も大きい2画素A、Bを抽出し、残りの2画素がA、Bどちらに近いかでクラスタリングし、その各クラスタにおいて平均値を求めることで、2色化する。そして、その2色化した画素値と入力の4画素の画素値との差分を計算し(S909)、誤差の大小を判定する(S910)。すなわち、各クラスタの平均値とそのクラスタリングに用いた各画素との差をそれぞれ算出して絶対値の和を取り、その値が閾値以下である場合には差が小さいと判定する。ここで、差が小さいと判定された場合には(S910でYes)、2色に減色すると判断し、減色処理を適用したことを示す減色フラグを生成する(S911)。その後、2色に減色した場合の画素値の位置に応じてパターンフラグを特定し(S912)、減色した2色の画素値とパターンフラグとを出力する(S913)。   If it is determined that the error is large (No in S904), then color reduction processing is performed to two colors (S908). Here, for example, two pixels A and B having the largest RGB value difference among the four pixels are extracted, clustered according to whether the remaining two pixels are closer to A or B, and an average value is obtained in each cluster. Two colors. Then, the difference between the two-colored pixel value and the input four pixel values is calculated (S909), and the magnitude of the error is determined (S910). That is, the difference between the average value of each cluster and each pixel used for the clustering is calculated to calculate the sum of the absolute values. If the value is equal to or smaller than the threshold value, it is determined that the difference is small. If it is determined that the difference is small (Yes in S910), it is determined that the color is reduced to two colors, and a color reduction flag indicating that the color reduction processing is applied is generated (S911). Thereafter, a pattern flag is specified according to the position of the pixel value when the color is reduced to two colors (S912), and the pixel value of the two colors and the pattern flag are output (S913).

また、ここでも誤差が大きいと判定された場合には(S910でNo)、続いて3色への減色処理を行う(S914)。ここでは、例えば4画素のうち最もRGB値の差の小さい2画素を抽出し、その2画素の値の平均値を求め、それ以外の2画素の画素値と合わせて3色へ減色する。そして、その3色化した画素値と入力の4画素の画素値との差分を計算し(S915)、誤差の大小を判定する(S916)。なお、平均値に用いた2画素以外の2画素については、入力画素と同じ画素値となるので、RGB値の差の小さい2画素の平均値と、その2画素の各画素値の差分によって誤差の大小を判定する。
判定した結果、差が小さいと判定された場合には(S916でYes)、3色に減色すると判断し、減色処理を適用したことを示す減色フラグを生成する(S917)。その後、3色に減色した場合の画素値の位置に応じてパターンフラグを特定し(S918)、減色した3色の画素値とパターンフラグを出力する(S919)。
If it is determined that the error is also large here (No in S910), then a color reduction process to three colors is performed (S914). Here, for example, two pixels having the smallest difference in RGB values are extracted from the four pixels, an average value of the values of the two pixels is obtained, and the colors are reduced to three colors together with the pixel values of the other two pixels. Then, the difference between the pixel values of the three colors and the pixel values of the input four pixels is calculated (S915), and the magnitude of the error is determined (S916). Since two pixels other than the two pixels used for the average value have the same pixel value as the input pixel, an error is caused by the difference between the average value of the two pixels having a small RGB value difference and the respective pixel values of the two pixels. Determine the size of.
If it is determined that the difference is small (Yes in S916), it is determined that the color is reduced to three colors, and a color reduction flag indicating that the color reduction processing is applied is generated (S917). After that, the pattern flag is specified according to the position of the pixel value when the color is reduced to three colors (S918), and the pixel value and the pattern flag of the reduced color are output (S919).

更に、ここでも誤差が大きいと判定された場合には(S916でNo)、減色すると視覚的に問題が出るブロックと判断し、減色フラグを生成することなくパターンフラグをEに特定し(S920)、4画素全ての画素値とパターンフラグを出力する(S921)。   If it is determined that the error is large again (No in S916), it is determined that the block is visually problematic when the color is reduced, and the pattern flag is specified as E without generating a color reduction flag (S920). The pixel values and pattern flags of all four pixels are output (S921).

図9の処理フローにおいて、最後に、図3に示したページ単位のラスタ画像データの中に2×2画素の次のブロックが存在するかを確認する。ここで、存在するならば(S922でYes)、図8に示した入力データから出力データへの変換を繰り返し(S901〜S921)、存在しなければ(S922でNo)、ページ単位の減色圧縮処理を終了する。このように、図9の処理においては、ある解像度のページ単位の画像データにおいて、いずれかのブロックで減色処理が行われた場合には減色フラグが生成されることになる。   In the processing flow of FIG. 9, finally, it is confirmed whether or not the next block of 2 × 2 pixels exists in the page-unit raster image data shown in FIG. Here, if it exists (Yes in S922), the conversion from the input data to the output data shown in FIG. 8 is repeated (S901 to S921). If it does not exist (No in S922), the color-reduction compression processing in units of pages. Exit. As described above, in the process of FIG. 9, a color reduction flag is generated when color reduction processing is performed in any block in image data in a page unit with a certain resolution.

次に、このようにして求めたパターンフラグと色データとを、DMAC213、253がメモリに書き込む処理(メモリ格納処理)を行う。このとき、DMACではパターンフラグと、第1色のデータと、第2色、第3色、及び第4色のデータと、の書き込み位置を変える。DMACにはパターンフラグ書き込みのためのメモリ先頭アドレスと、第1色データの書き込みのためのメモリ先頭アドレスと、第2色以降のデータの書き込みのためのメモリ先頭アドレスの3つのアドレスを指定する。すなわち、各ブロックのパターンフラグはメモリ上のパターンフラグ格納部(パターンフラグを格納するためのメモリ領域)にまとめて格納されることになる。また、各ブロックの第1色(1色目)の色データ(色データの集合データ)は、メモリ上の第1色格納部(各ブロックの1色目の色データを格納するためのメモリ領域)にまとめて格納されることになる。更に、各ブロックの第2〜4色目の色データは、メモリ上の第2、3、4色格納部(各ブロックの2〜4色目の色データを格納するためのメモリ領域)にまとめて格納されることになる。上記に加え、当該データに対応付けられた減色情報として、減色フラグをメモリ空間上あるいはハードウェアレジスタとして別途保持する。   Next, a process (memory storing process) in which the DMACs 213 and 253 write the pattern flag and color data obtained in this way into the memory is performed. At this time, the DMAC changes the writing positions of the pattern flag, the first color data, and the second color, third color, and fourth color data. The DMAC designates three addresses: a memory start address for writing a pattern flag, a memory start address for writing first color data, and a memory start address for writing data for the second and subsequent colors. That is, the pattern flags of each block are stored together in a pattern flag storage unit (memory area for storing pattern flags) on the memory. Also, the color data (color data set data) of the first color (first color) of each block is stored in a first color storage unit (memory area for storing the first color data of each block) on the memory. They are stored together. Further, the color data of the second to fourth colors of each block are collectively stored in the second, third and fourth color storage units (memory areas for storing the second to fourth color data of each block) on the memory. Will be. In addition to the above, as a color reduction information associated with the data, a color reduction flag is separately stored in a memory space or as a hardware register.

図10は、DMACによる画像データのメモリ空間への書き込み例を示す図である。なお、サイズがM×N画素のRGB各色8ビットの画像を圧縮部へ入力する場合、パターンフラグのデータが格納されるパターンフラグ格納部のデータサイズは、(M×N×4/8)/4バイトとなる。また、第1色のデータが格納される第1色格納部のデータサイズは、(M×N×24/8)/4バイトとなる。なお、4で除算している理由は、パターンフラグや第1色格納部は2×2画素のブロック毎に用意してあればよいからである。また、第2色、第3色、第4色のデータが格納される第2、3、4色格納部のデータサイズは、処理対象となるラスタ画像データに応じて異なる。これは、第2、3、4色が存在するブロック数が画像によって異なるためである。   FIG. 10 is a diagram showing an example of writing image data in the memory space by the DMAC. Note that when an 8-bit RGB image having a size of M × N pixels is input to the compression unit, the data size of the pattern flag storage unit in which pattern flag data is stored is (M × N × 4/8) / 4 bytes. Further, the data size of the first color storage unit in which the first color data is stored is (M × N × 24/8) / 4 bytes. The reason for dividing by 4 is that the pattern flag and the first color storage unit need only be prepared for each block of 2 × 2 pixels. The data sizes of the second, third, and fourth color storage units that store the second, third, and fourth color data differ depending on the raster image data to be processed. This is because the number of blocks in which the second, third, and fourth colors exist differs depending on the image.

ここで、図10に示すように、第1色書き込み先頭アドレス以降のメモリ領域(第1色格納部、および第2、3、4色格納部)に関しては、画素の色データがそのままのビット数で格納されることを利用して、圧縮データに対する画像処理が可能になる。すなわち、JPEG等の圧縮データとは異なり、圧縮データをデコードしてラスタ画像データに戻さなくても、各画素の色(画素値)を特定することができる。したがって、1画素入力1画素出力で完結する色処理、例えばLUTを用いた色変換やガンマ補正処理、行列演算を用いた色空間変換処理等を行う場合は、元のラスタ画像データに戻さずに、図8のように格納された画像データを直接処理することができる。図2に示した色処理部262で画素単位の画像処理を行う場合は、メモリ202上の第1色書き込み先頭アドレス以降の画素データをDMAC261経由で読み込み、画素単位での処理を済ませた後に、メモリ202上へ書き戻す。このとき、何らかの画素単位処理によって画素のビット数が変わらない場合には、メモリ202上の同じ場所へ上書きすることでメモリ202の節約も可能である。このように、圧縮データを直接用いることで、メモリバス上の転送効率が向上し、かつオリジナルのラスタ画像データの画素数よりも少ない数の色データに対して処理することになり、高速な処理が可能になる。   Here, as shown in FIG. 10, regarding the memory area (first color storage unit, and second, third, fourth, and fourth color storage units) after the first color write start address, the number of bits in which the color data of the pixel remains as it is. It is possible to perform image processing on the compressed data by using the stored data. That is, unlike compressed data such as JPEG, the color (pixel value) of each pixel can be specified without decoding the compressed data and returning it to raster image data. Therefore, when color processing that is completed with one pixel input and one pixel output, for example, color conversion using LUT, gamma correction processing, color space conversion processing using matrix operation, etc., is performed without returning to the original raster image data. The image data stored as shown in FIG. 8 can be directly processed. When the color processing unit 262 shown in FIG. 2 performs image processing in units of pixels, pixel data after the first color write start address on the memory 202 is read via the DMAC 261, and processing in units of pixels is completed. Write back to the memory 202. At this time, if the number of bits of the pixel does not change due to some pixel unit processing, the memory 202 can be saved by overwriting the same location on the memory 202. As described above, by directly using the compressed data, the transfer efficiency on the memory bus is improved, and processing is performed on a smaller number of color data than the number of pixels of the original raster image data. Is possible.

また、図10に示すように、画像データをパターンフラグと第1色とその他の色とに分け、離散的にメモリ上へ格納していることを利用して、第1色として保持されている低解像度の画像データをそのまま利用することが可能になる。これは例えば、MFPで蓄積したPDL画像データやスキャン画像データのプレビュー表示、ネットワーク送信などの機能を実現する際に利用可能である。具体的には、第1色格納部には、ラスタ画像データを2×2画素のブロックに分割して、各ブロックの左上の座標の画素をサンプリングした場合の画素値(色データ)がメモリ上に連続して存在することになる。したがって、例えば、プリント解像度が600dpiであったとしても、プレビューや送信時に300dpiやそれ以下で十分な場合に、300dpiの画像データをそのまま利用することが可能になる。このように、縮小されたラスタ画像データを得る必要がある場合には、第1色格納部に格納されている第1色の色データのみをまとめて抽出することで、簡単に半分のサイズのラスタ画像データを得ることができる。   Further, as shown in FIG. 10, the image data is divided into a pattern flag, a first color, and other colors and is stored as a first color by using the fact that they are discretely stored in the memory. Low resolution image data can be used as it is. This can be used, for example, when realizing functions such as preview display of PDL image data and scan image data stored in the MFP, network transmission, and the like. Specifically, the first color storage unit stores the pixel value (color data) in the memory when the raster image data is divided into blocks of 2 × 2 pixels and the pixel at the upper left coordinate of each block is sampled. Will be present continuously. Therefore, for example, even if the print resolution is 600 dpi, 300 dpi image data can be used as it is when previewing or transmitting at 300 dpi or less is sufficient. As described above, when it is necessary to obtain reduced raster image data, only the color data of the first color stored in the first color storage unit is extracted at a time, so that half the size can be easily obtained. Raster image data can be obtained.

更に、図10に示すように、画像データをパターンフラグと第1色とその他の色とに分け、離散的にメモリ上へ格納していることを利用して、必要最小限のメモリアクセスによって所望の解像度(画像サイズ)の画像データを生成することが可能になる。一例として、600dpiのラスタ画像データが図8のようなデータに変換されて蓄積されていた場合の縮小送信時について説明する。送信する画像の解像度として300dpiが指定された場合は、第1色格納部に格納されているデータをそのまま抽出して送信すればよい。また、解像度として400dpiなど、第1色格納部にサンプリングされている300dpiより大きい解像度が指定されている場合には、次のように処理する。すなわち、パターンフラグ格納部と第1色格納部と第2、3、4色格納部とに格納されているデータに基づき、圧縮データを一度展開し、公知の変倍処理を用いて変倍し、当該変倍された画像を送信する。また、300dpiより小さい送信解像度指定がされている場合には、第1色格納部のデータのみを用いて、指定の解像度へ変倍処理を行う。このように、必要な画像サイズに応じて切り替えながらデータの読み込みを行うようにすればよい。   Furthermore, as shown in FIG. 10, the image data is divided into pattern flags, first colors, and other colors, and is stored discretely on the memory. It is possible to generate image data having a resolution (image size) of. As an example, a description will be given of reduced transmission when 600 dpi raster image data is converted into data as shown in FIG. 8 and stored. When 300 dpi is specified as the resolution of the image to be transmitted, the data stored in the first color storage unit may be extracted as it is and transmitted. If a resolution greater than 300 dpi sampled in the first color storage unit, such as 400 dpi, is designated, the following processing is performed. That is, based on the data stored in the pattern flag storage unit, the first color storage unit, and the second, third, and fourth color storage units, the compressed data is expanded once and scaled using a known scaling process. Then, the scaled image is transmitted. If transmission resolution less than 300 dpi is specified, scaling processing is performed to the specified resolution using only the data in the first color storage unit. In this way, data can be read while switching according to the required image size.

このように、オリジナルの1/2サイズの画像を得ることができるのであれば、その画像を入力として再度圧縮を行うことも可能である。また、入力の画像データが高解像度になればなるほどそのサンプリング後の縮小画像には冗長性が残っており、多段で圧縮処理を行うことが可能になりまたそのときの圧縮率も十分期待できる。   In this way, if an original half-size image can be obtained, it is also possible to perform compression again using the image as an input. Further, the higher the resolution of the input image data, the more redundant the sampled reduced image remains, and the compression process can be performed in multiple stages, and the compression rate at that time can be expected sufficiently.

次に、画像圧縮部212、252と対になる画像伸張部222、232を説明する。なお、画像伸張部222、232では、上述したようなパターンフラグと色データを、ラスタ画像データへ戻す処理を行う。メモリ202上に図10に示すように配置されている圧縮データのパターンフラグ書き込み先頭アドレス、第1色書き込み先頭アドレス、及び第2、3、4色書き込み先頭アドレスの3つのアドレスをDMAC221、231へ指定する。DMAC221、231は3つのアドレスからデータを読み出し、画像伸張部222、232へ転送する。   Next, the image expansion units 222 and 232 that are paired with the image compression units 212 and 252 will be described. Note that the image decompression units 222 and 232 perform processing for returning the pattern flag and color data as described above to raster image data. The compressed data pattern flag write start address, first color write start address, and second, third and fourth color write start addresses of the compressed data arranged on the memory 202 as shown in FIG. specify. The DMACs 221 and 231 read data from three addresses and transfer them to the image decompression units 222 and 232.

画像伸張部222、232では、まず4ビットのパターンフラグを解釈し、そのブロック内の色数を算出する。第1色データに加え、色数に応じて第2、3、4色データを読み出し、図6に示した各パターンフラグに対して予め定義されている色データの配置パターンにしたがって、第1色ならびに第2〜4色の色データを再配置する。このようにすることで、2×2画素ブロックを展開、復号する。   The image expansion units 222 and 232 first interpret the 4-bit pattern flag and calculate the number of colors in the block. In addition to the first color data, the second, third, and fourth color data are read according to the number of colors, and the first color is determined according to the color data arrangement pattern defined in advance for each pattern flag shown in FIG. In addition, the color data of the second to fourth colors are rearranged. In this way, the 2 × 2 pixel block is expanded and decoded.

また、画像伸張部222、232で画像サイズを1/2にする場合には、前述したように、パターンフラグと2、3、4色データを必要としないので、DMAC221、231には第1色書き込み先頭アドレスのみ指定する。これにより、メモリ202から第1色データのみの読み込みが行われ、画像が構成される。このように処理することで、メモリバスの帯域を節約することが可能になる。   In addition, when the image size is reduced to 1/2 by the image expansion units 222 and 232, the pattern flag and the 2, 3, and 4 color data are not required as described above. Specify only the write start address. As a result, only the first color data is read from the memory 202 to form an image. By processing in this way, it becomes possible to save the bandwidth of the memory bus.

以上述べたように、第1の実施形態によれば、比較的単純な圧縮方式でメモリ容量やメモリバス帯域の節約が可能になるだけでなく、画素単位での画像処理や縮小変倍を行う場合の処理負荷も削減することが可能になる。   As described above, according to the first embodiment, not only can a memory capacity and a memory bus band be saved by a relatively simple compression method, but also image processing and reduction scaling are performed on a pixel basis. In this case, the processing load can be reduced.

なお、第1の実施形態は、色データの配置を示すブロックのパターンとパターンフラグとを図7のように対応付けたが、本発明をこれに限定するものではない。例えば、2×2画素ブロックの右下画素の画素値が第1色となるように、色データの配置を示すパターンとパターンフラグとを対応付けて予め定義しても構わない。また、第1の実施形態では、ブロックのサイズとして2×2画素のサイズを用いて説明してきたが、本発明をこれに限定するものではない。また、圧縮の説明の際に画像データとしてRGB8ビットを例に説明してきたが、CMYKの色空間の画像データやGRAYスケールの画像データ、或いは各色成分が8ビット以外のビット数を持つ画像データであっても良い。   In the first embodiment, the block pattern indicating the arrangement of the color data and the pattern flag are associated as shown in FIG. 7, but the present invention is not limited to this. For example, a pattern indicating the arrangement of color data and a pattern flag may be defined in advance so that the pixel value of the lower right pixel of the 2 × 2 pixel block is the first color. Further, in the first embodiment, the description has been given using the 2 × 2 pixel size as the block size, but the present invention is not limited to this. In the description of compression, the description has been given by taking RGB 8 bits as an example of image data. However, image data in CMYK color space, GRAY scale image data, or image data in which each color component has a bit number other than 8 bits. There may be.

また第1の実施形態で説明した減色処理による非可逆圧縮の方法は一例であり、他の公知の減色処理を用いて実施することも可能である。例えば、公知の色差を求める別の手法で代替することも可能である。   Further, the irreversible compression method by the color reduction process described in the first embodiment is an example, and can be implemented by using another known color reduction process. For example, it can be replaced by another method for obtaining a known color difference.

また、圧縮の段数についてもたとえば2段階、3段階など複数回繰り返し圧縮することができる。   Further, the number of compression stages can be repeatedly compressed a plurality of times, for example, in two stages and three stages.

これまで説明してきたようにMFPにおいては画像の入力手段として、スキャナを用いたものやネットワークからのものなど多岐にわたり、その解像度もさまざまである。またその用途によっても種類が増える。例えば同じスキャナからの入力であっても、コピー用途のスキャンであれば600dpiといった比較的高い解像度となるが、ネットワークの送信やFAXであれば300dpiやそれ以下であることもある。また、PDLの入力であればそのプリンタ解像度に応じてドライバからユーザーが複数選択可能であり、通常600dpiや1200dpiや2400dpiなどが選べる。   As described so far, MFPs have a wide variety of image input means, such as those using a scanner and those from a network, with various resolutions. There are also more types depending on the application. For example, even if the input is from the same scanner, the resolution is relatively high at 600 dpi for scanning for copying, but it may be 300 dpi or less for network transmission or FAX. In addition, if the input is PDL, a plurality of users can select from the driver according to the printer resolution, and normally 600 dpi, 1200 dpi, 2400 dpi, and the like can be selected.

このように、さまざまな解像度に応じて圧縮時の圧縮段数を切り替え最適化させることで、処理速度やデータサイズ、画質を最適化させることが可能になる。   As described above, it is possible to optimize the processing speed, the data size, and the image quality by switching and optimizing the number of compression stages at the time of compression according to various resolutions.

例えば、PDLの場合、ワープロソフトで作成されたドキュメントを1200dpiでプリントする場合に対し2400dpiでプリントする場合では画像サイズが4倍になる。しかし、実際のコンテンツは同じものであり、2400dpiの画像データには1200dpiの画像データに対して冗長性が高い。そのため、2400dpiの画像が入力の場合には3段の圧縮処理を行って300dpiまで圧縮し、1200dpiの画像の場合には2段の圧縮処理を行って300dpiまで圧縮する。圧縮回数が多いことで画質の劣化やパフォーマンスに差は生まれるが、通常前述したように2400dpiのような高解像度の画像データは冗長性が高いため、同じPDLデータであればこの両者でそれほどデータサイズに差は生まれない。   For example, in the case of PDL, when a document created with word processing software is printed at 1200 dpi, the image size is quadrupled when printed at 2400 dpi. However, the actual contents are the same, and the 2400 dpi image data is more redundant than the 1200 dpi image data. Therefore, when a 2400 dpi image is input, a three-stage compression process is performed to compress it to 300 dpi, and for a 1200 dpi image, a two-stage compression process is performed to compress it to 300 dpi. Although there are differences in image quality degradation and performance due to the large number of compressions, high-resolution image data such as 2400 dpi is usually highly redundant as described above. No difference is born.

同様に、スキャンの場合、1200dpiであれば2段、600dpiであれば1段の圧縮処理で300dpiまで圧縮するなど、その入力解像度に応じて圧縮の段数を切り替えることにより、データサイズとパフォーマンスの最適化を行うことが可能になる。   Similarly, in the case of scanning, the data size and performance are optimized by switching the number of compression stages according to the input resolution, such as compressing up to 300 dpi with 2 stages for 1200 dpi and 1 stage for 600 dpi. Can be performed.

[第2の実施形態]
次に、図面を参照しながら第2の実施形態を詳細に説明する。第2の実施形態では、前述した実施形態におけるラスタ画像データの圧縮処理で、画像データに対するランダムアクセス性を高めたものである。なお、第2の実施形態でも、画像処理装置として、第1の実施形態と同様に、MFPを例に説明する。
[Second Embodiment]
Next, the second embodiment will be described in detail with reference to the drawings. In the second embodiment, the raster image data compression process in the above-described embodiment improves the random accessibility to the image data. Note that in the second embodiment as well, the image processing apparatus will be described by taking an MFP as an example, as in the first embodiment.

前述したように、第1の実施形態で説明した圧縮処理は画像データに依存し、その圧縮データサイズが変わる可変長圧縮処理である。そのため、圧縮データに対してのランダムアクセス性はなく、圧縮画像データの一部(例えば、一部のオブジェクト)だけを切り出して処理するなどといった目的には向かない。   As described above, the compression process described in the first embodiment is a variable-length compression process that depends on image data and changes its compressed data size. Therefore, there is no random accessibility to the compressed data, and it is not suitable for the purpose of cutting out and processing only a part (for example, some objects) of the compressed image data.

そこで、図11のフローチャートを用いて、第1の実施形態で説明した方法よりもランダムアクセス性を高めることに着目した圧縮方法を詳細に説明する。まず、図12に示すページ単位でラスタ画像データを入力する(S1101)。そして、画像データのページ単位に1画素のページ背景画素を設定する(S1102)。これは圧縮処理時の初期記憶ブロックとして用いるための画素データで、通常白(RGB各色8ビット画像であれば255、CMYK画像であれば0)が用いられる。次に、圧縮部の入力となる画像データを所定の大きさのブロックへ分割する(S1103)。第2の実施形態では、32×32画素とする。以下の説明では、これまでの2×2画素のブロックと区別するために、この複数ブロックで構成される矩形領域のことを「タイル」と呼ぶ。図12に示すように、1つのタイル中には、2×2画素ブロックが16×16個存在することになる。   Therefore, a compression method that focuses on improving random accessibility as compared with the method described in the first embodiment will be described in detail with reference to the flowchart of FIG. First, raster image data is input in units of pages shown in FIG. 12 (S1101). Then, one page background pixel is set for each page of image data (S1102). This is pixel data to be used as an initial storage block at the time of compression processing, and normally white (255 for 8-bit RGB color images, 0 for CMYK images) is used. Next, the image data to be input to the compression unit is divided into blocks of a predetermined size (S1103). In the second embodiment, the pixel size is 32 × 32 pixels. In the following description, in order to distinguish from the conventional 2 × 2 pixel block, the rectangular area composed of the plurality of blocks is referred to as a “tile”. As shown in FIG. 12, there are 16 × 16 2 × 2 pixel blocks in one tile.

次に、タイルに所定の固定長のヘッダ情報を付与する(S1104)。このヘッダ情報は、ページID、タイル座標、色空間、画素データのビット数、タイルのデータサイズ、属性情報の有無、圧縮フラグ等に減色フラグを加えた情報である。ここで、ページIDは、ページ単位に付与されるユニークなID番号である。タイル座標は、このタイルがページ単位のラスタ画像上どの位置にあるかを示す座標情報である。ここには、X座標とY座標の2次元で座標が記述される。色空間は、このタイルが、RGB画像なのかCMYK画像なのかGRAY−SCALE画像なのかを識別するための識別子を示す情報である。画素データのビット数は、タイル内の1画素当たりのビット長を示す情報である。データサイズは、このタイルの第1色のデータサイズと第2、3、4色のデータのデータサイズとを示すバイト単位の情報である。属性情報の有無は、画像データに文字や写真といった属性情報が画素単位で付与されているか否かを示す情報である。圧縮フラグは、このタイルが圧縮されたデータか、非圧縮のデータかまたそのとき何段回の圧縮が施されているかを示すフラグ(またはカウンタ)の情報である。減色フラグは、このタイルが減色処理を適用されたデータか、適用されていないデータか、適用された場合にはどれくらい(例えば何回)適用されたかを示すフラグの情報である。なお、この減色フラグに関しては、以降の実施形態においても後述する。   Next, predetermined fixed-length header information is assigned to the tile (S1104). This header information is information obtained by adding a color reduction flag to a page ID, tile coordinates, color space, number of bits of pixel data, tile data size, presence / absence of attribute information, compression flag, and the like. Here, the page ID is a unique ID number assigned to each page. The tile coordinate is coordinate information indicating where the tile is located on the raster image in page units. Here, coordinates are described in two dimensions, an X coordinate and a Y coordinate. The color space is information indicating an identifier for identifying whether the tile is an RGB image, a CMYK image, or a GRAY-SCALE image. The number of bits of pixel data is information indicating the bit length per pixel in the tile. The data size is information in byte units indicating the data size of the first color of the tile and the data size of the second, third, and fourth color data. The presence / absence of attribute information is information indicating whether or not attribute information such as characters and photographs is added to the image data in units of pixels. The compression flag is flag (or counter) information indicating whether the tile is compressed data, non-compressed data, and how many times compression is performed at that time. The subtractive color flag is flag information indicating whether the tile is applied with the subtractive color process, is not applied data, or how many times (for example, how many times) the tile is applied. This color reduction flag will be described later in the following embodiments.

次に、タイル単位で減色情報である減色フラグを参照し、減色フラグに基づいて当該タイルを減色圧縮処理するか圧縮処理するかを切り替えて実行し、これをタイル単位で所望の解像度(画像サイズ)になるまで繰り返す(S1105〜S1109)。この一連の圧縮処理は、第1の実施形態で図5を用いて説明した圧縮処理(S504〜S508)と同様であり、その説明は割愛する。   Next, with reference to the color reduction flag, which is the color reduction information in tile units, the tile is subjected to switching between color reduction compression processing and compression processing based on the color reduction flag, and this is executed for each tile in a desired resolution (image size). ) Is repeated until (S1105 to S1109). This series of compression processing is the same as the compression processing (S504 to S508) described with reference to FIG. 5 in the first embodiment, and the description thereof is omitted.

そして、上述の結果を受けて圧縮されたタイルデータを、当該タイルのヘッダ情報と一緒に1つのデータにパッキングする(S1110)。このパッキングされたデータのデータ構造を図13に示す。これ以降、上述のヘッダ部分を含むデータの単位を「パケット」と呼ぶ。このようなパケットにするには、タイル単位で圧縮処理が終了し、データサイズが確定した後、第1色格納部と第2、3、4色格納部の間を詰めた状態でデータをパッキングする。すなわち、ヘッダと、前述したパターンフラグ格納部と、第1色格納部と第2、3、4色格納部とがタイル単位でパケットとしてデータ形成される。その後、DMACを経由してメモリ上へ出力する。次に、このパケットの座標とサイズとをリストとして列挙し、パケット管理テーブルとして作成(更新)する(S1111)。このパケット管理テーブルの一例を図14に示す。上述の処理を最後のタイルまで繰り返すことで(S1112でYES)、ページ単位のラスタ画像の圧縮処理を終了する。   Then, the tile data compressed in response to the above result is packed into one data together with the header information of the tile (S1110). The data structure of the packed data is shown in FIG. Hereinafter, a data unit including the above-described header portion is referred to as a “packet”. In order to make such a packet, after the compression process is completed for each tile and the data size is determined, the data is packed with the space between the first color storage unit and the second, third, and fourth color storage units packed. To do. That is, the header, the pattern flag storage unit, the first color storage unit, and the second, third, and fourth color storage units are data-formed as tiles. Thereafter, the data is output to the memory via the DMAC. Next, the coordinates and sizes of the packets are listed as a list and created (updated) as a packet management table (S1111). An example of this packet management table is shown in FIG. By repeating the above process up to the last tile (YES in S1112), the raster image compression process in units of pages is completed.

なお、上述のタイル単位でデータをメモリへ書き出すと、図14に示すように、パケット毎にサイズが異なり、それぞれのパケットの先頭アドレスが飛び飛びになる。そのため、パケット管理テーブルを用いて任意の座標のパケットの先頭アドレスを探索する。したがって、先頭パケットの書き込みアドレスが既知であれば、パケット管理テーブルに記載されている座標までのデータサイズをオフセットとして任意のパケットの先頭アドレスを求めることが可能になる。例えば、図15に示すメモリ空間上で、第3パケットを読み込む場合は、第1、第2パケットのサイズ合計をパケット管理テーブルより求め、先頭パケットのアドレスに対してオフセットを付加することで第3パケットアドレスを算出する。そして、算出した第3パケットアドレスからデータを読み込むことで第3パケットのデータを取得することが可能になる。   When data is written to the memory in units of tiles as described above, as shown in FIG. 14, the size differs for each packet, and the top address of each packet is skipped. Therefore, the start address of the packet at an arbitrary coordinate is searched using the packet management table. Therefore, if the write address of the leading packet is known, the leading address of any packet can be obtained with the data size up to the coordinates described in the packet management table as an offset. For example, when the third packet is read in the memory space shown in FIG. 15, the total size of the first and second packets is obtained from the packet management table, and the third packet is added by adding an offset to the address of the first packet. Calculate the packet address. Then, the data of the third packet can be acquired by reading the data from the calculated third packet address.

このように、タイル単位に任意のデータへのアクセスが可能になるので、画像の部分的な処理が可能になる。例えば、画像の一部の領域を抽出して処理したい場合は、当該領域に対応するパケットのデータを取得して処理すればよい。そして、このように画像の一部の領域を抽出して処理する場合であっても、第1の実施形態で説明したように、圧縮されたデータを用いて処理を行うことができる。   As described above, since arbitrary data can be accessed in tile units, partial processing of an image becomes possible. For example, when it is desired to extract and process a partial area of an image, it is only necessary to acquire and process packet data corresponding to the area. Even when a partial region of an image is extracted and processed as described above, processing can be performed using compressed data as described in the first embodiment.

また、タイル単位で多段の圧縮を施すことも可能である。このときのパケットのデータ構造としては図16のようになり、第1色格納部に対してデータが入れ子になる。多段の圧縮を施す場合には、第1の実施形態で説明したように、出力データの中の第1色のデータに対してさらに圧縮を施すことになる。従って、パケットのデータ構造としても第1色の格納部のデータが入れ子になるのである。   It is also possible to perform multistage compression on a tile basis. The data structure of the packet at this time is as shown in FIG. 16, and data is nested in the first color storage unit. When performing multi-stage compression, as described in the first embodiment, the first color data in the output data is further compressed. Therefore, the data of the first color storage unit is nested in the data structure of the packet.

また、展開処理は、パケット毎にヘッダが付与されているので、各ヘッダに記載されている情報を用いて処理を行う。展開処理とはパケット化されているデータからタイル毎の画像データに伸張する処理のことである。まず、圧縮フラグが非圧縮を示している場合にはヘッダを取り除いたデータを出力し、そうでない場合には展開処理を行う。展開処理では、ヘッダよりパターンフラグ格納位置、第1色のデータ格納位置、及び第2、3、4色格納位置を求め、後は順次前述した実施形態と同様に、タイルの画像データへ展開する。   In addition, since the expansion process is provided with a header for each packet, the process is performed using information described in each header. The decompression process is a process for decompressing the packetized data to image data for each tile. First, when the compression flag indicates non-compression, the data from which the header is removed is output, and when not, decompression processing is performed. In the expansion process, the pattern flag storage position, the first color data storage position, and the second, third, and fourth color storage positions are obtained from the header, and the subsequent processing is sequentially expanded into tile image data as in the above-described embodiment. .

例えば、パターンフラグの位置は固定長のヘッダの後なので、オフセットを付加することで求めることができる。第1色のデータの格納位置は、タイルのサイズが32×32画素であれば、パターンフラグのサイズが32×32ビットで固定になるので、パターンフラグ位置からオフセットを付加することで求める。最後に、第2、3、4色のデータ格納位置は、第1色のデータが不定長なので、ヘッダに記載されている第1色サイズを参照し、第1色のデータ位置からオフセットを付加することで求める。   For example, since the position of the pattern flag is after the fixed-length header, it can be obtained by adding an offset. If the tile size is 32 × 32 pixels, the pattern flag size is fixed at 32 × 32 bits, and the first color data storage position is obtained by adding an offset from the pattern flag position. Finally, the data storage position for the second, third, and fourth colors has an indefinite length, so the offset is added to the data position for the first color with reference to the first color size described in the header. Ask for it.

第1色のデータがさらに圧縮されている場合には、その段数毎ヘッダに記載されている次のデータサイズを参照し、そのサイズ分のオフセットを付加しながらデータを読み出し、展開処理を段を追って行う。   When the first color data is further compressed, the next data size described in the header for each number of stages is referred to, the data is read while adding an offset for that size, and the expansion process Do it later.

以上述べたように、第2の実施形態によれば、画像データに依存して、その圧縮データサイズが変わる可変長圧縮処理でも、圧縮データに対してのランダムアクセス性を高め、タイル単位で画像の一部だけ切り出して処理することが可能になる。   As described above, according to the second embodiment, even in the variable length compression process in which the compressed data size changes depending on the image data, the random accessibility to the compressed data is improved, and the image is tiled. It is possible to cut out and process only a part of.

[第3の実施形態]
次に、図面を参照しながら第3の実施形態を詳細に説明する。第3の実施形態は、前述した第1および第2の実施形態におけるラスタ画像データの圧縮処理において、入力された画像データに対して適応的に減色処理を制御するものである。なお、第3の実施形態でも、画像処理装置として、第1の実施形態と同様に、MFPを例に説明する。
[Third Embodiment]
Next, the third embodiment will be described in detail with reference to the drawings. In the third embodiment, in the compression processing of raster image data in the first and second embodiments described above, the subtractive color processing is adaptively controlled with respect to input image data. Note that, in the third embodiment, as an image processing apparatus, an MFP will be described as an example, as in the first embodiment.

前述した図9のフローチャートに示す処理においては、減色処理が可能な場合には直ちに減色処理を実行して減色フラグを生成する処理を行っている。この場合、例えば減色情報として1回の減色を許容するという情報が設定されている際には、必ず1回目の減色圧縮処理で減色処理が行われ、減色フラグが生成されることになる。しかしながら、ページ単位またはタイル単位における圧縮処理では、1回目の圧縮処理では減色処理が有効に作用せず、2回目以降の圧縮処理において初めて減色処理が有効に作用する場合がある。第3の実施形態においては、減色処理が有効に作用したかどうかを考慮した処理を行うことで、適応的に減色処理を制御する例を説明する。   In the process shown in the flowchart of FIG. 9 described above, when the color reduction process is possible, the color reduction process is immediately executed to generate the color reduction flag. In this case, for example, when information indicating that one color reduction is allowed is set as the color reduction information, the color reduction processing is always performed in the first color reduction compression processing, and a color reduction flag is generated. However, in the compression process in page units or tile units, the color reduction process does not work effectively in the first compression process, and the color reduction process may work effectively only in the second and subsequent compression processes. In the third embodiment, an example will be described in which color reduction processing is adaptively controlled by performing processing in consideration of whether the color reduction processing has worked effectively.

そこで、図17のフローチャートを用いて、入力された画像データに対して適応的に減色処理を制御することに着目した減色圧縮方法を詳細に説明する。ただし、図17に示す減色圧縮処理の流れは、前述した図9に示す減色圧縮処理の説明の流れと概ね同様であるため、その差分のみに着目して以下に説明する。   Therefore, a color reduction compression method focusing on controlling the color reduction processing adaptively for input image data will be described in detail with reference to the flowchart of FIG. However, since the flow of the color reduction compression process shown in FIG. 17 is substantially the same as the flow of the description of the color reduction compression process shown in FIG. 9 described above, only the difference will be described below.

第1および第2の実施形態では、図9のように、減色情報である減色フラグは、減色処理を適用した時点で無条件に付加していた(S905、S911、S917)。これに対して、第3の実施形態では、図17のように、減色情報である減色フラグは、減色処理を適用した時点で、減色が有効に作用しているか否かを検出する(S1705、S1712、S1719)。すなわち、入力との差分が0より大きかった場合には(S1705、S1712、S1719でYes)、そこで初めて減色情報である減色フラグを付加し(S1706、S1713、S1720)、入力との差分が0であった場合は、減色フラグを付加しない。入力との差分が0である場合とは、換言すれば、入力画素に対する減色処理による画素値の削減効果がないことを意味する。従って、このような場合に減色処理が行われた旨の減色情報を生成してしまうと、以降の圧縮処理において減色処理によって画素値を削減できる状況であるにも関わらず、実際には減色が行われなくなってしまう。このため、十分な削減効果が得られない結果となってしまう場合がある。そこで、図17に示す条件を追加することで、ページ単位またはタイル単位で減色処理を適用した際に、当該領域における減色が有効に作用している場合のみを対象とした減色制御が実現できる。   In the first and second embodiments, as shown in FIG. 9, the color reduction flag as the color reduction information is unconditionally added when the color reduction processing is applied (S905, S911, S917). On the other hand, in the third embodiment, as shown in FIG. 17, the color reduction flag, which is color reduction information, detects whether or not the color reduction is effective when the color reduction processing is applied (S1705, S1712, S1719). That is, when the difference from the input is greater than 0 (Yes in S1705, S1712, and S1719), a color reduction flag as color reduction information is added for the first time (S1706, S1713, and S1720), and the difference from the input is 0. If there is, the color reduction flag is not added. In other words, the case where the difference from the input is 0 means that there is no pixel value reduction effect due to the color reduction processing for the input pixel. Therefore, if color reduction information indicating that the color reduction processing has been performed in such a case is generated, the color reduction is actually performed even though the pixel value can be reduced by the color reduction processing in the subsequent compression processing. It will not be done. For this reason, there may be a case where a sufficient reduction effect cannot be obtained. Therefore, by adding the conditions shown in FIG. 17, when the color reduction process is applied in units of pages or tiles, it is possible to realize color reduction control only when the color reduction in the area is effectively acting.

前述した、入力との差分が0であるとの条件は、入力された高解像度の画像データの一部もしくは全部の領域が低解像度の画像オブジェクトで構成されている場合に、効果的な減色制御を実現するためのものである。同一の画像サイズを例にとると、低解像度の画像オブジェクトの部分では高解像度の画像オブジェクトの部分と比較して同一の画素値が連続することになる。従って、低解像度の画像オブジェクトの部分では減色処理が有効に作用しないことがある。具体的には、例えば、第2の実施形態のようにタイル単位で圧縮処理する場合において、1200dpi画像データの一部のタイル単位領域で300dpiの画像データのみが含まれる場合である。この時、図9のフローチャートの制御では、当該タイルに対して減色フラグが付加されるが、図17のフローチャートの制御では、当該タイルに対して減色フラグが付加されない。このように、領域毎の減色情報を正しく検出することで、画質劣化を最小限に抑えつつ非可逆圧縮による圧縮効率を高める目的で実施する減色制御を、より効果的に実現することができる。   The above-mentioned condition that the difference from the input is 0 is that effective color reduction control is performed when a part or all of the input high-resolution image data is composed of low-resolution image objects. It is for realizing. Taking the same image size as an example, the same pixel value is continuous in the low-resolution image object portion as compared with the high-resolution image object portion. Therefore, the color reduction processing may not work effectively on the low-resolution image object portion. Specifically, for example, when compression processing is performed in units of tiles as in the second embodiment, only 300 dpi image data is included in a part of the tile unit area of 1200 dpi image data. At this time, the color reduction flag is added to the tile in the control of the flowchart of FIG. 9, but the color reduction flag is not added to the tile in the control of the flowchart of FIG. As described above, by correctly detecting the color reduction information for each region, it is possible to more effectively realize the color reduction control performed for the purpose of increasing the compression efficiency by irreversible compression while minimizing image quality degradation.

次に、具体例として、図18に示す解像度の異なる8×8画素の画像A、画像B、画像Cを3ページとして入力したページ画像データに対して、第3の実施形態で説明した処理を用いて減色回数を上限1回で圧縮処理し、再び伸張処理した場合を説明する。なお、図18に示す画素値は、視覚的に分かりやすいように色差の大きいグラデーションによって強調表示しているが、実際に処理する画像データは、目視で確認できないレベルの色差の小さいグラデーションである。従って、仮に図18に示す8×8画素が1色で出力されたとしても、画質的な問題がないものとする。   Next, as a specific example, the processing described in the third embodiment is performed on page image data in which 8 × 8 pixel images A, B, and C having different resolutions shown in FIG. 18 are input as three pages. A case will be described in which the compression processing is performed with the upper limit of the number of color reductions and the decompression processing is performed again. The pixel values shown in FIG. 18 are highlighted with a gradation having a large color difference so as to be easily understood visually, but the image data to be actually processed is a gradation having a small color difference at a level that cannot be visually confirmed. Therefore, even if 8 × 8 pixels shown in FIG. 18 are output in one color, there is no problem with image quality.

図18に示すように、画像Aのページは、1回目の圧縮処理(600dpiから300dpi)が実行される。画像Aでは2×2のブロックで圧縮処理を行う場合のパターンとしては、全てが第1色のみのパターンとなる。すなわち、入力画素の平均値と各入力画素の画素値との差分が0であるので、1回目の圧縮処理においては減色処理が適用されずに第1色のみが出力データとして出力されることになる。次に、この圧縮された画像Aのデータ(すなわち、第1色の画素値のデータ)に対して2回目の圧縮処理(300dpiから150dpi)が実行される。この場合も同様に、ブロックのパターンとしては第1色のみのパターンとなるので、減色処理が適用されずに第1色のみが出力される。更に、圧縮された画像Aのデータに対して、3回目の圧縮処理(150dpiから75dpi)が実行される。この場合、第2色のパターンが初めて出現する。ここでは、第1色の画素値と第2色の画素値との差分が0ではないので減色処理が初めて適用される。減色処理の結果、第2色の色と平均化された第1色の色のみが出力される。以上の結果、600dpi相当の画像Aに対する画像圧縮(600dpiから75dpiに解像度を圧縮)の結果として計1個の色値(3回目の圧縮処理で出力された第1色)がメモリに格納される。なお、減色処理の結果として、第2色の色と平均化された第1色の色が出力されるとして説明したが、第1色の色をそのまま出力してもよい。この圧縮された画像を伸張すると、図18に示す300dpi相当の画像Aが出力されることになる。すなわち、非可逆の圧縮処理である減色処理を行うので、伸張した画像は圧縮前の画像を完全には再現できないものの、当初の解像度の半分の解像度を有する画像データを再現することができる。   As shown in FIG. 18, the first compression process (from 600 dpi to 300 dpi) is executed for the page of image A. In the image A, as a pattern when the compression process is performed with 2 × 2 blocks, all the patterns are only the first color. That is, since the difference between the average value of the input pixels and the pixel value of each input pixel is 0, only the first color is output as output data without applying the color reduction process in the first compression process. Become. Next, a second compression process (from 300 dpi to 150 dpi) is performed on the compressed image A data (that is, data of the pixel values of the first color). In this case as well, since the block pattern is the pattern of only the first color, only the first color is output without applying the color reduction process. Further, a third compression process (150 dpi to 75 dpi) is performed on the compressed image A data. In this case, the second color pattern appears for the first time. Here, since the difference between the pixel value of the first color and the pixel value of the second color is not 0, the color reduction process is applied for the first time. As a result of the color reduction processing, only the first color averaged with the second color is output. As a result of the above, a total of one color value (the first color output by the third compression process) is stored in the memory as a result of the image compression (the resolution is compressed from 600 dpi to 75 dpi) for the image A equivalent to 600 dpi. . Note that, as a result of the color reduction process, the first color averaged with the second color is output, but the first color may be output as it is. When this compressed image is expanded, an image A equivalent to 300 dpi shown in FIG. 18 is output. That is, since the color reduction process, which is an irreversible compression process, is performed, the expanded image cannot reproduce the image before compression completely, but can reproduce image data having half the original resolution.

同様に、画像Bのページについては、1回目の圧縮処理(1200dpiから600dpi)が実行される。この場合、ブロックのパターンとしては第1色のみのパターンとなるので、減色処理が適用されずに第1色のみが出力される。既に説明しているように本実施形態では、2×2のブロックの左上の画素について第1色としている点に留意されたい。次に、圧縮された画像Bのデータについて、2回目の圧縮処理(600dpiから300dpi)が実行される。この場合、第2色のパターンが初めて出現する。ここでは、第1色の画素値と第2色の画素値との差分が0ではないので、減色処理が初めて適用されて第2色と平均化された第1色のみが出力される。更に、圧縮された画像Bのデータについて、3回目の圧縮処理が実行され、減色処理済みなので減色処理が適用されずに第1色と第2色が出力される。以上の結果、1200dpi相当の画像Bに対する画像圧縮の結果として計2個の色値(3回目の圧縮処理で出力された第1色、第2色)がメモリに格納される。これを伸張すると、600dpi相当の画像Bが出力される。   Similarly, for the page of image B, the first compression process (1200 dpi to 600 dpi) is executed. In this case, since the block pattern is a pattern of only the first color, only the first color is output without applying the color reduction process. As already described, it should be noted that in the present embodiment, the upper left pixel of the 2 × 2 block is the first color. Next, a second compression process (from 600 dpi to 300 dpi) is performed on the compressed image B data. In this case, the second color pattern appears for the first time. Here, since the difference between the pixel value of the first color and the pixel value of the second color is not 0, only the first color averaged with the second color is output by applying the color reduction process for the first time. Further, a third compression process is executed for the compressed image B data, and since the color reduction process has been completed, the first color and the second color are output without applying the color reduction process. As a result of the above, a total of two color values (first color and second color output in the third compression process) are stored in the memory as a result of image compression on the image B equivalent to 1200 dpi. When this is expanded, an image B equivalent to 600 dpi is output.

同様に、画像Cは、1回目の圧縮処理が実行され、減色処理が初めて適用されて第2色と平均化された第1色のみが出力される。次に、画像Cは、2回目の圧縮処理が実行され、減色処理済みなので減色処理が適用されずに第1色と第2色が出力される。更に、画像Cは、3回目の圧縮処理が実行され、減色処理済みなので減色処理が適用されずに第1色と第2色が出力される。以上の結果、2400dpi相当の画像Cに対する画像圧縮の結果として計6個の色値(2回目の圧縮処理で出力された第2色、および、3回目の圧縮処理で出力された第1色、第2色)がメモリに格納される。これを伸張すると、1200dpi相当の画像Bが出力される。   Similarly, the first compression process is executed for the image C, and the first color that is averaged with the second color is output by applying the color reduction process for the first time. Next, the second compression process is executed for the image C, and since the color reduction process has been completed, the first color and the second color are output without applying the color reduction process. Furthermore, since the image C has been subjected to the third compression process and has been subjected to the color reduction process, the first color and the second color are output without applying the color reduction process. As a result of the above, a total of six color values (the second color output in the second compression process and the first color output in the third compression process) as a result of the image compression on the image C corresponding to 2400 dpi, (Second color) is stored in the memory. When this is expanded, an image B equivalent to 1200 dpi is output.

以上のように、図18に示した例では、画像Aのページに対して、例えば、第1の実施形態のように1回目の圧縮処理のみ決め打ちで減色処理を適用した場合には、減色は有効に作用しない。しかしながら本実施形態によれば、3回目の圧縮時に1画素分の減色を達成できる。また、画像Bのページに対して、例えば、1回目の圧縮処理のみ決め打ちで減色処理を適用した場合に、減色されないのに対し、本実施形態によれば、2回目の圧縮時の4画素分の減色を達成できる。画像Cのページに対しては、例えば、1回目の圧縮処理のみ決め打ちで減色処理を適用した場合と全く同様に、本実施形態によっても、1回目の圧縮時の16画素分の減色を達成できる。このように、画像A、画像B、画像Cの各ページ画像データにおいて最も有効な解像度でのみ減色を適用することで、画質劣化の問題を最小限に抑制しつつ、減色による圧縮率を最大限に向上できる減色制御が実現できる。   As described above, in the example illustrated in FIG. 18, when the color reduction process is applied to the page of the image A with only the first compression process as in the first embodiment, the color reduction is performed. Does not work effectively. However, according to the present embodiment, it is possible to achieve color reduction for one pixel at the time of the third compression. In addition, for example, when the color reduction process is applied to the page of the image B with only the first compression process, the color is not reduced, but according to the present embodiment, four pixels at the time of the second compression are used. Can achieve minute color reduction. For the page of image C, for example, in the same manner as when the color reduction process is applied only in the first compression process, the color reduction for 16 pixels at the time of the first compression is achieved also in this embodiment. it can. In this way, by applying color reduction only at the most effective resolution in each page image data of image A, image B, and image C, the compression rate by color reduction is maximized while minimizing the problem of image quality degradation. Color reduction control that can be improved greatly can be realized.

上述した図18の例では、画像A、画像B、画像Cがそれぞれ1ページの画像データであるものとして説明した。図18の例は、第2の実施形態で説明したタイル化されたデータを扱う場合でも同様に説明が可能である。第2の実施形態ではタイル毎に減色フラグを有しているので、解像度の異なるオブジェクトが1ページ内に含まれている場合に特に適用的に減色処理を制御することができる。なお、第2の実施形態ではタイルは32×32画素として説明したが、図18では簡潔に表現するために8×8画素のタイルとしている点に留意されたい。図18の画像A、画像B、画像Cがタイルとして1ページ内に含まれている場合においても、上述したような画像A、画像B、画像Cがそれぞれページを構成している場合と同様に減色圧縮処理が行われる。   In the example of FIG. 18 described above, it has been described that the image A, the image B, and the image C are each one page of image data. The example of FIG. 18 can be similarly described even when the tiled data described in the second embodiment is handled. In the second embodiment, since the color reduction flag is provided for each tile, the color reduction processing can be controlled particularly appropriately when objects having different resolutions are included in one page. In the second embodiment, the tile is described as 32 × 32 pixels, but it should be noted that in FIG. 18, the tile is an 8 × 8 pixel for the sake of brevity. Even when the image A, the image B, and the image C in FIG. 18 are included in one page as tiles, the image A, the image B, and the image C as described above each form a page. Subtractive color compression processing is performed.

図18で示す画像A、画像B、画像Cがタイルとして1ページの画像データを構成する場合には、減色圧縮処理の結果は次のとおりとなる。まず、(8×8画素)×3画像=192画素のうち、例えば、1回目の圧縮処理のみ決め打ちで減色処理を適用した場合には、画像Cの1回目の圧縮の第2色に相当する16画素分の減色を達成できる。これに対し、適応的に減色処理を制御する本実施形態によれば、画像Aの3回目の圧縮の第2色の画素と、画像Bの2回目の圧縮の第2色の画素とを加えた21画素分の減色を達成できる。このように、画像A、画像B、画像Cのページ分割された各タイルのオブジェクト領域毎に最も有効な解像度でのみ減色を適用することで、画質劣化の問題を最小限に抑制しつつ、減色による圧縮率を最大限に向上できる減色制御が実現できる。   When the image A, the image B, and the image C shown in FIG. 18 constitute one page of image data as tiles, the result of the color reduction compression process is as follows. First, out of (8 × 8 pixels) × 3 images = 192 pixels, for example, when the color reduction process is applied only in the first compression process, it corresponds to the second color of the first compression of the image C The reduction of 16 pixels can be achieved. On the other hand, according to the present embodiment that adaptively controls the color reduction processing, the second color pixel of the third compression of the image A and the second color pixel of the second compression of the image B are added. In addition, a reduction of 21 pixels can be achieved. In this way, by applying the color reduction only at the most effective resolution for each object area of each tile of the tiled image A, image B, and image C, the color reduction is performed while minimizing the problem of image quality degradation. Color reduction control that can improve the compression ratio to the maximum can be realized.

以上述べたように、第3の実施形態によれば、入力された画像データに対して減色が有効に作用した減色処理を適用した場合に限り、減色フラグを付加するように条件づけることで、更に減色処理を効果的に制御することが可能になる。   As described above, according to the third embodiment, the condition that the color reduction flag is added only when the color reduction process in which the color reduction effectively works is applied to the input image data. Furthermore, it is possible to effectively control the color reduction process.

[第4の実施形態]
次に、図面を参照しながら第4の実施形態を詳細に説明する。第4の実施形態は、前述した実施形態におけるラスタ画像データの圧縮処理で、入力された画像データに対して減色の程度を鑑みて減色処理を制御したものである。なお、第4の実施形態でも、画像処理装置として、第1の実施形態と同様に、MFPを例に説明する。
[Fourth Embodiment]
Next, a fourth embodiment will be described in detail with reference to the drawings. In the fourth embodiment, raster image data compression processing in the above-described embodiment is performed by controlling the color reduction processing in consideration of the degree of color reduction for input image data. Note that, in the fourth embodiment, as an image processing apparatus, an MFP will be described as an example as in the first embodiment.

前述したように、減色情報としての減色フラグは、ページ単位またはタイル単位で減色処理が適用されていない場合に0、適用された場合に1を保持するという簡易なフラグであるため、減色処理の適用回数を制御するために必ずしも十分な減色情報ではない。   As described above, the color reduction flag as the color reduction information is a simple flag that holds 0 when the color reduction process is not applied in page units or tile units, and holds 1 when it is applied. The color reduction information is not necessarily sufficient to control the number of applications.

そこで、図9および図17を参照しながら、入力された画像データに対して減色の程度を鑑みて減色処理を制御することに着目した減色圧縮方法を詳細に説明する。ただし、減色圧縮処理の流れは、前述した図9および図17に示す減色圧縮処理の説明の流れと同様であるため、その差分のみに着目して以下に説明する。   9 and 17, the color reduction compression method focused on controlling the color reduction processing in consideration of the degree of color reduction for the input image data will be described in detail. However, since the flow of the color reduction compression process is the same as the flow of the description of the color reduction compression process shown in FIGS. 9 and 17 described above, only the difference will be described below.

第4の実施形態では、図9の減色フラグ生成(S905、S911、S917)、および、図17の減色フラグ生成(S1706、S1713、S1720)において、減色フラグの代わりの減色情報として減色カウンタを保持する。この減色カウンタは、減色の程度を保持するカウンタであって、カウンタ値、例えば、減色が適用された累積回数や、減色時の色値の累積誤差などを保持する。すなわち、減色が適用された累積回数を保持する場合には、画質保持と圧縮率向上を両立するように、閾値Nを与え、減色処理を上限N回として減色処理を制御することができる。すなわち、色処理の適用回数が所定回数未満の場合には減色処理を実行するように制御することができる。また、減色時の色値の累計誤差を保持する場合には、画質保持と圧縮率向上を両立するように、閾値Nを与え、減色の程度を測る累計誤差の上限をNレベルとして減色処理を制御することができる。すなわち、累計誤差が予め定めた閾値未満である場合に限り減色処理を実行するように制御することができる。   In the fourth embodiment, a color reduction counter is held as color reduction information instead of the color reduction flag in the color reduction flag generation (S905, S911, S917) in FIG. 9 and the color reduction flag generation (S1706, S1713, S1720) in FIG. To do. This color reduction counter is a counter that holds the degree of color reduction, and holds a counter value, for example, the cumulative number of times that color reduction has been applied, the cumulative error of color values during color reduction, and the like. That is, when the cumulative number of times that color reduction is applied is held, the color reduction process can be controlled by giving a threshold value N so that the image quality is maintained and the compression rate is improved, and the color reduction process is set to the upper limit N times. In other words, when the number of times that the color process is applied is less than the predetermined number, it is possible to control so as to execute the color reduction process. Further, when the accumulated error of the color value at the time of color reduction is held, a threshold value N is given so that both the image quality maintenance and the compression rate are improved, and the upper limit of the accumulated error for measuring the degree of color reduction is set to the N level. Can be controlled. That is, it is possible to perform control so that the color reduction process is executed only when the cumulative error is less than a predetermined threshold.

以上述べたように、第4の実施形態によれば、入力された画像データに対して減色の程度を鑑みて、減色カウンタをカウントするように条件づけることで、更に減色処理を効果的に制御することが可能になる。   As described above, according to the fourth embodiment, it is possible to effectively control the color reduction processing by setting the condition that the color reduction counter is counted in consideration of the degree of color reduction with respect to the input image data. It becomes possible to do.

[他の実施形態]
また、本発明は、以下の処理を実行することによっても実現される。すなわち、前述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給してもよい。この場合、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して処理を実行する。
[Other Embodiments]
The present invention can also be realized by executing the following processing. That is, software (program) that realizes the functions of the above-described embodiments may be supplied to a system or apparatus via a network or various storage media. In this case, the computer (or CPU, MPU, etc.) of the system or apparatus reads the program and executes the process.

Claims (10)

画像データをブロック毎に分割し、当該分割されたブロックを順に処理対象にして、画像データに対して複数回の圧縮処理をする画像処理装置であって、
ブロックの色数を減色する減色処理を実行するか否かを減色情報に基づいて判定する判定手段と、
前記判定手段によって減色処理を実行すると判定された場合に、前記処理対象のブロックに対して前記減色処理を実行する減色処理手段と、
前記減色処理の結果に応じて前記減色情報を更新する更新手段と、
前記処理対象のブロックの各画素の色データを比較することによって当該ブロックに含まれる色データの配置パターンに対応するパターンフラグを特定する特定手段と、
前記特定手段で特定されたパターンフラグと当該ブロックに含まれる色数分の色データとを圧縮された出力データとして出力する出力手段と、
所定の解像度に達するまで、当該ブロックの第1色の色データの集合データを更にブロック毎に分割して再び処理対象のブロックとして前記判定手段に入力する入力手段と
を備えることを特徴とする画像処理装置。
An image processing apparatus that divides image data into blocks, sequentially processes the divided blocks, and performs compression processing on the image data a plurality of times.
Determining means for determining whether or not to execute a color reduction process for reducing the number of colors in a block based on the color reduction information;
A color reduction processing means for executing the color reduction processing on the processing target block when it is determined by the determination means to execute the color reduction processing;
Updating means for updating the color reduction information in accordance with the result of the color reduction processing;
A specifying unit for specifying a pattern flag corresponding to an arrangement pattern of color data included in the block by comparing the color data of each pixel of the block to be processed;
Output means for outputting the pattern flag specified by the specifying means and the color data for the number of colors included in the block as compressed output data;
And an input unit that further divides the aggregate data of the first color data of the block for each block until the predetermined resolution is reached, and inputs the divided data again to the determination unit as a block to be processed. Processing equipment.
前記更新手段は、処理対象のブロックに対する減色処理によって色数が削減されている場合のみ、前記減色処理が行われたとの更新を行うことを特徴とする請求項1に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the update unit updates that the color reduction process has been performed only when the number of colors is reduced by the color reduction process for the processing target block. 前記減色情報は、複数ブロックで構成される矩形領域であるタイル毎に対して設定されることを特徴とする請求項1に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the color reduction information is set for each tile that is a rectangular area including a plurality of blocks. 前記出力手段は、タイル毎にパケットとして前記出力データを出力し、前記減色情報は当該パケットのヘッダ部分に含まれることを特徴とする請求項3に記載の画像処理装置。   The image processing apparatus according to claim 3, wherein the output unit outputs the output data as a packet for each tile, and the color reduction information is included in a header portion of the packet. 前記更新手段は、前記減色情報として、前記処理対象のブロックに対する減色処理が適用された適用回数を保持するカウンタ値を更新し、
前記判定手段は、前記カウンタ値を参照して減色処理の適用回数が所定回数未満である場合に限り減色処理を実行するように判定することを特徴とする請求項1に記載の画像処理装置。
The update unit updates a counter value that holds the number of times the color reduction process is applied to the processing target block as the color reduction information.
The image processing apparatus according to claim 1, wherein the determination unit determines to perform the color reduction process only when the number of times the color reduction process is applied is less than a predetermined number with reference to the counter value.
前記更新手段は、前記減色情報として、前記処理対象のブロックに対する減色処理によって色数が削減された回数を保持するカウンタ値を更新し、
前記判定手段は、前記カウンタ値を参照して減色処理によって色数が削減された回数が所定回数未満である場合に限り減色処理を実行するように判定することを特徴とする請求項1に記載の画像処理装置。
The update means updates a counter value that holds the number of times the number of colors has been reduced by the color reduction processing for the processing target block as the color reduction information,
2. The determination unit according to claim 1, wherein the determination unit determines to perform the color reduction process only when the number of times the number of colors is reduced by the color reduction process is less than a predetermined number with reference to the counter value. Image processing apparatus.
前記更新手段は、前記減色情報として、前記処理対象のブロックに対する減色処理によって色数が削減された際の色値の誤差を累計誤差として保持するカウンタ値を更新し、
前記判定手段は、前記カウンタ値を参照して減色処理によって減色処理によって生じた累計誤差が予め定めた閾値未満である場合に限り減色処理を実行するように判定することを特徴とする請求項1に記載の画像処理装置。
The update means updates the counter value that holds the error of the color value when the number of colors is reduced by the color reduction process for the block to be processed as a cumulative error as the color reduction information,
2. The determination unit according to claim 1, wherein the determination unit refers to the counter value and determines to execute the color reduction process only when a cumulative error caused by the color reduction process by the color reduction process is less than a predetermined threshold. An image processing apparatus according to 1.
1画素入力1画素出力で完結する色処理を前記第1色の色データの集合データに対して行う画像処理手段をさらに備えることを特徴とする請求項1に記載の画像処理装置。   The image processing apparatus according to claim 1, further comprising an image processing unit that performs color processing that is completed by one pixel input and one pixel output on the set data of the color data of the first color. 画像データをブロック毎に分割し、当該分割されたブロックを順に処理対象にして、画像データに対して複数回の圧縮処理をする画像処理方法であって、
ブロックの色数を減色する減色処理を実行するか否かを減色情報に基づいて判定する判定ステップと、
前記判定ステップによって減色処理を実行すると判定された場合に、前記処理対象のブロックに対して前記減色処理を実行する減色処理ステップと、
前記減色処理の結果に応じて前記減色情報を更新する更新ステップと、
前記処理対象のブロックの各画素の色データを比較することによって当該ブロックに含まれる色データの配置パターンに対応するパターンフラグを特定する特定ステップと、
前記特定ステップで特定されたパターンフラグと当該ブロックに含まれる色数分の色データとを圧縮された出力データとして出力する出力ステップと、
所定の解像度に達するまで、当該ブロックの第1色の色データの集合データを更にブロック毎に分割して再び処理対象のブロックとして前記判定ステップに入力する入力ステップと
を備えることを特徴とする画像処理方法。
An image processing method in which image data is divided into blocks, the divided blocks are sequentially processed, and image data is compressed a plurality of times.
A determination step of determining whether or not to execute a color reduction process for reducing the number of colors of the block based on the color reduction information;
A subtractive color processing step for executing the subtractive color processing on the processing target block when it is determined in the determination step that the subtractive color processing is to be executed;
An update step of updating the color reduction information according to a result of the color reduction processing;
A specifying step of specifying a pattern flag corresponding to an arrangement pattern of color data included in the block by comparing color data of each pixel of the block to be processed;
An output step of outputting the pattern flag specified in the specifying step and the color data for the number of colors included in the block as compressed output data;
And an input step of further dividing the set data of the color data of the first color of the block for each block until the predetermined resolution is reached and inputting the data as a processing target block to the determination step again Processing method.
請求項9に記載の画像処理方法をコンピュータに実行させるためのプログラム。   A program for causing a computer to execute the image processing method according to claim 9.
JP2010148079A 2010-06-29 2010-06-29 Image processing apparatus and image processing method Expired - Fee Related JP5595142B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010148079A JP5595142B2 (en) 2010-06-29 2010-06-29 Image processing apparatus and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010148079A JP5595142B2 (en) 2010-06-29 2010-06-29 Image processing apparatus and image processing method

Publications (2)

Publication Number Publication Date
JP2012015644A true JP2012015644A (en) 2012-01-19
JP5595142B2 JP5595142B2 (en) 2014-09-24

Family

ID=45601595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010148079A Expired - Fee Related JP5595142B2 (en) 2010-06-29 2010-06-29 Image processing apparatus and image processing method

Country Status (1)

Country Link
JP (1) JP5595142B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0775096A (en) * 1993-08-31 1995-03-17 Sony Corp Picture encoding method and device
JP2007116731A (en) * 2006-12-04 2007-05-10 Kyushu Institute Of Technology Image signal processing method
JP2008271046A (en) * 2007-04-18 2008-11-06 Canon Inc Image processor, image processing method, computer program and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0775096A (en) * 1993-08-31 1995-03-17 Sony Corp Picture encoding method and device
JP2007116731A (en) * 2006-12-04 2007-05-10 Kyushu Institute Of Technology Image signal processing method
JP2008271046A (en) * 2007-04-18 2008-11-06 Canon Inc Image processor, image processing method, computer program and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN5012012911; BENJ LIPCHAK: '2D AND 3D PROGRESSIVE TRANSMISSION USING WAVELETS' [ONLINE] , 19970325, P.1-P.8, WORCESTER POLYTECHNIC INSTITUTE DEPARTMENT以下備考 *

Also Published As

Publication number Publication date
JP5595142B2 (en) 2014-09-24

Similar Documents

Publication Publication Date Title
JP5595151B2 (en) Image processing apparatus, compression method in image processing apparatus, and program
JP5558767B2 (en) Image processing apparatus and processing method thereof
JP5393574B2 (en) Image processing apparatus, image processing method, and program
JP5432450B2 (en) Lossless color image data compression using entropy coding
JP4979323B2 (en) Image processing apparatus and control method thereof
US8452083B2 (en) Image processing apparatus, image processing method, and computer-readable medium
US8953220B2 (en) Image processing for rotation of compressed image data
JP2006101010A (en) Image processing apparatus, image processing method, and program, and storage medium
US8406517B2 (en) Image processing apparatus and image processing method
JP5595142B2 (en) Image processing apparatus and image processing method
US8494261B2 (en) Image processing apparatus, image processing method, and computer-readable medium
US9049404B2 (en) Image processing apparatus and method that perform multiple image processes, and storage medium storing a program thereof, for decompressing a compressed image according to first and second information indicating image processing to be performed
JP5606223B2 (en) Image processing apparatus and processing method thereof
JP5643578B2 (en) Image processing apparatus, image processing method, and program
JP2012095227A (en) Image processing system, image processing method, and program
JP2014099742A (en) Color/monochromatic determination
JP2013121154A (en) Image processing device
JP2012074897A (en) Image processing device, image processing method, and program
JP2011193396A (en) Image processing apparatus, control method, and program
JP2013085173A (en) Image processing device and control method therefor
JP2012054789A (en) Image processor, image processing method, and program
JP2012065214A (en) Image processing device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130627

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140411

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140422

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140620

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140708

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140805

LAPS Cancellation because of no payment of annual fees