JP4418736B2 - Image encoding apparatus and method, computer program, and computer-readable storage medium - Google Patents

Image encoding apparatus and method, computer program, and computer-readable storage medium Download PDF

Info

Publication number
JP4418736B2
JP4418736B2 JP2004331105A JP2004331105A JP4418736B2 JP 4418736 B2 JP4418736 B2 JP 4418736B2 JP 2004331105 A JP2004331105 A JP 2004331105A JP 2004331105 A JP2004331105 A JP 2004331105A JP 4418736 B2 JP4418736 B2 JP 4418736B2
Authority
JP
Japan
Prior art keywords
encoding
color component
value
encoded data
block
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.)
Expired - Fee Related
Application number
JP2004331105A
Other languages
Japanese (ja)
Other versions
JP2006140967A (en
JP2006140967A5 (en
Inventor
友希 松本
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 JP2004331105A priority Critical patent/JP4418736B2/en
Publication of JP2006140967A publication Critical patent/JP2006140967A/en
Publication of JP2006140967A5 publication Critical patent/JP2006140967A5/ja
Application granted granted Critical
Publication of JP4418736B2 publication Critical patent/JP4418736B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Description

本発明は、画像データを符号化する技術に関するものである。   The present invention relates to a technique for encoding image data.

従来、画像処理装置を構成する一手法として、可逆符号化データの符号量を検出し、その可逆符号量が所定量以上の場合には、可逆符号化ではなく非可逆符号化に切り替えるという技術が知られている(特許文献1)。   Conventionally, as a technique for configuring an image processing apparatus, there is a technique of detecting the code amount of lossless encoded data and switching to lossy encoding instead of lossless encoding when the lossless code amount is a predetermined amount or more. Known (Patent Document 1).

また、ブロック内の色数がある閾値以内であれば可逆符号化方式を選択し、それ以外であれば非可逆符号化方式を選択する技術も知られている(特許文献2)。
特開平6−54208号公報 特開平8−167030号公報
A technique is also known in which a lossless encoding method is selected if the number of colors in a block is within a certain threshold, and an irreversible encoding method is selected otherwise (Patent Document 2).
JP-A-6-54208 JP-A-8-167030

可逆符号化は一般的に非可逆符号化よりも符号量が大きくなるとされていた。よって符号量を所定以内に収めようとするいわゆる符号量制御技術においては、例えば可逆符号化データのデータ量が大きい場合に可逆符号化の代わりに非可逆符号化を用いるという一方通行の符号化切り替えが一般的である。   Lossless encoding generally has a larger code amount than lossy encoding. Therefore, in the so-called code amount control technology that attempts to keep the code amount within a predetermined range, for example, when the data amount of lossless encoded data is large, one-way encoding switching in which lossy encoding is used instead of lossless encoding. Is common.

ところが、近年知られるJPEG−LS等の可逆符号化は、符号化対象の画像の種類によっては非可逆符号化よりも圧縮率が良いことで注目されている。   However, recently known lossless encoding such as JPEG-LS is attracting attention because it has a better compression rate than lossy encoding depending on the type of image to be encoded.

よって、従来の様な上記一方通行の符号化切り替えをするのではなく、例えば、最初から可逆符号化データと非可逆符号化データのお互いの符号量を比較して、符号化データ量が少ない方を選択する方式も有効と考えられる。   Therefore, instead of switching the one-way encoding as in the prior art, for example, comparing the code amounts of lossless encoded data and lossy encoded data from the beginning, the encoded data amount is smaller. The method of selecting is also considered effective.

本発明は上記状況に鑑みてなされたものであり、可逆符号化と非可逆符号化を画素ブロック単位に適宜切り換えて、再現した際の画質の劣化を抑制しつつ、画像全体を高い圧縮率で符号化する技術を提供しようとするものである。   The present invention has been made in view of the above situation, and appropriately switches between lossless encoding and lossy encoding in units of pixel blocks, and suppresses deterioration in image quality when reproduced, while maintaining a high compression rate for the entire image. It is intended to provide a technique for encoding.

この課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
画像データを符号化する画像符号化装置であって、
画像データを複数画素からなるブロックに分割するブロック分割手段と、
前記ブロック分割手段で得られたブロック内の各色成分の取り得る成分値の範囲で、幾つの成分値が存在したか示す出現数を計数する計数手段と、
該計数手段で得られた各色成分の出現数と所定の閾値とを比較することで、重み付け係数を決定する重み付け係数決定手段と、
前記ブロック内の実在する各画素の色成分値に、連続する値のインデックス値の1つを割り当てることで、前記実在する各画素値の前記色成分値と一対一の関係を有するインデックステーブルを、前記色成分毎に生成するインデックステーブル生成手段と、
前記ブロック内に実在する各画素の色成分値を、該当する色成分の前記インデックステーブルを参照してインデックス値に変換するインデックス変換手段と、
前記計数手段で得られた着目色成分の出現数が予め設定された閾値より小さい場合は、前記インデックス変換手段で得られた前記着目色成分のインデックス値を符号化対象データとして選択出力し、前記着目色成分の出現数が予め設定された閾値以上の場合には着目色成分値を前記符号化対象データとして選択出力することを、全色成分について実行する第1の選択手段と、
該第1の選択手段で選択出力された前記符号化対象データを可逆符号化し、前記ブロックの可逆符号化データを生成する可逆符号化手段と、
前記ブロック分割手段で得られたブロックを単位に非可逆符号化し、非可逆符号化データを生成する非可逆符号化手段と、
前記可逆符号化手段で得られた可逆符号化データ量と、前記非可逆符号化手段で得られた非可逆符号化データ量とを、前記重み付け係数決定手段で得られた重み付け係数を用いて比較する比較手段と、
該比較手段による重み付け比較結果に基づき、符号化データ量の少ない符号化データを選択し出力する第2の選択手段とを備える。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device for encoding image data,
Block dividing means for dividing the image data into blocks composed of a plurality of pixels;
Counting means for counting the number of appearances indicating how many component values existed in the range of possible component values of each color component in the block obtained by the block dividing means;
A weighting coefficient determination means for determining a weighting coefficient by comparing the number of appearances of each color component obtained by the counting means with a predetermined threshold;
An index table having a one-to-one relationship with the color component value of each existing pixel value by assigning one of the consecutive index values to the color component value of each existing pixel in the block, Index table generating means for generating each color component;
Index conversion means for converting the color component value of each pixel actually existing in the block into an index value with reference to the index table of the corresponding color component;
When the number of appearances of the target color component obtained by the counting unit is smaller than a preset threshold, the index value of the target color component obtained by the index conversion unit is selectively output as encoding target data, A first selection unit that executes, for all color components, selecting and outputting a target color component value as the encoding target data when the number of appearances of the target color component is equal to or greater than a preset threshold;
Lossless encoding means for losslessly encoding the encoding target data selected and output by the first selection means, and generating lossless encoded data of the block ;
Irreversible encoding means for generating lossy encoded data by irreversibly encoding a block obtained by the block dividing means;
Comparing the lossless encoded data amount obtained by the lossless encoding means and the lossy encoded data amount obtained by the lossy encoding means by using the weighting coefficient obtained by the weighting coefficient determining means Comparing means to
Second selection means for selecting and outputting encoded data with a small amount of encoded data based on the weighted comparison result by the comparison means.

本発明によれば、可逆符号化と非可逆符号化を画素ブロック単位に適宜切り換えて、再現した際の画質の劣化を抑制しつつ、画像全体を高い圧縮率で符号化することが可能になる。   According to the present invention, it is possible to appropriately switch between lossless encoding and lossy encoding in units of pixel blocks, and to encode the entire image at a high compression rate while suppressing deterioration in image quality when reproduced. .

以下添付図面を参照して、本発明を好適な実施形態に従って詳細に説明する。   Hereinafter, the present invention will be described in detail according to preferred embodiments with reference to the accompanying drawings.

[第1の実施形態]
図1は本実施形態に係る画像処理装置のブロック構成図である。
[First Embodiment]
FIG. 1 is a block diagram of an image processing apparatus according to this embodiment.

図1に示すように、本実施形態に係る画像処理装置は、ストライプバッファ101、ブロック分割部102、タイルバッファ103、有効レベル数カウント部104、インデックステーブル用メモリ105、インデックス変換部106、セレクタ107、タイルデータ可逆符号化部108、可逆符号列形成部109、インデックステーブル生成部113、タイルデータ非可逆符号化部114、セレクタ115、符号列形成部116とを備える。また、符号110、111、112はバス信号線を示している。   As shown in FIG. 1, the image processing apparatus according to the present embodiment includes a stripe buffer 101, a block division unit 102, a tile buffer 103, an effective level number counting unit 104, an index table memory 105, an index conversion unit 106, and a selector 107. A tile data lossless encoding unit 108, a lossless code sequence forming unit 109, an index table generating unit 113, a tile data lossy encoding unit 114, a selector 115, and a code sequence forming unit 116. Reference numerals 110, 111, and 112 denote bus signal lines.

本実施形態に係る画像処理装置の符号化対象とする画像データは、RGBカラー画像データであり、各コンポーネント(色)は8ビットで、それぞれ0〜255の範囲の輝度値を表現した画素データにより構成されるものとする。符号化対象の画像データの並びは点順次、即ち、ラスタースキャン順に各画素を並べ、その各画素はR,G,Bの順番でデータを並べて構成されるものとする。信号線110より入力される符号化対象の画像データは水平方向W画素、垂直方向H画素により構成されるものとする。   The image data to be encoded by the image processing apparatus according to the present embodiment is RGB color image data, each component (color) is 8 bits, and pixel data that represents a luminance value in the range of 0 to 255. Shall be composed. Assume that the image data to be encoded is arranged in the order of dots, that is, in the raster scan order, and the pixels are arranged in the order of R, G, and B. It is assumed that image data to be encoded input from the signal line 110 is composed of W pixels in the horizontal direction and H pixels in the vertical direction.

以下、図1を参照して、本実施形態に係る画像処理装置が行う画像符号化処理について説明する。   Hereinafter, with reference to FIG. 1, an image encoding process performed by the image processing apparatus according to the present embodiment will be described.

符号化対象画像データは信号線110から、ラスタースキャン順に入力される。   The encoding target image data is input from the signal line 110 in the raster scan order.

ストライプバッファ101は画像データを所定のライン数(Th)分格納する領域を持ち、信号線110から入力される画像データを順次格納していく。   The stripe buffer 101 has an area for storing image data for a predetermined number of lines (Th), and sequentially stores image data input from the signal line 110.

以降、符号化対象画像データをThラインの幅で分割した部分的な画像データをストライプデータもしくは単にストライプと呼ぶ。ストライプバッファ101に必要とされる容量、即ち1ストライプのデータ量はW×Th×3(RGB分)バイトである。説明の便宜上、垂直方向画素数HはThの整数倍であるとし、画像の末尾で不完全なストライプが発生しないものとする。   Hereinafter, partial image data obtained by dividing the encoding target image data by the width of the Th line is referred to as stripe data or simply stripe. The capacity required for the stripe buffer 101, that is, the data amount of one stripe is W × Th × 3 (for RGB) bytes. For convenience of explanation, it is assumed that the number of vertical pixels H is an integral multiple of Th, and an incomplete stripe does not occur at the end of the image.

ストライプバッファ101に1ストライプの画像データ、即ち、Thライン分の画像データが格納されるとブロック分割部102はストライプバッファ101に格納されるThライン分の画像データを水平方向Tw画素、垂直方向Th画素で構成される矩形ブロックに分割して、ブロック単位に読み出してタイルバッファ103へと格納する。説明の便宜上、画像の水平方向に並ぶ画素数WはTwの整数倍であるとし、矩形ブロックに分割した場合に不完全なブロックが発生しないものとする。この水平方向Tw画素、垂直方向Th画素で構成される矩形ブロックを以降ではタイルデータもしくは単にタイルと呼ぶ。   When one stripe of image data, that is, image data for Th lines is stored in the stripe buffer 101, the block dividing unit 102 converts the image data for Th lines stored in the stripe buffer 101 into pixels of horizontal direction Tw and vertical direction Th. The data is divided into rectangular blocks composed of pixels, read in block units, and stored in the tile buffer 103. For convenience of explanation, it is assumed that the number W of pixels arranged in the horizontal direction of the image is an integral multiple of Tw, and incomplete blocks do not occur when divided into rectangular blocks. The rectangular block composed of the horizontal direction Tw pixels and the vertical direction Th pixels is hereinafter referred to as tile data or simply a tile.

タイルバッファ103は、1タイル分の画素データを格納する領域を持ち、ブロック分割部102から出力されるタイルデータを順次格納していく。よってタイルバッファ103に必要とされる最低容量はTw×Th×3(RGB分)バイトである。タイルバッファ103に格納される1タイル分の画素データの水平方向画素位置x、垂直方向画素位置yにある画素のコンポーネントcの輝度値をP(x、y、c)と定義する。xは0からTw−1まで、yは0からTh−1まで、cはR,G,Bのいずれかである。   The tile buffer 103 has an area for storing pixel data for one tile, and sequentially stores tile data output from the block dividing unit 102. Therefore, the minimum capacity required for the tile buffer 103 is Tw × Th × 3 (for RGB) bytes. The luminance value of the component c of the pixel at the horizontal pixel position x and the vertical pixel position y of the pixel data for one tile stored in the tile buffer 103 is defined as P (x, y, c). x is from 0 to Tw-1, y is from 0 to Th-1, and c is any one of R, G, and B.

有効レベル数カウント部104は、タイルバッファ103に格納される1タイルの画素データについて、コンポーネント毎に、そこで使用されている輝度レベル数(言い換えると、何種類の輝度レベルが使われているか)をカウントする。   The effective level number counting unit 104 determines the number of luminance levels used for each component of pixel data stored in the tile buffer 103 (in other words, how many luminance levels are used). Count.

以降、タイル内にて使用されている輝度レベルを有効レベルと呼び、その個数を有効レベル数と呼び、R、G、Bの各コンポーネントの有効レベル数をそれぞれNLV(R)、NLV(G)、NLV(B)として表す。   Hereinafter, the luminance level used in the tile is referred to as an effective level, the number thereof is referred to as the effective level number, and the effective level numbers of the R, G, and B components are respectively NLV (R) and NLV (G). , Expressed as NLV (B).

有効レベル数カウント部104はその内部に図5に示すようなフラグの配列F(c,i)を保持する。cはコンポーネントを表し、R,G,Bのいずれかである。iは輝度値を表し、0〜255のいずれかの値である。フラグF(c,i)=0は着目するタイルのコンポーネントcにおいて輝度値iが出現しないことを意味し、フラグF(c、i)=1はタイルのコンポーネントcにおいて輝度値iが出現することを意味する。   The effective level number counting unit 104 holds a flag array F (c, i) as shown in FIG. c represents a component, and is one of R, G, and B. i represents a luminance value and is any value from 0 to 255. The flag F (c, i) = 0 means that the luminance value i does not appear in the component c of the tile of interest, and the flag F (c, i) = 1 indicates that the luminance value i appears in the component c of the tile. Means.

図6は有効レベル数カウント部104の処理の流れを示すフローチャートである。以下、図6に示したフローチャートを参照して、有効レベル数カウント部104の行う処理について説明する。   FIG. 6 is a flowchart showing a processing flow of the valid level number counting unit 104. Hereinafter, processing performed by the valid level number counting unit 104 will be described with reference to the flowchart shown in FIG.

まず、有効レベル数カウント部104の内部に保持するフラグ配列F(c,i)を全て0に初期化する(ステップS601)。   First, all the flag arrays F (c, i) held in the valid level number counting unit 104 are initialized to 0 (step S601).

次に、タイル内垂直方向画素位置を示す変数yを0に設定する(ステップS602)。   Next, a variable y indicating the vertical pixel position in the tile is set to 0 (step S602).

同様にタイル内水平方向画素位置を示す変数xを0に設定する(ステップS603)。   Similarly, a variable x indicating the horizontal pixel position in the tile is set to 0 (step S603).

タイルバッファ103に格納されるP(x,y,R)、P(x,y,G)、P(x,y,B)を参照し、フラグ配列F(R,P(x,y,R))、F(G,P(x,y,G))、F(B,P(x,y,B))に1を設定する(ステップS604)。   Referring to P (x, y, R), P (x, y, G), and P (x, y, B) stored in the tile buffer 103, a flag array F (R, P (x, y, R) )), F (G, P (x, y, G)), and F (B, P (x, y, B)) are set to 1 (step S604).

例えば、タイル内の位置x、yのR、G、Bの値がそれぞれ10、20、30である場合、
F(R、10)←1
F(G、20)←1
F(B、30)←1
とし、R成分の有効レベル“10”が存在したことを示す情報をセットする。G、B成分についても同様である。
For example, if the values of R, G, B at positions x, y in the tile are 10, 20, 30 respectively,
F (R, 10) ← 1
F (G, 20) ← 1
F (B, 30) ← 1
And information indicating that the effective level “10” of the R component exists is set. The same applies to the G and B components.

次に、タイル内垂直方向画素位置を示す変数xに1を加算する(ステップS605)。そして、変数xとタイルの水平方向画素数Twを比較し、x<Twの場合(YES)にはステップS604に処理を移して右隣の画素について処理を行い、そうでない場合(NO)にはステップS607へと処理を移す。   Next, 1 is added to the variable x indicating the vertical pixel position in the tile (step S605). Then, the variable x is compared with the horizontal pixel count Tw of the tile. If x <Tw (YES), the process proceeds to step S604 to perform the process on the right adjacent pixel, and otherwise (NO). The process moves to step S607.

ステップS607ではタイル内垂直方向画素位置を示す変数yに1を加算する(ステップS607)。   In step S607, 1 is added to the variable y indicating the vertical pixel position in the tile (step S607).

変数yとタイルの垂直方向画素数Thを比較し、y<Thの場合(YES)にはステップS603に処理を戻し、上記処理を繰り返す。   The variable y is compared with the vertical pixel count Th of the tile. If y <Th (YES), the process returns to step S603 and the above process is repeated.

以上の処理を、タイルの全画素について処理すると、そのタイル内に出現した各色成分の有効レベルが判明する。したがって、ステップS609では、各色成分毎の有効レベル数NLV(R)、NLV(G)、NLV(B)は次のようにして求めることができる。
NLV(R)=ΣF(R,i)
NLV(G)=ΣF(G,i)
NLV(B)=ΣF(B,i)
ここで『Σ』はi=0〜255までの累積加算を示すものである。
When the above processing is performed for all the pixels of the tile, the effective level of each color component appearing in the tile is determined. Therefore, in step S609, the effective level numbers NLV (R), NLV (G), and NLV (B) for each color component can be obtained as follows.
NLV (R) = ΣF (R, i)
NLV (G) = ΣF (G, i)
NLV (B) = ΣF (B, i)
Here, “Σ” indicates cumulative addition from i = 0 to 255.

以上の処理により各コンポーネントの有効レベル数NLV(c)(cはR、G、Bのいずれか)を生成し、出力する。   Through the above processing, the effective level number NLV (c) (c is any of R, G, and B) of each component is generated and output.

インデックステーブル用メモリ105には図7に示すようなインデックス変換テーブルIDX(c、i)を保持する。   The index table memory 105 holds an index conversion table IDX (c, i) as shown in FIG.

ここでも、cはコンポーネントを表し、R,G,Bのいずれかであり、iは輝度値を表し、0〜255のいずれかの値である。このインデックス変換テーブルIDX(c、i)は後述するインデックス変換部106において輝度値をインデックス値に変換する際に参照される。   Here, c represents a component and is any one of R, G, and B, i represents a luminance value, and is any value from 0 to 255. This index conversion table IDX (c, i) is referred to when the luminance value is converted into an index value in the index conversion unit 106 described later.

インデックステーブル生成部113は有効レベル数カウント部104に保持されているフラグ配列F(c,i)を参照して、インデックステーブル用メモリ105にインデックス変換テーブルIDX(c、i)を生成する。同時に符号列に付加情報として含めて伝送するための変換テーブル情報を可逆符号列形成部109へと出力する。   The index table generating unit 113 refers to the flag array F (c, i) held in the valid level number counting unit 104 and generates the index conversion table IDX (c, i) in the index table memory 105. At the same time, conversion table information for transmission including additional information in the code string is output to the lossless code string forming unit 109.

図8はインデックステーブル生成部113の処理の流れを示すフローチャートである。この処理は、各コンポーネント毎の、出現した有効レベル(F(c,i)=1となっている輝度)に0、1、2とインデックス番号を割り当てるものである。   FIG. 8 is a flowchart showing a processing flow of the index table generation unit 113. In this process, index numbers 0, 1, and 2 are assigned to the effective levels that appear for each component (luminance with F (c, i) = 1).

以下、図8に示したフローチャートを参照して、インデックステーブル生成部113の行う処理について説明する。インデックステーブル生成部113によるインデックステーブル生成の処理はコンポーネント毎に行われるが、各コンポーネント毎の処理は同一であるので、ここではコンポーネントをcとして処理を説明する。   Hereinafter, processing performed by the index table generating unit 113 will be described with reference to the flowchart shown in FIG. The index table generation processing by the index table generation unit 113 is performed for each component. Since the processing for each component is the same, the processing will be described assuming that the component is c.

まず、インデックステーブル用メモリ105の内部に保持するインデックス変換テーブルIDX(c,i)を全て−1等のインデックスとしてあり得ない値で初期化する(ステップS801)。   First, all the index conversion tables IDX (c, i) held in the index table memory 105 are initialized with values that cannot be used as indexes such as −1 (step S801).

次に、輝度値を示す変数iに0を初期設定し(ステップS802)、インデックス値を表す変数idx(c)を0に初期化する(ステップS803)。   Next, the variable i indicating the luminance value is initialized to 0 (step S802), and the variable idx (c) representing the index value is initialized to 0 (step S803).

次いで、有効レベル数カウント部104に保持されているフラグ配列F(c,i)を参照し、着目する輝度値iについてF(c,i)=1かどうかを判断する(ステップS804)。   Next, with reference to the flag array F (c, i) held in the valid level number counting unit 104, it is determined whether or not F (c, i) = 1 for the luminance value i of interest (step S804).

F(c,i)=1である場合(YES)はステップS805へ、そうでない場合(NO)はステップS807へと処理を移す。   If F (c, i) = 1 (YES), the process proceeds to step S805; otherwise (NO), the process proceeds to step S807.

F(c,i)=1である場合、コンポーネントcの輝度値iが注目タイル内に存在したことを示すことを意味するので、ステップS805にて、IDX(c,i)にidx(c)を設定するとともに、idx(c)を可逆符号列形成部109へ出力する(ステップS805)。   When F (c, i) = 1, it means that the luminance value i of the component c is present in the tile of interest, so in step S805 IDx (c, i) is set to idx (c). Is set and idx (c) is output to the lossless code string forming unit 109 (step S805).

続いてidx(c)に1を加えて値を更新する(ステップS806)。   Subsequently, 1 is added to idx (c) to update the value (step S806).

ステップS807では輝度値を示す変数iに1を加えて更新し(ステップS807)、変数iと256と比較し、i<256である場合(YES)にはステップS804に処理を戻して次の輝度値について処理を継続し、それ以外の場合(NO)にはステップS809へと処理を移す。   In step S807, the variable i indicating the luminance value is updated by adding 1 (step S807). When the variable i is compared with 256, if i <256 (YES), the process returns to step S804 to return to the next luminance. The process is continued for the value, and in other cases (NO), the process proceeds to step S809.

ステップS809では1つのコンポーネントについての付加情報の終了コードとして値−1を可逆符号列形成部109へと出力する。   In step S809, the value −1 is output to the lossless code string forming unit 109 as the end code of the additional information for one component.

以上の処理をR,G,B各コンポーネントについて順番に行い、インデックステーブル用メモリ105内部にインデックステーブル用メモリを生成する。   The above processing is performed in order for each of the R, G, and B components, and an index table memory is generated in the index table memory 105.

着目するタイルについて、有効レベル数カウント部104による有効レベル数カウント処理と、インデックステーブル生成部113によるインデックステーブル生成処理が終了すると、インデックス変換部106、セレクタ107、タイルデータ予測符号化部108により、タイルバッファ103に格納されるタイルデータの符号化処理を開始する。   When the effective level number counting process by the effective level number counting unit 104 and the index table generating process by the index table generating unit 113 are finished for the tile of interest, the index converting unit 106, the selector 107, and the tile data predictive encoding unit 108 Encoding processing of tile data stored in the tile buffer 103 is started.

本実施形態の画像符号化装置では、タイルの符号化データをコンポーネント順に読み出して符号化する。即ち、まず、タイルのRコンポーネントを先ず符号化し、続いてGコンポーネント、Bコンポーネントの順に符号化していく。各コンポーネントについてはタイル内をラスタースキャン順にデータを読み出して符号化処理を行う。各コンポーネントの符号化処理は共通であるので、以下、コンポーネントをcとして符号化処理を説明する。   In the image encoding apparatus according to the present embodiment, encoded data of tiles is read and encoded in the order of components. That is, the R component of the tile is first encoded, and then the G component and B component are encoded in this order. For each component, the data is read out in the tiles in the raster scan order and encoded. Since the encoding process of each component is common, the encoding process will be described below with component c.

インデックス変換部106はインデックステーブル用メモリ105に格納されるインデックス変換テーブルIDX(c,i)を参照して、タイルバッファ103からコンポーネント順、ラスタースキャン順に読み出される輝度値P(x,y,c)をインデックス値IDX(c、P(x、y、c))に置き換えて出力する。   The index conversion unit 106 refers to the index conversion table IDX (c, i) stored in the index table memory 105, and reads the luminance value P (x, y, c) read from the tile buffer 103 in the order of components and raster scan. Is replaced with the index value IDX (c, P (x, y, c)) and output.

セレクタ107はタイルバッファ103から順次読み出される画素値P(x,y,c)とインデックス変換部106から出力されるインデックス値IDX(c、P(x,y,c))を受け取り、選択して出力する。セレクタ内部には所定の閾値ML(タイルサイズに依存して決定されることが望ましい)を保持しておき、有効レベル数カウント部104から出力される有効レベルNLV(c)と閾値MLを比較し、NLV(c)<MLである場合にはインデックス変換された値、即ちインデックス変換部106からの入力値を選択して出力し、NLV(c)≧MLである場合にはインデックス変換されていない値P(x,y,c)を選択して出力する。   The selector 107 receives and selects the pixel value P (x, y, c) sequentially read from the tile buffer 103 and the index value IDX (c, P (x, y, c)) output from the index conversion unit 106. Output. A predetermined threshold ML (desirably determined depending on the tile size) is held in the selector, and the effective level NLV (c) output from the effective level number counting unit 104 is compared with the threshold ML. , When NLV (c) <ML, an index converted value, that is, an input value from the index conversion unit 106 is selected and output, and when NLV (c) ≧ ML, no index conversion is performed. The value P (x, y, c) is selected and output.

タイルデータ可逆符号化部108は、信号線111から入力される画素値、またはインデックス値を可逆符号化して符号列を信号線112を介して可逆符号列形成部109へと出力する。   The tile data lossless encoding unit 108 performs lossless encoding on the pixel value or index value input from the signal line 111 and outputs the code string to the lossless code string forming unit 109 via the signal line 112.

タイルデータ可逆符号化部108の内部は可逆符号化方式であれば適用可能であり、例えば、連続階調静止画像の可逆及び準可逆圧縮の国際標準として勧告されるJPEG−LS(ISO/IEC14495−1および2)などを適用することができる。ここでは、図2に示すブロック構成図で示される構成になっているものとする。   The inside of the tile data lossless encoding unit 108 is applicable as long as it is a lossless encoding method. For example, JPEG-LS (ISO / IEC 14495- recommended as an international standard for lossless and semi-reversible compression of continuous tone still images is applicable. 1 and 2) can be applied. Here, the configuration shown in the block configuration diagram shown in FIG. 2 is assumed.

同図に於いて201はバッファ、202は予測器、203は減算器、204はメモリ、205はハフマン符号化器である。図2は、画像データを予測誤差に変換する系列変換の処理に周辺画素を用いた予測変換を用い、符号化処理にはハフマン符号化を用いる画像圧縮方式の例である。   In the figure, 201 is a buffer, 202 is a predictor, 203 is a subtractor, 204 is a memory, and 205 is a Huffman encoder. FIG. 2 shows an example of an image compression method that uses predictive conversion using peripheral pixels for the series conversion process for converting image data into prediction errors, and uses Huffman coding for the encoding process.

同図において、実際の符号化が行われる前に、予め幾つかの画像を示す画像データを系列変換して得られた予測誤差の頻度分布を調べ、これに応じてハフマンテーブルを作成し、メモリ204に格納される。   In the figure, before actual encoding is performed, the frequency distribution of prediction errors obtained by series conversion of image data representing several images is examined in advance, and a Huffman table is created in accordance with the frequency distribution. 204.

予測誤差の頻度分布の一般的性質として予測誤差0を中心として出現頻度が高く、予測誤差の絶対値が大きくなるにつれて出現頻度が下がっていく傾向にあるため、メモリ204に格納されるハフマン符号では予測誤差0近辺に短い符号語が割り当てられ、予測誤差の絶対値が大きい部分には長い符号語が割り当てられる。   As a general property of the frequency distribution of the prediction error, the appearance frequency is high centering on the prediction error 0, and the appearance frequency tends to decrease as the absolute value of the prediction error increases. Therefore, in the Huffman code stored in the memory 204, A short codeword is assigned near the prediction error 0, and a long codeword is assigned to a portion where the absolute value of the prediction error is large.

最初に信号線111からタイルデータが順に入力される。バッファ201は信号線111から入力されるタイルデータを2ライン分格納する。予測器202はバッファ201から符号化対象画素の直前の画素aと,1ライン前の同じ水平位置の画素bのタイルデータ(図3参照)を取り出し、p=(a+b)/2の演算を行う事により予測値pを生成する。   First, tile data is sequentially input from the signal line 111. The buffer 201 stores tile data input from the signal line 111 for two lines. The predictor 202 takes out tile data (see FIG. 3) of the pixel a immediately before the pixel to be encoded and the pixel b at the same horizontal position one line before from the buffer 201, and performs the calculation of p = (a + b) / 2. As a result, the predicted value p is generated.

減算器203は符号化対象画素のタイルデータxと予測値pとの差分値eとして出力する。ハフマン符号器205は、予めメモリ204に格納されるハフマンテーブルを参照して、差分値eに対応する符号化データを信号線112から出力する。   The subtracter 203 outputs the difference value e between the tile data x of the encoding target pixel and the predicted value p. The Huffman encoder 205 refers to a Huffman table stored in advance in the memory 204 and outputs encoded data corresponding to the difference value e from the signal line 112.

メモリ204には予め幾つかのサンプル画像を予測符号化した際の予測誤差の特性に基づいて作成されたハフマンテーブルを格納しておく。図4はメモリ204に格納されるハフマンテーブルの一例である。   The memory 204 stores in advance a Huffman table created based on the characteristics of prediction errors when several sample images are predictively encoded. FIG. 4 is an example of a Huffman table stored in the memory 204.

可逆符号列形成部109は、インデックステーブル生成部113から出力される付加情報と、タイルデータ予測符号化部108から出力される符号化データを結合させて、予測符号化方式の出力となる符号列を形成して出力する。   The lossless code sequence forming unit 109 combines the additional information output from the index table generating unit 113 and the encoded data output from the tile data predictive encoding unit 108 to generate a code sequence that is the output of the predictive encoding method. Is output.

図10(a)、(b)は1つのタイルの可逆符号列のデータフォーマットを示す図である。また、同図(c)はタイルデータ非可逆符号化部114により出力される非可逆符号列のデータフォーマット示している。   FIGS. 10A and 10B are diagrams showing a data format of a lossless code string of one tile. FIG. 6C shows the data format of an irreversible code string output by the tile data irreversible encoding unit 114.

各データの先頭の1バイトの最上位ビットMSB(=ビット7)は、可逆、非可逆を区別するデータを格納する。実施形態の場合、MSBが“0”を可逆符号化を示す情報にアサインし、“1”の場合には非可逆符号化を示す情報にアサインした。また、下位3ビットのビット2、1、0は、コンポーネントR,G,Bに対応し、それぞれ閾値ML(セレクタ107の保持する閾値に同じ)以上か以下かを表す情報を割り当てた。   The most significant bit MSB (= bit 7) of the first byte of each data stores data that distinguishes reversible and irreversible. In the case of the embodiment, the MSB assigns “0” to information indicating lossless encoding, and if it is “1”, the MSB assigns information indicating lossy encoding. Further, bits 2, 1, and 0 of the lower 3 bits correspond to the components R, G, and B, and information indicating whether each is greater than or less than the threshold value ML (same as the threshold value held by the selector 107) is assigned.

つまり、ビット2にはNLV(R)<MLであるかどうかを表し、NLV(R)<MLである場合には“1”、それ以外の場合には“0”を設定する。ビット1にはNLV(G)<MLであるかどうかを表し、NLV(G)<MLである場合には“1”、それ以外の場合には“0”を設定する。ビット0にはNLV(B)<MLであるかどうかを表し、NLV(B)<MLである場合には“1”、それ以外の場合には“0”を設定する。また、ビット6からビット3については常に0を設定する。   That is, bit 2 indicates whether NLV (R) <ML, and “1” is set when NLV (R) <ML, and “0” is set otherwise. Bit 1 indicates whether or not NLV (G) <ML. “1” is set when NLV (G) <ML, and “0” is set otherwise. Bit 0 indicates whether NLV (B) <ML. “1” is set when NLV (B) <ML, and “0” is set otherwise. Also, 0 is always set for bits 6 to 3.

NLV(R)、NLV(G)、NLV(B)のいずれかが所定の閾値ML以下である場合、即ち、先頭バイトのMSBが“0”で、下位7ビットの値が0でない場合にはタイルの符号列の先頭バイトに続き、変換テーブル情報が付随する。   When any of NLV (R), NLV (G), and NLV (B) is less than or equal to the predetermined threshold ML, that is, when the MSB of the first byte is “0” and the value of the lower 7 bits is not 0 Following the first byte of the code string of the tile, conversion table information is attached.

インデックステーブル生成部113から変換テーブル情報が出力されるが、有効レベル数カウント部104から出力される有効レベル数NLV(c)を所定の閾値MLと比較して、NLV(c)<MLであるコンポーネントについてのみ変換テーブル情報を符号列に付加する。   The conversion table information is output from the index table generating unit 113. The effective level number NLV (c) output from the effective level number counting unit 104 is compared with a predetermined threshold ML, and NLV (c) <ML. Only for the component, conversion table information is added to the code string.

例えば、或るタイルについてインデックステーブル生成部から出力される変換テーブル情報が、
0、1,2,3,4,…,254、255,−1,0,128,255,−1,0,64,128,192,255
であるとき、NLV(R)=255、NLV(G)=3、NLV(B)=5となる。
For example, conversion table information output from the index table generation unit for a certain tile is
0, 1, 2, 3, 4, ..., 254, 255, -1, 0, 128, 255, -1, 0, 64, 128, 192, 255
NLV (R) = 255, NLV (G) = 3, and NLV (B) = 5.

ここで、閾値MLを“32”と仮定する。この場合、コンポーネントRの有効レベル数「255」は閾値“32”より大きいので、注目タイルの符号化データ列の先頭1バイトのビット2は“0”となる。また、コンポーネントG、Bそれぞれの有効レベル数は閾値“32”未満であるので、符号化データ列の先頭1バイトのビット1、0は共に“1”となる。   Here, it is assumed that the threshold value ML is “32”. In this case, since the effective level number “255” of the component R is larger than the threshold value “32”, the bit 2 of the first 1 byte of the encoded data string of the tile of interest is “0”. Since the number of effective levels of each of the components G and B is less than the threshold value “32”, both the bits 1 and 0 of the first byte of the encoded data string are “1”.

注目タイルは、可逆符号化であるのでMSBは“0”、ビット3乃至6も“0”としているわけであるから、上記の場合、先頭の1バイトは“3”という値になる。   Since the target tile is lossless encoding, the MSB is set to “0” and bits 3 to 6 are also set to “0”. Therefore, in the above case, the first byte has a value of “3”.

また、符号化データ列中の「変換テーブル情報」を生成する際、−1をコンポーネントの変換テーブル情報の区切りとして識別し、コンポーネントGとコンポーネントBについての変換テーブル情報を生成する。   Further, when generating “conversion table information” in the encoded data string, −1 is identified as a delimiter of component conversion table information, and conversion table information for component G and component B is generated.

上述の例では「変換テーブル情報」は、次のようになる。
0,128,255,0,0,64,128,192,255
変換テーブル情報の区切りを表す−1は0に置き換えられ、最後の0は削除される。復号する際には、先頭の1バイトのMSBが“0”であり、下位3ビットを調べれば、どの色成分についての変換テーブルが存在するかが判明するので、変換テーブル情報を左から右に順番に見て、隣の値よりも小さくなるか等しい部分は区切り情報であると判断してインデックス値から輝度値に変換する情報を取得すれば良いことになる。
In the above example, the “conversion table information” is as follows.
0, 128, 255, 0, 0, 64, 128, 192, 255
-1 representing the break of the conversion table information is replaced with 0, and the last 0 is deleted. When decoding, the MSB of the first 1 byte is “0”, and by examining the lower 3 bits, it can be determined which color component exists, so the conversion table information is changed from left to right. In view of the order, a portion smaller than or equal to the adjacent value is determined as delimiter information, and information for converting the index value into the luminance value may be acquired.

タイル毎に独立に符号化を行い、必要な変換テーブル情報を各タイルの符号化データに含むことにより、復号時にはタイルデータを独立に復号することが可能となる。   By encoding independently for each tile and including necessary conversion table information in the encoded data of each tile, it becomes possible to decode the tile data independently at the time of decoding.

図10の出力符号列の構成には示していないが、符号化データ中に所定の値が発生しないように工夫を加えて特殊なマーカを設定し、各タイルデータの先頭、または末尾にマーカを置く、あるいは、各タイルの符号列の長さを別途管理することでタイル単位のランダムアクセスを可能とすることができる。   Although not shown in the configuration of the output code string in FIG. 10, a special marker is set so that a predetermined value does not occur in the encoded data, and a marker is set at the beginning or end of each tile data. By placing or managing the length of the code string of each tile separately, random access in tile units can be made possible.

タイルデータ可逆符号化部108で可逆符号化を行うと同時に、タイルデータ非可逆符号化部114で、ブロックに分割されたデータの画素値を受け取り、非可逆符号化を行う。非可逆符号化には、多値自然画像を対象とした非可逆圧縮の国際標準として勧告されたJPEG(ITUT−T.81|ISO/IEC IS10918)などを適用することができる。JPEGについての詳細は規格書などあるためここでは説明は省略するが、図10(c)に示すように、先頭1バイトのMSBを“1”にした符号化列を生成する。これは、該当するタイルが可逆、非可逆符号化のいずれで符号化されているかを識別するためである。   The tile data lossless encoding unit 108 performs lossless encoding. At the same time, the tile data lossy encoding unit 114 receives pixel values of the data divided into blocks and performs lossy encoding. For lossy encoding, JPEG (ITUT-T.81 | ISO / IEC IS10918) recommended as an international standard for lossy compression for multi-valued natural images can be applied. The details of JPEG are not described here because there are standards, etc., but as shown in FIG. 10C, an encoded sequence in which the MSB of the first 1 byte is set to “1” is generated. This is for identifying whether the corresponding tile is encoded by lossless or lossy encoding.

セレクタ115は、可逆符号列形成部109から出力される可逆符号化データと、非可逆符号化部114から出力される非可逆符号化データを入力し、そのいずれか一方を選択し出力する。この際の選択条件は次の通りである。
CLK≦CLH+α の関係を満たすとき、可逆符号化データを選択出力する。
CLK>CLH+α の関係を満たすとき、非可逆符号化データを選択出力する。
ここで、CLHは非可逆符号化データの符号量(符号長)を示し、CLKは可逆符号化データの符号量(符号長)を示し、αは重み付け係数である。
The selector 115 inputs the lossless encoded data output from the lossless code sequence forming unit 109 and the lossy encoded data output from the lossy encoding unit 114, and selects and outputs either of them. The selection conditions at this time are as follows.
When the relationship CLK ≦ CLH + α is satisfied, lossless encoded data is selectively output.
When the relationship CLK> CLH + α is satisfied, lossy encoded data is selectively output.
Here, CLH indicates the code amount (code length) of lossy encoded data, CLK indicates the code amount (code length) of lossless encoded data, and α is a weighting coefficient.

ここで、全コンポーネントの有効レベル数が閾値ML未満である場合、すなわち、
NLV(R)<ML
NLV(G)<ML
NLV(B)<ML
である場合には、可逆符号化データの方が選択されやすいようにするため、α=正の定数で、例えば“100”とする。
Here, when the number of effective levels of all components is less than the threshold ML, that is,
NLV (R) <ML
NLV (G) <ML
NLV (B) <ML
In order to make it easier to select the lossless encoded data, α = a positive constant, for example, “100”.

一方、各コンポーネントの有効レベル数の1つでも閾値ML以上の場合には、α=0とする。   On the other hand, if even one of the effective levels of each component is greater than or equal to the threshold ML, α = 0.

例えば、あるタイルの符号化を行った際の非可逆符号化データ量CLH=750(バイト)、可逆符号化データ量CLK=800(バイト)であるものとする。そして、そのタイルの全コンポーネントの有効レベル数NLV(c)<閾値ML(cは、R、G、B)を満足する場合には、重み付け係数αは“100”になるので、
800<{750+100}
となり、可逆符号化データが選択され出力されることになる。
For example, it is assumed that the lossy encoded data amount CLH = 750 (bytes) and the lossless encoded data amount CLK = 800 (bytes) when a certain tile is encoded. When the effective level number NLV (c) <threshold value ML (c is R, G, B) of all the components of the tile, the weighting coefficient α is “100”.
800 <{750 + 100}
Thus, lossless encoded data is selected and output.

なお、本発明は、タイル単位での有効レベル数に応じて符号量比較の重み付けをする方法に限らず、例えば、NLV<MLであるコンポーネントの数に応じて、符号量比較の際の重み付けを行う様にしても良い。   The present invention is not limited to the method of weighting the code amount comparison according to the number of effective levels in tile units. For example, the weighting at the time of code amount comparison is performed according to the number of components where NLV <ML. You may do it.

次に、実施形態における符号列形成部116を説明する。符号列形成部116は、セレクタ115から出力されるタイルごとの符号化データを結合させて受け取り、入力画像全体に対応する符号列を形成して出力する。そのため、符号化データの先頭には、図9に示すように、画像を復号するために必要となる情報、例えば、画像の水平方向画素数、垂直方向画素数(タイルサイズは固定とするので、タイル数を示す情報でもある)、コンポーネント数、各コンポーネントのビット数などの付加情報がヘッダとして付けられる。   Next, the code string forming unit 116 in the embodiment will be described. The code string forming unit 116 combines and receives the encoded data for each tile output from the selector 115, forms a code string corresponding to the entire input image, and outputs the code string. Therefore, at the beginning of the encoded data, as shown in FIG. 9, information necessary for decoding the image, for example, the number of pixels in the horizontal direction and the number of pixels in the vertical direction (the tile size is fixed, Additional information such as the number of components and the number of bits of each component is attached as a header.

以上説明したように本実施形態によれば、画像データを符号化する際に、その画像データを所定サイズのブロック(実施形態ではタイル)に分割し、基本的には非可逆符号化データ量と可逆符号化データ量とを重み付け比較して、小さい方を選択して画像全体の符号化データを生成するので、高い圧縮率が期待できる。   As described above, according to the present embodiment, when encoding image data, the image data is divided into blocks of a predetermined size (tiles in the embodiment). Since the weighted comparison with the lossless encoded data amount is performed and the smaller one is selected to generate encoded data of the entire image, a high compression rate can be expected.

しかも、2つの符号化データの一方を選択する際の重み付け比較の際には、全色成分の有効レベル数、すなわち、R、G、Bのそれぞれの色成分で実在する輝度値の種類数が所定閾値(実施形態では閾値ML)未満である場合、可逆符号化データが選択され易く作用する。このような状況は、一般には、文字・線画領域、或いは下地色や単調な色の画像領域に相当するものである。したがって、特に、可逆であるが故に、文字や線画についてはそのエッジが明瞭な状態で符号化されることになり、高い画質が期待できる。   In addition, in the weighted comparison when selecting one of the two encoded data, the number of effective levels of all the color components, that is, the number of types of luminance values that exist in each of the R, G, and B color components is obtained. When it is less than the predetermined threshold value (threshold value ML in the embodiment), the lossless encoded data is easily selected. Such a situation generally corresponds to a character / line drawing area or an image area of a background color or a monotone color. Therefore, in particular, because it is reversible, characters and line drawings are encoded with clear edges, and high image quality can be expected.

特に、可逆符号化の場合、実施形態では、入力された各色成分値をそのまま利用した可逆符号化と、インデックス値による可逆符号化の2つが存在することにより、文字・線画領域では、そのほとんどがインデックス値に基づく符号化が採用されることになり、更に高い圧縮率が期待できる。   In particular, in the case of lossless encoding, in the embodiment, there are two types of lossless encoding using each input color component value as it is and lossless encoding using an index value. Encoding based on the index value will be adopted, and a higher compression rate can be expected.

また、有効レベル数が閾値MLを超える状況とは、そのブロックには多数の色が存在することを意味し、一般に自然画に多く見られる状況である。したがって、このような状況では、JPEG等の非可逆符号化データを選択しても、画質的に問題となることはないであろうし、高い圧縮率が期待できる。   Further, the situation where the number of effective levels exceeds the threshold ML means that there are a large number of colors in the block, and is generally a situation often seen in natural images. Therefore, in such a situation, even if irreversible encoded data such as JPEG is selected, there will be no problem in image quality, and a high compression rate can be expected.

<変形例の説明>
上記実施形態では図1の構成に基づく説明であったが、パーソナルコンピュータ等の汎用の情報処理装置(以下、PC)上で実行するコンピュータプログラムでもっても実現する例を以下に説明する。
<Description of modification>
Although the above embodiment has been described based on the configuration of FIG. 1, an example that can be realized even by a computer program executed on a general-purpose information processing apparatus (hereinafter, PC) such as a personal computer will be described below.

図11はPCのブロック構成図である。図示において、1401は装置全体を制御するCPUであり、1402はメインメモリとなるRAMである。1403はBIOSやブートプログラムを格納しているROMである。1404はキーボード、1405はマウス(登録商標)等のポインティングデバイス(PD)である。1406はCRTや液晶等の表示装置である。1407はハードディスク装置等の外部記憶装置であり、ここにOSをはじめ、画像圧縮に関するプログラムが格納されている。また、各種データファイルもここに格納される。1408はフロッピー(登録商標)ディスクドライブ、CD−ROMドライブ等の記憶媒体ドライブであり、1409はスキャナ装置等の外部装置と接続するためのインタフェースである。そして、1410は上記構成を電気的に接続するためのバスである。   FIG. 11 is a block diagram of the PC. In the figure, 1401 is a CPU for controlling the entire apparatus, and 1402 is a RAM serving as a main memory. A ROM 1403 stores a BIOS and a boot program. Reference numeral 1404 denotes a keyboard, and 1405 denotes a pointing device (PD) such as a mouse (registered trademark). Reference numeral 1406 denotes a display device such as a CRT or a liquid crystal. Reference numeral 1407 denotes an external storage device such as a hard disk device, in which an OS and a program related to image compression are stored. Various data files are also stored here. Reference numeral 1408 denotes a storage medium drive such as a floppy (registered trademark) disk drive or CD-ROM drive, and 1409 denotes an interface for connecting to an external device such as a scanner device. Reference numeral 1410 denotes a bus for electrically connecting the above configurations.

上記構成において、本装置の電源をONにすると、CPU1401はROM1403に格納されたOSをRAM1402にロードし、起動することになる。OS起動後、本変形例における画像符号化アプリケーションプログラムをOSを介して外部記憶装置1407からRAM1402にロードし、実行する。   In the above configuration, when the power of this apparatus is turned on, the CPU 1401 loads the OS stored in the ROM 1403 into the RAM 1402 and starts it. After the OS is started, the image encoding application program in the present modification is loaded from the external storage device 1407 to the RAM 1402 via the OS and executed.

ここでは説明を簡単なものとするため、インタフェース1409にイメージスキャナが接続されていて、原稿を読取り、その画像を符号化し、外部記憶装置1407にファイルとして格納する例を説明する。説明を簡単なものとするため、入力画像は上記の実施形態と同じ、R、G、B各8ビットで表わされているものとする。   In order to simplify the description, an example will be described in which an image scanner is connected to the interface 1409, a document is read, the image is encoded, and stored in the external storage device 1407 as a file. In order to simplify the description, it is assumed that the input image is represented by 8 bits each of R, G, and B as in the above embodiment.

図12、図13は本変形例における符号化処理を示すフローチャートである。   12 and 13 are flowcharts showing the encoding process in the present modification.

ステップS1201では、原稿画像を読取り、RAM1402に確保されたバッファーに1ストライプ分の画像データを格納する。   In step S1201, the original image is read, and image data for one stripe is stored in a buffer secured in the RAM 1402.

そして、ステップS1202にて、1タイル分の画像データをバッファより読み出し、ステップS1203にてJPEG符号化等の非可逆符号化を行う。この結果、1タイル分の非可逆符号化データ量をCLHとする。   In step S1202, one tile of image data is read from the buffer, and in step S1203, lossy encoding such as JPEG encoding is performed. As a result, the lossy encoded data amount for one tile is CLH.

次いで、可逆符号化を行うが、前段階で、ステップS1204にて、読出した1タイル中のR、G、Bの有効レベル数NLV(R)、NLV(G)、NLV(B)を算出する。この処理は、図6に示すフローチャートにしたがえば良いであろう。   Next, lossless encoding is performed. In step S1204, the number of effective levels NLV (R), NLV (G), and NLV (B) of R, G, and B in one read tile is calculated in the previous step. . This processing may be performed according to the flowchart shown in FIG.

そして、ステップS1205にて、R成分の有効レベル数NLV(R)と閾値MLとを比較し、「NLV(R)≧ML」の関係を満たす場合には、ステップS1206に進んで、入力したタイルのR成分値をそのまま利用して可逆符号化を行う。   In step S1205, the effective level number NLV (R) of the R component is compared with the threshold value ML. If the relationship of “NLV (R) ≧ ML” is satisfied, the process proceeds to step S1206, and the input tile The lossless encoding is performed by using the R component value of.

また、「NLV(R)<ML」の関係にあると判断した場合には、ステップS1207にてインデックス化し、ステップS1208にてインデックス値を可逆符号化する。   If it is determined that “NLV (R) <ML”, the index value is indexed in step S1207 and the index value is losslessly encoded in step S1208.

上記はR成分についての可逆符号化処理であるが、上記と同様の処理を、G、B成分についても行う。これを示すのがステップS1209、S1210である。それぞれの処理内容は、NLV(G)、NLV(B)と置換えれば良いので説明するまでもないであろう。   The above is the lossless encoding process for the R component, but the same process as described above is also performed for the G and B components. This is shown in steps S1209 and S1210. Each processing content may be replaced with NLV (G) and NLV (B), and will not be described.

1つのタイルに対するR、G、Bの全コンポーネントの可逆符号化処理が完了すると、ステップS1211にて、全有効レベル数NLV(R)、NLV(G)、NLV(B)が閾値ML未満であるか否かを判断する。もしこの条件を満たすと判断した場合には、ステップS1212にて重み付け係数αに正の所定値(実施形態では仮に“100”)を設定する。また、1つの色成分の有効レベル数が閾値ML以上になった場合には、重み付け係数αには“0”を設定する。   When the lossless encoding process for all the R, G, and B components for one tile is completed, the total number of effective levels NLV (R), NLV (G), and NLV (B) are less than the threshold ML in step S1211. Determine whether or not. If it is determined that this condition is satisfied, a positive predetermined value (temporarily “100” in the embodiment) is set to the weighting coefficient α in step S1212. When the number of effective levels of one color component is equal to or greater than the threshold ML, “0” is set to the weighting coefficient α.

こうして、重み付け係数αの設定処理を終えると、処理はステップS1214に進み、「CLK≦CLH+α」を満足するか否かを判定する。   When the setting process of the weighting coefficient α is thus completed, the process proceeds to step S1214, and it is determined whether or not “CLK ≦ CLH + α” is satisfied.

「CLK≦CLH+α」を満たすと判断した場合には、先のステップS1205乃至S1210で得られた可逆符号化データを、注目タイルの符号化データとしてRAM1402に確保された出力バッファに出力する(ステップS1215)。この際、データフォーマットは図10(a)もしくは図10(b)の形式である。   If it is determined that “CLK ≦ CLH + α” is satisfied, the lossless encoded data obtained in the previous steps S1205 to S1210 is output to the output buffer secured in the RAM 1402 as encoded data of the tile of interest (step S1215). ). At this time, the data format is as shown in FIG. 10 (a) or FIG. 10 (b).

また、「CLK>CLH+α」と判断した場合には、先のステップS1203の処理で得られた非可逆符号化データを、注目タイルの符号化データとして出力バッファに出力する(ステップS1216)。   If it is determined that “CLK> CLH + α”, the lossy encoded data obtained in the previous step S1203 is output to the output buffer as encoded data of the tile of interest (step S1216).

ステップS1217は、注目タイルが注目ストライプの最後のタイルであるか否かを判断する。否の場合には、ステップS1202以降の処理を繰り返す。   In step S1217, it is determined whether the target tile is the last tile of the target stripe. If not, the processes after step S1202 are repeated.

また、注目タイルが注目ストライプの最後のタイルであると判断した場合には、ステップS1218に進み、注目ストライプが画像データの最終ストライプであるか否かを判断し、否の場合にはステップS1201以降の処理を繰り返す。   If it is determined that the tile of interest is the last tile of the stripe of interest, the process advances to step S1218 to determine whether or not the stripe of interest is the final stripe of the image data. Repeat the process.

最終ストライプの最終タイルであった場合、画像全体の符号化が完了したことを意味するので、ステップS1219に進み、ヘッダ情報を付加し、出力バッファに格納された符号化データをファイルとして外部記憶装置1407に書き込み保存し、本処理を終了することになる。   If it is the final tile of the final stripe, it means that the encoding of the entire image has been completed, and the process advances to step S1219 to add header information and use the encoded data stored in the output buffer as a file as an external storage device. The information is written and saved in 1407, and this processing is terminated.

以上説明したように、先に説明した第1の実施形態と同様の処理を、PC等の汎用の情報処理装置上で実行するアプリケーションプログラムとしても実現できることになり、同様の作用効果を奏することが可能になる。   As described above, the same processing as that of the first embodiment described above can be realized as an application program executed on a general-purpose information processing apparatus such as a PC, and the same operational effects can be achieved. It becomes possible.

なお、復号処理であるが、復号処理は基本的に符号化処理とは逆の手順にしたがって行えばよいのは、自明のことであろうから、ここでの説明については省略する。   It should be noted that although it is a decoding process, it is obvious that the decoding process basically needs to be performed in accordance with the reverse procedure of the encoding process, and therefore description thereof is omitted here.

また、実施形態では、符号化対象の画像データはR、G、B成分で表現され、各8ビットであるものとして説明したが、これに限られるものではなく、他の色空間、他のビット数でも構わない。これは以下に説明する例でも同様である。   In the embodiment, the image data to be encoded is expressed as R, G, and B components, each having 8 bits. However, the present invention is not limited to this, and other color spaces and other bits are used. It can be a number. The same applies to the examples described below.

[第2の実施形態]
上記第1の実施形態、並びにその変形例では、着目するタイルの有効レベル数に応じて符号化処理(または符号化データ)の選択の際に加算する重み付け係数を求めるものであった。
[Second Embodiment]
In the first embodiment and its modification, the weighting coefficient to be added when selecting the encoding process (or encoded data) is obtained according to the number of effective levels of the tile of interest.

しかし、上記の処理によって本願発明が限定されるものではない。例えば、2つの符号化データの一方を選択され易いようにするためには、一方に重み付け係数を加算すること以外に、減算する手法を採用しても構わないし、乗算、除算を採用しても構わない。   However, the present invention is not limited by the above processing. For example, in order to make it easy to select one of the two encoded data, a method of subtracting may be employed in addition to adding a weighting coefficient to one of the two encoded data, and multiplication or division may be employed. I do not care.

例えば、乗算を利用するのであれば、ステップS1212にてαに“1.1”を設定し、ステップS1213ではαに“1.0”を設定する。そして、ステップS1214では、「CLK≦CLH×α」を満たすか否かを判断すれば良い。   For example, if multiplication is used, “1.1” is set to α in step S1212, and “1.0” is set to α in step S1213. In step S1214, it may be determined whether or not “CLK ≦ CLH × α” is satisfied.

[第3の実施形態]
第3の実施形態では、属性情報をも利用する例を説明する。
[Third Embodiment]
In the third embodiment, an example in which attribute information is also used will be described.

図14は第3の実施形態における画像符号化装置のブロック構成図である。図1に示した第1の実施形態の画像処理装置と同じ機能ブロックについては同じ番号を付し、その説明については省略する。   FIG. 14 is a block configuration diagram of an image encoding device according to the third embodiment. The same functional blocks as those of the image processing apparatus according to the first embodiment shown in FIG. 1 are denoted by the same reference numerals, and description thereof is omitted.

図1と異なる点は、属性情報検出部1501、タイル属性判定部1502を設け、セレクタ115はタイル属性判定部1502の判定結果をも加味して、符号化データの選択出力する点にある。   The difference from FIG. 1 is that an attribute information detection unit 1501 and a tile attribute determination unit 1502 are provided, and the selector 115 selects and outputs encoded data in consideration of the determination result of the tile attribute determination unit 1502.

属性情報検出部1501は、タイルバッファ103に格納される1タイルの画像データから属性情報を取得する。取得する属性情報は画素ごとに、文字であるなら1、文字以外であるなら0のフラグを持つようなものであり、その情報を出力する。文字か文字以外かの判定は、タイルのRGBデータをLab色空間に変換し、隣接する画素の輝度成分Lの差が所定の閾値以上あるか否かを判断することで対処すればよい。すなわち、一般に、文字線画は、そのエッジで濃度(或いは輝度)が急峻に変化することを利用する。   The attribute information detection unit 1501 acquires attribute information from one tile of image data stored in the tile buffer 103. The attribute information to be acquired has a flag of 1 for each pixel and 0 for other than a character, and outputs the information. The determination of whether the character is a character or not can be dealt with by converting the RGB data of the tile into a Lab color space and determining whether or not the difference between the luminance components L of adjacent pixels is greater than or equal to a predetermined threshold. That is, in general, a character line drawing utilizes the fact that the density (or luminance) changes sharply at the edge.

タイル属性判定部1502では、属性情報検出部1501から出力された属性情報を受け取り、画素ごとの属性情報からタイル中に文字属性を持った画素がどれくらいの割合で存在しているかを判定し出力する。ここで出力される文字属性画素の割合をMZとする。   The tile attribute determination unit 1502 receives the attribute information output from the attribute information detection unit 1501, determines from what attribute information for each pixel the ratio of pixels having character attributes in the tile, and outputs them. . The ratio of character attribute pixels output here is MZ.

セレクタ115は、タイルデータ可逆符号化部108とタイルデータ非可逆符号化部114から出力される符号化データと、タイル属性判定部1502から出力される文字属性画素の割合MZを受け取り、それらから符号化方式の選択を行い、選択された符号化方式の符号化結果を出力する。   The selector 115 receives the encoded data output from the tile data lossless encoding unit 108 and the tile data irreversible encoding unit 114 and the character attribute pixel ratio MZ output from the tile attribute determination unit 1502 and encodes them from them. The encoding method is selected, and the encoding result of the selected encoding method is output.

このとき、文字であるかそうでないかを判定する閾値をMC、重み付けにより付加する符号量をNとし、NLV(c)>MLであり有効レベル数のみでは重み付けできないような場合においても、MZ>MCであれば非可逆符号化した符号量CLHにNだけ重み付けを行う。   At this time, even when the threshold value for determining whether the character is a character or not is MC and the code amount to be added by weighting is N and NLV (c)> ML and weighting is not possible only by the number of effective levels, MZ> In the case of MC, N is weighted to the losslessly encoded code amount CLH.

例えば、非可逆符号化の符号量CLHが500バイト、可逆符号化の符号量CLKが590バイト、付加する符号量Nを100バイトとし、有効レベル数NLV(c)が33で、閾値MLが32、またMCであるとすると、第1の実施形態における重み付けでは重みは付加されず非可逆符号化が選択されてしまうが、本実施形態では画素の情報から、タイル中の文字属性の割合MZが90%以上であれば、CLHに100バイト符号量を加えることになる。そのため、単純に符号量比較をした場合にはCLH<CLKとなり非可逆符号化方式が選択されてしまうものが、インデックス化された値を符号化することによる効果と属性情報による重み付けを行うことで可逆符号化方式が選択され易くなり、文字線画領域については画質劣化を更に抑制することが可能になる。   For example, the code amount CLH for lossy encoding is 500 bytes, the code amount CLK for lossless encoding is 590 bytes, the code amount N to be added is 100 bytes, the number of effective levels NLV (c) is 33, and the threshold ML is 32. If it is MC, weighting is not added in the weighting in the first embodiment and lossy encoding is selected. In this embodiment, the character attribute ratio MZ in the tile is determined from the pixel information. If it is 90% or more, a 100-byte code amount is added to CLH. Therefore, when the code amount is simply compared, CLH <CLK and the lossy encoding method is selected, but the effect of encoding the indexed value and weighting by attribute information are performed. It becomes easy to select a lossless encoding method, and it is possible to further suppress image quality deterioration for a character / line image area.

以上の動作により、アンチエリアスありの文字などの、非可逆符号化の符号量CLHは小さく、可逆符号化の符号量CLKが大きくなるという特徴をもつ画像などにおいて、符号量比較のみでは符号化方式の正確な切換えが困難であったものに対して、符号化方式選択精度が向上し、劣化の見えやすい文字部分で可逆符号化が選択されるため、視覚的に画質劣化の無い画像を実現可能となる。   With the above operation, for an image having a characteristic that the code amount CLH of lossy encoding is small and the code amount CLK of lossless encoding is large, such as a character with anti-aliasing, an encoding method is performed only by code amount comparison. Because it is difficult to switch accurately, the coding method selection accuracy is improved, and lossless coding is selected for the character parts that are easily degraded. It becomes.

なお、重み付けの方法としては、NLV≦MLかつMZ>MCの場合には非可逆符号化した符号量CLHにNだけ重み付けを行う方法や、NLV<MLだが、MZ<MCの場合可逆符号化した符号量CLKにNだけ重み付けを行う方法など、有効レベル数NLVと属性情報MZを用いて重み付けを調整していれば、どのような形式でもよい。   In addition, as a weighting method, when NLV ≦ ML and MZ> MC, the code amount CLH subjected to lossy encoding is weighted by N, or when NLV <ML but MZ <MC, lossless encoding is performed. Any format may be used as long as the weight is adjusted using the effective level number NLV and the attribute information MZ, such as a method of weighting the code amount CLK by N.

また、上記第3の実施形態については、第1の実施形態と同様、コンピュータプログラムによっても実現できるのは、先の変形例で説明した如く、明らかである。   Further, as described in the previous modification, it is apparent that the third embodiment can be realized by a computer program as in the first embodiment.

また、通常、コンピュータプログラムは、それを格納したCD−ROM等のコンピュータ可読記憶媒体を、コンピュータにセットし、システムにコピーもしくはインストールすることで実行可能になるわけであるから、当然、このようなコンピュータ可読記憶媒体も本願発明の範疇にあることも明らかである。   Moreover, since a computer program is normally executable by setting a computer-readable storage medium such as a CD-ROM storing the computer program in a computer and copying or installing the computer program in a system, naturally It is also clear that computer-readable storage media are within the scope of the present invention.

第1の実施形態に係る画像処理装置のブロック構成図である。1 is a block configuration diagram of an image processing apparatus according to a first embodiment. 可逆符号化部の構成を示す図である。It is a figure which shows the structure of a lossless encoding part. 可逆符号化部における予測値を求める際の注目画素と近傍画素との関係を示す図である。It is a figure which shows the relationship between the attention pixel at the time of calculating | requiring the predicted value in a lossless encoding part, and a neighboring pixel. メモリ204に格納されるハフマンテーブルの例を示す図である。4 is a diagram illustrating an example of a Huffman table stored in a memory 204. FIG. フラグ配列F(c,i)のデータフォーマットを示す図である。It is a figure which shows the data format of flag arrangement | sequence F (c, i). 有効レベル数カウント部104の処理の流れを示すフローチャートである。5 is a flowchart showing a flow of processing of an effective level number counting unit 104. インデックス変換テーブルIDX(c、i )の内容の一例を示す図である。It is a figure which shows an example of the content of index conversion table IDX (c, i). インデックステーブル生成部113の処理を示すフローチャートである。It is a flowchart which shows the process of the index table production | generation part 113. FIG. 本画像処理装置の出力符号列のデータフォーマットを示す図である。It is a figure which shows the data format of the output code sequence of this image processing apparatus. 実施形態における1つのタイルの符号列のデータフォーマットを示す図である。It is a figure which shows the data format of the code sequence of one tile in embodiment. 第1の実施形態の変形例の装置のブロック構成図である。It is a block block diagram of the apparatus of the modification of 1st Embodiment. 第1の実施形態の変形例における画像符号化処理手順を示すフローチャートである。It is a flowchart which shows the image coding process procedure in the modification of 1st Embodiment. 第1の実施形態の変形例における画像符号化処理手順を示すフローチャートである。It is a flowchart which shows the image coding process procedure in the modification of 1st Embodiment. 第3の実施形態における画像処理装置のブロック構成図である。It is a block block diagram of the image processing apparatus in 3rd Embodiment.

Claims (6)

画像データを符号化する画像符号化装置であって、
画像データを複数画素からなるブロックに分割するブロック分割手段と、
前記ブロック分割手段で得られたブロック内の各色成分の取り得る成分値の範囲で、幾つの成分値が存在したか示す出現数を計数する計数手段と、
該計数手段で得られた各色成分の出現数と所定の閾値とを比較することで、重み付け係数を決定する重み付け係数決定手段と、
前記ブロック内の実在する各画素の色成分値に、連続する値のインデックス値の1つを割り当てることで、前記実在する各画素値の前記色成分値と一対一の関係を有するインデックステーブルを、前記色成分毎に生成するインデックステーブル生成手段と、
前記ブロック内に実在する各画素の色成分値を、該当する色成分の前記インデックステーブルを参照してインデックス値に変換するインデックス変換手段と、
前記計数手段で得られた着目色成分の出現数が予め設定された閾値より小さい場合は、前記インデックス変換手段で得られた前記着目色成分のインデックス値を符号化対象データとして選択出力し、前記着目色成分の出現数が予め設定された閾値以上の場合には着目色成分値を前記符号化対象データとして選択出力することを、全色成分について実行する第1の選択手段と、
該第1の選択手段で選択出力された前記符号化対象データを可逆符号化し、前記ブロックの可逆符号化データを生成する可逆符号化手段と、
前記ブロック分割手段で得られたブロックを単位に非可逆符号化し、非可逆符号化データを生成する非可逆符号化手段と、
前記可逆符号化手段で得られた可逆符号化データ量と、前記非可逆符号化手段で得られた非可逆符号化データ量とを、前記重み付け係数決定手段で得られた重み付け係数を用いて比較する比較手段と、
該比較手段による重み付け比較結果に基づき、符号化データ量の少ない符号化データを選択し出力する第2の選択手段と
を備えることを特徴とする画像符号化装置。
An image encoding device for encoding image data,
Block dividing means for dividing the image data into blocks composed of a plurality of pixels;
Counting means for counting the number of appearances indicating how many component values existed in the range of possible component values of each color component in the block obtained by the block dividing means;
A weighting coefficient determination means for determining a weighting coefficient by comparing the number of appearances of each color component obtained by the counting means with a predetermined threshold;
An index table having a one-to-one relationship with the color component value of each existing pixel value by assigning one of the consecutive index values to the color component value of each existing pixel in the block, Index table generating means for generating each color component;
Index conversion means for converting the color component value of each pixel actually existing in the block into an index value with reference to the index table of the corresponding color component;
When the number of appearances of the target color component obtained by the counting unit is smaller than a preset threshold, the index value of the target color component obtained by the index conversion unit is selectively output as encoding target data, A first selection unit that executes, for all color components, selecting and outputting a target color component value as the encoding target data when the number of appearances of the target color component is equal to or greater than a preset threshold;
Lossless encoding means for losslessly encoding the encoding target data selected and output by the first selection means, and generating lossless encoded data of the block ;
Irreversible encoding means for generating lossy encoded data by irreversibly encoding a block obtained by the block dividing means;
Comparing the lossless encoded data amount obtained by the lossless encoding means and the lossy encoded data amount obtained by the lossy encoding means by using the weighting coefficient obtained by the weighting coefficient determining means Comparing means to
An image encoding apparatus comprising: a second selection unit that selects and outputs encoded data with a small amount of encoded data based on a weighted comparison result by the comparison unit.
前記重み付け係数決定手段は、色成分C1、C2、C3それぞれの出現数をNLV(C1)、NLV(C2)、NLV(C3)とし、予め設定された値をMLとしたとき、
条件1:NLV(C1)<ML & NLV(C2)<ML & NLV(C3)<ML
を満たす場合、前記非可逆符号化データ量を相対的に増やすための重み付け係数値を生成することを特徴とする請求項1に記載の画像符号化装置。
The weighting coefficient determining means has NLV (C1), NLV (C2), and NLV (C3) as the number of appearances of each of the color components C1, C2, and C3, and sets a preset value as ML.
Condition 1: NLV (C1) <ML & NLV (C2) <ML & NLV (C3) <ML
The image encoding device according to claim 1, wherein when the condition is satisfied, a weighting coefficient value for relatively increasing the amount of lossy encoded data is generated.
更に、ブロック内の文字・線画の属性を有する画素を検出する検出手段と、
文字・線画の属性を有する画素数を計数する第2の計数手段とを備え、
前記重み付け係数決定手段は、前記条件1を満たさない場合、
条件2:第2の計数手段で得られた画素数>所定の閾値
を満足する場合、前記非可逆符号化データ量を相対的に増やすための重み付け係数値を生成することを特徴とする請求項に記載の画像符号化装置。
Furthermore, a detecting means for detecting a pixel having a character / line drawing attribute in the block;
A second counting means for counting the number of pixels having a character / line drawing attribute;
When the weighting coefficient determining means does not satisfy the condition 1,
Condition 2: When the number of pixels obtained by the second counting means> a predetermined threshold value is satisfied, a weighting coefficient value for relatively increasing the amount of lossy encoded data is generated. 2. The image encoding device according to 2.
画像データを符号化する画像符号化方法であって、
画像データを複数画素からなるブロックに分割するブロック分割工程と、
前記ブロック分割工程で得られたブロック内の各色成分の取り得る成分値の範囲で、幾つの成分値が存在したか示す出現数を計数する計数工程と、
該計数工程で得られた各色成分の出現数と所定の閾値とを比較することで、重み付け係数を決定する重み付け係数決定工程と、
前記ブロック内の実在する各画素の色成分値に、連続する値のインデックス値の1つを割り当てることで、前記実在する各画素値の前記色成分値と一対一の関係を有するインデックステーブルを、前記色成分毎に生成するインデックステーブル生成工程と、
前記ブロック内に実在する各画素の色成分値を、該当する色成分の前記インデックステーブルを参照してインデックス値に変換するインデックス変換工程と、
前記計数工程で得られた着目色成分の出現数が予め設定された閾値より小さい場合は、前記インデックス変換工程で得られた前記着目色成分のインデックス値を符号化対象データとして選択出力し、前記着目色成分の出現数が予め設定された閾値以上の場合には着目色成分値を前記符号化対象データとして選択出力することを、全色成分について実行する第1の選択工程と、
該第1の選択工程で選択出力された前記符号化対象データを可逆符号化し、前記ブロックの可逆符号化データを生成する可逆符号化工程と、
前記ブロック分割工程で得られたブロックを単位に非可逆符号化し、非可逆符号化データを生成する非可逆符号化工程と、
前記可逆符号化工程で得られた可逆符号化データ量と、前記非可逆符号化工程で得られた非可逆符号化データ量とを、前記重み付け係数決定工程で得られた重み付け係数を用いて比較する比較工程と、
該比較工程による重み付け比較結果に基づき、符号化データ量の少ない符号化データを選択し出力する第2の選択工程と
を備えることを特徴とする画像符号化方法。
An image encoding method for encoding image data, comprising:
A block dividing step for dividing the image data into blocks each having a plurality of pixels;
A counting step of counting the number of appearances indicating how many component values existed within a range of possible component values of each color component in the block obtained in the block dividing step;
A weighting coefficient determination step for determining a weighting coefficient by comparing the number of appearance of each color component obtained in the counting step with a predetermined threshold;
An index table having a one-to-one relationship with the color component value of each existing pixel value by assigning one of the consecutive index values to the color component value of each existing pixel in the block, An index table generating step for generating each color component;
An index conversion step of converting a color component value of each pixel existing in the block into an index value by referring to the index table of the corresponding color component;
When the number of appearances of the target color component obtained in the counting step is smaller than a preset threshold value, the index value of the target color component obtained in the index conversion step is selectively output as encoding target data. A first selection step of executing, for all color components, selecting and outputting a target color component value as the encoding target data when the number of appearance of the target color component is equal to or greater than a preset threshold;
A lossless encoding step of losslessly encoding the encoding target data selected and output in the first selection step and generating lossless encoded data of the block ;
Irreversible encoding step of generating lossy encoded data by irreversibly encoding the block obtained in the block dividing step; and
Comparing the lossless encoded data amount obtained in the lossless encoding step and the lossy encoded data amount obtained in the lossy encoding step using the weighting coefficient obtained in the weighting factor determination step A comparison process to
And a second selection step of selecting and outputting encoded data with a small amount of encoded data based on the weighted comparison result of the comparison step.
コンピュータが読み込み実行することで、前記コンピュータを、画像データを符号化する画像符号化装置として機能させるコンピュータプログラムであって、
画像データを複数画素からなるブロックに分割するブロック分割手段と、
前記ブロック分割手段で得られたブロック内の各色成分の取り得る成分値の範囲で、幾つの成分値が存在したか示す出現数を計数する計数手段と、
該計数手段で得られた各色成分の出現数と所定の閾値とを比較することで、重み付け係数を決定する重み付け係数決定手段と、
前記ブロック内の実在する各画素の色成分値に、連続する値のインデックス値の1つを割り当てることで、前記実在する各画素値の前記色成分値と一対一の関係を有するインデックステーブルを、前記色成分毎に生成するインデックステーブル生成手段と、
前記ブロック内に実在する各画素の色成分値を、該当する色成分の前記インデックステーブルを参照してインデックス値に変換するインデックス変換手段と、
前記計数手段で得られた着目色成分の出現数が予め設定された閾値より小さい場合は、前記インデックス変換手段で得られた前記着目色成分のインデックス値を符号化対象データとして選択出力し、前記着目色成分の出現数が予め設定された閾値以上の場合には着目色成分値を前記符号化対象データとして選択出力することを、全色成分について実行する第1の選択手段と、
該第1の選択手段で選択出力された前記符号化対象データを可逆符号化し、前記ブロックの可逆符号化データを生成する可逆符号化手段と、
前記ブロック分割手段で得られたブロックを単位に非可逆符号化し、非可逆符号化データを生成する非可逆符号化手段と、
前記可逆符号化手段で得られた可逆符号化データ量と、前記非可逆符号化手段で得られた非可逆符号化データ量とを、前記重み付け係数決定手段で得られた重み付け係数を用いて比較する比較手段と、
該比較手段による重み付け比較結果に基づき、符号化データ量の少ない符号化データを選択し出力する第2の選択手段
として機能させることを特徴とするコンピュータプログラム。
A computer program that causes a computer to function as an image encoding device that encodes image data by being read and executed by a computer,
Block dividing means for dividing the image data into blocks composed of a plurality of pixels;
Counting means for counting the number of appearances indicating how many component values existed in the range of possible component values of each color component in the block obtained by the block dividing means;
A weighting coefficient determination means for determining a weighting coefficient by comparing the number of appearances of each color component obtained by the counting means with a predetermined threshold;
An index table having a one-to-one relationship with the color component value of each existing pixel value by assigning one of the consecutive index values to the color component value of each existing pixel in the block, Index table generating means for generating each color component;
Index conversion means for converting the color component value of each pixel actually existing in the block into an index value with reference to the index table of the corresponding color component;
When the number of appearances of the target color component obtained by the counting unit is smaller than a preset threshold, the index value of the target color component obtained by the index conversion unit is selectively output as encoding target data, A first selection unit that executes, for all color components, selecting and outputting a target color component value as the encoding target data when the number of appearances of the target color component is equal to or greater than a preset threshold;
Lossless encoding means for losslessly encoding the encoding target data selected and output by the first selection means, and generating lossless encoded data of the block ;
Irreversible encoding means for generating lossy encoded data by irreversibly encoding a block obtained by the block dividing means;
Comparing the lossless encoded data amount obtained by the lossless encoding means and the lossy encoded data amount obtained by the lossy encoding means by using the weighting coefficient obtained by the weighting coefficient determining means Comparing means to
A computer program that functions as a second selection unit that selects and outputs encoded data with a small amount of encoded data based on a weighted comparison result by the comparison unit.
請求項5に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読記憶媒体。   A computer-readable storage medium storing the computer program according to claim 5.
JP2004331105A 2004-11-15 2004-11-15 Image encoding apparatus and method, computer program, and computer-readable storage medium Expired - Fee Related JP4418736B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004331105A JP4418736B2 (en) 2004-11-15 2004-11-15 Image encoding apparatus and method, computer program, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004331105A JP4418736B2 (en) 2004-11-15 2004-11-15 Image encoding apparatus and method, computer program, and computer-readable storage medium

Publications (3)

Publication Number Publication Date
JP2006140967A JP2006140967A (en) 2006-06-01
JP2006140967A5 JP2006140967A5 (en) 2007-12-27
JP4418736B2 true JP4418736B2 (en) 2010-02-24

Family

ID=36621425

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004331105A Expired - Fee Related JP4418736B2 (en) 2004-11-15 2004-11-15 Image encoding apparatus and method, computer program, and computer-readable storage medium

Country Status (1)

Country Link
JP (1) JP4418736B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10506137B2 (en) 2018-02-08 2019-12-10 Seiko Epson Corporation Image coding device, image coding method, and image coding system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110071231A (en) * 2009-12-21 2011-06-29 엠텍비젼 주식회사 Encoding method, decoding method and apparatus thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10506137B2 (en) 2018-02-08 2019-12-10 Seiko Epson Corporation Image coding device, image coding method, and image coding system

Also Published As

Publication number Publication date
JP2006140967A (en) 2006-06-01

Similar Documents

Publication Publication Date Title
JP4418762B2 (en) Image encoding apparatus, image decoding apparatus, control method thereof, computer program, and computer-readable storage medium
JP4732203B2 (en) Image encoding apparatus, decoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP4979323B2 (en) Image processing apparatus and control method thereof
US7912300B2 (en) Image processing apparatus and control method therefor
US7689048B2 (en) Image encoding apparatus, method, and computer-readable storage medium for encoding a pixel value
US7650039B2 (en) Image encoding apparatus, image decoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP4847398B2 (en) Image processing apparatus and method
AU2007249106B2 (en) A lossless compressor for image data values
JP2000050268A (en) Image coding device
JP2008042688A (en) Image processing apparatus and control method thereof, and computer program and computer readable storage medium
US8396308B2 (en) Image coding based on interpolation information
WO2021145105A1 (en) Data compression device and data compression method
JP4418736B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP4084802B2 (en) Image processing device
JP2008109478A (en) Image encoding device, method, program and storage medium
JP2006080793A (en) Image coder, method, compputer program, and computer readable storage medium
JP4324079B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP2008042683A (en) Image processing apparatus and its control method, computer program and computer readable storage medium
JP4377351B2 (en) Data compression apparatus and data compression program
JP2008042681A (en) Image processing method and processor, computer program and computer readable storage medium
JP4771541B2 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP3263218B2 (en) Image information data compression and playback device
JP6572093B2 (en) Image coding apparatus and control method thereof
JP4377352B2 (en) Data compression apparatus and data compression program
JP5538985B2 (en) Image coding apparatus and control method thereof

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071108

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20071108

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20071108

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090525

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090724

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20091124

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20091130

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121204

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131204

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees