JP2012095228A - Image encoding device and control method thereof, and program and storage medium - Google Patents
Image encoding device and control method thereof, and program and storage medium Download PDFInfo
- Publication number
- JP2012095228A JP2012095228A JP2010242652A JP2010242652A JP2012095228A JP 2012095228 A JP2012095228 A JP 2012095228A JP 2010242652 A JP2010242652 A JP 2010242652A JP 2010242652 A JP2010242652 A JP 2010242652A JP 2012095228 A JP2012095228 A JP 2012095228A
- Authority
- JP
- Japan
- Prior art keywords
- encoding
- block
- encoded data
- pixel
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
Description
本発明は画像データの符号化技術に関するものである。 The present invention relates to an image data encoding technique.
従来、ブロック単位の画像データを固定長符号に圧縮する方法として、特許文献1が知られている。この文献では、ブロック単位の画像データのうち視覚上重要な画素(例えば文字線画の画素)を抽出して可逆符号化し、その他のデータを非可逆符号化する。すなわち、1つの画像データに対して複数の符号化処理を並行して実行している。 Conventionally, Patent Document 1 is known as a method for compressing block-unit image data into a fixed-length code. In this document, a visually important pixel (for example, a character / line image pixel) is extracted from image data in block units and losslessly encoded, and other data is lossyly encoded. That is, a plurality of encoding processes are executed in parallel on one image data.
また、ブロック単位の画像データを高速に符号化する方法として、特許文献2が知られている。ここでは、JPEG符号化のDCT演算において、ブロックの画素が全て白のときの演算値をあらかじめ記憶しておく。そして、当該ブロックと直前ブロックとが全て白のときに、記憶しているDCT演算値を用いることにより、高速に符号化を行う、というものである。
Further,
入力画像データを少なくとも2つの符号化方式を並列に用いて符号化する装置において、同一色のブロックを符号化しようとしたとき、既に上記2つの符号化方式がいずれも実行中であった場合には、全体的な符号化に時間がかかってしまう。 In an apparatus that encodes input image data using at least two encoding methods in parallel, when trying to encode a block of the same color, both of the above two encoding methods are already being executed. Takes time for overall encoding.
本発明は上記点に鑑みてなされたものであり、文字線画に好適な符号化、階調画像に好適な符号化の両方を持つ装置であって、ブロック単位に固定長の符号化データを生成しつつ、且つ、符号化をより高速に行う技術を提供しようとするものである。 The present invention has been made in view of the above points, and is an apparatus having both encoding suitable for character line drawings and encoding suitable for gradation images, and generates fixed-length encoded data for each block. However, the present invention intends to provide a technique for performing encoding at higher speed.
この課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
画像データを符号化する画像符号化装置であって、
符号化対象の画像から、複数画素で構成されるブロックを入力する入力手段と、
入力した着目ブロック内の各画素の画素値を解析し、前記着目ブロック内に文字線画に属する画素があるか否かを判定する解析手段と、
該解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合には文字線画の代表画素値と、各画素毎に文字線画に属するか非文字線画に属するかを示す識別情報を生成する生成する生成手段と、
該生成手段で生成した文字線画の代表画素値と識別情報を可逆符号化し、第1の形式の符号化データを生成する第1の符号化手段と、
前記解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合、非文字線画に属する画素の平均画素値で、文字線画に属する画素の画素値を置換して、非文字線画の画素で構成されるブロックを生成する置換手段と、
前記解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合には前記置換手段で得られたブロックを、前記解析手段が前記着目ブロック内に文字線画に属する画素がないと判定した場合には前記置換手段による置換前のブロックを非可逆符号化し、第2の形式の符号化データを生成する第2の符号化手段と、
前記第1の符号化手段、及び、前記第2の符号化手段で生成された符号化データを多重化すると共に、ブロックヘッダには前記第1の形式の符号化データの有無、前記第2の形式の符号化データの有無を示す情報を格納した固定長のブロック符号化データを生成し、出力する多重化手段とを備え、更に、
前記入力手段で入力した前記着目ブロックの全画素の画素値が同じであるか否かを判定する判定手段と、
該判定手段が前記着目ブロックの全画素が同じ画素値を持つと判定した場合、前記第1の符号化手段及び前記第2の符号化手段による前記着目ブロックに対する符号化を中止し、予め記憶された全画素が同じとした前記第1,第2の形式の符号化データと前記着目ブロックの画素値から、前記第1の形式の符号化データ、又は、前記第2の形式符号化データのいずれか一方を生成する第3の符号化手段とを有し、
前記多重化手段は、該判定手段が前記着目ブロックの全画素が同じ画素値を持つと判定した場合、前記第3の符号化手段より得られた符号化データを、前記着目ブロックの符号化データとして出力することを特徴とする。
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,
Input means for inputting a block composed of a plurality of pixels from an image to be encoded;
Analyzing means for analyzing a pixel value of each pixel in the input target block and determining whether or not there is a pixel belonging to the character line image in the target block;
If the analysis means determines that there are pixels belonging to the character line drawing in the block of interest, the representative pixel value of the character line drawing and identification information indicating whether each pixel belongs to the character line drawing or non-character line drawing Generating means for generating; and
First encoding means for losslessly encoding the representative pixel values and identification information of the character / line image generated by the generating means to generate encoded data of the first format;
When the analysis unit determines that there is a pixel belonging to the character / line drawing in the target block, the pixel value of the pixel belonging to the character / line drawing is replaced with the average pixel value of the pixel belonging to the non-character / line drawing. Replacement means for generating a block composed of pixels;
When the analyzing unit determines that there is a pixel belonging to the character line image in the target block, the analyzing unit determines that there is no pixel belonging to the character line image in the target block. In such a case, the second encoding means for irreversibly encoding the block before replacement by the replacement means and generating encoded data of the second format;
The encoded data generated by the first encoding unit and the second encoding unit are multiplexed, and the presence or absence of the encoded data of the first format in the block header, the second Multiplex means for generating and outputting fixed-length block encoded data storing information indicating the presence or absence of encoded data in a format;
Determination means for determining whether or not the pixel values of all pixels of the block of interest input by the input means are the same;
When the determination means determines that all the pixels of the block of interest have the same pixel value, the encoding of the block of interest by the first encoding means and the second encoding means is stopped and stored in advance. From the encoded data of the first and second formats and the pixel value of the block of interest in which all the pixels are the same, either the encoded data of the first format or the encoded data of the second format Third encoding means for generating either one of
When the determining unit determines that all the pixels of the target block have the same pixel value, the multiplexing unit converts the encoded data obtained from the third encoding unit into the encoded data of the target block. Is output as
本発明によれば、文字線画に好適な符号化、階調画像に好適な符号化の両方を持つ装置であって、ブロック単位に固定長の符号化データを生成しつつ、且つ、符号化をより高速に行うことが可能になる。 According to the present invention, there is provided an apparatus having both encoding suitable for a character / line image and encoding suitable for a gradation image, while generating fixed-length encoded data in units of blocks and performing encoding. It becomes possible to perform at higher speed.
以下添付図面に従って本発明に係る実施形態を詳細に説明する。 Embodiments according to the present invention will be described below in detail with reference to the accompanying drawings.
[第1の実施形態]
なお、以下に説明における符号化対象の多値画像データの発生源はイメージスキャナとするが、画像データを格納した記憶媒体であっても良いし、その種類は問わない。また、説明を簡単なものとするため、符号化対象の画像データは1画素1成分のモノクロ画像とし、その成分は8ビット(256階調)であって、輝度を表わすものとして説明する。ただし、色成分の数、及び、色空間の種類(RGB、CMY、Lab等)は如何なるものであっても良いし、1色成分のビット数も8ビットに限らない。因に、1画素が複数の成分で構成される場合には、以下に説明する事項を各成分毎に実行すれば良い。
[First Embodiment]
In the following description, the source of multi-value image data to be encoded is an image scanner, but it may be a storage medium storing image data, and the type thereof is not limited. For the sake of simplicity, the description will be made assuming that the image data to be encoded is a monochrome image of one component per pixel, and that the component is 8 bits (256 gradations) and represents luminance. However, the number of color components and the type of color space (RGB, CMY, Lab, etc.) may be arbitrary, and the number of bits of one color component is not limited to 8 bits. Incidentally, when one pixel is composed of a plurality of components, the items described below may be executed for each component.
図1に、本発明の第1の実施形態における画像符号化装置の構成図を示す。本装置は、装置全体の制御を司る制御部11をはじめ、以下に示す処理部で構成される。
FIG. 1 shows a configuration diagram of an image coding apparatus according to the first embodiment of the present invention. This apparatus includes a
ブロック化部1は、符号化対象の画像データから複数画素(m×n画素)で構成されるブロック画像データを生成する。以下では、簡単のため1ブロックのサイズを8×8画素とする。 The blocking unit 1 generates block image data composed of a plurality of pixels (m × n pixels) from the image data to be encoded. In the following, for simplification, the size of one block is 8 × 8 pixels.
解析部2は、ブロック化部1から入力した1ブロック分の画像データ(実施形態では8×8画素)を解析して、ブロック中の各画素毎に、文字線画/非文字線画のいずれに属するかを示す識別データ、並びに、文字線画に属すると判定された画素値(文字線画の代表色)を生成し、第1の符号化部4に出力する。具体例を示せば次の通りである。
The
解析部2は、ブロック内の全画素の平均画素値AVEを算出し、その平均画素値AVEよりも大きい画素値を持つ画素群(以下、第1の画素群という)と、その平均画素値AVE以下の画素群(以下、第2の画素群という)に分類する。そして、第1の画素群の平均画素値である第1の平均画素値AVE1と第2の画素群の平均画素値である第2の平均画素値AVE2を求め、それらの差「AVE1−AV2」が予め設定された閾値Th1を越えるか否かを判定する。閾値Th1を越えていれば、輝度の低い(濃度が高い)第2の画素群は文字線画に属する画素群と判定し、第1の画素群は非文字線画に属する画素群に属するものと判定する。この場合、第2の平均値AVE2を、文字線画に属する代表画素値として決定する。そして、ブロック内をラスタースキャンし、文字線画に属する画素に対して“1”、非文字線画に属する画素に対して“0”の1ビットの識別データを生成していく。実施形態の場合、1ブロックは8×8画素としているわけであるから、1ブロックからは64個の識別データが生成されることになる。以下、1ブロック分の64個(64ビット)の識別データを識別情報と呼ぶこととする。なお、解析部2は、{AVE1−AV2}>Th1の場合、文字線画の代表画素値+識別情報を第1の符号化部4に出力してその符号化を行なわせ、多重化部10に対しても着目ブロックに対して文字線画の代表画素値及び識別情報の符号化データを多重化する旨の信号を出力する。一方、{AVE1−AV2}≦Th1の場合、第1の符号化部4に対しては、文字線画の代表画素値+識別情報を出力せず、且つ、着目ブロックに対して文字線画の代表画素値及び識別情報の符号化データはない旨を多重化部10に通知する。更に、後述する同一色検出部3による検出結果も合わせて、多重化部10に通知する。また、上記は画素値が輝度を示すものとした場合である。画素値が濃度を示す場合、文字線画の代表画素値としてAVE1を利用する。
The
解析部2は上記の処理に加え、{AVE1−AVE2}≦Th1の場合には、入力したブロックデータをそのまま第2の符号化部5に出力する。また、{AVE1−AVE2}>Th1である場合、入力したブロック中の非文字線画に属する画素はその画素値のまま、文字線画に属する画素値は上記の第1の平均値AVE1(非文字線画に属する画素の平均値)で置換した新たなブロックデータを生成し、それを第2の符号化部5に出力する。前者の場合は説明するまでもないであろう。ここでは、後者の具体例を説明する。座標x、y(0≦x、y≦7)の新たなブロックの画素値をPout(x,y)、入力したブロックの画素値をPin(x,y)、及び、識別データをB(x,y)としたとき、次のようにして新たなブロックデータを生成すればよい。
・B(x,y)=0のとき(着目画素が非文字線画であるとき)
Pout(x,y)←Pin(x,y)
・B(x,y)=1のとき(着目画素が文字線画であるとき)
Pout(x,y)←AVE1
上記の結果、第2の符号化部5に供給されるブロックデータには、高周波(AC)成分が無い、もしくは少ないものとなり、JPEG等の非可逆符号化を行った場合に高い圧縮率が期待できる。
In addition to the above processing, the
・ When B (x, y) = 0 (when the target pixel is a non-character line drawing)
Pout (x, y) ← Pin (x, y)
When B (x, y) = 1 (when the target pixel is a character line drawing)
Pout (x, y) ← AVE1
As a result, the block data supplied to the
次に、同一色検出部3について説明する。この同一色検出部3は、解析部2の内部にある処理部であり、入力したブロックを構成する全画素が同一色(輝度)であるか否かを判定し、その判定結果と、同一色であると判定した場合にはその色(画素値)を第3の符号化部6に出力する。なお、「同一色」と判定する範囲をユーザが設定しても良い。たとえば、ブロック中の全画素中の最大画素値と最小画素値の差を求め、その差が同一色として判定可能な許容範囲(閾値Th2;ただし、Th2≦Th1とする)以下である場合、そのブロックの全画素が同一色と判定するようにしても良い。
Next, the same
この同一色検出部3が解析部2内に設けられるとする理由は、先に説明した第1の画素群と第2の画素群に分類する際に、それが副次的にそれが判定できるからである。すなわち、全画素の画素値の最大値と最小値とを求め、その差が0又は許容範囲を示す閾値以下の場合に同一色と見なせば良い(後者の場合には上記平均値AVEを文字線画の代表値とすればよい)。
The reason that the same
また、同一色検出部3が、着目ブロック内の全画素が同一色であると判定した場合、解析部2から、第1の符号化部4、第2の符号化部5には、着目ブロックに対する符号化対象データは供給されない(すなわち、第1、第2の符号化部による着目ブロックの符号化は中止になる)。同一色検出部3が、着目ブロック内の全画素が同一色であると判定した場合の符号化データは、第3の符号化部6が生成することになる。
When the same
第1の符号化部4は、文字線画の代表色(8ビット)と識別情報(64個の識別データ=64ビット)を入力し、識別情報をランレングス符号化などの可逆符号化を行う。そして、文字線画代表色(8ビット)+識別情報のランレングス符号化データをバッファ7に出力する。
The first encoding unit 4 receives a representative color (8 bits) of character / line drawing and identification information (64 pieces of identification data = 64 bits), and performs lossless encoding such as run-length encoding on the identification information. Then, the run-length encoded data of the character / line drawing representative color (8 bits) + identification information is output to the
第2の符号化部5は、文字線画の画素値が非文字線画の画素値の平均値AVE1で置換されたブロックデータ、或いは、入力したブロックデータ(置換前のブロックデータ)を入力し、JPEG符号化(非可逆符号化)を行い、DC成分+AC成分の符号化データを生成し、バッファ8に出力する。高周波成分が無い、もしくは少ないわけであるから、高い圧縮率がえられるのは理解できよう。
The
第3の符号化部6は、同一色検出部3からの情報が、着目ブロックの全画素が同一色ではある場合に限って、その符号化データを生成し、バッファ9に出力する。第3の符号化部6が生成する符号化データのフォーマットは2種類ある。
The third encoding unit 6 generates the encoded data only when the information from the same
1つ目は、第1の符号化部4において全画素が文字線画に属すると見なされた場合に相当する符号化データ「文字線画の代表色を表わす画素値+エンドオフブロック示すEOB(End of Block)」の形式である。全画素が同じであるわけであるから、EOBは、ランが64であることを示す符号語と等価の意味を持つと言えば分かりやすい。基本的に、同一色検出部3からの同一色であるとして示された画素値に、予め記憶されたEOBの符号語を付加して出力するだけであり、画素値をスキャンする必要がない分だけ、その処理に要する時間は非常に短くできる。以下、このフォーマットの符号化データを第1の形式符号化データという。
The first is encoded data corresponding to the case where all the pixels are considered to belong to the character / line image in the first encoding unit 4 “pixel value representing the representative color of the character / line image + EOB (End of Block)”. Block) ”. Since all the pixels are the same, it is easy to understand that EOB has an equivalent meaning to a code word indicating that the run is 64. Basically, only the EOB code word stored in advance is added to the pixel value indicated as the same color from the same
符号化データの種類のもう1つは、第2の符号化部5が、全画素が同一色値を持つブロックを符号化した場合の符号化形式である「DC成分+AC成分の符号化データ」である。着目ブロック内の全画素が、同一色検出部3から同一色であるとされた色を表わす画素値を「DC成分」に当てはめる。AC成分は無い、もしくは合っても非常に少ないことが約束されているので、本実施形態ではEOB符号語を割り当てた。以下、このフォーマットの符号化データを第2の形式符号化データという。
Another type of encoded data is “DC component + AC component encoded data”, which is an encoding format when the
実施形態における、第3の符号化部6は、同一色検出部3から着目ブロックが同一色であることを通知を受けるたびに、上記の第1,第2の形式符号化データを切り替えて、生成する。
Each time the third encoding unit 6 in the embodiment receives notification from the same
多重化部10は、解析部2からの解析結果を受けて、バッファ7乃至9からの符号化データを組み合わせて、ブロックヘッダを先頭にした固定長Lのブロック符号化データを生成し、出力する。ここで多重化部10が生成する1ブロック分の符号化データの形式について説明する。なお、この固定長Lの下限は、文字線画の代表画素値を表わす8ビット+識別情報の最悪の符号長(ビット数)+第2の符号化部で生成されるDC成分の8ビットであり、これ以上であれば良く、その固定長はLはユーザが設定するものとする。固定長を示す情報は、ファイルヘッダに格納しておけば良い。
Upon receiving the analysis result from the
図2(A)乃至(D)は、本実施形態における多重化部10が生成する1ブロック分の固定長符号化データの種類を示している。ヘッダには、多重化したデータには、第1,第2の符号化部による符号化データの有無が示せれば良いので、それを示す2ビットを内包している。
2A to 2D show types of fixed-length encoded data for one block generated by the multiplexing
図2(A)は、同一色検出部3の検出結果も非同一色を示し、且つ、着目ブロック内に文字線画の画素が存在すると判定された場合の符号化データ形式を示している。図示の如くヘッダに後続して、バッファ7に格納された符号化データ、後続してバッファ8に格納された符号化データを配置する。なお、バッファ8に格納された全AC成分の符号化データが格納できない場合には、固定長Lを越えたビットは切り捨てる。この場合、不完全な符号語が、固定長の末端位置に存在する可能性があるが、復号化側では固定長Lを越える不完全な符号語があった場合にはそれ以降のAC成分値は“0”と見なして復号するので問題はない。また、全AC成分の符号化データを格納しても、未だ空き領域がある場合には適当なダミーデータを格納すれば良い。
FIG. 2A shows an encoded data format when it is determined that the detection result of the same
図2(B)は、同一色検出部3の検出結果も非同一色を示し、着目ブロック内に文字線画の画素が存在しないと判定された場合の符号化データ形式を示している。図示の如くヘッダに後続して、バッファ8に格納された符号化データを配置する。なお、固定長Lを越えたビットを切り捨てる点、固定長Lに満たない場合のダミービットを付加する点は図2(A)と同様である。
FIG. 2B shows the encoded data format when the detection result of the same
図2(C)、(D)は、同一色検出部3の検出結果が同一色を示した場合の符号化データ形式を示している。図示の如く、EOBの後にはダミーデータとして0を、固定長Lを満たす分だけ格納する。図2(C),(D)の符号化データを交互に切り替えるのは先に説明した通りである。ブロック内の全画素が同一色であるのは、たとえば通常の文字で構成される文書画像の上下左右の余白領域や行間部分を想像すると分かりやすい。かかる領域の場合、本実施形態によれば、図2(C)、(D)が交互に発生することになるので、ランレングス復号を行っている間、次のブロックについてJPEG復号処理を実行でき、2つの復号処理の並列実行ができる可能性を高めることができ、結果的に、復号処理を高速化できるようになる。
2C and 2D show the encoded data format when the detection result of the same
以上のような制御を行うことにより、同一色のブロックを符号化する場合には、第1、第2の符号化処理の終了を待つことなく第3の符号化処理によって高速に符号化を進めることができるので、同一色のブロックを多く含むような画像データの符号化において、高速に符号化を行うことができる。 By performing the control as described above, when the same color block is encoded, the encoding is advanced at a high speed by the third encoding process without waiting for the end of the first and second encoding processes. Therefore, it is possible to perform encoding at high speed in encoding of image data including many blocks of the same color.
[変形例の説明]
上述した第1の実施形態における画像符号化処理を、パーソナルコンピュータ等の情報処理装置は、その内部のプロセッサが実行されるコンピュータプログラムで実現する例を以下に説明する。なお、情報処理装置のハードウェアは一般的なもので良いので、ここでは詳述しない。ただし、符号化対象の画像データはハードディスク等の外部記憶装置にファイルとして格納されていて、符号化結果もその外部記憶装置に格納する例を説明する。ただし、符号化対象の画像データの発生源はネットワーク上のストレージでも良いし、イメージスキャナでも構わないし、符号化結果の出力先も可搬性の記憶媒体、ネットワーク上の媒体でも良く、その種類を問わない。
[Description of modification]
An example will be described below in which the image encoding process in the first embodiment described above is realized by a computer program in which an information processing apparatus such as a personal computer executes a processor therein. The hardware of the information processing apparatus may be general, and will not be described in detail here. However, an example will be described in which image data to be encoded is stored as a file in an external storage device such as a hard disk, and the encoding result is also stored in the external storage device. However, the source of the image data to be encoded may be a storage on the network or an image scanner, and the output destination of the encoding result may be a portable storage medium or a network medium. Absent.
S1にて復号処理が開始されると、S2にてプロセッサは1ブロック分の画像データを入力ファイルからRAM上にロードする。そして、S3にて、プロセッサは、RAM上のロードした着目ブロック分の画像データを解析して、第1の符号化および第2の符号化に必要なデータを抽出する。解析の詳細は第1の実施形態で説明したとおりである。次いで、S4にて、着目ブロックが同一色の画像データからなるブロックであるか判定する。同一色ブロックでない場合は、処理をS5に移す。また、同一色ブロックである場合は、処理をS8に移す。 When the decoding process is started in S1, the processor loads image data for one block from the input file onto the RAM in S2. In S3, the processor analyzes the image data of the loaded target block on the RAM, and extracts data necessary for the first encoding and the second encoding. Details of the analysis are as described in the first embodiment. Next, in S4, it is determined whether the target block is a block composed of the same color image data. If it is not the same color block, the process proceeds to S5. If they are the same color block, the process proceeds to S8.
S5では、第1の符号化を行う。この第1の符号化は上記第1の実施形態における第1の符号化部4と同じである。ただし、第1の符号化部4と同様に、着目ブロック内に文字線画の画素が存在しない場合には、符号化データは生成しない。S6では、第2の符号化を行う。この第2の符号化の詳細は第1の実施形態における第2の符号化部5と同様である。そして、S7にて、S5で生成された符号化データ(もしあれば)、S6で生成された符号化データを外部記憶装置に出力する。このときの符号化データのフォーマットは図2(A)、(B)のいずれかになる。
In S5, the first encoding is performed. This first encoding is the same as the first encoding unit 4 in the first embodiment. However, similarly to the first encoding unit 4, if there is no character / line drawing pixel in the block of interest, encoded data is not generated. In S6, the second encoding is performed. The details of the second encoding are the same as those of the
一方、S8に処理を移した場合には、第3の符号化を行う。この第3の符号化の詳細は第1の実施形態における第3の符号化部6と同様である。そして、S9に、符号化データを外部記憶装置に出力する。このときの符号化データのフォーマットは図2(C)、(D)のいずれかになる。 On the other hand, when the processing is shifted to S8, the third encoding is performed. The details of the third encoding are the same as those of the third encoding unit 6 in the first embodiment. In step S9, the encoded data is output to the external storage device. The format of the encoded data at this time is either one of FIGS. 2C and 2D.
S10にて、ファイルの全ての画像データを処理したかどうかを判定する。全ての画像データを処理していないと判断した場合には、S2以降の処理を繰り返す。また、全ての画像データの処理を終了した場合は、S11に移り、全ての符号化を終了する。 In S10, it is determined whether all the image data of the file has been processed. If it is determined that all the image data has not been processed, the processes in and after S2 are repeated. If all the image data has been processed, the process proceeds to S11, and all encoding is completed.
ステップ5、ステップ6を経由する第1および第2の符号化とステップ8の第3の符号化は、プログラムで実行する際の実行に要する時間が異なる。第1の実施形態で説明した通り、第1、第2の符号化は時間がかかるのと比較して、第3の符号化は短時間で終了する。また、第3の符号化は、第1、第2の符号化とは独立に処理できる。したがって、第1、第2の符号化をしている最中に第3の符号化を行うことができる。その場合、第3の符号化が第1、第2の符号化よりも先に処理が終了する場合がある。その場合は、先に、第3の符号化で処理された符号化データを外部記憶装置に出力する。本発明の符号化データは固定長の符号化データであるため、出力先の外部アドレスを予め知ることができる。入力されたブロックの外部記憶装置上のアドレスから出力先の外部記憶装置のアドレスを対応付けておくことで、入力と出力の順番が異なることがあっても間違いなく外部記憶装置に所定アドレスに符号化データを出力することが可能になる。
The time required for execution of the first and second encodings via
以上のような制御を行うことにより、コンピュータプログラムでもって実現する場合であっても、第1の実施形態と同様の作用効果を奏することができる。 By performing the control as described above, the same operational effects as those of the first embodiment can be obtained even when implemented by a computer program.
[第2の実施形態]
本第2の実施形態では、復号側における第1の形式符号化データ、第2の形式符号化データの復号リソースを、より効率良く利用できる符号化データを生成する例を説明する。具体的には、復号処理がランレングス復号処理とJPEG復号処理の一方に偏ったものとなるのを抑制するものである。
[Second Embodiment]
In the second embodiment, an example will be described in which encoded data that can efficiently use the decoding resources of the first format encoded data and the second format encoded data on the decoding side is described. Specifically, the decoding process is prevented from being biased to one of the run-length decoding process and the JPEG decoding process.
図3に、第2の実施形態の画像符号化装置の構成図を示す。第1の実施形態と同様の動作をする処理部については同じ番号を付して、その説明は省略する。本第2の実施形態に特有の動作を行う処理部の説明を行う。 FIG. 3 shows a configuration diagram of an image encoding device according to the second embodiment. The processing units that perform the same operations as those in the first embodiment are denoted by the same reference numerals, and description thereof is omitted. A processing unit that performs operations peculiar to the second embodiment will be described.
第3の符号化部24は、同一色検出部3で同一色と検出されたブロックを符号化する符号化部である。第3の符号化部24は、第1の形式符号化データ(文字線画の代表画素値+EOB)を生成する。つまり、図2(C)に示すフォーマットの符号化データを生成する。
The
第4の符号化部25は、同一色検出部3で同一色と検出されたブロックを符号化する符号化部である。第4の符号化部25は、第2の形式符号化データ(DC成分値+EOB)を生成する。つまり、図2(D)に示すフォーマットの符号化データを生成する。
The
比較部23は、内部に2つのレジスタ(もしくはカウンタ)を持ち、符号化処理開始時にゼロクリアされる。そして、一方のレジスタはバッファ7に符号化データが出力された回数を計数するために用いられ、もう一方のレジスタはバッファ8に符号化データが出力された回数を計数するために用いられる。なお、着目ブロックに、文字線画画素が存在するものとした場合、その着目ブロックからはバッファ7、8の両方に符号化データが格納されるので、それぞれのレジスタが“1”だけカウントアップされる。また、着目ブロック内に文字線画の画素が存在しないものの、同一色でもない場合、着目ブロックは第2の符号化部5による符号化データのみがバッファ8に格納されるので、バッファ8への符号化データの出力回数のみがカウントアップされる。
The
比較部23は、上記のようにして、画像の符号化開始時から現在までの第1の符号化部4の符号化データの出力回数をN1、第2の符号化部5による符号化データの出力回数をN2としたとき、
条件:N1≦f(N2)
を満たすか否かを判定し、この条件を満たす場合には、“0”、それ以外の場合には“1”の制御信号を選択部26に出力する。なお、一般に、JPEG符号化、復号ではDCT変換(マトリクス演算)に多くの演算量が費やされる。一方、ランレングス符号化、復号にかかる処理はDCT処理ほど、重い処理ではない。上記の関数f()は、この演算量の重みを相殺するための関数である。簡単には、予め設定した係数Rを定義し、次の条件で判断すれば良い。
条件:N1<R×N2
As described above, the
Condition: N1 ≦ f (N2)
If the condition is satisfied, a control signal of “0” is output to the
Condition: N1 <R × N2
選択部26は、第3の符号化部24あるいは第4の符号化部25の符号化データのいずれをバッファ27に出力するかを選択する。この選択は、比較部23からの制御信号に基づいて決定される。すなわち、比較部23の制御信号が“0”の場合は、第3の符号化部24の符号化データをバッファ27に出力し、“1”の場合は、第4の符号化部の符号化データをバッファ27に出力する。このように動作することで、同一色のブロックが入力された場合は、バッファ7、8への出力回数の少ない方のフォーマットの符号化データがバッファ27に格納されることになる。この結果、ランレングス復号とJPEG復号が並列に実行できる復号装置では、いずれか一方に復号対象の符号化データが偏って供給されることを抑制、換言すれば、それら復号処理のためのリソースを効率良く稼働でき、結果、復号処理を高速化することができる。
The
なお、上記では、比較部23には、内部に2つのレジスタ(もしくはカウンタ)を持ちそれぞれはバッファ7に符号化データが出力された回数を保持するためとして説明したがこれに限定されない。例えば、バッファ7、8をFIFOメモリとし、usedwordをモニタすることによりそれぞれの占有率を比較する。たとえば、usedwordを単純比較して、usedwordが小さい方を占有率が低いと判断する。または、FIFOフルの容量が異なるFIFOであれば、usedwordの空きワード数を比較して、空きワード数が多い方を占有率が低いと判断する。あるいは、usedwordをFIFOフル容量のusedwordで割って(文字通り占有率を計算して)、値が小さい方を占有率が低いと判断する。このようにして、比較部23は、バッファ7、8の占有率の比較し、バッファ7の占有率がバッファ8のそれより小さい場合に0を出力し、それ以外の場合に1を出力しても構わない。
In the above description, the
(その他の実施例)
また、本発明は、以下の処理を実行することによっても実現される。即ち、上述した実施形態の機能を実現するソフトウェア(プログラム)を、ネットワーク又は各種記憶媒体を介してシステム或いは装置に供給し、そのシステム或いは装置のコンピュータ(またはCPUやMPU等)がプログラムを読み出して実行する処理である。
(Other examples)
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 (9)
符号化対象の画像から、複数画素で構成されるブロックを入力する入力手段と、
入力した着目ブロック内の各画素の画素値を解析し、前記着目ブロック内に文字線画に属する画素があるか否かを判定する解析手段と、
該解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合には文字線画の代表画素値と、各画素毎に文字線画に属するか非文字線画に属するかを示す識別情報を生成する生成する生成手段と、
該生成手段で生成した文字線画の代表画素値と識別情報を可逆符号化し、第1の形式の符号化データを生成する第1の符号化手段と、
前記解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合、非文字線画に属する画素の平均画素値で、文字線画に属する画素の画素値を置換して、非文字線画の画素で構成されるブロックを生成する置換手段と、
前記解析手段が前記着目ブロック内に文字線画に属する画素があると判定した場合には前記置換手段で得られたブロックを、前記解析手段が前記着目ブロック内に文字線画に属する画素がないと判定した場合には前記置換手段による置換前のブロックを非可逆符号化し、第2の形式の符号化データを生成する第2の符号化手段と、
前記第1の符号化手段、及び、前記第2の符号化手段で生成された符号化データを多重化すると共に、ブロックヘッダには前記第1の形式の符号化データの有無、前記第2の形式の符号化データの有無を示す情報を格納した固定長のブロック符号化データを生成し、出力する多重化手段とを備え、更に、
前記入力手段で入力した前記着目ブロックの全画素の画素値が表わす色が互いに同じであるか否かを判定する判定手段と、
該判定手段が前記着目ブロックの全画素が同じ色を持つと判定した場合、前記第1の符号化手段及び前記第2の符号化手段による前記着目ブロックに対する符号化を中止し、予め記憶された全画素が同じ色とする前記第1,第2の形式の符号化データと前記着目ブロックの画素値とから、前記第1の形式の符号化データ、又は、前記第2の形式符号化データのいずれか一方を生成する第3の符号化手段とを有し、
前記多重化手段は、該判定手段が前記着目ブロックの全画素が同じ色を持つと判定した場合、前記第3の符号化手段より得られた符号化データを、前記着目ブロックの符号化データとして出力することを特徴とする画像符号化装置。 An image encoding device for encoding image data,
Input means for inputting a block composed of a plurality of pixels from an image to be encoded;
Analyzing means for analyzing a pixel value of each pixel in the input target block and determining whether or not there is a pixel belonging to the character line image in the target block;
If the analysis means determines that there are pixels belonging to the character line drawing in the block of interest, the representative pixel value of the character line drawing and identification information indicating whether each pixel belongs to the character line drawing or non-character line drawing Generating means for generating; and
First encoding means for losslessly encoding the representative pixel values and identification information of the character / line image generated by the generating means to generate encoded data of the first format;
When the analysis unit determines that there is a pixel belonging to the character / line drawing in the target block, the pixel value of the pixel belonging to the character / line drawing is replaced with the average pixel value of the pixel belonging to the non-character / line drawing. Replacement means for generating a block composed of pixels;
When the analyzing unit determines that there is a pixel belonging to the character line image in the target block, the analyzing unit determines that there is no pixel belonging to the character line image in the target block. In such a case, the second encoding means for irreversibly encoding the block before replacement by the replacement means and generating encoded data of the second format;
The encoded data generated by the first encoding unit and the second encoding unit are multiplexed, and the presence or absence of the encoded data of the first format in the block header, the second Multiplex means for generating and outputting fixed-length block encoded data storing information indicating the presence or absence of encoded data in a format;
Determining means for determining whether or not colors represented by pixel values of all pixels of the block of interest input by the input means are the same;
When the determination means determines that all pixels of the block of interest have the same color, the encoding of the block of interest by the first encoding means and the second encoding means is stopped and stored in advance. From the encoded data of the first and second formats in which all pixels have the same color and the pixel value of the block of interest, the encoded data of the first format or the encoded data of the second format Third encoding means for generating any one of them,
When the determining unit determines that all pixels of the target block have the same color, the multiplexing unit uses the encoded data obtained from the third encoding unit as the encoded data of the target block. An image encoding apparatus that outputs the image.
前記着目ブロック内に全画素の平均画素値AVEを算出し、
算出した前記平均画素値AVEを越える画素値を持つ第1の画素群と、前記平均画素値AVE以下の画素値を持つ第2の画素群に分類し、
第1の画素群に属する画素の平均画素値AVE1と第2の画素群に属する画素の平均画素値AVE2との差が、予め設定された閾値を越える場合、前記着目ブロックには文字線画が存在すると判定し、前記予め設定された閾値を越えない場合には前記着目ブロックには文字線画が存在しないと判定し、
前記解析手段は、前記画素値が輝度を示す場合では、前記平均画素値AVE2を文字線画に属する代表画素値として決定し、前記画素値が濃度を示す場合では、前記平均画素値AVE1を文字線画に属する代表画素値として決定することを特徴とする請求項1に記載の画像符号化装置。 The analysis means includes
An average pixel value AVE of all pixels is calculated in the target block,
Classifying into a first pixel group having a pixel value exceeding the calculated average pixel value AVE and a second pixel group having a pixel value less than or equal to the average pixel value AVE;
When the difference between the average pixel value AVE1 of the pixels belonging to the first pixel group and the average pixel value AVE2 of the pixels belonging to the second pixel group exceeds a preset threshold, there is a character / line image in the block of interest. If it does not exceed the preset threshold, it is determined that there is no character line drawing in the block of interest,
The analysis means determines the average pixel value AVE2 as a representative pixel value belonging to a character line image when the pixel value indicates luminance, and determines the average pixel value AVE1 as a character line image when the pixel value indicates density. The image encoding device according to claim 1, wherein the image encoding device is determined as a representative pixel value belonging to the image data.
該計数手段で計数したN1、N2と、予め設定した重み関数f()とが、
条件:N1<f(N2)
を満たす場合、前記第3の符号化手段は前記第1の形式の符号化データを生成し、前記条件を満たさない場合には前記第2の形式の符号化データを生成することを特徴とする請求項1又は2に記載の画像符号化装置。 Further, a counting means for counting N1 of the number of times that the encoded data is generated by the first encoding means, and N2 of the number of times that the encoded data is generated by the second encoding means,
N1 and N2 counted by the counting means and a preset weight function f () are:
Condition: N1 <f (N2)
The third encoding means generates encoded data of the first format when the condition is satisfied, and generates encoded data of the second format when the condition is not satisfied. The image coding apparatus according to claim 1 or 2.
入力手段が、符号化対象の画像から、複数画素で構成されるブロックを入力する入力工程と、
解析手段が、入力した着目ブロック内の各画素の画素値を解析し、前記着目ブロック内に文字線画に属する画素があるか否かを判定する解析工程と、
生成手段が、該解析工程が前記着目ブロック内に文字線画に属する画素があると判定した場合には文字線画の代表画素値と、各画素毎に文字線画に属するか非文字線画に属するかを示す識別情報を生成する生成する生成工程と、
第1の符号化手段が、該生成工程で生成した文字線画の代表画素値と識別情報を可逆符号化し、第1の形式の符号化データを生成する第1の符号化工程と、
置換手段が、前記解析工程が前記着目ブロック内に文字線画に属する画素があると判定した場合、非文字線画に属する画素の平均画素値で、文字線画に属する画素の画素値を置換して、非文字線画の画素で構成されるブロックを生成する置換工程と、
第2の符号化手段が、前記解析工程が前記着目ブロック内に文字線画に属する画素があると判定した場合には前記置換工程で得られたブロックを、前記解析工程が前記着目ブロック内に文字線画に属する画素がないと判定した場合には前記置換工程による置換前のブロックを非可逆符号化し、第2の形式の符号化データを生成する第2の符号化工程と、
多重化手段が、前記第1の符号化工程、及び、前記第2の符号化工程で生成された符号化データを多重化すると共に、ブロックヘッダには前記第1の形式の符号化データの有無、前記第2の形式の符号化データの有無を示す情報を格納した固定長のブロック符号化データを生成し、出力する多重化工程とを有し、更に、
判定手段が、前記入力工程で入力した前記着目ブロックの全画素の画素値が表わす色が互いに同じであるか否かを判定する判定工程と、
第3の符号化手段が、該判定工程で前記着目ブロックの全画素が同じ色を持つと判定した場合、前記第1の符号化工程及び前記第2の符号化工程による前記着目ブロックに対する符号化を中止し、予め記憶された全画素が同じ色とする前記第1,第2の形式の符号化データと前記着目ブロックの画素値とから、前記第1の形式の符号化データ、又は、前記第2の形式符号化データのいずれか一方を生成する第3の符号化工程とを有し、
前記多重化工程では、該判定工程で前記着目ブロックの全画素が同じ色を持つと判定した場合、前記第3の符号化工程より得られた符号化データを、前記着目ブロックの符号化データとして出力することを特徴とする画像符号化装置の制御方法。 A control method for an image encoding device for encoding image data, comprising:
An input step in which an input means inputs a block composed of a plurality of pixels from an image to be encoded;
An analyzing step of analyzing a pixel value of each pixel in the input target block and determining whether or not there is a pixel belonging to the character line image in the target block;
When the generating unit determines that the analysis step includes a pixel belonging to the character line drawing in the target block, the representative pixel value of the character line drawing and whether each pixel belongs to the character line drawing or the non-character line drawing are determined. A generating step for generating identification information to indicate;
A first encoding step, wherein the first encoding means losslessly encodes the representative pixel value and identification information of the character / line drawing generated in the generation step, and generates encoded data of the first format;
When the analyzing unit determines that the pixel belonging to the character line drawing is in the target block, the pixel value of the pixel belonging to the character line drawing is replaced with the average pixel value of the pixels belonging to the non-character line drawing, A replacement step for generating a block composed of non-character line drawing pixels;
When the second encoding means determines that the analysis step includes a pixel belonging to the character / line image in the target block, the analysis step uses the block obtained in the replacement step as the character in the target block. A second encoding step of irreversibly encoding the block before replacement by the replacement step when it is determined that there is no pixel belonging to the line drawing, and generating encoded data of the second format;
The multiplexing means multiplexes the encoded data generated in the first encoding step and the second encoding step, and the presence or absence of the encoded data of the first format in the block header And a multiplexing step for generating and outputting fixed-length block encoded data storing information indicating the presence or absence of encoded data in the second format, and
A determining step for determining whether or not the colors represented by the pixel values of all the pixels of the block of interest input in the input step are the same;
When the third encoding means determines that all pixels of the block of interest have the same color in the determination step, the encoding of the block of interest by the first encoding step and the second encoding step From the encoded data of the first and second formats and the pixel value of the block of interest, in which all pixels stored in advance have the same color, or the encoded data of the first format, or the A third encoding step for generating any one of the second format encoded data,
In the multiplexing step, when it is determined in the determination step that all pixels of the target block have the same color, the encoded data obtained from the third encoding step is used as the encoded data of the target block. A control method for an image encoding device, characterized by:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010242652A JP2012095228A (en) | 2010-10-28 | 2010-10-28 | Image encoding device and control method thereof, and program and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010242652A JP2012095228A (en) | 2010-10-28 | 2010-10-28 | Image encoding device and control method thereof, and program and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2012095228A true JP2012095228A (en) | 2012-05-17 |
Family
ID=46388065
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010242652A Withdrawn JP2012095228A (en) | 2010-10-28 | 2010-10-28 | Image encoding device and control method thereof, and program and storage medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2012095228A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019098092A1 (en) * | 2017-11-15 | 2019-05-23 | パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ | Encoding device, decoding device, encoding method, and decoding method |
-
2010
- 2010-10-28 JP JP2010242652A patent/JP2012095228A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019098092A1 (en) * | 2017-11-15 | 2019-05-23 | パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ | Encoding device, decoding device, encoding method, and decoding method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7826670B2 (en) | Data compression apparatus and data compression program storage medium | |
JP4689545B2 (en) | Data compression apparatus and data compression program | |
US20050249283A1 (en) | Image coding apparatus and image decoding apparatus and their control methods, and computer program and computer-readable storage medium | |
US8213727B2 (en) | Image encoding apparatus and image decoding apparatus, and control method thereof | |
JP2008042687A (en) | Image processing apparatus and its control method, computer program and computer readable storage medium | |
US20080037883A1 (en) | Image encoding apparatus and image decoding apparatus | |
JP4956304B2 (en) | Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium | |
US20100118947A1 (en) | Decoder for selectively decoding predetermined data units from a coded bit stream | |
US20090263011A1 (en) | Detection Technique for Digitally Altered Images | |
JP2008072624A (en) | Image encoding device and its control method | |
JP5101962B2 (en) | Image coding apparatus, control method therefor, and computer program | |
US20210160516A1 (en) | Data rate control method, computer system, and device | |
US8023756B2 (en) | Image encoding apparatus and method of controlling same | |
JP4649237B2 (en) | Image compression apparatus, image compression method, and image compression program | |
JP2012095228A (en) | Image encoding device and control method thereof, and program and storage medium | |
JP4521835B2 (en) | Image processing device | |
JP2014090416A (en) | Video detector and method for detecting black frames | |
JP5757904B2 (en) | Image compression device | |
JP2012151573A (en) | Image decoder and control method thereof | |
JP5086777B2 (en) | Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium | |
JP4971881B2 (en) | Image encoding apparatus, image decoding apparatus, and control method thereof | |
JP2005277932A (en) | Device and program for compressing data | |
JP4579793B2 (en) | Data compression apparatus and data compression program | |
JP2016208153A (en) | Encoding device and encoding method | |
JP2009111821A (en) | Image encoding apparatus, image decoding apparatus, image data processing apparatus, image encoding method, and image decoding method |
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: 20140107 |