JP2012054789A - Image processor, image processing method, and program - Google Patents

Image processor, image processing method, and program Download PDF

Info

Publication number
JP2012054789A
JP2012054789A JP2010196097A JP2010196097A JP2012054789A JP 2012054789 A JP2012054789 A JP 2012054789A JP 2010196097 A JP2010196097 A JP 2010196097A JP 2010196097 A JP2010196097 A JP 2010196097A JP 2012054789 A JP2012054789 A JP 2012054789A
Authority
JP
Japan
Prior art keywords
color
color data
processing target
block
pattern
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2010196097A
Other languages
Japanese (ja)
Inventor
Shintaro Okamura
晋太郎 岡村
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 JP2010196097A priority Critical patent/JP2012054789A/en
Publication of JP2012054789A publication Critical patent/JP2012054789A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To improve the compression rate of image data.SOLUTION: The present invention relates to a method to improve the compression rate based on the similarity to a first color of three adjoining blocks, in a method of dividing image data into blocks of 2×2 pixels and converting into a pattern flag indicating a color arrangement pattern of each block and color data based on the color (pixel value) in each block. Furthermore, the number of bits of the pattern flag is not increased when the method of improving the compression rate based on the similarity to a previous adjacent block, and the method of improving the compression rate based on the similarity to the first color of the three adjoining blocks are used in combination.

Description

本発明は、画像を所定のブロック単位に圧縮する技術とブロック単位に圧縮された画像の画像処理や復元処理を行う技術に関する。   The present invention relates to a technique for compressing an image in predetermined block units and a technique for performing image processing and restoration processing on an image compressed in block units.

従来、高解像度のカラー画像への需要は高く、それらの高画質化への要望へ応えるべくデジタル複合機では1200dpiやそれを超える解像度の画像を扱うことが多くなってきている。画像の高解像度化が進むにつれて、画像処理を必要とする画素数が飛躍的に増え、その処理負荷が増大しているという課題がある。デジタル複合機に限らず、デジタルカメラやファクシミリ装置などの画像処理装置では、メモリ/ハードディスク量の節約やそれらへの書き込み時間を短縮するために、カラー画像データの圧縮を行い、低コスト化や高速化を実現している。   Conventionally, there is a high demand for high-resolution color images, and digital multifunction peripherals are increasingly handling images with a resolution of 1200 dpi or higher in order to meet the demand for higher image quality. As the resolution of an image increases, there is a problem that the number of pixels that require image processing increases dramatically and the processing load increases. Image processing devices such as digital cameras and facsimile machines, not limited to digital multifunction devices, compress color image data in order to save memory and hard disk space and shorten the time required for writing to them. Has been realized.

カラー静止画像の圧縮方式には、離散コサイン変換を利用したJPEG方式やWavelet変換を利用した方式が多く使われている。この種の符号化方式は、一般的に画像を所定のブロック(例えば8×8や16×16画素単位)に符号化し、離散コサイン変換、量子化及びエントロピー符号化を行うことで高い圧縮効率を達成している。この種の符号化方式は、可変長符号化方式であるので、符号化対象の画像毎に符号量が変化するものである。   As a color still image compression method, a JPEG method using discrete cosine transform or a method using Wavelet transform is often used. In this type of encoding method, generally, an image is encoded into a predetermined block (for example, 8 × 8 or 16 × 16 pixel unit), and high compression efficiency is achieved by performing discrete cosine transform, quantization, and entropy encoding. Have achieved. Since this type of encoding method is a variable-length encoding method, the code amount changes for each image to be encoded.

上述した画像圧縮を用いた場合、その画素データを参照し、その画素データを変換するには、圧縮データの復号処理が必要になってくる。つまり、圧縮データのままで画像処理を行うことはできず、必ず復号処理が必要になり、高解像度データ全ての画素に対して画素単位に処理を行う必要が出てしまい、処理時間の増大を招く。   When the above-described image compression is used, in order to refer to the pixel data and convert the pixel data, it is necessary to decode the compressed data. In other words, image processing cannot be performed with compressed data as it is, and decoding processing is necessarily required, and it is necessary to perform processing on a pixel basis for all pixels of high resolution data, which increases processing time. Invite.

画素データの符号化を行わずに圧縮処理を行う技術としては、画素データとその連続数を記憶する公知のランレングス圧縮方式やブロック単位でエッジを検出し、そのエッジの持つ2色を記憶することで圧縮する技術が開示されている(例えば、特許文献1)。   As a technique for performing compression processing without encoding pixel data, a known run-length compression method for storing pixel data and its continuous number or an edge is detected for each block, and two colors of the edge are stored. Thus, a technique for compressing is disclosed (for example, Patent Document 1).

特開2008−271046号公報JP 2008-271046 A

特許文献1においては、ブロック内を2色化し、その2色の配置に関する形状情報と2色の色情報を記憶していた。しかし、さらなる高画質化、処理高速化を図るため、本出願人は特願2009−221444で以下のような提案をしている。   In Patent Document 1, the inside of a block is made into two colors, and shape information relating to the arrangement of the two colors and color information of the two colors are stored. However, in order to achieve higher image quality and higher processing speed, the present applicant has made the following proposal in Japanese Patent Application No. 2009-212444.

前記提案では、まず、画像データをブロック毎に分割し、ブロック内の各画素の色データを比較することにより、注目ブロックに含まれる色データの配置パターン情報と、注目ブロックに含まれる色数分の色データ情報とを出力する。そして、出力された色データ情報のうち、各ブロックにおける予め決められた位置の画素に対応する第1の色データ情報、それ以外の色データ情報、配置パターン情報をそれぞれ、それぞれ異なるメモリ領域にまとめて格納することを特徴としている。これにより、2色より多い色数を持つブロックの画質を落とさずに高画質化を実現し、特定位置の間引き画像データを連続メモリ領域に置き、復号化することなく低解像度画像を扱えるようにすることで、処理高速化を実現しようとしている。   In the proposal, first, the image data is divided into blocks, and the color data of each pixel in the block is compared, so that the arrangement pattern information of the color data included in the block of interest and the number of colors included in the block of interest. Output color data information. In the output color data information, the first color data information corresponding to the pixel at a predetermined position in each block, the other color data information, and the arrangement pattern information are collected in different memory areas. It is characterized by storing. This realizes high image quality without reducing the image quality of blocks with more than two colors, and places the thinned image data at specific positions in a continuous memory area so that low-resolution images can be handled without decoding. By doing so, we are trying to achieve faster processing.

すなわち、前記提案では、2×2画素の処理対象ブロック内に含まれる色データを比較することにより圧縮処理を行う例が示されている(ここでは、上述したブロック内の色データの比較のみによる圧縮処理を、「2×2画素のブロックで閉じた圧縮方法」と呼ぶことにする)。前記提案では上述した2×2画素のブロックで閉じた圧縮方法に加え、更に、1つ前の処理対象ブロックの類似性に着目した処理が提案されている。すなわち、前記提案では、現在の処理対象ブロックが1つ前の処理対象ブロックと同じ色配置であれば、前のブロックと同じであることを示すフラグを配置パターン情報として格納し、色データを格納しないことで、更に圧縮率を向上させることも考えられている。   That is, in the above proposal, an example is shown in which the compression processing is performed by comparing the color data included in the processing target block of 2 × 2 pixels (here, only by the comparison of the color data in the block described above). The compression processing will be referred to as “compression method closed with a block of 2 × 2 pixels”). In the above proposal, in addition to the compression method closed by the 2 × 2 pixel block described above, a process focusing on the similarity of the previous block to be processed is proposed. That is, in the above proposal, if the current processing target block has the same color arrangement as the previous processing target block, a flag indicating that it is the same as the previous block is stored as arrangement pattern information, and color data is stored. It is also considered that the compression rate is further improved by not doing so.

本発明では、上述した1つ前の処理対象ブロックとの類似性に基づく処理とは異なる、隣接する他のブロックとの類似性に基づく他の処理を適用することで、圧縮率を向上させる。また、当該他の処理を、上述した1つ前の処理対象ブロックとの類似性に着目した処理と組み合わせる場合、いずれの処理を適用したか判別できるように、配置パターン情報のビット数を増やして、その処理を適用したことを示すフラグを配置パターン情報として格納することが考えられる。しかしながら、配置パターン情報のビット数を増加させると、その分データ量が増加してしまい、圧縮率が低下する場合がありうる。   In the present invention, the compression ratio is improved by applying another process based on the similarity with another adjacent block, which is different from the process based on the similarity with the previous processing target block described above. In addition, when the other process is combined with the process focusing on the similarity with the previous processing target block, the number of bits of the arrangement pattern information is increased so that it can be determined which process is applied. It is conceivable that a flag indicating that the process is applied is stored as arrangement pattern information. However, when the number of bits of the arrangement pattern information is increased, the data amount is increased correspondingly, and the compression rate may be reduced.

したがって、2×2画素のブロックで閉じた圧縮方法に加えて、他の処理を2つ以上追加する場合、配置パターン情報を4ビットのまま圧縮を行うためには、圧縮処理開始前に残りの1通りに割り当てる処理をあらかじめ決定しておかなければならない。しかしながら、圧縮対象の画像データによって圧縮率向上を見込める処理が異なり、画像データに対しどの処理が効果的かは圧縮するまでは分からない。そのため、圧縮処理開始前に圧縮対象の画像データにどの処理が適しているか判断して、残りの1通りに処理を割り当てる必要がある。   Therefore, in addition to the compression method closed by the block of 2 × 2 pixels, when adding two or more other processes, in order to compress the arrangement pattern information with 4 bits, the remaining pattern before starting the compression process The processing to be assigned in one way must be determined in advance. However, the processing that can be expected to improve the compression rate differs depending on the image data to be compressed, and it is not known until the image processing is compressed which processing is effective. For this reason, it is necessary to determine which process is suitable for the image data to be compressed before starting the compression process, and to assign the process to the remaining one.

本発明の画像処理装置は、画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割手段と、前記分割手段で分割された処理対象ブロック内の色データの配置が、1つ前に処理対象になったブロック内の色データの配置と同じであるか否か判定する第1判定手段と、前記第1判定手段で同じでないと判定された場合、前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定手段と、前記処理対象のブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出手段と、前記特定手段で特定されるパターンフラグそれぞれの出現回数をカウントする第1カウント手段と、前記特定手段で2つ以上の色データが配置されていることを示すパターンフラグであると特定された処理対象ブロックに関して、前記処理対象ブロック内の予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する第2判定手段と、前記第1カウント手段でカウントした結果に基づいて、前記予め定義された複数のパターンフラグの中から、パターンを入れ替えることにより生じるデータ増加量が最少のパターンフラグを、入れ替え対象パターンフラグとして選択する選択手段と、前記パターンフラグ、または、前記色データの少なくとも一方を出力する出力手段とを有し、前記出力手段は、前記第1判定手段で同じであると判定された処理対象ブロックに対しては、当該処理対象ブロック内の色の配置が1つ前に処理対象になったブロック内の色の配置と同じであることを示すパターンフラグを出力し、前記第1判定手段で同じでないと判定され、且つ、前記特定手段で特定されたパターンフラグが1色で構成されるブロックであることを示すパターンフラグである処理対象ブロックに対しては、前記特定手段で特定されたパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致すると判定された処理対象ブロックに対しては、前記選択手段で選択されたパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致しないと判定され、且つ、前記特定手段で特定されたパターンフラグが前記選択手段で選択された前記入れ替え対象パターンフラグである処理対象ブロックに対しては、当該処理対象ブロックを4色で構成されるブロックとして、当該処理対象ブロックが4つの色データが配置されるブロックであることを示すパターンフラグと、当該処理対象ブロック内の4画素それぞれの色データとを出力し、前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致しないと判定され、且つ、前記特定手段で特定されるパターンフラグが前記選択手段で選択された前記入れ替え対象パターンフラグでない処理対象ブロックに対しては、前記特定手段で特定された当該処理対象のブロックに含まれる色の配置パターンを示すパターンフラグと、前記抽出手段で抽出される前記処理対象のブロック内の前記第1色の色データと、前記処理対象のブロック内の前記第1色の色データ以外の色データとを出力することを特徴とする。   An image processing apparatus according to the present invention divides image data into blocks each having a size of 2 × 2 pixels, a dividing unit that sequentially processes each of the divided blocks, and a processing target block divided by the dividing unit The first determination means for determining whether the arrangement of the color data in the block is the same as the arrangement of the color data in the previous block to be processed and the first determination means determine that the arrangement is not the same. If the color data of each pixel in the block to be processed is compared, the arrangement of the color data included in the block to be processed is selected from a plurality of predefined pattern flags indicating the arrangement pattern of the color data. A specifying means for specifying a pattern flag indicating a pattern, a color of a pixel at a predefined position in the processing target block is extracted as color data of a first color, and the block Extraction means for extracting color data other than the color data included in the first color, first count means for counting the number of appearances of each of the pattern flags specified by the specifying means, and two or more by the specifying means Regarding the processing target block identified as a pattern flag indicating that color data is arranged, the color data of three pixels other than the pixel at a predefined position in the processing target block are the three pixels. Based on the result of counting by the second counting means and the first counting means based on the result of counting by the first counting means, respectively Replace the pattern flag with the smallest amount of data increase caused by replacing the pattern from the multiple defined pattern flags. Selection means for selecting as a target pattern flag, and output means for outputting at least one of the pattern flag or the color data, and the output means is determined to be the same by the first determination means. For the processing target block, a pattern flag indicating that the color arrangement in the processing target block is the same as the color arrangement in the previous processing target block is output, and the first For the processing target block that is a pattern flag indicating that the pattern flag determined by the determining unit is not the same and the pattern flag specified by the specifying unit is a block composed of one color, the specifying unit specifies Output the pattern flag and the color data of the first color in the processing target block extracted by the extraction unit, and the first determination unit determines that they are not the same. In addition, for the processing target block determined to match by the second determination unit, the pattern flag selected by the selection unit and the first in the processing target block extracted by the extraction unit Color data of a color is output, and the first determination unit determines that they are not the same, and the second determination unit determines that they do not match, and the pattern flag specified by the specifying unit is the selection unit For the processing target block that is the replacement target pattern flag selected in step 4, the processing target block is a block in which four color data are arranged, with the processing target block being a block composed of four colors. And the color data of each of the four pixels in the processing target block are output, and the first determination unit determines that they are not the same, For the processing target block that is determined not to match by the second determination unit and the pattern flag specified by the specifying unit is not the replacement target pattern flag selected by the selection unit, the specifying unit A pattern flag indicating an arrangement pattern of colors included in the processing target block identified in Step 1, color data of the first color in the processing target block extracted by the extraction unit, and the processing target block The color data other than the color data of the first color are output.

また、本発明の画像処理装置は、画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割手段と、前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定手段と、前記処理対象ブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出手段と、前記処理対象ブロック内の前記予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する判定手段と、前記判定手段で一致すると判定された処理対象ブロックに対しては、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データと一致することを示すパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の第1色の色データとを出力し、前記判定手段で一致しないと判定された処理対象ブロックに対しては、前記特定手段により特定される当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグと、前記抽出手段により抽出される前記第1色の色データと前記第1色の色データ以外の色データとを出力する出力手段とを有する。   Further, the image processing apparatus of the present invention divides image data into blocks each having a size of 2 × 2 pixels, dividing means for sequentially processing each divided block, and each pixel in the processing target block Specifying means for identifying a pattern flag indicating the arrangement pattern of the color data included in the processing target block from a plurality of predefined pattern flags indicating the arrangement pattern of the color data by comparing the color data of Extracting means for extracting a color of a pixel at a predetermined position in the processing target block as color data of a first color, and further extracting color data other than the color data of the first color included in the block And the color data of three pixels other than the pixel at the predefined position in the processing target block are respectively in three separate blocks adjacent to the three pixels. Determination means for determining whether or not the color data of the pixel at a predefined position in each of the two match, and for the processing target block determined to match by the determination means, three adjacent to the three pixels Outputting a pattern flag indicating that it matches the color data of a pixel at a predefined position in each of the other blocks, and the color data of the first color in the processing target block extracted by the extraction means, For a processing target block determined not to match by the determination unit, a pattern flag indicating an arrangement pattern of color data included in the processing target block specified by the specifying unit, and the extraction unit extracts the pattern flag. Output means for outputting color data of the first color and color data other than the color data of the first color.

本発明によれば、配置パターン情報のビット数を増加させることなく、画像データの圧縮率を向上させることが可能となる。   According to the present invention, it is possible to improve the compression rate of image data without increasing the number of bits of arrangement pattern information.

本発明に係る画像処理装置の構成の一例を示すブロック図。1 is a block diagram showing an example of the configuration of an image processing apparatus according to the present invention. 本発明に係るコントローラの構成例を示す図。The figure which shows the structural example of the controller which concerns on this invention. 本発明に係る2×2画素ブロックの色の配置パターンの組み合わせを示す図。The figure which shows the combination of the arrangement pattern of the color of 2x2 pixel block which concerns on this invention. 本発明に係る配置パターンとパターンフラグの関係を示す図。The figure which shows the relationship between the arrangement | positioning pattern which concerns on this invention, and a pattern flag. 本発明に係る画素の数とパターンフラグの特定処理を示すフローチャート。The flowchart which shows the number of pixels and pattern flag specific processing which concern on this invention. 本発明に係る配置パターンに対応する出力データのデータ量を示す図。The figure which shows the data amount of the output data corresponding to the arrangement | positioning pattern which concerns on this invention. 本発明に係る画像データのメモリ空間への書き込み例を示す図。The figure which shows the example of writing to the memory space of the image data based on this invention. 本発明に係る前ブロックとの一致を表すパターンフラグを示す図。The figure which shows the pattern flag showing a coincidence with the previous block which concerns on this invention. 本発明に係る前ブロックとの一致を表す圧縮処理を示すフローチャート。The flowchart which shows the compression process showing a coincidence with the previous block which concerns on this invention. 本発明に係る画像データのメモリ空間への書き込み例を示す図。The figure which shows the example of writing to the memory space of the image data based on this invention. 本発明に係る着目ブロックと周囲ブロックの位置関係を示す図。The figure which shows the positional relationship of the attention block and surrounding block which concerns on this invention. 本発明に係る3方向のブロックとの一致を表すパターンフラグを示す図。The figure which shows the pattern flag showing a match with the block of 3 directions which concerns on this invention. 本発明に係る3方向のブロックとの一致を表す圧縮処理のフローチャート。The flowchart of the compression process showing a match with the block of 3 directions which concerns on this invention. 本発明に係る圧縮処理で用いられるパターン入れ替えの例を示す図。The figure which shows the example of the pattern exchange used by the compression process which concerns on this invention. 本発明に係るパターンの入れ替えによるパターンのデータ増加を示す図。The figure which shows the data increase of the pattern by replacement of the pattern which concerns on this invention. 本発明に係るパターンの入れ替えによるデータの削減量と増加量を示す図。The figure which shows the reduction amount and increase amount of data by the replacement of the pattern which concerns on this invention. 本発明に係るパターンの入れ替えを行う圧縮処理を示すフローチャート。The flowchart which shows the compression process which replaces the pattern which concerns on this invention. 本発明に係る圧縮処理とカウント処理を示すフローチャート。The flowchart which shows the compression process and count process which concern on this invention. 本発明に係るパターン入れ替え処理を示すフローチャート。The flowchart which shows the pattern replacement process which concerns on this invention. 本発明に係るパターン入れ替え後の圧縮処理を示すフローチャート。The flowchart which shows the compression process after the pattern replacement based on this invention. 本発明に係る画像データのメモリ空間への書き込み例を示す図。The figure which shows the example of writing to the memory space of the image data based on this invention.

[ハードウェア構成]
以下、本発明の発明を実施するための形態について図面を用いて説明する。本実施形態では、画像処理装置として、スキャン、プリント、コピーなどの複数の機能を有するデジタル複合機(MFP)を例に説明する。
[Hardware configuration]
DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments for carrying out the invention will be described with reference to the drawings. In this embodiment, a digital multi-function peripheral (MFP) having a plurality of functions such as scanning, printing, and copying will be described as an example of the image processing apparatus.

図1に示すように、コントローラ101は、画像入力機器であるスキャナ102や画像出力機器であるプリンタ103と接続される。また、コントローラ101はLANや公衆回線(WAN)などのネットワーク104と接続することで、画像情報やデバイス情報の入出力、PDLデータのイメージ展開を行う。   As shown in FIG. 1, the controller 101 is connected to a scanner 102 as an image input device and a printer 103 as an image output device. Further, the controller 101 is connected to a network 104 such as a LAN or a public line (WAN) to input / output image information and device information and develop an image of PDL data.

CPU105は、後述する記憶部107に格納されたプログラムに従ってMFP全体を制御するプロセッサである。メモリ106は、CPU105が動作するためのシステムワークメモリであり、画像データを一時記憶するための画像メモリでもある。記憶部107は、ハードディスクドライブであり、システムソフトウェアやプログラム、画像データなどを格納する。   The CPU 105 is a processor that controls the entire MFP in accordance with a program stored in a storage unit 107 described later. The memory 106 is a system work memory for operating the CPU 105, and is also an image memory for temporarily storing image data. The storage unit 107 is a hard disk drive, and stores system software, programs, image data, and the like.

次に、図2に示すコントローラ101の構成例を参照してコントローラ101の各部の詳細な処理を説明する。まず、スキャナ102によってスキャンされた画像データを読み込む場合を説明する。スキャナ102で読み取られたRGB(レッド、グリーン、ブルー)3色の画像データをスキャナ用画像処理部201が受け取り、その画像データに対してシェーディング処理やフィルタ処理等の画像処理を行い、圧縮部202が画像圧縮処理を行う。そして、圧縮されたデータ(圧縮データ)をDMAC(Direct Memory Access Controller)203が画像メモリバスを介してメモリ106に格納する。   Next, detailed processing of each unit of the controller 101 will be described with reference to a configuration example of the controller 101 shown in FIG. First, a case where image data scanned by the scanner 102 is read will be described. The scanner image processing unit 201 receives RGB (red, green, blue) three-color image data read by the scanner 102, performs image processing such as shading processing and filter processing on the image data, and compresses the data. Performs image compression processing. The compressed data (compressed data) is stored in the memory 106 via the image memory bus by a DMAC (Direct Memory Access Controller) 203.

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

また、スキャンされた画像データをネットワークへ送信する場合、メモリ106に格納されている圧縮データをDMAC211が画像メモリバスを介して色処理部212へ転送する。そして、色処理部212がディスプレイガンマ調整や用紙地色調整等を行った後、YCbCr(輝度、BLUE色差、RED色差)色空間へ変換する。そして、色処理部212で処理されたデータをDMAC211が画像メモリバスを介してメモリ106に再度格納する。その後、送信用の画像処理を行うために、DMAC231が画像メモリバスを介してメモリ106に格納されている圧縮データを展開部232へ転送する。そして、展開部232が圧縮データをラスタ画像データに展開する。その後、ラスタのYCbCr画像データに対して送信処理部233がカラー画像送信であればJPEG圧縮処理を行い、モノクロ2値画像送信であればYデータに対して2値化を行い、JBIG圧縮等を行い、ネットワーク104へ出力する。   When the scanned image data is transmitted to the network, the DMAC 211 transfers the compressed data stored in the memory 106 to the color processing unit 212 via the image memory bus. After the color processing unit 212 performs display gamma adjustment, paper background color adjustment, and the like, the color processing unit 212 performs conversion to a YCbCr (luminance, BLUE color difference, RED color difference) color space. Then, the DMAC 211 stores the data processed by the color processing unit 212 in the memory 106 again via the image memory bus. Thereafter, in order to perform image processing for transmission, the DMAC 231 transfers the compressed data stored in the memory 106 to the expansion unit 232 via the image memory bus. Then, the expansion unit 232 expands the compressed data into raster image data. After that, if the transmission processing unit 233 performs color image transmission on the raster YCbCr image data, JPEG compression processing is performed. If the monochrome binary image transmission is performed, binarization is performed on the Y data, and JBIG compression or the like is performed. And output to the network 104.

また、スキャンされた画像データを保存する場合、メモリ106に格納されている圧縮データをDMAC241が画像メモリバスを介してディスクスプール高圧縮/展開部242へ転送する。ディスクスプール高圧縮/展開部242では、HDDの書き込みスピードがメモリに対して遅いため、更に高圧縮のJPEG圧縮を施す。その後ディスクアクセスコントローラ243を介して記憶部107へ圧縮データを保存する。また、記憶部107に保存されている圧縮データをメモリ106に再度転送する場合には、上述した処理を逆に行えば良い。   When saving scanned image data, the DMAC 241 transfers the compressed data stored in the memory 106 to the disk spool high compression / decompression unit 242 via the image memory bus. In the disk spool high compression / decompression unit 242, the writing speed of the HDD is slower than that of the memory. Thereafter, the compressed data is stored in the storage unit 107 via the disk access controller 243. Further, when the compressed data stored in the storage unit 107 is transferred again to the memory 106, the above-described processing may be performed in reverse.

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

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

[配置パターン]
ここで圧縮処理を説明する前に、所定の画素数(本実施形態では2×2の4画素)からなるブロックにおける色の組み合わせを考える。画素数が4画素なので、そこに占める色数は最大4色になり、ブロック内で1色〜4色の組み合わせしか存在しない。その4色の配置パターンの取り得る組み合わせの場合の数を図3に示す。
[Placement pattern]
Before explaining the compression processing here, a combination of colors in a block having a predetermined number of pixels (4 pixels of 2 × 2 in this embodiment) is considered. Since the number of pixels is four, the maximum number of colors is four, and there are only combinations of one to four colors in the block. FIG. 3 shows the number of combinations of the four color arrangement patterns.

まず、ブロック内を構成する色数が1色の場合、4画素が同色で構成されていることになるので、その組み合わせ(配置パターン)は1通りである。次に、ブロック内を構成する色数が2色の場合を考える(各色を第1色と第2色と呼ぶこととする)。図3に示すように、2色が4画素内にレイアウトされる場合の数は、所定位置の画素(本実施例では右下の画素とする)を第1色として考えると、右下画素以外の残りの3画素へ第1色もしくは第2色が入るので、4画素同色の場合を除くと、全部で7通りの組み合わせが考えられる。   First, when the number of colors constituting the block is one, four pixels are composed of the same color, so there is one combination (arrangement pattern). Next, consider a case where the number of colors constituting the block is two (each color is referred to as a first color and a second color). As shown in FIG. 3, when the two colors are laid out in four pixels, the pixel at a predetermined position (in this embodiment, the lower right pixel) is considered as the first color, except for the lower right pixel. Since the first color or the second color enters the remaining three pixels, a total of seven combinations are possible except for the case of four pixels having the same color.

次に、ブロック内を構成する色数が3色(第1色〜第3色)の場合を考える。3色が4画素内にレイアウトされる場合の数は、3色のうち1色だけ2度使われる場合の数と言い換えることができるので、4画素のうち2画素が同じ色になる場合の数を求めれば良い。つまり、3色の場合の数は、4つの画素から2つの画素を取る組み合わせとなり、全部で6通りとなる。また、ブロック内を構成する色数が4色(第1色〜第4色)の場合は1パターンしか存在しない。   Next, consider the case where the number of colors constituting the block is three (first to third colors). The number in the case where three colors are laid out in four pixels can be paraphrased as the number in which only one of the three colors is used twice, so the number in which two of the four pixels have the same color. Just ask. That is, the number in the case of three colors is a combination of taking two pixels from four pixels, for a total of six. In addition, when the number of colors constituting the block is four colors (first to fourth colors), there is only one pattern.

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

[圧縮処理]
上述のように、2×2画素の取り得る組み合わせを踏まえて、圧縮部202、252で行われる処理を、図5を用いて説明する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。入力としては、例えばRGBそれぞれ8ビットの256階調を持っており、またデータとしては8ビットデータの点順次で1画素当たり24ビットの画像として説明する。
[Compression processing]
As described above, processing performed by the compression units 202 and 252 will be described with reference to FIG. 5 based on possible combinations of 2 × 2 pixels. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. 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画素のブロックを入力し、そのブロック内の全ての2画素の組み合わせに対して24ビットの比較をする(S501)。ここで比較をした結果、全ビット一致していた場合は"1"を、不一致の場合は"0"を出力する。   First, a 2 × 2 pixel block is input, and 24-bit comparison is performed for all combinations of two pixels in the block (S501). As a result of the comparison, “1” is output when all bits match, and “0” is output when they do not match.

ここで、2×2画素内の右下から左上、右上、左下画素の位置順に、座標1、2、3、4とする(図4に示す401)。2画素の組み合わせの座標は、2−3、2−4、2−1、3−4、1−3、1−4の全部で6通り(図4に示す402)あるので、6回比較する必要があり、結果は6ビット出力される。図4に示す比較結果のように、全画素が同色であれば、全ての比較結果が1を出力し、逆に4画素が全てバラバラの画素値を持っていれば、全ての比較結果が0を出力する。   Here, the coordinates are 1, 2, 3, 4 in the order of the positions of the lower right, the upper left, the upper right, and the lower left pixels in 2 × 2 pixels (401 shown in FIG. 4). Since there are six coordinates (402 shown in FIG. 4) of the combination of two pixels, that is, 2-3, 2-4, 2-1, 3-4, 1-3, and 1-4 in total, compare 6 times. The result is output 6 bits. As shown in the comparison result shown in FIG. 4, if all pixels have the same color, all comparison results output 1, and conversely, if all four pixels have disjoint pixel values, all comparison results are 0. Is output.

この例では、4画素で色の一致から出現し得るパターンの数は15通りなので、図4に示すように、6ビットの比較結果に応じて、4ビットのパターンフラグを特定する(S502)。次に、4画素内で出現した色数及び色データを抽出する(S503)。図4に示したように、4ビットのパターンフラグ(または6ビットの比較結果)に対して、ブロック内での各色の配置を示す各パターンが対応づけられているので、各ブロックにおける色数と色データを特定することができる。   In this example, since there are 15 patterns that can appear from the color match in 4 pixels, as shown in FIG. 4, a 4-bit pattern flag is specified according to the 6-bit comparison result (S502). Next, the number of colors appearing within the four pixels and the color data are extracted (S503). As shown in FIG. 4, since each pattern indicating the arrangement of each color in the block is associated with the 4-bit pattern flag (or 6-bit comparison result), the number of colors in each block Color data can be specified.

なお、本実施形態の図4では、全てのパターンにおいて、右下の画素の色(画素値)が第1色(1番目の色データ)となるように定義している。パターンフラグが0の場合は、色数1で、右下の画素の色(画素値)を第1色として抽出する。また、パターンフラグが1〜7の場合は、色数2で、右下の画素の色(画素値)を第1色として抽出し、更に、各パターンフラグに応じて定義されている第2色(2番目の色データ)が存在する位置の画素の色(画素値)を抽出する。例えば、パターンフラグが1の場合は、右上の画素の色を第2色として抽出する。また、パターンフラグが8〜Dの場合は、色数3で、右下の画素の色(画素値)を第1色として抽出し、更に各パターンフラグに応じて定義されている第2色(2番目の色データ)及び第3色(3番目の色データ)が存在する位置の画素の色(画素値)を抽出する。例えば、パターンフラグが8の場合は、左上の画素の色(画素値)を第2色として抽出し、右上の画素の色(画素値)を第3色として抽出する。また、パターンフラグがEの場合は、右下の画素の色を第1色、左上の画素の色を第2色、右上の画素の色を第3色、左下の画素の色を第4色として抽出する。   In FIG. 4 of the present embodiment, it is defined that the color (pixel value) of the lower right pixel is the first color (first color data) in all patterns. When the pattern flag is 0, the number of colors is 1 and the color of the lower right pixel (pixel value) is extracted as the first color. When the pattern flag is 1 to 7, the number of colors is 2 and the color (pixel value) of the lower right 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 (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 lower right 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) and the third color (third color data) exist is extracted. For example, when the pattern flag is 8, the color (pixel value) of the upper left pixel is extracted as the second color, and the color (pixel value) of the upper right pixel is extracted as the third color. When the pattern flag is E, the lower right pixel is the first color, the upper left pixel is the second color, the upper right pixel is the third color, and the lower left pixel is the fourth color. Extract as

即ち、パターンフラグ(または比較結果)に基づいて、ブロックの色数が特定され(S504、S506、S508)、それぞれに応じたパターンフラグと色データとを出力する(S505、S507、S509、S510)。なお、第1色を代表色、第2〜4色を他色と呼ぶ場合もある。   That is, based on the pattern flag (or comparison result), the number of colors of the block is specified (S504, S506, S508), and the corresponding pattern flag and color data are output (S505, S507, S509, S510). . The first color may be referred to as a representative color, and the second to fourth colors may be referred to as other colors.

本処理により出力されるデータを、図6を用いて説明する。図6に示すように、例えばパターンフラグが0(即ち4画素内が1色で構成されている)の場合(S504でYES)、2色目以降は存在しないので、パターンフラグの4ビットと1色目の画素値(24ビット分の色データ)とを出力する(S505)。また、パターンフラグが1〜7(即ち4画素内が2色で構成されている)の場合(S506でYES)、2色目が存在する画素の座標をパターンフラグより算出し、パターンフラグの4ビットと2色分の画素値(48ビット分の色データ)を出力する(S507)。また、パターンフラグが8〜D(即ち3色)の場合(S508でYES)、パターンフラグの4ビットと3色分の画素値(72ビット分の色データ)とを出力する(S510)。そして、パターンフラグがE(即ち4色)の場合(S508でNO)、パターンフラグの4ビットと4色分の画素値(96ビット分の色データ)とを出力(S511)して処理を終了する(S512)。言い換えると、各ブロックから出力される色データは、ブロック内の座標(右下から左上、右上、左下の順に1、2、3、4)順に走査した場合に、出現していなかった色データが第1色から順に出力されることに相当する。   Data output by this processing will be described with reference to FIG. As shown in FIG. 6, for example, when the pattern flag is 0 (that is, the four pixels are configured with one color) (YES in S504), since the second and subsequent colors do not exist, the 4th bit of the pattern flag and the first color Are output (24-bit color data) (S505). If the pattern flag is 1 to 7 (that is, the four pixels are composed of two colors) (YES in S506), 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 pixel values for two colors (48-bit color data) are output (S507). If the pattern flag is 8 to D (that is, three colors) (YES in S508), 4 bits of the pattern flag and pixel values for three colors (72-bit color data) are output (S510). If the pattern flag is E (that is, 4 colors) (NO in S508), 4 bits of the pattern flag and pixel values for 4 colors (96-bit color data) are output (S511), and the process ends. (S512). In other words, the color data output from each block is the color data that did not appear when the coordinates in the block (1, 2, 3, 4 in the order from lower right to upper left, upper right, lower left) were scanned. This corresponds to output in order from the first color.

このように、2×2画素のブロック内の4色(96ビット)の入力データを4ビットのパターンフラグと、そこに存在する色数分の画素値を出力することで、比較的簡単な処理で出力データ量を削減することが可能になる。特に、2×2画素のブロック内で同色の画素が存在するブロック(即ち各ブロック内の色数が少ないブロック)が多いラスタ画像の場合は、出力されるデータ量の圧縮率も大きくなる。また、パターンフラグを参照することで、そのブロック内の色数を特定することが可能になる。このような処理を画像ブロック全てに対して行うことで、画像全面をデータ圧縮することが可能になる。   In this way, the input data of 4 colors (96 bits) in a 2 × 2 pixel block is output as a 4-bit pattern flag and pixel values corresponding to the number of colors existing therein, thereby relatively simple processing. 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 on all the image blocks, the entire image can be compressed.

次に、このようにして求めたパターンフラグと色データとを、DMAC203、253がメモリ106に書き込む処理(メモリ格納処理)を行う。このとき、DMACではパターンフラグと第1色のデータと第2色〜第4色のデータ(第1色の色データ以外)との書き込み位置を変える。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 203 and 253 write the pattern flag and color data obtained in this way into the memory 106 is performed. At this time, the DMAC changes the writing position of the pattern flag, the first color data, and the second to fourth color data (other than the first 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. Further, the color data of the first color (first color) of each block is stored together in a first color storage unit (memory area for storing the first color data of each block) on the memory. Become. 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 color data of the second to fourth colors of each block) on the memory. Will be.

図7は、DMACによる画像データのメモリ空間への書き込み例を示す図である。尚、サイズがM×N画素のRGB各8ビットの画像を圧縮部へ入力する場合、パターンフラグのデータが格納されるパターンフラグ格納部のデータサイズは、(M×N×4/8)バイトとなる。また、第1色のデータが格納される第1色格納部のデータサイズは、(M×N×24/8)バイトとなる。また、第2色、第3色、第4色のデータが格納される第2,3,4色格納部のデータサイズは、処理対象となるラスタ画像に応じて異なる。これは、第2,3,4色が存在するブロックの数が画像によって異なるためである。   FIG. 7 is a diagram illustrating an example of writing image data in the memory space by the DMAC. 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 that stores pattern flag data is (M × N × 4/8) bytes. It becomes. Further, the data size of the first color storage unit in which the first color data is stored is (M × N × 24/8) bytes. 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 to be processed. This is because the number of blocks in which the second, third, and fourth colors are present differs depending on the image.

ここで、第1色書き込み先頭アドレス以降のメモリ領域(第1色格納部、及び第2,3,4色格納部)に関しては、画素の色データがそのままのビット数で格納されている。即ち、JPEG等の圧縮データとは異なり、圧縮データをデコードしてラスタ画像に戻さなくても、各画素の色(画素値)を特定することができる。従って、1画素入力1画素出力で完結する色処理、例えばLUTを用いた色変換やガンマ補正処理、行列演算を用いた色空間変換処理等を行う場合、元のラスタ画像に戻す必要はなく、図7のように格納されているデータに対して直接処理を行うことが可能になる。図2に示した色処理部212で画素単位の画像処理を行う場合は、メモリ106上の第1色書き込み先頭アドレス以降の画素データをDMAC211経由で読み込み、画素単位での処理を済ませた後に、メモリ106上へ書き戻す。このとき、何らかの画素単位処理によって画素のビット数が変わらない場合には、メモリ106上の同じ場所へ上書きすることでメモリ106の節約も可能である。   Here, in the memory area (first color storage unit and second, third, and fourth color storage units) after the first color write start address, pixel color data is stored in the same number of bits. 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 a raster image. Therefore, when performing color processing that is completed with one pixel input and one pixel output, such as color conversion using LUT, gamma correction processing, color space conversion processing using matrix operation, etc., there is no need to return to the original raster image. It becomes possible to directly process the data stored as shown in FIG. In the case where image processing in units of pixels is performed by the color processing unit 212 shown in FIG. 2, pixel data after the first color writing start address on the memory 106 is read via the DMAC 211, and after processing in units of pixels is completed, Write back to the memory 106. At this time, if the number of bits of the pixel does not change due to some pixel unit processing, the memory 106 can be saved by overwriting the same location on the memory 106.

このように、圧縮データを直接用いることで、メモリバス上の転送効率が向上し、かつオリジナルのラスタ画像の画素数よりも少ない数の色データに対して処理することになり、高速処理が可能になる。   In this way, by directly using compressed data, transfer efficiency on the memory bus is improved, and processing is performed for a smaller number of color data than the number of pixels of the original raster image, enabling high-speed processing. become.

[データ格納形式]
また、図7に示すように、画像データを、パターンフラグと第1色とその他の色とに分け、離散的にメモリ上へ格納している。したがって、第1色格納部には、ラスタ画像を2×2画素のブロックに分割して、各ブロックの右下の座標の画素をサンプリングした場合の画素値(色データ)がメモリ上に連続して存在することになる。
[Data storage format]
As shown in FIG. 7, the image data is divided into a pattern flag, a first color, and other colors, and is discretely stored in the memory. Therefore, in the first color storage unit, pixel values (color data) obtained by dividing the raster image into blocks of 2 × 2 pixels and sampling the pixel at the lower right coordinate of each block are continuously stored in the memory. Will exist.

MFPにおいては、蓄積したPDL画像データやスキャン画像データのプレビュー表示、上述したネットワーク送信などの機能も有している。例えば、プリント解像度が600dpiであったとしても、プレビューや送信時にそこまでの解像度は通常必要とされず、300dpiやそれ以下で十分な場合が多い。このように、縮小データを得る必要がある場合は、第1色格納部に格納されている第1色の色データのみをまとめて抽出することで、簡単に半分のサイズのラスタ画像を得ることができる。   The MFP also has functions such as preview display of accumulated PDL image data and scanned image data, and network transmission described above. For example, even if the print resolution is 600 dpi, the resolution up to that is not usually required at the time of preview or transmission, and 300 dpi or less is often sufficient. As described above, when it is necessary to obtain reduced data, a raster image having a half size can be easily obtained by extracting only the color data of the first color stored in the first color storage unit. Can do.

例えば、600dpiのラスタ画像が図7のようなデータに変換されて蓄積されていた場合の縮小送信時を説明する。送信する画像の解像度として300dpiが指定された場合は、第1色格納部に格納されているデータをそのまま抽出して送信すればよい。また、解像度として400dpiなど、第1色格納部にサンプリングされている300dpiより大きい解像度が指定されている場合には、次のように処理する。即ち、パターンフラグ格納部と第1色格納部と第2,3,4色格納部とに格納されているデータに基づき、圧縮データを一度展開し、公知の変倍処理を用いて変倍し、当該変倍された画像を送信する。また、300dpiより小さい送信解像度指定がされている場合には、第1色格納部のデータのみを用いて、指定の解像度へ変倍処理を行う。このように、必要な画像サイズに応じて切り替えながらデータの読み込みを行うようにすればよい。上述の圧縮処理を以下で通常の圧縮処理と呼ぶ。   For example, a description will be given of the time of reduced transmission when a 600 dpi raster image is converted into data as shown in FIG. 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. Hereinafter, the above-described compression processing is referred to as normal compression processing.

[展開処理]
次に、圧縮部202、252と対になる展開部222、232を説明する。尚、展開部222、232では、上述したようなパターンフラグと色データを、ラスタ画像データへ戻す処理を行う。メモリ106上に図7に示すように配置されている圧縮データのパターンフラグ書き込み先頭アドレス、第1色書き込み先頭アドレス、及び第2、3、4色書き込み先頭アドレスの3つのアドレスをDMAC221、231へ指定する。DMAC221、231は3つのアドレスからデータを読み出し、展開部222、232へ転送する。
[Deployment processing]
Next, the expansion units 222 and 232 that are paired with the compression units 202 and 252 will be described. The developing 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 106 as shown in FIG. specify. The DMACs 221 and 231 read data from three addresses and transfer them to the expansion units 222 and 232.

展開部222、232では、まず4ビットのパターンフラグを解釈し、そのブロック内の色数を算出する。第1色データに加え、色数に応じて第2、3、4色データを読み出し、各パターンフラグに対して予め定義されている色データの配置パターン(図4)に従って、第1色ならびに第2〜4色の色データを再配置する。これにより2×2画素ブロックを展開、復号する。   The 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 in accordance with the number of colors, and the first color and the first color are determined according to the color data arrangement pattern (FIG. 4) defined in advance for each pattern flag. Rearrange 2 to 4 color data. As a result, the 2 × 2 pixel block is expanded and decoded.

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

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

[リピート処理による圧縮処理]
次に、通常の圧縮処理に追加することで、更に圧縮率を向上するための処理について説明する。通常の圧縮処理で高圧縮になることが期待される画像は、画像内で隣接画素値が同色の領域が多い画像である。このような画像領域に着目すると、2×2画素のブロック内部だけでなく、隣接する2×2画素のブロックも同色である場合が多い。
[Compression processing by repeat processing]
Next, a process for further improving the compression rate by adding to the normal compression process will be described. An image that is expected to be highly compressed by a normal compression process is an image having many regions having the same color of adjacent pixel values in the image. Focusing on such an image area, not only the inside of a 2 × 2 pixel block but also an adjacent 2 × 2 pixel block often has the same color.

そこで、前述したブロック内で閉じた圧縮方法に加え、隣接ブロックの類似性に着目した圧縮方法を説明する。図4に2×2のブロックが取り得るパターンフラグの場合の数を15通りのパターンとして4ビットで表現している。4ビットのパターンフラグでは16通りまで表現可能なので、1通りまだ利用できる余地がある。   Therefore, in addition to the compression method closed within the block described above, a compression method that focuses on the similarity between adjacent blocks will be described. In FIG. 4, the number of pattern flags that can be taken by a 2 × 2 block is expressed by 4 bits as 15 patterns. Since a 4-bit pattern flag can represent up to 16 patterns, there is still room for one pattern to be used.

そこで、現在処理しているブロックの一つ前のブロックの画素値を記憶しておき、現在のブロックと全画素一致と判断できる場合、そのブロックの画素値(色データ)は出力せず、前ブロックと同じというフラグだけ立てる。このパターンフラグに4ビットの残りの1通りを割り当てることにより、パターンフラグのビット数を変化させることなく、データの更なる圧縮が可能になる。   Therefore, if the pixel value of the block immediately before the currently processed block is stored and it can be determined that all pixels match the current block, the pixel value (color data) of that block is not output and the previous block is not output. Only flag the same as the block. By assigning the remaining 4 bits to this pattern flag, the data can be further compressed without changing the number of bits of the pattern flag.

図8は、新たなパターンフラグとして、前のブロックと同じパターンであることを示すフラグ(リピートフラグと称する)を追加した場合のビット数を示す図である。この例では、パターンフラグとして前ブロックと一致(新たに画素値出力しない)を表す"F"を追加している。図8に示すように、パターンフラグFのブロックはパターンフラグの4ビットで表現することが可能となる。即ち、パターンフラグがFのブロックは、前のブロックの画素値(色データ)とパターンフラグとを参照して展開することが可能となるので、画素値(色データ)を格納しなくて済み、圧縮率が向上する。上述の処理を以下でリピート処理と呼ぶ。   FIG. 8 is a diagram showing the number of bits when a flag (referred to as a repeat flag) indicating that the pattern is the same as the previous block is added as a new pattern flag. In this example, “F” representing a match with the previous block (no new pixel value output) is added as a pattern flag. As shown in FIG. 8, the block of the pattern flag F can be expressed by 4 bits of the pattern flag. That is, since the block having the pattern flag F can be expanded with reference to the pixel value (color data) and the pattern flag of the previous block, it is not necessary to store the pixel value (color data). The compression rate is improved. The above process is referred to as a repeat process below.

[リピート処理フロー]
ここで、リピート処理の説明を、図9を用いて詳細に説明する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。まず、処理が開始されると、ラスタ画像データを入力し、そこから2×2画素のブロックを切り出す(S901)。次に、着目ブロック(処理対象ブロック)が最初のブロックであれば、それ以前に処理し記憶しているブロックはないので(S902でYES)、前述した通常の圧縮処理と同様に圧縮処理を行う(S906)。一方、S902で着目ブロックが最初のブロックでないと判定された場合(S902にてNO)、1つ前に処理し、記憶していたブロックと着目ブロックの画素値を比較する(S903)。これにより、第1判定を行う。ここで記憶したブロックと着目ブロックの画素値が一致した場合(S904にてYES)は、1つ前に記憶した前のブロックと同じデータを使用可能であると判断する。そして、前ブロックと同じであることを示すパターンフラグFに特定し(S905)、画素値(色データ)の出力は省略する。即ち、処理対象のブロックとその前に処理対象となったブロックが画素値が一致したと判断した場合は、当該処理対象ブロックに対しては、前のブロックの繰り返しを示すパターンフラグF(リピートフラグ)を出力する。その後、S909へ進む。
[Repeat processing flow]
Here, the repeat process will be described in detail with reference to FIG. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. First, when processing is started, raster image data is input, and a block of 2 × 2 pixels is cut out therefrom (S901). Next, if the target block (processing target block) is the first block, there is no block that has been processed and stored before (YES in S902), so the compression process is performed in the same way as the normal compression process described above. (S906). On the other hand, when it is determined in S902 that the target block is not the first block (NO in S902), the pixel value of the target block is compared with the block that has been processed one time before and stored (S903). Thereby, the first determination is performed. When the pixel value of the block stored here and the pixel value of the block of interest match (YES in S904), it is determined that the same data as the previous block stored immediately before can be used. Then, the pattern flag F indicating that it is the same as the previous block is specified (S905), and output of pixel values (color data) is omitted. That is, when it is determined that the pixel value of the block to be processed matches the block to be processed before that, the pattern flag F (repeat flag) indicating the repetition of the previous block is determined for the block to be processed. ) Is output. Thereafter, the process proceeds to S909.

また、記憶したブロックと画素値が一致しない場合(S904にてNO)は、前述した通常の圧縮処理を行う(S906)。その後、そのデータの展開を行い(S907)、その展開された2×2画素のブロックを前のブロックのデータとして記憶更新しておく(S908)。なお、本実施形態では、S906で圧縮処理を行った後に、S907〜S908で前ブロックのデータを更新するようにしているが、これに限るものではない。例えば、S906で圧縮処理を行う前に、当該処理対象のブロックの画素値を用いて前ブロックのデータを更新するようにしても構わない。   If the stored block does not match the pixel value (NO in S904), the normal compression process described above is performed (S906). Thereafter, the data is expanded (S907), and the expanded 2 × 2 pixel block is stored and updated as data of the previous block (S908). In this embodiment, after the compression process is performed in S906, the data of the previous block is updated in S907 to S908. However, the present invention is not limited to this. For example, before performing the compression processing in S906, the data of the previous block may be updated using the pixel value of the processing target block.

次に、記憶したブロックと画素値が一致しなかったブロックに対しては、S906で通常の圧縮処理を行った結果のパターンフラグと画素値(色データ)とを出力し、記憶したブロックと画素値が一致したブロックに対しては、パターンフラグFのみ出力する(S909)。この処理を最後のブロックまで繰り返し(S910でYES)、画像全体の圧縮処理を終了する。   Next, for a block whose pixel value does not match the stored block, the pattern flag and pixel value (color data) as a result of performing the normal compression processing in S906 are output, and the stored block and pixel Only the pattern flag F is output for the blocks whose values match (S909). This process is repeated until the last block (YES in S910), and the entire image compression process is terminated.

パターンフラグのビット数が4ビットと増えていないので、前述した通常の圧縮処理に比べて確実に圧縮率を向上させることが可能であるが、第1色の色データのサイズも、第2、3、4色データと同様に不定(画像によって異なる)になってしまう。   Since the number of bits of the pattern flag has not increased to 4 bits, it is possible to improve the compression rate with certainty compared to the normal compression processing described above, but the size of the color data of the first color is Like the three- and four-color data, it becomes indefinite (differs depending on the image).

従って、図10に示すように、第1色データと連続したメモリ空間に第2、3、4色のデータを格納することができず、第1色と、第2、3、4色のデータを離散的に持たせる必要がある。前述した図2に示す色処理部212では、メモリ106上の第1色書き込み先頭アドレス以降の画素データをDMAC211経由で読み込み、画素単位で処理を済ませた後にメモリ106上へ書き戻せた。しかしながら、リピート処理では、第1色と、第2、3、4色が連続していないので、第1色のアドレスに加えて第2、3、4色の書き込み先頭アドレスも含めて色処理部212のDMAC211に指定する必要がある。   Accordingly, as shown in FIG. 10, the second, third, and fourth color data cannot be stored in the memory space continuous with the first color data, and the first color, the second, third, and fourth color data are stored. Must be given discretely. In the above-described color processing unit 212 shown in FIG. 2, pixel data after the first color writing head address on the memory 106 is read via the DMAC 211, processed in units of pixels, and then written back onto the memory 106. However, since the first color and the second, third, and fourth colors are not continuous in the repeat process, the color processing unit includes the second, third, and fourth write start addresses in addition to the first color address. It is necessary to specify in the DMAC 211 of 212.

ここでは、1つ左のブロックを前ブロックと定義し、そのブロックとの一致、不一致を状態として保持しているが、これに限るものではない。例えば、上のブロックとの一致やパターンフラグのビット数を拡張することで、より広いエリアとの一致を規定できる。パターンフラグのビット数を拡張する場合には、色データを保持するよりもデータ量を削減できる範囲で設定する。   Here, the block one block to the left is defined as the previous block, and matching and mismatching with the block are held as states, but this is not restrictive. For example, it is possible to define a match with a wider area by expanding the match with the upper block or the number of bits of the pattern flag. When the number of bits of the pattern flag is expanded, it is set within a range where the data amount can be reduced rather than holding the color data.

[リピートフラグを有する圧縮データに対する展開処理]
次に、圧縮処理と対になる展開処理を説明する。展開処理は、前述したようなパターンフラグ、画素データからラスタ画像データに戻す処理である。メモリ106上に図10に示すように配置されている圧縮データのパターンフラグ書き込み先頭アドレス、第1色書き込み先頭アドレス、第2、3、4色書き込み先頭アドレスの3つのアドレスをDMAC221、231へ指定する。パターンフラグを参照して、前ブロックと同じと識別された際は、その注目ブロックの出力は前ブロックの出力そのものを用い、それ以外のフラグの場合は前述した方法で展開が可能である。尚、この際に1ブロック分は次ブロックで利用する可能性があるのでバッファする必要がある。
[Expanding process for compressed data with repeat flag]
Next, a decompression process paired with the compression process will be described. The expansion process is a process for returning from the pattern flag and pixel data to the raster image data as described above. Designate the DMACs 221 and 231 with three addresses of the compressed data pattern flag write start address, the first color write start address, and the second, third and fourth color write start addresses arranged on the memory 106 as shown in FIG. To do. When it is identified as the same as the previous block with reference to the pattern flag, the output of the block of interest uses the output of the previous block itself, and other flags can be developed by the method described above. At this time, since one block may be used in the next block, it is necessary to buffer it.

しかしながら、展開処理で画像サイズを1/2にする場合には、前述したようにメモリ106から第1色データのみ読み込みを行い、画像を構成するだけでは隣接ブロックとの一致データを展開することができない。そのため、本実施形態の展開処理では、パターンフラグを参照しながら、第1色のデータに基づいて1/2サイズの画像を復元する。なお、第2、3、4色のデータは使用せずに済む。具体的には、パターンフラグを参照した際、前ブロックと同じと識別された場合は、第1色データ中の前の色データを繰り返し出力することで展開が可能になる。これにより、メモリバスの帯域を節約することが可能になる。   However, when the image size is halved by the expansion process, only the first color data is read from the memory 106 as described above, and the matching data with the adjacent block can be expanded only by composing the image. Can not. For this reason, in the development processing of the present embodiment, a 1/2 size image is restored based on the first color data while referring to the pattern flag. The second, third and fourth color data need not be used. Specifically, when the pattern flag is referred to and identified as the same as the previous block, the previous color data in the first color data can be repeatedly output to be developed. As a result, it is possible to save the bandwidth of the memory bus.

[類似性に基づく圧縮処理]
次に、リピート処理とは異なる、隣接ブロックの類似性に着目した圧縮処理について説明する。この圧縮処理はリピート処理と同様に、現在処理しているブロックの画素値を、周囲のブロックの画素値を参照して展開することで、更に圧縮率を向上する処理である。
[Compression based on similarity]
Next, compression processing that focuses on the similarity between adjacent blocks, which is different from repeat processing, will be described. Similar to the repeat process, this compression process is a process that further improves the compression ratio by expanding the pixel value of the currently processed block with reference to the pixel values of the surrounding blocks.

図11は現在処理しているブロックと周囲のブロックの画素の位置関係を示す図である。図11で示すように、現在処理しているブロックの座標2の画素は、左上のブロックの座標1の画素の右下に配置されており、座標3の画素は上のブロックの座標1の画素の下に配置され、座標4の画素は左のブロックの座標1の画素の右に隣接して配置されている。これは、図4の401にて示した配置と同様である。そして、処理対象ブロック内の座標1の画素(第1色の画素)の左上に位置する座標2の画素については、左上方向に隣接する別のブロック内の座標1の画素(第1色の画素)と比較することにより一致するか判定する。同様に、処理対象ブロック内の座標1の画素(第1色の画素)の上に位置する座標3の画素については、上方向に隣接する別のブロック内の座標1の画素(第1色の画素)と比較することにより一致するか判定する。更に、処理対象ブロック内の座標1の画素(第1色の画素)の左に位置する座標4の画素については、左方向に隣接する別のブロック内の座標1の画素(第1色の画素)と比較することにより一致するか判定する。このように、現在処理しているブロック内の座標2〜4とそれぞれ隣接している3つのブロックの座標1の画素の画素値が一致する場合、次に示す処理を行う。現在処理しているブロックの座標1(第1色の画素)以外の画素値は出力せず、第1色の画素値と、3方向の第1色の画素と一致というフラグだけを出力する。このパターンフラグに残りの1パターンを割り当てることにより、パターンフラグのビット数を変化させることなく、データの更なる圧縮が可能になる。   FIG. 11 is a diagram showing the positional relationship between pixels of a block currently being processed and surrounding blocks. As shown in FIG. 11, the pixel at coordinate 2 of the block currently being processed is located at the lower right of the pixel at coordinate 1 of the upper left block, and the pixel at coordinate 3 is the pixel at coordinate 1 of the upper block. The pixel at coordinate 4 is arranged adjacent to the right of the pixel at coordinate 1 in the left block. This is the same as the arrangement indicated by 401 in FIG. For the pixel at coordinate 2 located at the upper left of the pixel at coordinate 1 (first color pixel) in the processing target block, the pixel at first coordinate (pixel of the first color) in another block adjacent in the upper left direction. ) To determine whether they match. Similarly, with respect to the pixel of coordinate 3 positioned above the pixel of coordinate 1 (first color pixel) in the processing target block, the pixel of coordinate 1 (first color of the first color) in another block adjacent in the upward direction. By comparing with (pixel). Furthermore, with respect to the pixel of coordinate 4 located to the left of the pixel of coordinate 1 (first color pixel) in the processing target block, the pixel of coordinate 1 (first color pixel) in another block adjacent in the left direction. ) To determine whether they match. As described above, when the pixel values of the coordinates 1 of the three adjacent blocks coincide with the coordinates 2 to 4 in the block currently being processed, the following processing is performed. The pixel value other than the coordinate 1 (first color pixel) of the block currently being processed is not output, but only the first color pixel value and the flag that matches the first color pixel in the three directions are output. By assigning the remaining one pattern to this pattern flag, it is possible to further compress the data without changing the number of bits of the pattern flag.

図12は、リピート処理を行わない場合、新たなパターンフラグとして、3方向の画素が一致することを示すフラグ(3方向一致フラグと称する)を追加した場合のビット数を示す図である。この例ではパターンフラグとして周囲3方向の画素と一致(第1色以外の画素値を出力しない)を表す"F"を追加している。図12に示すように、パターンフラグがFのブロックはパターンフラグの4ビットと第1色の画素値の24ビットで表現することが可能となる。即ち、パターンフラグがFのブロックは、周囲の3つのブロックの第1色の画素値とパターンフラグとを参照して展開することが可能となるので、第2〜4色の画素値を格納しなくて済み、圧縮率が向上する。この場合、パターンフラグが0(ブロック内の色データが1色のみ)の場合と同じデータ量まで削減することが可能となる。つまり、類似性に基づいて圧縮されるブロックのデータ量は、パターンフラグ(4ビット)と1色分の色データ(24ビット)との総和である28ビットとなる。上述の処理を以下で3方向一致処理と呼ぶ。   FIG. 12 is a diagram showing the number of bits when a flag indicating that pixels in three directions match (referred to as a three-way match flag) is added as a new pattern flag when repeat processing is not performed. In this example, “F” is added as a pattern flag, which represents a match with pixels in the surrounding three directions (pixel values other than the first color are not output). As shown in FIG. 12, a block whose pattern flag is F can be expressed by 4 bits of the pattern flag and 24 bits of the pixel value of the first color. That is, since the block having the pattern flag F can be expanded with reference to the pixel values of the first color and the pattern flags of the three surrounding blocks, the pixel values of the second to fourth colors are stored. This is unnecessary and the compression rate is improved. In this case, it is possible to reduce to the same data amount as when the pattern flag is 0 (the color data in the block is only one color). That is, the data amount of the block compressed based on the similarity is 28 bits that is the sum of the pattern flag (4 bits) and the color data for one color (24 bits). The above process is hereinafter referred to as a three-way matching process.

[類似性に基づく圧縮処理フロー]
ここで、3方向一致処理の説明を図13を用いて詳細に説明する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。まず、処理が開始されると、ラスタ画像データを入力し、そこから2×2画素のブロックを切り出す(S1301)。次に画像データの上端または左端のブロックであれば(S1302にてYES)、周囲にブロックが存在しない箇所があるので、前述した通常の圧縮処理と同様に圧縮処理を行う(S1306)。一方、上端または左端のブロックでない場合(S1302にてNO)、左上、上、左のそれぞれに配置されているブロックの第1色の画素値と、現在処理している第1色以外のそれぞれの画素値を比較する(S1303)。第1色以外の画素の画素値の比較結果がすべて一致だった場合(S1304でYES)、3方向一致を示すパターンフラグFに特定し、第1色以外の画素値の出力は省略する(S1306)。即ち、処理対象のブロックの第1色以外の画素値と周辺ブロックの第1色の画素値が一致したと判断した場合は、3方向一致を示すパターンフラグF(3方向一致フラグ)を出力する。この処理を最後のブロックまで繰り返し(S1308)、画像全体の圧縮処理を終了する。
[Compression processing flow based on similarity]
Here, the description of the three-way matching process will be described in detail with reference to FIG. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. First, when the process is started, raster image data is input, and a 2 × 2 pixel block is cut out therefrom (S1301). Next, if it is the uppermost or leftmost block of the image data (YES in S1302), there is a portion where no block exists around it, so the compression process is performed in the same way as the normal compression process described above (S1306). On the other hand, if the block is not the upper end or the left end block (NO in S1302), the pixel values of the first color of the blocks arranged at the upper left, the upper, and the left, and the respective colors other than the first color currently processed The pixel values are compared (S1303). If all pixel value comparison results of pixels other than the first color match (YES in S1304), the pattern flag F indicating three-way matching is specified, and output of pixel values other than the first color is omitted (S1306). ). That is, when it is determined that the pixel values other than the first color of the block to be processed match the pixel values of the first color of the surrounding blocks, a pattern flag F (three-way match flag) indicating three-way match is output. . This process is repeated until the last block (S1308), and the entire image compression process is terminated.

リピート処理と同様にパターンフラグのビット数が4ビットから増加していないため、前述した通常の圧縮処理に比べて、確実に圧縮率を向上させることが可能である。なお、メモリ空間へのデータの格納方法は、図7に示すような通常の圧縮処理のメモリ空間へのデータ格納方法と同様である。   Similar to the repeat processing, the number of bits of the pattern flag does not increase from 4 bits, so that the compression rate can be improved reliably as compared with the normal compression processing described above. The method for storing data in the memory space is the same as the method for storing data in the memory space for normal compression processing as shown in FIG.

[3方向一致フラグを有する圧縮データに対する展開処理]
次に圧縮処理と対になる展開処理を説明する。展開処理は前述したようなパターンフラグ、画素データからラスタ画像データに戻す処理である。メモリ106上に図7に示すように配置されている圧縮データのパターンフラグ書き込み先頭アドレス、第1色書き込み先頭アドレス、第2、3、4色書き込み先頭アドレスの3つのアドレスをDMAC221、231へ指定する。パターンフラグを参照して、3方向一致したと識別された際は、その現在処理しているブロックの出力は隣接、または斜め上に配置されたブロックを参照することで展開し、それ以外のフラグの場合は前述した方法で展開が可能である。尚、この際に隣接した3方向のブロックの画素値を参照するために、現在処理しているブロックのひとつ上の1ラインと前のブロックをバッファする必要がある。
[Expansion processing for compressed data having a three-way match flag]
Next, the decompression process paired with the compression process will be described. The expansion process is a process for returning from the pattern flag and pixel data to the raster image data as described above. The compressed data pattern flag write start address, first color write start address, second, third and fourth color write start addresses of the compressed data arranged on the memory 106 as shown in FIG. To do. When it is identified that three directions coincide with each other with reference to the pattern flag, the output of the block currently being processed is expanded by referring to the block arranged adjacently or diagonally above, and the other flags In this case, it can be expanded by the method described above. At this time, in order to refer to the pixel values of adjacent three-direction blocks, it is necessary to buffer one line above the block currently processed and the previous block.

前述したリピート処理や3方向一致処理は、4ビットの配置パターン情報の残り1通りにこれらの処理を割り当てることで、通常の圧縮処理だけの場合と比べ、更に圧縮率を向上する処理である。リピート処理や3方向一致処理を単独で行うより、これらの処理を組み合わせることで、更なる圧縮率向上が見込める。しかし、これらを組み合わせて処理を行うためには、パターン数の増加により配置パターン情報のビット数を増やす必要がある。   The repeat process and the three-direction matching process described above are processes that further improve the compression ratio by assigning these processes to the remaining one of the 4-bit arrangement pattern information as compared with the case of only the normal compression process. The compression ratio can be further improved by combining these processes rather than performing the repeat process and the three-way matching process alone. However, in order to perform processing by combining these, it is necessary to increase the number of bits of arrangement pattern information by increasing the number of patterns.

[本発明に係る圧縮処理]
ここで、本発明に係る配置パターン情報のビット数を増やさずに、リピート処理と3方向一致処理とを組み合わせて圧縮処理を行う方法について説明する。配置パターン情報のビット数を増やさずに、通常の圧縮処理に対して更に上述した2つの処理を追加するためには、各パターンフラグに既に割り当てられている処理と、新たに追加したい処理を入れ替えればよい。
[Compression processing according to the present invention]
Here, a method for performing compression processing by combining repeat processing and three-way matching processing without increasing the number of bits of the arrangement pattern information according to the present invention will be described. In order to add the above-described two processes to the normal compression process without increasing the number of bits of the arrangement pattern information, the process already assigned to each pattern flag and the process to be newly added are switched. That's fine.

図14(A)に初期のパターンのパターンフラグへの割り当てを示す。ここでは通常の圧縮処理における15通りのパターンとリピート処理用の1パターンとにパターンフラグ0〜F(16パターン)を割り当てている。次に、図14(B)にパターンフラグを入れ替える例を示す。この例では、パターンフラグDに割り当てられているパターンと3方向一致処理を入れ替え、3方向一致処理にパターンフラグDを割り当てている。次に、初期のパターンフラグDに割り当てられていたパターンに、新たに4色のパターンであるパターンフラグEを割り当てている。すなわち、初期のパターンフラグDに相当するブロックが入力された場合、そのブロックは4色のブロック(E)として扱うようにする。このパターンの場合、4ビットのパターンフラグと、96ビットの4画素分の画素値を出力することになる。そのため、パターンの入れ替えを行っても、初期のパターンフラグDに相当するパターンである入力ブロックは、4画素分の画素値を出力するため画質の劣化は引き起こすことはない。   FIG. 14A shows assignment of the initial pattern to the pattern flag. Here, pattern flags 0 to F (16 patterns) are assigned to 15 patterns in normal compression processing and one pattern for repeat processing. Next, FIG. 14B shows an example of replacing the pattern flag. In this example, the pattern assigned to the pattern flag D is replaced with the three-way matching process, and the pattern flag D is assigned to the three-way matching process. Next, a pattern flag E which is a pattern of four colors is newly assigned to the pattern assigned to the initial pattern flag D. That is, when a block corresponding to the initial pattern flag D is input, the block is handled as a four-color block (E). In the case of this pattern, a 4-bit pattern flag and a 4-bit pixel value of 96 bits are output. Therefore, even if the patterns are replaced, the input block that is a pattern corresponding to the initial pattern flag D outputs the pixel values for four pixels, so that the image quality is not deteriorated.

しかしながら、パターン入れ替えを行うと、初期のパターンの中で入れ替えられたパターンは上述したとおり、4色のブロック(E)として扱われる。そのため、初期のパターンで圧縮する場合には出力する必要のなかった画素値(色データ)も出力することになり、その分圧縮率は低下してしまう。   However, when pattern replacement is performed, the pattern replaced in the initial pattern is treated as a four-color block (E) as described above. For this reason, when compressing with the initial pattern, pixel values (color data) that did not need to be output are also output, and the compression rate is reduced accordingly.

図15に入力データを、初期のパターンと入れ替え後のパターンで圧縮処理を行った場合の出力データを示す。図15は2色のブロックを4色のブロックとして扱った場合の例である。4色として扱われるブロックは4画素分の画素値を出力しなければならないため、2画素分の画素データ(48ビット)が増加することになる。   FIG. 15 shows output data when the input data is compressed with the initial pattern and the pattern after replacement. FIG. 15 shows an example in which a two-color block is treated as a four-color block. Since a block treated as four colors must output pixel values for four pixels, pixel data (48 bits) for two pixels increases.

そのため、確実に圧縮率を向上させるためには、パターンを入れ替えることで画素データがどれだけ増加するか、また、3方向一致処理を追加することで、圧縮率がどれだけ向上するかを判断し、パターンを入れ替える必要がある。つまり、通常のパターンと入れ替え後のパターンのいずれか、圧縮率が高い方をブロックに対して適用する。   Therefore, in order to improve the compression rate reliably, determine how much the pixel data will increase by replacing the pattern, and how much the compression rate will improve by adding the three-way matching process. It is necessary to change the pattern. That is, the higher one of the normal pattern and the pattern after replacement is applied to the block.

図16に画像データを処理したときの各パターンの出現回数のカウント値とパターン入れ替えによるデータ削減量とデータ増加量を示す。ここで、図16を用いて、入れ替えるパターンの判断方法を示す。図16は通常の圧縮処理とリピート処理を組み合わせた16通りの中から3通りを抜粋して示した。初めに2色のパターンaを例に説明する。画像全体におけるパターンaの出現回数は30回で、そのうち、3方向一致した回数は10回であったとする。3方向一致処理を追加することでパターンaのブロックのうち10個は1色分の画素データ(24ビット)を削減できる。そのため、パターンaの場合は、3方向一致により(1×10×24/8=30)バイト削減できる。一方、もし3方向一致処理をパターンaと入れ替えることで追加した場合、パターンaは4色のブロックとして扱われるため、前述したとおり2色分の余分なデータを出力する必要がある。つまりパターンaと3方向一致処理を入れ替えた場合、(2×(30−10)×24/8=120)バイトのデータが増加する。同様に、パターンb、パターンcを考えると図16のような結果となる。   FIG. 16 shows the count value of the number of appearances of each pattern when image data is processed, and the data reduction amount and data increase amount due to pattern replacement. Here, a method for determining a pattern to be replaced will be described with reference to FIG. FIG. 16 shows 3 types extracted from 16 types of combinations of normal compression processing and repeat processing. First, a two-color pattern a will be described as an example. It is assumed that the number of occurrences of the pattern a in the entire image is 30 times, of which the number of matches in the three directions is 10 times. By adding the three-direction matching process, ten of the blocks in the pattern a can reduce pixel data (24 bits) for one color. Therefore, in the case of the pattern a, the number of bytes can be reduced by matching in three directions (1 × 10 × 24/8 = 30). On the other hand, if the three-direction matching process is added by replacing the pattern a, the pattern a is handled as a block of four colors, so that it is necessary to output extra data for two colors as described above. That is, when the pattern a and the three-direction matching process are exchanged, (2 × (30−10) × 24/8 = 120) bytes of data increase. Similarly, when the patterns b and c are considered, the result is as shown in FIG.

もし表記していない残りのパターンにおける3方向一致回数が0であったとすると、3方向一致処理によって削減されるデータは合計150バイトである。データ削減量の合計がパターンごとのデータ増加量を上回っていれば、3方向一致処理とパターンを入れ替えることによって、圧縮率が向上することを判断できる。データ削減量の合計がデータ増加量を上回っているパターンの中から最もデータ増加量が少ないパターンを3方向一致と入れ替えることで、圧縮率向上を見込むことができる。図16においては、パターンbが入れ替え対象のパターンとして選択され、画像全体で(150−30=120)バイト圧縮率が向上する。もし、データ削減量の合計がパターンの入れ替えにより発生する各パターンのデータ増加量をいずれも超えない場合、パターンは入れ替えない。   If the number of three-way matching times in the remaining patterns not shown is zero, the data reduced by the three-way matching process is a total of 150 bytes. If the total data reduction amount exceeds the data increase amount for each pattern, it can be determined that the compression rate is improved by replacing the three-way matching process and the pattern. By replacing the pattern with the smallest data increase amount among the patterns in which the total data reduction amount exceeds the data increase amount with the three-way match, the compression ratio can be expected to be improved. In FIG. 16, the pattern b is selected as a replacement target pattern, and the byte compression rate is improved for the entire image (150-30 = 120). If the total data reduction amount does not exceed the data increase amount of each pattern generated by the pattern replacement, the pattern is not replaced.

パターンの入れ替えを行った場合、入れ替えたパターンフラグを示すパターン入れ替えフラグと、3方向一致処理を追加したことを示す追加処理フラグ”1”を出力し保持する。パターン入れ替えフラグと追加処理フラグから圧縮に用いたパターンを判断できるので、これより展開処理を行い元の画像に復元することが可能である。   When pattern replacement is performed, a pattern replacement flag indicating the replaced pattern flag and an additional process flag “1” indicating that the three-way matching process has been added are output and held. Since the pattern used for the compression can be determined from the pattern replacement flag and the additional processing flag, it is possible to restore the original image by performing a development process.

このように、カウンタを用いて各パターンの出現回数をカウントし、パターンフラグに割り当てられているパターンを確実に圧縮率が向上するように入れ替えることで、配置パターン情報のビット数を増加させずに処理を追加することができる。これにより、第1カウント手段を実現する。   In this way, the number of occurrences of each pattern is counted using a counter, and the pattern assigned to the pattern flag is replaced so as to improve the compression rate without increasing the number of bits of the arrangement pattern information. Processing can be added. Thereby, the first counting means is realized.

[本発明に係る処理フロー]
ここで、本発明の処理方法を、図17を用いて詳細に説明する。本実施形態では、通常の圧縮処理とリピート処理を4ビットの配置パターン情報で表し、更に3方向一致処理を組み合わせた場合について説明する。ここでは、通常の圧縮処理のパターン15通りとリピート処理の組み合わせを初期のパターンと定義する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。
[Processing Flow According to the Present Invention]
Here, the processing method of the present invention will be described in detail with reference to FIG. In the present embodiment, a case will be described in which normal compression processing and repeat processing are represented by 4-bit arrangement pattern information and three-way matching processing is combined. Here, 15 patterns of normal compression processing and combinations of repeat processing are defined as initial patterns. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like.

まず、処理が開始されると、ラスタ画像データを入力し、そこから2×2画素のブロックを切り出す(S1701)。次に、S1701にて切り出されたブロックに対し圧縮処理を行いつつ、並行して各パターンフラグの出現回数をカウントする(S1702)。ここでの処理については、図18を用いて後述する。ここまでの処理を画像データの最後のブロックまで繰り返し(S1703でYES)、画像全体の圧縮処理を行い、記憶部に保持する。ここで、圧縮結果から目標圧縮率に達しているかの判断を行う(S1704)。ここでの目標圧縮率は、入力された画像データに対し、目標とする圧縮率である。この目標圧縮率は、予め定義されていても良いし、ユーザにより指定されても良い。判断の結果、S1702における画像データへの処理により、目標圧縮率を達成している場合(S1704でYES)、圧縮処理を終了する。一方、目標圧縮率を達成していない場合(S1704にてNO)、圧縮率を向上させるために、パターンの入れ替え処理を行う(S1705)。ここでの処理については、図19を用いて後述する。パターンの入れ替え処理が行われた結果、圧縮率が向上する(データ量が減少する)場合(S1706にてYES)、次に入れ替えたパターンを用いて圧縮処理を行い(S1707)、処理を終了する。ここでの処理については、図20を用いて後述する。パターンの入れ替え処理の結果、圧縮率が向上しない(データ量が減少しない)場合(S1706にてNO)、例えばJPEGのような非可逆な圧縮手段(不図示)で圧縮を行い(S1708)、処理を終了する。なお、S1704にて、目標圧縮率が達成できないと判定された場合(S1704にてNO)において、S1707では、元の画像データに対してパターンフラグを入れ替えた後の割り当てを用いて圧縮処理を行う。また、S1708では、元の画像データに対して非可逆な圧縮方式にて圧縮処理を行う。なお、非可逆圧縮方式による非可逆圧縮を適用する画像データは、元の画像データでもよいし、一度S1702にて圧縮された画像データに対して適用しても良い。従って、S1702にて圧縮され、記憶部に保持された圧縮データは、破棄されても良いし、更なる圧縮等の用途で用いられても良い。   First, when the process is started, raster image data is input, and a 2 × 2 pixel block is cut out therefrom (S1701). Next, while performing compression processing on the block extracted in S1701, the number of appearances of each pattern flag is counted in parallel (S1702). This process will be described later with reference to FIG. The processing so far is repeated up to the last block of the image data (YES in S1703), the entire image is compressed, and stored in the storage unit. Here, it is determined from the compression result whether the target compression rate has been reached (S1704). The target compression rate here is a target compression rate for the input image data. This target compression rate may be defined in advance or specified by the user. As a result of the determination, if the target compression rate is achieved by the processing on the image data in S1702 (YES in S1704), the compression processing is terminated. On the other hand, if the target compression rate has not been achieved (NO in S1704), pattern replacement processing is performed to improve the compression rate (S1705). This process will be described later with reference to FIG. As a result of the pattern replacement process, if the compression rate improves (data amount decreases) (YES in S1706), the compression process is performed using the next replaced pattern (S1707), and the process ends. . This process will be described later with reference to FIG. If the compression rate does not improve as a result of the pattern replacement process (NO in S1706) (NO in S1706), compression is performed by an irreversible compression means (not shown) such as JPEG (S1708). Exit. If it is determined in S1704 that the target compression rate cannot be achieved (NO in S1704), in S1707, compression processing is performed using the assignment after replacing the pattern flag for the original image data. . In step S1708, the original image data is compressed using an irreversible compression method. Note that the image data to which the irreversible compression by the irreversible compression method is applied may be the original image data, or may be applied to the image data once compressed in S1702. Therefore, the compressed data compressed in S1702 and stored in the storage unit may be discarded or used for further compression or the like.

[圧縮処理&カウント処理]
ここで、上述した処理における圧縮処理とカウント処理(S1702)について、図18を用いて詳細に説明する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。また、ここでのカウンタの値は、メモリ106等の記憶部に保持されている。まず、処理が開始されると、初めに現在処理しているブロックが最初のブロックか判断し(S1801)、最初のブロックであれば以前に圧縮処理を適用し記憶したブロックはないため(S1801でYES)、通常の圧縮処理を行う(S1807)。一方、最初のブロックでない場合(S1801でNO)、1つ前に処理し、記憶していたブロックと画素値を比較する(S1802)。ここで、記憶したブロックと画素値が一致した場合(S1803にてYES)、前のブロックと同じであることを示すパターンフラグ(F)を作成し(S1804)、パターンフラグを出力する(S1805)。その後、リピートフラグに対応するカウンタに1を加算する(S1806)。
[Compression & Counting]
Here, the compression processing and count processing (S1702) in the above-described processing will be described in detail with reference to FIG. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. Further, the counter value here is held in a storage unit such as the memory 106. First, when processing is started, it is first determined whether the block currently being processed is the first block (S1801). If it is the first block, there is no block that has been previously stored by applying compression processing (in S1801). YES), normal compression processing is performed (S1807). On the other hand, if it is not the first block (NO in S1801), the previous block is processed and the pixel value is compared with the stored block (S1802). If the pixel value matches the stored block (YES in S1803), a pattern flag (F) indicating the same as the previous block is created (S1804), and the pattern flag is output (S1805). . Thereafter, 1 is added to the counter corresponding to the repeat flag (S1806).

また、記憶したブロックと画素値が一致しない場合(S1803にてNO)、通常の圧縮処理を行う(S1807)。その後、そのデータの展開を行い(S1808)、展開された2×2画素のブロックを前のブロックのデータとして、展開ブロックを記憶する(S1809)。次に画素データとパターンフラグを出力する(S1810)。そして、判別されたパターンフラグに対応するカウンタに1を加算する(S1811)。   If the stored block does not match the pixel value (NO in S1803), normal compression processing is performed (S1807). Thereafter, the data is expanded (S1808), and the expanded block is stored with the expanded 2 × 2 pixel block as the previous block data (S1809). Next, pixel data and a pattern flag are output (S1810). Then, 1 is added to the counter corresponding to the determined pattern flag (S1811).

次に、判別されたパターンの中に3方向一致した回数がどれだけあったかの判断を行う(S1812)。まず判別されたパターンが1色であった場合(S1812にてYES)、1色のパターンを3方向一致と入れ替えても、出力する画素数の変化はないので、カウント処理は行う必要がない。そのため、ここで処理を終了する。判別されたパターンが1色でなかった場合に(S1812にてNO)、3方向一致しているかどうかの判断を行う(S1813)。ここで、現在処理しているブロックが画像の上端または左端のブロックであれば(S1813でYES)、周囲にブロックが存在しない箇所があり、3方向一致しないのでここで処理を終了する。一方、上端または左端のブロックでない場合(S1813にてNO)、隣または斜め上に配置されているブロックの第1色の画素値と現在処理しているブロックの第1色以外のそれぞれの画素値を比較する(S1814)。画素値を比較した結果、一致しなかった場合(S1815にてNO)、ここで処理を終了する。また、比較した結果が全て一致した場合(S1815にてYES)、3方向一致を示すカウンタに1を加算した後、(S1816)、処理を終了する。S1816の処理により、第2カウント手段を実現する。   Next, it is determined how many times the identified pattern has been matched in three directions (S1812). If the determined pattern is one color (YES in S1812), there is no change in the number of pixels to be output even if the one-color pattern is replaced with the three-direction match, so there is no need to perform the counting process. Therefore, the process ends here. If the determined pattern is not one color (NO in S1812), it is determined whether the three directions match (S1813). Here, if the currently processed block is the uppermost or leftmost block of the image (YES in S1813), there are places where there are no blocks around and there is no coincidence in three directions, so the processing ends here. On the other hand, if the block is not the upper end or the left end block (NO in S1813), the pixel value of the first color of the block arranged next to or obliquely above and the pixel value of each block other than the first color of the currently processed block Are compared (S1814). If the pixel values are not matched as a result of the comparison (NO in S1815), the process ends here. If all the comparison results match (YES in S1815), 1 is added to the counter indicating the three-way match (S1816), and the process ends. The second counting means is realized by the processing of S1816.

[パターン入れ替え処理]
次に、上述した処理におけるパターン入れ替え処理(S1705)について、図19を用いて詳細に説明する。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。まず処理が開始されると、S1702のカウント処理(図18)によってカウントした結果を記憶部から読み出し、パターンを入れ替えた場合の合計データ削減量を計算する(S1901)。次に、パターンを入れ替えた場合のパターンごとのデータ増加量を計算する(S1902)。S1901およびS1902に置ける計算方法は上記に述べたとおりである。その後、S1901、S1902で計算した結果を比較する。ここで、合計データ削減量が入れ替えによるデータ増加量より大きくなるパターンがある場合(S1903でYES)、2色または3色のパターン(パターンフラグ2〜D)の中からデータ増加量が最小となるパターンフラグを入れ替え対象パターンフラグとして選択する(S1904)。S1904で選択されたパターンは4色のパターン(パターンフラグE)として扱い、3方向一致処理と入れ替えを行い、入れ替える配置パターンを示す情報を記憶部に保持する(S1905)。ここで、S1904で選択されたパターンを示すフラグ(以下、パターン入れ替えフラグと称する)と、どの処理を追加したかを示すフラグ(以下、追加処理フラグと称する)を出力する(S1906)。これにより、フラグ出力手段を実現する。そして、本処理を終了する。一方、合計データ削減量がデータ増加量より大きくなるパターンがない場合(S1903にてNO)、パターン入れ替えを行わず本処理を終了する。なお、S1903の処理により、第3判定手段を実現する。
[Pattern replacement process]
Next, the pattern replacement process (S1705) in the process described above will be described in detail with reference to FIG. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. First, when the processing is started, the count result of S1702 (FIG. 18) is read from the storage unit, and the total data reduction amount when the patterns are replaced is calculated (S1901). Next, the data increase amount for each pattern when the patterns are replaced is calculated (S1902). The calculation method for S1901 and S1902 is as described above. Thereafter, the results calculated in S1901 and S1902 are compared. Here, when there is a pattern in which the total data reduction amount is larger than the data increase amount due to replacement (YES in S1903), the data increase amount is the smallest among the two-color or three-color patterns (pattern flags 2 to D). The pattern flag is selected as a replacement target pattern flag (S1904). The pattern selected in S1904 is treated as a four-color pattern (pattern flag E), is replaced with the three-direction matching process, and information indicating the replacement arrangement pattern is held in the storage unit (S1905). Here, a flag indicating the pattern selected in S1904 (hereinafter referred to as a pattern replacement flag) and a flag indicating which process has been added (hereinafter referred to as an additional processing flag) are output (S1906). This implements a flag output means. Then, this process ends. On the other hand, if there is no pattern in which the total data reduction amount is greater than the data increase amount (NO in S1903), this process ends without performing pattern replacement. Note that the third determination unit is realized by the processing of S1903.

[パターン入れ替え後の圧縮処理]
次に、上述した処理におけるパターン入れ替え後の圧縮処理(S1707)について、図20を用いて詳細に説明する。ここでは、パターンを入れ替えることによって、画像データに対する圧縮率を向上させることができると判定された場合に、パターンの入れ替えを行うと決定し、その入れ替えによる割り当て後のパターンを用いて、圧縮する処理を示す。以下の処理は、たとえば記憶部107等に記憶されたプログラムをCPU105が読み出し、実行する。まず処理が開始されると、現在処理しているブロックが最初のブロックか判断し、最初のブロックでなければ(S2001にてNO)、現在処理しているブロックと記憶ブロックの画素値を比較する(S2002)。ここで、記憶したブロックと画素値が一致した場合(S2003にてYES)、前のブロックと同じであることを示すパターンフラグ(F)に特定し(S2004)、画素値の出力は省略し、パターンフラグを出力する(S2005)。
[Compression after pattern replacement]
Next, the compression processing (S1707) after pattern replacement in the above-described processing will be described in detail with reference to FIG. Here, when it is determined that the compression rate for the image data can be improved by replacing the pattern, it is determined that the pattern is to be replaced, and compression is performed using the pattern after the allocation by the replacement. Indicates. In the following processing, for example, the CPU 105 reads and executes a program stored in the storage unit 107 or the like. First, when processing is started, it is determined whether the currently processed block is the first block. If the first block is not the first block (NO in S2001), the pixel values of the currently processed block and the storage block are compared. (S2002). If the pixel value matches the stored block (YES in S2003), the pattern flag (F) indicating that it is the same as the previous block is specified (S2004), and the output of the pixel value is omitted. A pattern flag is output (S2005).

一方、現在のブロックが最初のブロックであった場合(S2001にてYES)や、現在処理しているブロックと記憶ブロックの画素値が一致しなかった場合(S2003にてNO)は、次に、現在処理しているブロックのパターンフラグを特定する処理に移る。まず現在処理しているブロック内の全ての2画素の組み合わせの画素値を比較し(S2007)する。そして、パターンを特定してパターンフラグを作成する(S2008)。   On the other hand, if the current block is the first block (YES in S2001), or if the pixel value of the currently processed block and the storage block do not match (NO in S2003), then: The process moves to the process of specifying the pattern flag of the block currently being processed. First, the pixel values of all the combinations of two pixels in the currently processed block are compared (S2007). Then, a pattern is specified and a pattern flag is created (S2008).

その後、現在処理しているブロックの色数を判断する(S2009)。現在処理しているブロックが1色のパターンである場合(S2010にてYES)、第1色の色データ(画素値)とパターンフラグ(0)とを出力する(S2011)。また、1色のパターンでなかった場合(S2010にてNO)、現在処理しているブロックが画像データ上端または左端のブロックであるかを判断する(S2014)。画像の上端または左端のブロックでなかった場合(S2014にてNO)、現在処理しているブロックの座標2〜4の画素と、隣接または斜め上に配置されている3つの別のブロック(すなわち3方向のブロック)の第1色の色データとを比較する(S2015)。これにより、第2判定手段を実現する。ここで、3方向の画素値が一致した場合(S2016にてYES)、当該処理対象ブロックの第1色の色データ(画素値)と、S1906で出力されたパターン入れ替えフラグを元に、3方向一致処理と入れ替えられたパターンを示すパターンフラグとを出力する(S2017)。   Thereafter, the number of colors of the block currently being processed is determined (S2009). If the currently processed block is a one-color pattern (YES in S2010), the first color data (pixel value) and the pattern flag (0) are output (S2011). If it is not a one-color pattern (NO in S2010), it is determined whether the block currently being processed is the uppermost or leftmost block of image data (S2014). If it is not the top or left end block of the image (NO in S2014), the pixel of coordinates 2-4 of the block currently being processed and three other blocks that are adjacent or diagonally above (ie, 3) The first color data of the direction block) is compared (S2015). Thereby, a second determination unit is realized. If the pixel values in the three directions match (YES in S2016), the three directions are based on the color data (pixel value) of the first color of the processing target block and the pattern replacement flag output in S1906. The matching process and a pattern flag indicating the replaced pattern are output (S2017).

また、現在処理しているブロックが画像の上端または左端のブロックであった場合(S2014にてYES)、またはS2016で3方向の画素値が一致しなかった場合(S2016にてNO)、次のような処理を行う。まず、現在処理しているブロックのパターンがS1904で入れ替え対象として選択されたブロックかどうかの判断をする(S2018)。もし入れ替えられたパターンであった場合(S2018にてYES)、現在処理しているブロック内の4画素の画素値を全て出力し(すなわち、各画素の色を、第1色の色データと、第2〜4色の色データとして出力し)、4色のパターンフラグ(E)を出力する(S2019)。   If the block currently being processed is the top or left block of the image (YES in S2014), or if the pixel values in the three directions do not match in S2016 (NO in S2016), the next Perform the following process. First, it is determined whether the pattern of the block currently being processed is a block selected as a replacement target in S1904 (S2018). If the pattern has been replaced (YES in S2018), all the pixel values of the four pixels in the currently processed block are output (that is, the color of each pixel is the color data of the first color, The data is output as the second to fourth color data), and the four-color pattern flag (E) is output (S2019).

一方、現在処理しているブロックが入れ替えられたパターンでなかった場合(S2018にてNO)、(リピート、1色、3方向一致以外の)13種類のパターンのいずれに一致するか特定する(S2020)。そして、第1色の色データと、特定されたパターンに応じた第2〜4色の色データと、パターンフラグ(2〜E)とを出力する(S2021)。   On the other hand, if the currently processed block is not a replaced pattern (NO in S2018), it is specified which of the 13 types of patterns (other than repeat, one color, and three-direction matching) matches (S2020). ). Then, the first color data, the second to fourth color data corresponding to the identified pattern, and the pattern flags (2 to E) are output (S2021).

このように上述の処理(S2011、S2017、S2019、S2021)を行った後、データの展開を行い(S2012)、展開ブロックを前のブロックとして記憶する(S2013)。そして、最後のブロックの処理が終わるまで、以上の処理を繰り返し(S2006)、パターン入れ替え後の圧縮処理を終了する。   After performing the above processing (S2011, S2017, S2019, S2021) in this way, data is expanded (S2012), and the expanded block is stored as the previous block (S2013). Then, the above processing is repeated until the processing of the last block is completed (S2006), and the compression processing after pattern replacement is completed.

ここでは、通常の圧縮処理に加えリピート処理と3方向一致処理を加えた場合の圧縮処理を例に説明しているが、これに限るものではない。リピート処理や3方向一致処理とは異なった処理を追加しても良いし、追加処理が3つ以上あっても良い。3つ以上の処理を追加する場合は追加処理フラグのビット数を増やすことで対応できる。   Here, the compression process when the repeat process and the three-way matching process are added to the normal compression process is described as an example, but the present invention is not limited to this. A process different from the repeat process or the three-way matching process may be added, or there may be three or more additional processes. When three or more processes are added, it can be dealt with by increasing the number of bits of the additional process flag.

[メモリ空間への書き込み構成]
次に、図21に画像データのメモリ空間への書き込み例を示す。図21に示すように、画像データを、パターン入れ替えフラグと追加処理フラグ、パターンフラグ、第1色、その他の色に分け、分散的にメモリ上へ格納している。メモリ空間への画像データの書き込みは通常の圧縮処理とほぼ同様であるが、本実施形態では、メモリ空間上のパターンフラグの前のアドレスに、パターン入れ替えフラグと追加処理フラグを書き込むことが異なる。
[Write configuration to memory space]
Next, FIG. 21 shows an example of writing image data into the memory space. As shown in FIG. 21, the image data is divided into a pattern replacement flag, an additional processing flag, a pattern flag, the first color, and other colors, and stored in the memory in a distributed manner. Writing image data to the memory space is almost the same as normal compression processing, but the present embodiment is different in that the pattern replacement flag and the additional processing flag are written at the address before the pattern flag in the memory space.

次に、圧縮処理と対になる展開処理を説明する。メモリ106上に図21に示すように配置されている圧縮データの書き込み先頭アドレスをDMAC221、231へ指定する。ここで圧縮データとは、パターン入れ替えフラグと追加処理フラグ、パターンフラグ、第1色、第2、3、4色の画素値を指す。パターン入れ替えフラグと追加パターンフラグを参照して、どのパターンを用いて圧縮処理を行ったか特定する。パターンの特定後の処理は前述した方法で展開が可能である。   Next, a decompression process paired with the compression process will be described. The write start address of compressed data arranged on the memory 106 as shown in FIG. 21 is designated to the DMACs 221 and 231. Here, the compressed data refers to a pattern replacement flag, an additional processing flag, a pattern flag, and pixel values of the first color, the second, third, and fourth colors. With reference to the pattern replacement flag and the additional pattern flag, it is specified which pattern is used for the compression processing. The processing after the pattern is specified can be developed by the method described above.

本実施形態によれば、パターン入れ替えによる合計データ削減量を考慮し、2色または3色のパターンと3方向一致処理を入れ替えることで、配置パターン情報は4ビットのままで、通常の圧縮処理とリピート処理、3方向一致処理を組み合わせることが可能である。そして、パターン入れ替えにより、圧縮率が向上するか判断を行った上でパターンの入れ替え処理や入れ替えたパターンを用いた圧縮処理を行うので、確実に圧縮率を向上させることが可能となる。   According to the present embodiment, in consideration of the total data reduction amount due to the pattern replacement, by replacing the two-color or three-color pattern and the three-direction matching process, the arrangement pattern information remains 4 bits, and the normal compression process is performed. It is possible to combine repeat processing and three-way matching processing. Then, after determining whether or not the compression rate is improved by pattern replacement, the pattern replacement processing and the compression processing using the replaced pattern are performed, so that the compression rate can be reliably improved.

<その他の実施形態>
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(または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 is supplied to a system or apparatus via a network or various storage media, and a computer (or CPU, MPU, or the like) of the system or apparatus reads the program. It is a process to be executed.

Claims (8)

画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割手段と、
前記分割手段で分割された処理対象ブロック内の色データの配置が、1つ前に処理対象になったブロック内の色データの配置と同じであるか否か判定する第1判定手段と、
前記第1判定手段で同じでないと判定された場合、前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定手段と、
前記処理対象のブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出手段と、
前記特定手段で特定されるパターンフラグそれぞれの出現回数をカウントする第1カウント手段と、
前記特定手段で2つ以上の色データが配置されていることを示すパターンフラグであると特定された処理対象ブロックに関して、前記処理対象ブロック内の予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する第2判定手段と、
前記第1カウント手段でカウントした結果に基づいて、前記予め定義された複数のパターンフラグの中から、パターンを入れ替えることにより生じるデータ増加量が最少のパターンフラグを、入れ替え対象パターンフラグとして選択する選択手段と、
前記パターンフラグ、または、前記色データの少なくとも一方を出力する出力手段と
を有し、
前記出力手段は、
前記第1判定手段で同じであると判定された処理対象ブロックに対しては、当該処理対象ブロック内の色の配置が1つ前に処理対象になったブロック内の色の配置と同じであることを示すパターンフラグを出力し、
前記第1判定手段で同じでないと判定され、且つ、前記特定手段で特定されたパターンフラグが1色で構成されるブロックであることを示すパターンフラグである処理対象ブロックに対しては、前記特定手段で特定されたパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、
前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致すると判定された処理対象ブロックに対しては、前記選択手段で選択されたパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、
前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致しないと判定され、且つ、前記特定手段で特定されたパターンフラグが前記選択手段で選択された前記入れ替え対象パターンフラグである処理対象ブロックに対しては、当該処理対象ブロックを4色で構成されるブロックとして、当該処理対象ブロックが4つの色データが配置されるブロックであることを示すパターンフラグと、当該処理対象ブロック内の4画素それぞれの色データとを出力し、
前記第1判定手段で同じでないと判定され、且つ、前記第2判定手段で一致しないと判定され、且つ、前記特定手段で特定されるパターンフラグが前記選択手段で選択された前記入れ替え対象パターンフラグでない処理対象ブロックに対しては、前記特定手段で特定された当該処理対象のブロックに含まれる色の配置パターンを示すパターンフラグと、前記抽出手段で抽出される前記処理対象のブロック内の前記第1色の色データと、前記処理対象のブロック内の前記第1色の色データ以外の色データとを出力する
ことを特徴とする画像処理装置。
A dividing unit that divides image data into blocks each having a size of 2 × 2 pixels, and sequentially processes each of the divided blocks;
First determination means for determining whether or not the arrangement of the color data in the processing target block divided by the dividing means is the same as the arrangement of the color data in the previous block to be processed;
If it is determined by the first determination means that they are not the same, by comparing the color data of each pixel in the processing target block, from among a plurality of predefined pattern flags indicating the arrangement pattern of the color data, A specifying means for specifying a pattern flag indicating an arrangement pattern of color data included in the processing target block;
Extraction means for extracting the color of a pixel at a predefined position in the processing target block as color data of the first color, and further extracting color data other than the color data of the first color included in the block When,
First counting means for counting the number of appearances of each pattern flag specified by the specifying means;
With respect to the processing target block specified as a pattern flag indicating that two or more color data are arranged by the specifying unit, three pixels other than the pixel at a predefined position in the processing target block Second determination means for determining whether the color data matches the color data of the pixel at a predefined position in each of three different blocks adjacent to the three pixels;
Selection for selecting, as a replacement target pattern flag, a pattern flag with the smallest amount of data increase caused by replacing a pattern from the plurality of predefined pattern flags based on the result counted by the first counting means Means,
Output means for outputting at least one of the pattern flag or the color data,
The output means includes
For the processing target block that is determined to be the same by the first determination unit, the color arrangement in the processing target block is the same as the color arrangement in the block that was previously processed. Output a pattern flag indicating
For the processing target block that is a pattern flag that is determined not to be the same by the first determination unit and that indicates that the pattern flag specified by the specifying unit is a block composed of one color, the specification Outputting the pattern flag specified by the means and the color data of the first color in the processing target block extracted by the extraction means;
The processing target block that is determined to be not the same by the first determination unit and that is matched by the second determination unit is extracted by the pattern flag selected by the selection unit and the extraction unit. Output the color data of the first color in the processing target block.
The replacement target pattern flag that is determined not to be the same by the first determination unit, is determined not to match by the second determination unit, and the pattern flag specified by the specifying unit is selected by the selection unit For the processing target block, the processing target block is a block configured with four colors, the processing target block is a block in which four color data are arranged, and the processing target block Output color data for each of the four pixels in the block,
The replacement target pattern flag that is determined not to be the same by the first determination unit, is determined not to match by the second determination unit, and the pattern flag specified by the specification unit is selected by the selection unit For a non-processing target block, a pattern flag indicating an arrangement pattern of colors included in the processing target block specified by the specifying means, and the first in the processing target block extracted by the extracting means. An image processing apparatus that outputs color data of one color and color data other than the color data of the first color in the processing target block.
前記予め定義された位置の画素とは、2×2画素のサイズのブロック内の右下の画素であり、
前記第2判定手段は、前記処理対象ブロック内の左上の画素の色データと、当該処理対象ブロックの左上に隣接するブロックの右下の画素の色データとが一致し、かつ、
前記処理対象ブロック内の右上の画素の色データと、当該処理対象ブロックの上に隣接するブロックの右下の画素の色データとが一致し、かつ、
前記処理対象ブロック内の左下の画素の色データと、当該処理対象ブロックの左に隣接するブロックの右下の画素の色データとが一致するか否かを判定することを特徴とする請求項1に記載の画像処理方法。
The pixel at the predefined position is a lower right pixel in a block having a size of 2 × 2 pixels,
The second determination unit is such that the color data of the upper left pixel in the processing target block matches the color data of the lower right pixel of the block adjacent to the upper left of the processing target block, and
The color data of the upper right pixel in the processing target block matches the color data of the lower right pixel of the block adjacent to the processing target block, and
The color data of the lower left pixel in the processing target block and the color data of the lower right pixel of a block adjacent to the left of the processing target block are determined. An image processing method described in 1.
前記第2判定手段で一致すると判定されたブロックの数をカウントする第2カウント手段と
前記第1カウント手段でカウントした結果と前記第2カウント手段でカウントした結果とに基づいて、前記パターンフラグを入れ替えた場合にデータ量が減少するか否かを判定する第3判定手段と
を更に有し、
前記選択手段は、前記第3判定手段で減少すると判定した場合に、前記第1カウント手段でカウントした結果に基づいて、前記予め定義された複数のパターンフラグの中から、パターンを入れ替えたときのデータ増加量が最少のパターンフラグを、前記入れ替え対象パターンフラグとして選択することを特徴とする請求項1または2に記載の画像処理装置。
Based on the second counting means for counting the number of blocks determined to match by the second determining means, the result counted by the first counting means and the result counted by the second counting means, the pattern flag is set. A third determination means for determining whether or not the data amount decreases when the data is replaced;
When the selection means determines that the third determination means decreases, the selection means replaces a pattern from among the plurality of predefined pattern flags based on the result counted by the first count means. The image processing apparatus according to claim 1, wherein a pattern flag with the smallest data increase amount is selected as the replacement target pattern flag.
前記第3判定手段にてデータ量が減少しないと判定した場合、非可逆圧縮方式で前記画像データの圧縮を行う非可逆圧縮手段を更に有することを特徴とする請求項3に記載の画像処理装置。   The image processing apparatus according to claim 3, further comprising an irreversible compression unit that compresses the image data using a lossy compression method when the third determination unit determines that the data amount does not decrease. . 画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割手段と、
前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定手段と、
前記処理対象ブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出手段と、
前記処理対象ブロック内の前記予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する判定手段と、
前記判定手段で一致すると判定された処理対象ブロックに対しては、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データと一致することを示すパターンフラグと、前記抽出手段で抽出される当該処理対象ブロック内の第1色の色データとを出力し、
前記判定手段で一致しないと判定された処理対象ブロックに対しては、前記特定手段により特定される当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグと、前記抽出手段により抽出される前記第1色の色データと前記第1色の色データ以外の色データとを出力する出力手段と
を有することを特徴とする画像処理装置。
A dividing unit that divides image data into blocks each having a size of 2 × 2 pixels, and sequentially processes each of the divided blocks;
By comparing the color data of each pixel in the processing target block, the arrangement pattern of the color data included in the processing target block is indicated from among a plurality of predefined pattern flags indicating the arrangement pattern of the color data. A specifying means for specifying a pattern flag;
Extracting means for extracting a color of a pixel at a predefined position in the processing target block as color data of a first color, and further extracting color data other than the color data of the first color included in the block; ,
The color data of three pixels other than the pixel at the predefined position in the processing target block is the color data of the pixel at the predefined position in each of three separate blocks adjacent to the three pixels. Determining means for determining whether or not they match,
For a processing target block determined to match by the determination means, a pattern flag indicating that the color data of a pixel at a predefined position in each of three different blocks adjacent to the three pixels matches , Outputting the color data of the first color in the processing target block extracted by the extraction means,
For processing target blocks determined not to match by the determination means, a pattern flag indicating an arrangement pattern of color data included in the processing target blocks specified by the specifying means and the extraction means are extracted. An image processing apparatus comprising: output means for outputting the color data of the first color and color data other than the color data of the first color.
分割手段が、画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割工程と、
第1判定手段が、前記分割工程で分割された処理対象ブロック内の色データの配置が、1つ前に処理対象になったブロック内の色データの配置と同じであるか否か判定する第1判定工程と、
特定手段が、前記第1判定工程で同じでないと判定された場合、前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定工程と、
抽出手段が、前記処理対象のブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出工程と、
第1カウント手段が、前記特定工程で特定されるパターンフラグそれぞれの出現回数をカウントする第1カウント工程と、
第2判定手段が、前記特定工程で2つ以上の色データが配置されていることを示すパターンフラグであると特定された処理対象ブロックに関して、前記処理対象ブロック内の予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する第2判定工程と、
選択手段が、前記第1カウント工程でカウントした結果に基づいて、前記予め定義された複数のパターンフラグの中から、パターンを入れ替えたときのデータ増加量が最少のパターンフラグを、入れ替え対象パターンフラグとして選択する選択工程と、
出力手段が、前記パターンフラグ、または、前記色データの少なくとも一方を出力する出力工程と
を有し、
前記出力工程において、
前記第1判定工程で同じであると判定された処理対象ブロックに対しては、当該処理対象ブロック内の色の配置が1つ前に処理対象になったブロック内の色の配置と同じであることを示すパターンフラグを出力し、
前記第1判定工程で同じでないと判定され、且つ、前記特定工程で特定されたパターンフラグが1色で構成されるブロックであることを示すパターンフラグである処理対象ブロックに対しては、前記特定工程で特定されたパターンフラグと、前記抽出工程で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、
前記第1判定工程で同じでないと判定され、且つ、前記第2判定工程で一致すると判定された処理対象ブロックに対しては、前記選択工程で選択されたパターンフラグと、前記抽出工程で抽出される当該処理対象ブロック内の前記第1色の色データとを出力し、
前記第1判定工程で同じでないと判定され、且つ、前記第2判定工程で一致しないと判定され、且つ、前記特定工程で特定されたパターンフラグが前記選択工程で選択された前記入れ替え対象パターンフラグである処理対象ブロックに対しては、当該処理対象ブロックを4色で構成されるブロックとして、当該処理対象ブロックが4つの色データが配置されるブロックであることを示すパターンフラグと、当該処理対象ブロック内の4画素それぞれの色データとを出力し、
前記第1判定工程で同じでないと判定され、且つ、前記第2判定工程で一致しないと判定され、且つ、前記特定工程で特定されるパターンフラグが前記選択工程で選択された前記入れ替え対象パターンフラグでない処理対象ブロックに対しては、前記特定工程で特定された当該処理対象のブロックに含まれる色の配置パターンを示すパターンフラグと、前記抽出工程で抽出される前記処理対象のブロック内の前記第1色の色データと、前記処理対象のブロック内の前記第1色の色データ以外の色データとを出力する
ことを特徴とする画像処理方法。
A dividing step of dividing the image data into blocks each having a size of 2 × 2 pixels, and sequentially dividing each of the divided blocks;
The first determination means determines whether or not the arrangement of the color data in the processing target block divided in the dividing step is the same as the arrangement of the color data in the previous block to be processed. 1 determination process;
A plurality of pre-defined pattern flags indicating color data arrangement patterns by comparing the color data of each pixel in the processing target block when the specifying means determines that they are not the same in the first determination step A specifying step for specifying a pattern flag indicating an arrangement pattern of color data included in the processing target block,
The extracting means extracts the color of a pixel at a predefined position in the processing target block as color data of the first color, and further extracts color data other than the color data of the first color included in the block. An extraction process to extract;
A first counting unit that counts the number of appearances of each of the pattern flags identified in the identifying step;
A pixel at a predefined position in the processing target block with respect to the processing target block specified by the second determination unit as a pattern flag indicating that two or more color data are arranged in the specifying step A second determination step of determining whether the color data of the other three pixels matches the color data of the pixel at a predefined position in each of three different blocks adjacent to the three pixels,
Based on the result of the counting in the first counting step, the selection means selects a pattern flag having the smallest data increase amount when the pattern is replaced from among the plurality of predefined pattern flags. A selection step to select as,
An output unit having an output step of outputting at least one of the pattern flag or the color data;
In the output step,
For the processing target block that is determined to be the same in the first determination step, the color arrangement in the processing target block is the same as the color arrangement in the block that was previously processed. Output a pattern flag indicating
For the processing target block which is a pattern flag indicating that the pattern flag specified in the first determination step is not the same and the pattern flag specified in the specific step is a block composed of one color, the specification Outputting the pattern flag specified in the process and the color data of the first color in the processing target block extracted in the extraction process;
For the processing target block determined to be not the same in the first determination step and determined to match in the second determination step, it is extracted in the pattern flag selected in the selection step and the extraction step. Output the color data of the first color in the processing target block.
The replacement target pattern flag that is determined not to be the same in the first determination step, is determined not to match in the second determination step, and the pattern flag specified in the specific step is selected in the selection step For the processing target block, the processing target block is a block configured with four colors, the processing target block is a block in which four color data are arranged, and the processing target block Output color data for each of the four pixels in the block,
The replacement target pattern flag that is determined not to be the same in the first determination step, is determined not to match in the second determination step, and the pattern flag specified in the specific step is selected in the selection step For a non-processing target block, a pattern flag indicating an arrangement pattern of colors included in the processing target block specified in the specifying step, and the first in the processing target block extracted in the extraction step. An image processing method comprising: outputting color data of one color and color data other than the color data of the first color in the processing target block.
分割手段が、画像データを2×2画素のサイズのブロックごとに分割し、当該分割される各ブロックを順に処理対象にする分割工程と、
特定手段が、前記処理対象ブロック内の各画素の色データを比較することにより、色データの配置パターンを示す予め定義された複数のパターンフラグの中から、当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグを特定する特定工程と、
抽出手段が、前記処理対象ブロック内の予め定義された位置の画素の色を第1色の色データとして抽出し、更に、当該ブロックに含まれる前記第1色の色データ以外の色データを抽出する抽出工程と、
判定手段が、前記処理対象ブロック内の前記予め定義された位置の画素以外の3つの画素の色データが、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データとそれぞれ一致するか否か判定する判定工程と、
出力手段が、
前記判定工程で一致すると判定された処理対象ブロックに対しては、当該3つの画素に隣接する3つの別のブロックそれぞれにおける予め定義された位置の画素の色データと一致することを示すパターンフラグと、前記抽出工程で抽出される当該処理対象ブロック内の第1色の色データとを出力し、
前記判定工程で一致しないと判定された処理対象ブロックに対しては、前記特定工程により特定される当該処理対象ブロックに含まれる色データの配置パターンを示すパターンフラグと、前記抽出工程により抽出される前記第1色の色データと前記第1色の色データ以外の色データとを出力する出力工程と
を有することを特徴とする画像処理方法。
A dividing step of dividing the image data into blocks each having a size of 2 × 2 pixels, and sequentially dividing each of the divided blocks;
The specifying unit compares the color data of each pixel in the processing target block, so that the color data included in the processing target block can be selected from a plurality of predefined pattern flags indicating the arrangement pattern of the color data. A specific step of specifying a pattern flag indicating an arrangement pattern;
The extraction unit extracts the color of a pixel at a predefined position in the processing target block as first color data, and further extracts color data other than the first color data included in the block An extraction process to
The determination unit determines that the color data of the three pixels other than the pixel at the predefined position in the processing target block is the pixel data at the predefined position in each of three separate blocks adjacent to the three pixels. A determination step of determining whether or not each color data matches,
The output means is
For a processing target block determined to match in the determination step, a pattern flag indicating that it matches the color data of a pixel at a predefined position in each of three different blocks adjacent to the three pixels , Outputting color data of the first color in the processing target block extracted in the extraction step,
For processing target blocks determined not to match in the determination step, a pattern flag indicating an arrangement pattern of color data included in the processing target block specified in the specifying step and the extraction step are extracted. An image processing method comprising: outputting the color data of the first color and color data other than the color data of the first color.
コンピュータを請求項1乃至5のいずれか1項に記載の画像処理装置として機能させるためのプログラム。   A program for causing a computer to function as the image processing apparatus according to any one of claims 1 to 5.
JP2010196097A 2010-09-01 2010-09-01 Image processor, image processing method, and program Withdrawn JP2012054789A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010196097A JP2012054789A (en) 2010-09-01 2010-09-01 Image processor, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010196097A JP2012054789A (en) 2010-09-01 2010-09-01 Image processor, image processing method, and program

Publications (1)

Publication Number Publication Date
JP2012054789A true JP2012054789A (en) 2012-03-15

Family

ID=45907659

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010196097A Withdrawn JP2012054789A (en) 2010-09-01 2010-09-01 Image processor, image processing method, and program

Country Status (1)

Country Link
JP (1) JP2012054789A (en)

Similar Documents

Publication Publication Date Title
JP5393574B2 (en) Image processing apparatus, image processing method, and program
JP5595151B2 (en) Image processing apparatus, compression method in image processing apparatus, and program
JP5558767B2 (en) Image processing apparatus and processing method thereof
US8452083B2 (en) Image processing apparatus, image processing method, and computer-readable medium
CN107632801B (en) Method and computing device for cell-based compression of digital images
JP2009141807A (en) Image processing device, image processing method, and image processing program
JP2011193394A (en) Image processing apparatus, image processing method, and program
US20110158522A1 (en) Image processing apparatus and processing method thereof
US20110222082A1 (en) Image processing apparatus, control method, and computer-readable medium
US8406517B2 (en) Image processing apparatus and image processing method
JP2011250199A (en) Image processing apparatus, image processing method, and program
JP2012054789A (en) Image processor, image processing method, and program
JP5538996B2 (en) Image processing apparatus, image processing method, program, and storage medium
JP5606223B2 (en) Image processing apparatus and processing method thereof
JP2012095227A (en) Image processing system, image processing method, and program
JP5643578B2 (en) Image processing apparatus, image processing method, and program
JP2014099742A (en) Color/monochromatic determination
JP2012015644A (en) Image processor and image processing method
US8837021B2 (en) Image processing apparatus, control method, and computer-readable medium
JP2013085173A (en) Image processing device and control method therefor
JP2012074897A (en) Image processing device, image processing method, and program

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20131105