JPH089165A - Binary image encoding device and binary image decoding device - Google Patents

Binary image encoding device and binary image decoding device

Info

Publication number
JPH089165A
JPH089165A JP14009494A JP14009494A JPH089165A JP H089165 A JPH089165 A JP H089165A JP 14009494 A JP14009494 A JP 14009494A JP 14009494 A JP14009494 A JP 14009494A JP H089165 A JPH089165 A JP H089165A
Authority
JP
Japan
Prior art keywords
prime
pixel
appearances
sequence
probability
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP14009494A
Other languages
Japanese (ja)
Other versions
JP3084187B2 (en
Inventor
Hironori Takeda
裕紀 武田
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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP06140094A priority Critical patent/JP3084187B2/en
Publication of JPH089165A publication Critical patent/JPH089165A/en
Application granted granted Critical
Publication of JP3084187B2 publication Critical patent/JP3084187B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Image Processing (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

(57)【要約】 【目的】 シンボルの出現確率に応じた正確なオージェ
ンドを設定することで高い符号化効率をえる。 【構成】 符号化はラインメモリに読み込まれた2値画
像データからテンプレートをもとに画素を抽出し、コン
テクストと符号化注目画素の値を得る。コンテクスト及
び符号化注目画素のカウント数からシンボル出現確率を
求め、それらを素数変換テーブルによって素数の積に変
換する。オージェンドを素数の積で表し、オージェンド
更新時には各べき数同士を加算する。出現確率劣勢シン
ボル出現時に、オージェンドの下界値を求め符号を生成
する。復号化は、ラインメモリに読み込まれた、それま
でに復号化された復号化データからテンプレートをもと
に画素を抽出し、コンテクストを得る。出現確率劣勢シ
ンボル出現時の符号ヲ参照用に生成して符号化データと
比較することで復号化シンボルが優勢シンボルか劣勢シ
ンボルかを判定し復号化する。
(57) [Summary] [Purpose] High encoding efficiency is obtained by setting an accurate augend according to the probability of symbol appearance. [Structure] In encoding, pixels are extracted from binary image data read into a line memory based on a template, and the values of a context and an encoded pixel of interest are obtained. Symbol appearance probabilities are obtained from the context and the count number of the coded pixel of interest, and they are converted into products of prime numbers by the prime number conversion table. The augend is expressed by the product of prime numbers, and each exponent is added when updating the augend. When the appearance probability inferior symbol appears, the lower bound value of the augend is obtained and a code is generated. In the decoding, pixels are extracted from the decoded data that has been read in the line memory and has been decoded so far, based on the template, and the context is obtained. A code at the time of appearance probability inferior symbol appearance is generated for reference and compared with encoded data to determine whether the decoded symbol is a dominant symbol or an inferior symbol, and to decode it.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、算術符号を応用して2
値画像データを符号化/復号化する2値画像符号化/復
号化装置に関する。
BACKGROUND OF THE INVENTION The present invention applies an arithmetic code to
The present invention relates to a binary image encoding / decoding device that encodes / decodes value image data.

【0002】[0002]

【従来の技術】2値画像データの符号化方式はファクシ
ミリ用に広く利用されてきている。これらの符号化方式
には、画像を上から下へ逐次的(以下シーケンシャルと
称す)に符号化、伝送するもの、あるいは階層的(以下
プログレッシブと称す)な符号化、伝送が可能なものが
ある。前者には、MH(Modifid Huffman)、MR、MM
R方式があり、後者にはJBIG方式がある。後者は、
新しい画像通信サービスである画像データベース検索、
オーディオグラフィクコンファレンスなど、利用者の目
の前のディスプレイを利用して情報を表示するソフトコ
ピー通信に適した符号化方式である。これらの符号化方
式に用いられている符号は、ともにエントロピー符号化
と呼ばれるものであり、可逆符号化の性質を持ってい
る。MH、MR、MMR方式ではハフマン符号、JBI
G方式では算術符号が用いられている。算術符号は非ブ
ロック符号であるため、ハフマン符号に比べてより高い
圧縮性能が期待できる。
2. Description of the Related Art Binary image data encoding methods have been widely used for facsimiles. Among these encoding methods, there are those that sequentially encode (hereinafter referred to as “sequential”) and transmit images from top to bottom, or those that enable hierarchical (hereinafter referred to as “progressive”) encoding and transmission. . For the former, MH (Modifid Huffman), MR, MM
There is an R system, and the latter has a JBIG system. The latter is
Image database search, a new image communication service
It is an encoding method suitable for soft copy communication in which information is displayed using a display in front of the user, such as an audio graphics conference. The codes used in these coding methods are both called entropy coding and have the property of lossless coding. Huffman code, JBI in MH, MR and MMR systems
An arithmetic code is used in the G method. Since the arithmetic code is a non-block code, higher compression performance can be expected as compared with the Huffman code.

【0003】以下、従来の算術符号を応用した2値画像
データの符号化方式の例として、JBIG方式の算術符
号について図面を用いて説明する。
As an example of a binary image data encoding system to which a conventional arithmetic code is applied, a JBIG type arithmetic code will be described below with reference to the drawings.

【0004】JBIG方式の算術符号化は、QMコーダ
と呼ばれる。QMコーダでは、オージェンドの演算が減
算のみで実行される固定領域割り当て型(減算型)算術
符号が用いられている。減算型算術符号は、算術符号に
比べて符号化効率が低下するものの符号、復号器が簡易
であるというメリットがある。JBIG方式では、シー
ケンシャル、プログレッシブ両方の符号化に対応するた
めに2値画像データをストライプで分割して符号化処理
する。図22はストライプについて示している。この図
22において、101は2値画像データを表している。
また、102、103、104はストライプを表してい
る。復号器側では最低1ストライプ分のメモリバッファ
を用意することでシーケンシャルな復号化にも対応でき
る。図23はJBIG方式のエンコーダの機能ブロック
図を示している。エンコーダは、この図23の201、
202で表される解像度縮小による差分階層(レイヤ)
のエンコード処理と203で表される最低解像度レイヤ
のエンコード処理で構成される。
The JBIG arithmetic coding is called a QM coder. In the QM coder, a fixed area allocation type (subtraction type) arithmetic code in which the augend operation is executed only by subtraction is used. Although the subtraction type arithmetic code has lower coding efficiency than the arithmetic code, it has an advantage that the code and the decoder are simple. In the JBIG method, binary image data is divided into stripes for encoding processing in order to support both sequential and progressive encoding. FIG. 22 shows a stripe. In FIG. 22, reference numeral 101 represents binary image data.
Further, 102, 103 and 104 represent stripes. Sequential decoding can be supported by preparing a memory buffer for at least one stripe on the decoder side. FIG. 23 shows a functional block diagram of a JBIG encoder. The encoder is 201 in FIG.
Difference hierarchy (layer) due to resolution reduction represented by 202
And the encoding process of the lowest resolution layer represented by 203.

【0005】図24は縮小解像度レイヤのエンコード処
理の機能ブロック図を示している。この図24におい
て、301は解像度縮小処理を行うブロックである。ま
た、302、303はTypical Predict
ion(以下TPと称す)、Determ−inist
ic Prediction(以下DPと称す)と呼ば
れるもので、ともに後述する算術符号化の対象画素数を
減少させる方式である。TPが行われたならばTPVA
LUEは0または1が出力され、そうでないならば2ま
たは3が出力される。またDPが行われたならばDPV
ALUEは0または1が出力され、そうでないならば2
または3が出力される。また、この図24において、3
04はAdaptive Templates(以下A
Tと称す)と呼ばれるもので、後述するモデルテンプレ
ートのAT画素を、より相関の大きい位置の画素と入れ
換える。また、305はモデルテンプレートである。モ
デルテンプレートではテンプレートの画素によるビット
パターン(以下コンテクストと称す)の抽出を行う。3
06はQMコーダであり、適応的算術符号化を行う。図
25は最低解像度レイヤのエンコード処理の機能ブロッ
ク図を示している。この図25において、401はTy
pical Prediction(TP)である。ま
た、402はAdaptive Templates
(AT)、403はモデルテンプレート、404はQM
コーダである。
FIG. 24 shows a functional block diagram of encoding processing of a reduced resolution layer. In FIG. 24, reference numeral 301 is a block for performing resolution reduction processing. In addition, 302 and 303 are Physical Predict
Ion (hereinafter referred to as TP), Determ-inist
It is called ic Prediction (hereinafter referred to as DP), and is a method for reducing the number of target pixels for arithmetic coding, which will be described later. TPVA if TP is performed
LUE outputs 0 or 1, and otherwise outputs 2 or 3. If DP is done, DPV
ALUE outputs 0 or 1, otherwise 2
Or 3 is output. In addition, in FIG.
04 is Adaptive Templates (hereinafter A
This is referred to as T), and the AT pixel of the model template, which will be described later, is replaced with the pixel at a position having a greater correlation. 305 is a model template. In the model template, a bit pattern (hereinafter referred to as “context”) is extracted by the pixels of the template. Three
Reference numeral 06 is a QM coder, which performs adaptive arithmetic coding. FIG. 25 shows a functional block diagram of the encoding process of the lowest resolution layer. In FIG. 25, 401 is Ty
It is a physical prediction (TP). Also, 402 is Adaptive Templates.
(AT), 403 is a model template, 404 is QM
It is a coder.

【0006】図26はJBIG方式で用いられるモデル
テンプレートの一例である。モデルテンプレートとは、
符号化のために必要な符号化注目画素PIXおよびその
周囲の特定範囲の画素の抽出範囲のことである。この図
26の501の位置にある画素が符号化注目画素を表し
ている。また、この図26の502で表される符号化注
目画素の周囲の画素の“0”“1”の組み合わせを数値
化したものをコンテクストCXと呼ぶ。図27はJBI
G方式のエンコーダのフローダイアグラムを示してい
る。ステップ1では初期化処理を行う。ステップ2で
は、符号化注目画素PIX、コンテクストCX、TPV
ALUE、DPVALUEを読み込む。ステップ3の条
件分岐では、TPVALUE≠2or3またはDPVA
LUE≠2or3ならばステップ5に行き、そうでない
ならばステップ4に行く。ステップ4ではENCODE
処理を行う。ステップ5の条件分岐ではストライプが終
了した場合はステップ6に、そうでない場合はステップ
2に行く。ステップ6ではFLUSH処理を行う。 図
28はJBIG方式で使用するオージェンドレジスタ
(以下Aレジスタと称す)と符号レジスタ(以下Cレジ
スタと称す)の構造を示している。Aレジスタにおける
aビットが確率幅を表すビット(17ビット)である。
また、Cレジスタにおけるxビット(16ビット)は未
完成の符号が入るビットである。bビット(8ビット)
が完成した符号が8ビット単位で取り出される位置を表
している。 コンテクストをもとに符号化注目画素のシ
ンボル“0”“1”を予測した場合に出現確率が大きい
シンボルを優勢シンボルMPS、出現確率が小さいシン
ボルを劣性シンボルLPSと呼ぶ。また各コンテクスト
は符号化注目画素がMPSかLPSかにより確率状態
(ステータスST)が遷移する。各コンテクストCXに
対応したMPS(1ビット)とステータスST(7ビッ
ト)の値はメモリ等に格納される。
FIG. 26 shows an example of a model template used in the JBIG method. What is a model template?
This is the extraction range of the coded pixel of interest PIX necessary for coding and the pixels in a specific range around it. The pixel at the position 501 in FIG. 26 represents the coded pixel of interest. Further, a numerical representation of a combination of "0" and "1" of pixels around the coded pixel of interest represented by 502 in FIG. 26 is called a context CX. Figure 27 is JBI
7 shows a flow diagram of a G-type encoder. In step 1, initialization processing is performed. In Step 2, the coded pixel of interest PIX, context CX, TPV
Read ALUE and DPVALUE. In the conditional branch of step 3, TPVALUE ≠ 2or3 or DPVA
If LUE ≠ 2 or 3, go to step 5, otherwise go to step 4. ENCODE in step 4
Perform processing. In the conditional branch of step 5, if the stripe is completed, go to step 6; otherwise, go to step 2. In step 6, FLUSH processing is performed. FIG. 28 shows the structure of an augend register (hereinafter referred to as A register) and a code register (hereinafter referred to as C register) used in the JBIG method. The a bit in the A register is a bit (17 bits) representing the probability width.
The x bit (16 bits) in the C register is a bit in which an unfinished code is placed. b bit (8 bits)
Represents the position where the completed code is extracted in 8-bit units. When the symbols “0” and “1” of the coded pixel of interest are predicted based on the context, a symbol having a high appearance probability is called a dominant symbol MPS, and a symbol having a low appearance probability is called a recessive symbol LPS. Further, the probability state (status ST) of each context transits depending on whether the coded pixel of interest is MPS or LPS. The values of MPS (1 bit) and status ST (7 bits) corresponding to each context CX are stored in a memory or the like.

【0007】図29は確率推定テーブルを示している。
LSZは各ステータスSTに対応する劣性シンボル出現
確率、NLPSはLPSが出現した時の次のSTの値、
NMPSはMPSが出現した時の次のSTの値、SWT
CHはMPSが反転するかどうかを表している。図30
はENCODE処理のフローダイアグラムである。ステ
ップ1の条件分岐では、符号化注目画素PIXとコンテ
クストに対応する優勢シンボルMPSの値が同じならば
ステップ3に、そうでない場合は、ステップ2に行く。
ステップ2ではCODELPS処理を行う。ステップ3
ではCODEMPS処理を行う。図31はCODELP
S処理のフローダイアグラムを示している。A、Cはそ
れぞれAレジスタ、Cレジスタの値を表している。ステ
ップ1ではA=A−LSZを行う。ステップ2の条件分
岐では、A<LSZならばステップ4に行き、そうでな
いならばステップ3に行く。ステップ3では、C=C+
A、A=LSZを行う。ステップ4の条件分岐では、S
WTCH=1ならばステップ6に行き、そうでないなら
ばステップ5に行く。ステップ5では、MPS=1−M
PSを行う。ステップ6では、ST=NLPSを行い、
RENORME処理を行う。
FIG. 29 shows a probability estimation table.
LSZ is the recessive symbol appearance probability corresponding to each status ST, NLPS is the value of the next ST when the LPS appears,
NMPS is the value of the next ST when MPS appears, SWT
CH represents whether MPS is inverted. Figure 30
Is a flow diagram of the ENCODE process. In the conditional branch of step 1, if the coded pixel of interest PIX and the value of the dominant symbol MPS corresponding to the context are the same, the process proceeds to step 3, and if not, the process proceeds to step 2.
In step 2, CODELPS processing is performed. Step 3
Then, CODEMPS processing is performed. Figure 31 is CODELP
The flow diagram of S processing is shown. A and C represent the values of the A register and the C register, respectively. In step 1, A = A-LSZ is performed. In the conditional branch of step 2, if A <LSZ, go to step 4, and if not, go to step 3. In step 3, C = C +
A, A = LSZ is performed. In the conditional branch of step 4, S
If WTCH = 1, go to step 6, otherwise go to step 5. In step 5, MPS = 1-M
Perform PS. In step 6, ST = NLPS is performed,
Perform RENORME processing.

【0008】図32はCODEMPS処理のフローダイ
アグラムを示している。ステップ1ではA=A−LSZ
を行う。ステップ2の条件分岐では、A<0x8000
ならばステップ3に行き、そうでないならば処理を終了
する。ステップ3の条件分岐では、A<LSZならばス
テップ4に行き、そうでないならばステップ5に行く。
ステップ4では、C=C+A、A=LSZを行う。ステ
ップ5では、ST=NMPSを行い、RENORME処
理を行う。図33はRENORME処理のフローダイア
グラムを示している。ステップ1では、A=A<<1
(左に1ビットシフト)、C=C<<1、CT=CT−
1を行う。ステップ2の条件分岐では、CT=0ならば
ステップ4に行き、そうでないならばステップ3に行
く。ステップ3ではBYTEOUT処理を行う。ステッ
プ4の条件分岐では、A<0x8000ならばステップ
1に行き、そうでないならば処理を終了する。
FIG. 32 shows a flow diagram of the CODEMPS process. In step 1, A = A-LSZ
I do. In the conditional branch of step 2, A <0x8000
If so, go to step 3, and if not, end the process. In the conditional branch of step 3, if A <LSZ, go to step 4, and if not, go to step 5.
In step 4, C = C + A and A = LSZ are performed. In step 5, ST = NMPS is performed, and RENORME processing is performed. FIG. 33 shows a flow diagram of the RENORME process. In step 1, A = A << 1
(Shift 1 bit to the left), C = C << 1, CT = CT-
Do 1. In the conditional branch of step 2, if CT = 0, go to step 4, and if not, go to step 3. In step 3, BYTEOUT processing is performed. In the conditional branch of step 4, if A <0x8000, go to step 1; otherwise, end the process.

【0009】図34はBYTEOUT処理のフローダイ
アグラムを示している。ステップ1では、TEMP=C
>>19(右に19ビットシフト)を行う。ステップ2
の条件分岐では、TEMP=0xffならばステップ3
に行き、そうでなければステップ4に行く。ステップ3
では、BUFFER=BUFFER+1を行い、BUF
FERを出力し、0x00をSC回出力し、SC=0、
BUFFER=TEMP&0xffを行う。ステップ4
の条件分岐では、TEMP=0xffならばステップ5
に行き、そうでないならばステップ6に行く。ステップ
5ではSC=SC+1を行う。ステップ6ではBUFF
ERを出力し、0xffをSC回出力し、SC=0、B
UFFER=TEMPを行う。ステップ7では、C=C
&0x7ffff、CT=8を行う。図35はINIT
ENC処理のフローダイアグラムを示している。ステッ
プ1の条件分岐では、現在のレイヤの最初のストライプ
またはリセット直後ならばステップ2に行き、そうでな
いならばステップ3に行く。ステップ2では、すべての
コンテクストについてステータスST=0、MPS=0
にする。ステップ3では、すべてのコンテクストについ
てステータスSTおよびMPSは現在のレイヤの前スト
ライプの最終値にする。ステップ4では、SC=0、A
=0x10000、C=0、CT=11を行う。
FIG. 34 shows a flow diagram of the BYTEOUT process. In step 1, TEMP = C
>> 19 (shift to the right by 19 bits). Step 2
In the conditional branch of, if TEMP = 0xff, step 3
Go to step 4, otherwise go to step 4. Step 3
Then, BUFFER = BUFFER + 1 is performed, and BUF
FER is output, 0x00 is output SC times, SC = 0,
Perform BUFFER = TEMP & 0xff. Step 4
In the conditional branch of, if TEMP = 0xff, step 5
If not, go to step 6. In step 5, SC = SC + 1 is performed. BUFF in step 6
ER is output, 0xff is output SC times, SC = 0, B
Perform UFFER = TEMP. In step 7, C = C
& 0x7ffff, CT = 8. Figure 35 is INIT
The flow diagram of ENC processing is shown. In the conditional branch of step 1, go to step 2 if it is just after the first stripe or reset of the current layer, otherwise go to step 3. In step 2, status ST = 0, MPS = 0 for all contexts
To In step 3, the status ST and MPS are set to the last value of the previous stripe of the current layer for all contexts. In step 4, SC = 0, A
= 0x10000, C = 0, CT = 11.

【0010】図36はFLUSH処理のフローダイアグ
ラムを示している。ステップ1ではCLEARBITS
処理、FINALWRITES処理を行い、ストライプ
符号化データ(SCD)の最初の1バイトを取り除く。
また、もし望むならばSCDの最後の0x00をすべて
取り除く。図37はCLEARBITS処理のフローダ
イアグラムを示している。ステップ1ではTEMP=
(A−1+C)&0xffff0000を行う。ステッ
プ2ではTEMP<Cならばステップ3に行き、そうで
ないならばステップ4に行く。ステップ3ではC=TE
MP+0x8000を行う。ステップ4ではC=TEM
Pを行う。図38はFINALWRITES処理のフロ
ーダイアグラムを示している。ステップ1ではC=C<
<CTを行う。ステップ2の条件分岐では、C>0xf
fffffならばステップ3に行き、そうでないならば
ステップ4に行く。ステップ3では、BUFFER+1
を出力し、0x00をSC回出力する。ステップ4で
は、BUFFERを出力し、0xffをSC回出力す
る。ステップ5では、(C>>19)&0xffを出力
し、(C>>11)&0xffを出力する。JBIG方
式のデコードについては省略する。なお、JBIG方式
およびQMコーダについてのより詳しい説明は、例えば
“マルチメディア符号化の国際標準”(丸善株式会社
刊)のなかで述べられている。
FIG. 36 shows a flow diagram of the FLUSH process. In Step 1, CLEARBITS
Processing, FINALWRITES processing is performed to remove the first 1 byte of the stripe encoded data (SCD).
Also, if desired, remove all 0x00 at the end of the SCD. FIG. 37 shows a flow diagram of the CLEARBITS process. In step 1, TEMP =
(A-1 + C) & 0xffff0000 is performed. In step 2, if TEMP <C, go to step 3, otherwise go to step 4. In step 3, C = TE
Perform MP + 0x8000. In step 4, C = TEM
Perform P. FIG. 38 shows a flow diagram of the FINALWRITES process. In step 1, C = C <
<Perform CT. In the conditional branch of step 2, C> 0xf
If fffff, go to step 3, otherwise go to step 4. In step 3, BUFFER + 1
Is output, and 0x00 is output SC times. In step 4, BUFFER is output and 0xff is output SC times. In step 5, (C >> 19) & 0xff is output and (C >> 11) & 0xff is output. The JBIG decoding is omitted. A more detailed description of the JBIG system and QM coder is given in, for example, "International Standard for Multimedia Coding" (published by Maruzen Co., Ltd.).

【0011】[0011]

【発明が解決しようという課題】算術符号では、シンボ
ルの出現確率に応じて確率幅(以下オージェンドと称
す)を設定できればきわめて高い符号化効率が得られる
が、シンボルを符号化する際のオージェンドの演算に領
域幅と確率値の乗算がともなうため演算精度(有効桁
数)の問題や最終シンボルを知るまで符号を送出できな
いという問題があるため実用化が困難であった。また、
JBIG方式の減算型算術符号ではオージェンド演算を
単なる減算で行うことで算術符号を実用化している。し
かし劣性シンボルの想定確率がオージェンドレジスタの
オージェンドの値の変化に伴い2倍変化するため符号化
効率は本来の算術符号に比較して低いという問題があっ
た。本発明は、上記問題点に鑑みて、この問題点を解消
した2値画像符号化装置及び2値画像復号化装置を提供
するものである。
In the arithmetic code, if a probability width (hereinafter referred to as Augend) can be set according to the probability of appearance of a symbol, extremely high coding efficiency can be obtained. However, the calculation of the Augend when the symbol is coded. In addition, there is a problem in calculation accuracy (the number of significant digits) due to the multiplication of the region width and the probability value and a problem that the code cannot be transmitted until the final symbol is known, which makes it difficult to put into practical use. Also,
In the subtraction type arithmetic code of the JBIG system, the arithmetic code is put into practical use by performing the Augend operation by simple subtraction. However, there is a problem in that the assumed probability of recessive symbols changes twice as the augend value of the augend register changes, so that the coding efficiency is lower than the original arithmetic code. In view of the above problems, the present invention provides a binary image encoding device and a binary image decoding device that solve this problem.

【0012】[0012]

【課題を解決するための手段】第1の発明の2値画像符
号化装置は、符号化する画素(以下、符号化注目画素と
称す)及び、符号化注目画素の周囲の特定位置(以下テ
ンプレートと称す)の画素を抽出する手段と、テンプレ
ートの画素によるビットパターン(以下コンテクストと
称す)各々に対する白、黒、各々の出現回数(以下、シ
ンボル出現回数と称す)、及びその和(以下、コンテク
スト出現回数と称す)をカウントし第1のメモリに記憶
する第1の記憶手段と、テーブル参照等によりコンテク
スト出現回数とシンボル出現回数を、有限個の素数
(2,3,5,...)を用いた積で近似した結果の、
それぞれの素数のべき数(以下、素数べき列と称す)を
求めるための第1の変換手段、シンボル出現回数の素数
べき列からコンテクスト出現回数の素数べき列を素数要
素毎に減算する減算手段と、該結果を第2のメモリに記
憶する第2の記憶手段と、確率幅(以下オージェンドと
称す)を上記変換手段で素数べき列とし、オージェンド
更新の際にシンボル出現確率の素数べき列とオージェン
ドの素数べき列とを素数要素毎に加算する加算手段と、
上記素数べき列を第2のテーブル参照手段等により整数
に変換する変換手段と、 オージェンドレジスタに格納
された素数べき列からテーブル参照等により符号のビッ
ト長nを出力する出力手段と、第2の変換手段で求めた
整数値を被除数、2-nを除数とする除算手段と、からな
るものであり、また、第2発明の2値画像復号化装置
は、復号化する画素の周囲の特定位置の画素を抽出する
手段と、テンプレートの画素によるビットパターン各々
に対する白、黒、各々の出現回数、及びその和をカウン
トし第1のメモリに記憶する第1の記憶手段と、テーブ
ル参照等によりコンテクスト出現回数とシンボル出現回
数を、有限個の素数(2,3,5,...)を用いた積
で近似した結果の、それぞれの素数のべき数を求めるた
めの第1の変換手段と、シンボル出現回数の素数べき列
からコンテクスト出現回数の素数べき列を素数要素毎に
減算する減算手段と、該結果を第2のメモリに記憶する
第2の記憶手段と、オージェンドを上記変換手段で素数
べき列とし、オージェンド更新の際にシンボル出現確率
の素数べき列とオージェンドの素数べき列とを素数要素
毎に加算する加算手段と、上記素数べき列を第2のテー
ブル参照手段等により整数に変換する変換手段と、 オ
ージェンドレジスタに格納された素数べき列からテーブ
ル参照等により符号のビット長nを出力する出力手段
と、第2の変換手段で求めた整数値を被除数、2-nを除
数とする除算手段と、符号化データと参照用データを比
較する比較手段と、からなるものである。
According to a first aspect of the present invention, there is provided a binary image coding apparatus, which is a pixel to be coded (hereinafter referred to as a coded pixel of interest) and a specific position (hereinafter referred to as a template) around the coded pixel of interest. Means) for extracting pixels, white and black for each bit pattern (hereinafter referred to as context) by the pixels of the template, the number of appearances of each (hereinafter referred to as the number of symbol appearances), and the sum thereof (hereinafter referred to as context). The first storage means for counting the number of occurrences (referred to as the number of appearances) and storing it in the first memory, and the number of context appearances and the number of symbol appearances by a table reference or the like are a finite number of prime numbers (2, 3, 5, ...) Of the result approximated by the product using
A first conversion means for obtaining a power of each prime number (hereinafter referred to as a prime power sequence); a subtraction means for subtracting a prime power sequence of the context occurrence frequency from the prime power sequence of the symbol appearance frequency for each prime element , A second storage means for storing the result in a second memory, and a probability width (hereinafter referred to as "augend") as a prime power sequence by the conversion means, and a prime power sequence and augend of the symbol appearance probability at the time of updating the agend. An addition means for adding the prime power sequence of
Conversion means for converting the prime power sequence into an integer by a second table reference means, output means for outputting a bit length n of the code from the prime power sequence stored in the augend register by table reference, And a dividing means in which the integer value obtained by the converting means is a dividend, and 2 −n is a divisor, and the binary image decoding device according to the second aspect of the present invention specifies the periphery of the pixel to be decoded. By means for extracting the pixel at the position, first storage means for counting the number of appearances of white, black, and each of the bit patterns by the pixels of the template, and the sum thereof, and storing the result in the first memory. A first conversion means for obtaining a power of each prime number as a result of approximating the number of context occurrences and the number of symbol appearances by a product using a finite number of prime numbers (2, 3, 5, ...). , Subtracting means for subtracting the prime power sequence of the number of times of occurrence of the context from the power series of the number of times of the symbol occurrence for each prime number element, the second storage means for storing the result in the second memory, and the augend by the conversion means. A prime exponent sequence, and an addition means for adding a prime exponent sequence of the symbol occurrence probability and an augmented prime exponent sequence for each prime number element at the time of updating the augend, and the prime exponent sequence to an integer by the second table reference device or the like. Conversion means for converting, output means for outputting the bit length n of the code from a sequence of prime powers stored in the augend register by table reference, and the integer value obtained by the second conversion means for the dividend 2 -n It is composed of a dividing means which is a divisor and a comparing means which compares the encoded data and the reference data.

【0013】[0013]

【作用】本2値画像符号化/復号化装置においては、符
号化注目画素および符号化注目画素(あるいは復号化画
素)の周囲のテンプレートの画素を抽出し、テンプレー
トの画素のコンテクストを求めて、各コンテクストの出
現回数と符号化注目画素(あるいは復号化画素)で出現
したシンボル“0”“1”の出現回数を、それぞれをカ
ウントしてメモリに記憶し、シンボル出現回数を被除
数、コンテクスト出現回数を除数とする除算演算でシン
ボル出現確率を求める際に、コンテクスト出現回数とシ
ンボル出現回数を、有限個の素数(2,3,
5,...)を用いた積で近似し、それぞれの素数のべ
き数のみを用いて表すことで、シンボル出現確率の各べ
き数をシンボル出現回数の各べき数からコンテクスト出
現確率の各べき数を引くという減算演算で求めて、各べ
き数をメモリに記憶する。そして、算術符号化時には、
符号化注目画素のシンボル出現確率を順次、オージェン
ドに乗じてオージェンドの更新を行う際に、オージェン
ドを有限個の素数(2,3,5,...)を用いた積で
近似し、それぞれの素数のべき数のみを用いて表すこと
で、オージェンドの各べき数に、シンボル出現確率の各
べき数を加える加算演算でオージェンドを更新し、各べ
き数をAレジスタに記憶し、LPSの出現時のみ、オー
ジェンドの各べき数にMPS出現確率の各べき数を加え
た値をCレジスタに記憶し、Cレジスタに格納された各
べき数と、それらに対応する素数をもとに実数値を求
め、Aレジスタに格納された各べき数によってテーブル
を参照することで算術符号のビット長nを算出し、前記
実数値を被除数、2-nを除数として除算を行い、その商
を符号データとして出力する。また、復号化時には、L
PSの出現確率によって、オージェンドを順次更新し、
さらに、オージェンドの各べき数にMPS出現確率の各
べき数を加えた値をCレジスタに記憶し、Cレジスタに
格納された各べき数と、それらに対応する素数をもとに
実数値を求め、Aレジスタに格納された各べき数によっ
てテーブルを参照することで算術符号のビット長nを算
出し、Cレジスタの実数値を被除数、2-nを除数として
除算を行い、その商を参照用データとし、符号化データ
と参照用データを比較して一致していないならばMP
S、一致しているならばLPSを復号化データとして出
力する。
In the binary image coding / decoding device, the pixel of the template around the coded pixel of interest and the coded pixel of interest (or the decoded pixel) is extracted, and the context of the pixel of the template is obtained. The number of appearances of each context and the number of appearances of the symbol “0” and “1” appearing in the coded pixel of interest (or the decoded pixel) are counted and stored in the memory, and the number of appearances of the symbol is the dividend and the number of appearances of the context. When obtaining the symbol appearance probability by the division operation with the divisor as, the number of context appearances and the number of symbol appearances are set to a finite number of prime numbers (2, 3,
5 ,. . . ) Is used to represent each exponent of the symbol occurrence probability by subtracting each exponent of the context occurrence probability from each exponent of the symbol occurrence frequency. Each exponent is calculated and stored in a memory. And at the time of arithmetic coding,
When the symbol appearance probability of the coded pixel of interest is sequentially multiplied by the augend to update the augend, the augend is approximated by a product using a finite number of prime numbers (2, 3, 5, ...), and Representing only the powers of prime numbers by adding the powers of the symbol appearance probability to each powers of the augend, the augend is updated by the addition operation, each power is stored in the A register, and when the LPS appears. Only, the value obtained by adding each power number of the MPS appearance probability to each power number of the augend is stored in the C register, and the real value is obtained based on each power number stored in the C register and the corresponding prime numbers. calculates the bit length n of the arithmetic code by referring to the table by the number each should stored in the a register, the real value dividend, divides the 2 -n as divisor, the quotient as the code data Forces. Also, at the time of decoding, L
Depending on the PS appearance probability, the augend is updated in sequence,
Furthermore, a value obtained by adding each power of the MPS appearance probability to each power of the augend is stored in the C register, and a real value is obtained based on each power stored in the C register and the corresponding prime numbers. , The bit length n of the arithmetic code is calculated by referring to the table according to each power stored in the A register, and the real value of the C register is divided by the dividend 2 -n and the quotient is used for reference. If the data does not match by comparing the encoded data with the reference data, MP
S, if they match, LPS is output as decrypted data.

【0014】[0014]

【実施例】以下、図面により本発明の実施例を説明す
る。図1は実施例の機能ブロック図を示している。この
図1において、501はラインメモリを示している。こ
のラインメモリ501には2値画像データが3ライン分
読み込まれる。読み込まれるラインは符号化中のライ
ン、1つ前のラインおよび2つ前のラインである。50
2は画素抽出処理を示している。画素抽出処理502で
はラインメモリの2値画像データから後述するテンプレ
ートをもとに画素を抽出し、コンテクストCXと符号化
注目画素PIXの値を得る。503はカウント処理を示
している。カウント処理502では画像抽出処理で抽出
したコンテクストCXの出現回数、符号化注目画素のシ
ンボルが“0”である回数、“1”である回数をカウン
トし、カウント値格納SRAMに格納する。504はカ
ウント値格納SRAMを示している。505は素数変換
処理を示している。素数変換処理505ではカウント値
格納SRAMに格納された各カウント値をもとにシンボ
ル出現確率を求め、それらを素数変換テーブルによって
素数の積に変換し、そのべき数を出現確率格納SRAM
に格納する。また、シンボル“0”、“1”のMPS、
LPSを判定しMPSを格納する。506は素数変換テ
ーブルROMを示している。507は出現確率格納SR
AMを示している。508はレジスタ演算処理を示して
いる。レジスタ演算処理508では出現確率格納SRA
Mに格納された出現確率と確率幅(オージェンド)を表
すAレジスタとの乗算処理を行う。またLPS出現時に
はCレジスタに下界値を書き込む。509はAレジスタ
を示している。510はCレジスタを示している。51
1は符号長算出処理を示している。符号長算出処理51
1ではAレジスタの値をもとに符号長テーブルを検索し
Aレジスタの値を表すのに必要な精度のビット長nを算
出する。512は符号長テーブルROMを示している。
513は下界値算出処理を示している。下界値算出処理
513では素数テーブルをもとにCレジスタの値を2進
小数に変換する。514は素数テーブルROMを示して
いる。515は符号生成手段を示している。符号生成手
段では下界値を2-nで割ることで符号を生成する。51
6は出力バッファを示している。符号は1度出力バッフ
ァに格納されたのち上位ビット側から出力される。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 shows a functional block diagram of the embodiment. In FIG. 1, reference numeral 501 indicates a line memory. Binary image data for three lines is read into the line memory 501. The lines that are read are the line being encoded, the line before one, and the line before two. Fifty
Reference numeral 2 denotes pixel extraction processing. In the pixel extraction processing 502, pixels are extracted from the binary image data in the line memory based on a template described later, and the values of the context CX and the coded pixel of interest PIX are obtained. Reference numeral 503 indicates a counting process. In the count process 502, the number of appearances of the context CX extracted in the image extraction process, the number of times the symbol of the coded pixel of interest is “0”, and the number of times of “1” are counted and stored in the count value storage SRAM. Reference numeral 504 denotes a count value storage SRAM. Reference numeral 505 indicates a prime number conversion process. In the prime number conversion processing 505, symbol appearance probabilities are obtained based on each count value stored in the count value storage SRAM, converted into products of prime numbers by the prime number conversion table, and the exponents are stored in the appearance probability storage SRAM.
To be stored. Also, the MPS of the symbols “0” and “1”,
LPS is determined and MPS is stored. Reference numeral 506 denotes a prime number conversion table ROM. 507 is an appearance probability storage SR
It shows AM. Reference numeral 508 denotes register arithmetic processing. In the register calculation processing 508, the occurrence probability storage SRA
Multiplication processing is performed between the appearance probability stored in M and the A register representing the probability width (orgend). When LPS appears, the lower bound value is written in the C register. Reference numeral 509 indicates an A register. Reference numeral 510 indicates a C register. 51
Reference numeral 1 indicates a code length calculation process. Code length calculation processing 51
In the case of 1, the code length table is searched based on the value of the A register, and the bit length n of the precision required to represent the value of the A register is calculated. Reference numeral 512 denotes a code length table ROM.
Reference numeral 513 indicates a lower bound value calculation process. In the lower bound value calculation processing 513, the value of the C register is converted into a binary decimal based on the prime number table. Reference numeral 514 represents a prime number table ROM. Reference numeral 515 indicates a code generation means. The code generation means generates a code by dividing the lower bound by 2-n. 51
Reference numeral 6 indicates an output buffer. The code is stored in the output buffer once and then output from the upper bit side.

【0015】図2はテンプレートで抽出される画素を示
している。テンプレートで抽出される画素は図の601
で表される符号化注目画素PIXおよび図2の602で
表される周囲の画素CXnである。CXnの画素の“0”
“1”の組み合わせを数値化したものをコンテクストC
X(10ビットの値)とする。nはコンテクストのnビ
ット目に対応する画素であることを表している。図3は
エンコーダのフローダイアグラムを示している。ステッ
プ1では初期化処理を行う。ステップ2では符号化注目
画素PIXとコンテクストCXを読み込む。ステップ3
では出現確率を算出する。ステップ4ではオージェンド
演算処理を行う。ステップ5では符号化処理を行う。ス
テップ6では出現回数カウント処理を行う。ステップ7
の条件分岐では、2値画像データが終了したならば処理
を終了し、そうでないならばステップ2に行く。図4は
コンテクストカウント処理のフローダイアグラムを示し
ている。ステップ1ではCT(CX)=CT(CX)+
1を行う。ステップ2の条件分岐ではPIX=0ならば
ステップ3に行き、そうでないならばステップ4に行
く。ステップ3ではSYM0(CX)=SYM0(C
X)+1を行う。ステップ4ではSYM1(CX)=S
YM1(CX)+1を行う。
FIG. 2 shows pixels extracted by the template. The pixels extracted by the template are 601 in the figure.
The encoded pixel of interest PIX represented by and the surrounding pixel CXn represented by 602 in FIG. "0" of CXn pixel
The numerical value of the combination of "1" is the context C
X (10-bit value). n represents a pixel corresponding to the nth bit of the context. FIG. 3 shows a flow diagram of the encoder. In step 1, initialization processing is performed. In step 2, the coded pixel of interest PIX and the context CX are read. Step 3
Then, the appearance probability is calculated. In step 4, the augend calculation process is performed. In step 5, encoding processing is performed. In step 6, appearance frequency counting processing is performed. Step 7
In the conditional branch of, the processing is ended if the binary image data is completed, and if not, the process goes to step 2. FIG. 4 shows a flow diagram of the context count process. In step 1, CT (CX) = CT (CX) +
Do 1. In the conditional branch of step 2, if PIX = 0, go to step 3, otherwise go to step 4. In step 3, SYM0 (CX) = SYM0 (C
X) +1. At step 4, SYM1 (CX) = S
Perform YM1 (CX) +1.

【0016】図5は素数変換処理のフローダイアグラム
を示している。ステップ1の条件分岐ではCT(CX)
=50ならばステップ2に行き、そうでないならば処理
を終了する。ステップ2ではi=1を行う。ステップ3
ではP0(CX,i)=PWR(SYM0(CX),
i)−PWR(50,i)、P1(CX,i)=PWR
(SYM1(CX),i)−PWR(50,i)、i=
i+1を行う。ステップ4の条件分岐ではiが素数の個
数であるPRMNUMより大きければステップ3に行
き、そうでなければステップ5に行く。ステップ5の条
件分岐ではSYM0(CX)≧SYM1(CX)ならば
ステップ6に行き、そうでないならばステップ7に行
く。ステップ6ではMPS(CX)=0を行う。ステッ
プ7ではMPS(CX)=1を行う。ステップ8ではC
T(CX)=0、SYM0(CX)=0、SYM1(C
X)=0を行う。図6はオージェンド演算処理のフロー
ダイアグラムを示している。ステップ1の条件分岐では
PIX=MPS(CX)ならばステップ2に行き、そう
でないならばステップ3に行く。ステップ2ではMPS
処理を行う。ステップ3ではLPS処理を行う。図7は
MPS処理のフローダイアグラムを示している。ステッ
プ1の条件分岐ではPIX=0ならばステップ2に行
き、そうでないならばステップ5に行く。ステップ2で
はi=1を行う。ステップ3ではA(i)=A(i)−
P0(CX,i)、i=i+1を行う。ステップ4の条
件分岐ではi>PRMNUMならば処理を終了し、そう
でなければステップ3に行く。ステップ5ではi=1を
行う。ステップ6ではA(i)=A(i)−P1(C
X,i)、i=i+1を行う。ステップ7の条件分岐で
はi>PRMNUMならば処理を終了し、そうでなけれ
ばステップ6に行く。
FIG. 5 shows a flow diagram of the prime number conversion process. CT (CX) in the conditional branch of step 1
= 50, go to step 2, and if not, end the process. In step 2, i = 1 is performed. Step 3
Then P0 (CX, i) = PWR (SYM0 (CX),
i) -PWR (50, i), P1 (CX, i) = PWR
(SYM1 (CX), i) -PWR (50, i), i =
Perform i + 1. In the conditional branch of step 4, if i is larger than PRMNUM, which is the number of prime numbers, the process proceeds to step 3, and if not, the process proceeds to step 5. In the conditional branch of step 5, if SYM0 (CX) ≧ SYM1 (CX), go to step 6, and if not, go to step 7. In step 6, MPS (CX) = 0 is performed. In step 7, MPS (CX) = 1 is performed. C in step 8
T (CX) = 0, SYM0 (CX) = 0, SYM1 (C
X) = 0. FIG. 6 shows a flow diagram of the augend calculation process. In the conditional branch of step 1, if PIX = MPS (CX), go to step 2, and if not, go to step 3. MPS in step 2
Perform processing. In step 3, LPS processing is performed. FIG. 7 shows a flow diagram of MPS processing. In the conditional branch of step 1, if PIX = 0, go to step 2, and if not, go to step 5. In step 2, i = 1 is performed. In step 3, A (i) = A (i)-
Perform P0 (CX, i), i = i + 1. In the conditional branch of step 4, if i> PRMNUM, the process is terminated, and if not, the process proceeds to step 3. In step 5, i = 1 is performed. In step 6, A (i) = A (i) -P1 (C
X, i), i = i + 1. In the conditional branch of step 7, if i> PRMNUM, the process is terminated, and if not, the process proceeds to step 6.

【0017】図8はLPS処理のフローダイアグラムを
示している。ステップ1の条件分岐ではPIX=0なら
ばステップ2に行き、そうでないならばステップ5に行
く。ステップ2ではi=1を行う。ステップ3ではC
(i)=C(i)−P1(CX,i)、A(i)=A
(i)−P0(CX,i)、i=i+1を行う。ステッ
プ4の条件分岐ではi>PRMNUMならば処理を終了
し、そうでなければステップ3に行く。ステップ5では
i=1を行う。ステップ6ではC(i)=C(i)−P
0(CX,i)、A(i)=A(i)−P1(CX,
i)、i=i+1を行う。ステップ7の条件分岐ではi
>PRMNUMならば処理を終了し、そうでなければス
テップ6に行く。図9は符号化処理のフローダイアグラ
ムを示している。ステップ1の条件分岐ではPIX=M
PS(CX)ならば処理を終了し、そうでないならばス
テップ2に行く。ステップ2では符号長算出処理を行
う。ステップ3では下界値算出処理を行う。ステップ4
ではC=C0/2-nを行う。ステップ5ではCを出力す
る。図10は符号長算出処理のフローダイアグラムを示
している。ステップ1ではj=1、n=0を行う。ステ
ップ2ではn=n+CL(A(i),i)を行う。ステ
ップ3ではj=j+1を行う。ステップ4の条件分岐で
はi>PRMNUMならば処理を終了し、そうでないな
らばステップ2に行く。
FIG. 8 shows a flow diagram of the LPS processing. In the conditional branch of step 1, if PIX = 0, go to step 2, and if not, go to step 5. In step 2, i = 1 is performed. C in step 3
(I) = C (i) -P1 (CX, i), A (i) = A
(I) -P0 (CX, i), i = i + 1 is performed. In the conditional branch of step 4, if i> PRMNUM, the process is terminated, and if not, the process proceeds to step 3. In step 5, i = 1 is performed. In step 6, C (i) = C (i) -P
0 (CX, i), A (i) = A (i) -P1 (CX,
i) and i = i + 1. In the conditional branch of step 7, i
If it is> PRMNUM, the process is terminated. If not, go to step 6. FIG. 9 shows a flow diagram of the encoding process. In the conditional branch of step 1, PIX = M
If it is PS (CX), the process is terminated, and if not, go to step 2. In step 2, code length calculation processing is performed. In step 3, lower bound calculation processing is performed. Step 4
Then, C = C0 / 2- n is performed. In step 5, C is output. FIG. 10 shows a flow diagram of the code length calculation process. In step 1, j = 1 and n = 0 are performed. In step 2, n = n + CL (A (i), i) is performed. In step 3, j = j + 1 is performed. In the conditional branch of step 4, if i> PRMNUM, the process is ended, and if not so, the process goes to step 2.

【0018】図11は下界値算出処理のフローダイアグ
ラムを示している。ステップ1ではi=1を行う。ステ
ップ2ではj=1を行う。ステップ3ではC0=C0*
PRM(i)を行う。ステップ4ではj=j+1を行
う。ステップ5の条件分岐ではj>A(i)ならばステ
ップ6に行き、そうでないならばステップ2に行く。ス
テップ6ではi=i+1を行う。ステップ7ではiが素
数の個数より大きければ処理を終了し、そうでなければ
ステップ1に行く。図11は初期化処理のフローダイア
グラムを示している。ステップ1では素数の個数をPR
MNUM、i番目の素数をPRM(i)に代入し、すべ
てのCXに対してCT(CX)=0、SYM0(CX)
=0、SYM1(CX)=0、MPS(CX)=0と
し、すべてのi=2,3,・・・PRMNUMに対して
P0(CX,1)=−1、P0(CX,i)=0、P1
(CX,1)=−1、P1(CX,i)=0を行う。図
12は本実施例の素数変換テーブルを示している。本実
施例では使用する素数は2、3、5、7で、素数の個数
は4である。表の4桁の数値はそれぞれ2のべき数、3
のべき数、5のべき数、7のべき数を表している。
FIG. 11 shows a flow diagram of the lower bound value calculation processing. In step 1, i = 1 is performed. In step 2, j = 1 is performed. In step 3, C0 = C0 *
Perform PRM (i). In step 4, j = j + 1 is performed. In the conditional branch of step 5, if j> A (i), go to step 6, otherwise go to step 2. In step 6, i = i + 1 is performed. In step 7, if i is larger than the number of prime numbers, the process is terminated, and if not, the process goes to step 1. FIG. 11 shows a flow diagram of the initialization process. PR the number of prime numbers in step 1
MNUM, substituting i-th prime number into PRM (i), CT (CX) = 0, SYM0 (CX) for all CX
= 0, SYM1 (CX) = 0, MPS (CX) = 0, and P0 (CX, 1) =-1, P0 (CX, i) = for all i = 2, 3, ... PRMNUM. 0, P1
(CX, 1) = − 1 and P1 (CX, i) = 0 are performed. FIG. 12 shows a prime number conversion table of this embodiment. In this embodiment, the prime numbers used are 2, 3, 5, and 7, and the number of prime numbers is 4. The 4-digit numbers in the table are powers of 2 and 3, respectively.
Represents the powers of 5, the powers of 5, and the powers of 7.

【0019】図13はLPS出現時にオージェンド幅か
ら符号ビット長nを求めるテーブルを示している。nは
-n≦オージェンドの値<2-(n-1)を満たす値となる。
図14は実施例のデコーダの機能ブロック図を示してい
る。この図14において、701はラインメモリを示し
ている。ラインメモリには2値画像データが2ライン分
および復号化した画素が読み込まれる。読み込まれるラ
インは符号化中のラインの1つ前のラインおよび2つ前
のラインである。702は画素抽出処理を示している。
この画素抽出処理702ではラインメモリの2値画像デ
ータから後述するテンプレートをもとに画素を抽出し、
コンテクストCXの値を得る。703はカウント処理を
示している。このカウント処理703では画像抽出処理
で抽出したコンテクストCXの出現回数をカウントし、
復号化画素のシンボルが“0”である回数、“1”であ
る回数をカウントし、カウント値格納SRAMに格納す
る。図704はカウント値格納SRAMを示している。
705は素数変換処理を示している。素数変換処理70
5ではカウント値格納SRAMに格納された各カウント
値をもとにシンボル出現確率を求め、それらを素数変換
テーブルによって素数の積に変換し、そのべき数を出現
確率格納SRAMに格納する。また、シンボル“0”、
“1”のMPS、LPSを判定しMPSを格納する。7
06は素数変換テーブルROMを示している。707は
出現確率格納SRAMを示している。708はレジスタ
演算処理を示している。このレジスタ演算処理708で
は出現確率格納SRAMに格納された出現確率とオージ
ェンドを表すAレジスタとの乗算処理を行う。デコード
時は常にLPSを想定した下界値をCレジスタに書き込
む。709はAレジスタを示している。710はCレジ
スタを示している。711は符号長算出処理を示してい
る。この符号長算出処理711ではAレジスタの値をも
とに符号長テーブルを検索しAレジスタの値を表すのに
必要な精度のビット長nを算出する。712は符号長テ
ーブルROMを示している。713は下界値算出処理を
示している。この下界値算出処理713では素数テーブ
ルをもとにCレジスタの値を2進小数に変換する。71
4は素数テーブルROMを示している。715は符号生
成手段を示している。この符号生成手段715では下界
値を2-nで割ることで参照用符号を生成する。716は
比較手段を表している。この比較手段716では符号化
データと参照用符号を比較し、一致するならばLPS、
一致しなければMPSを出力する。717は出力バッフ
ァを示している。復号化データは1度出力バッファに格
納されたのち出力される。
FIG. 13 shows a table for obtaining the code bit length n from the augend width when the LPS appears. n is a value satisfying 2 −n ≦ Augend value <2 − (n−1) .
FIG. 14 shows a functional block diagram of the decoder of the embodiment. In FIG. 14, 701 indicates a line memory. Two lines of binary image data and decoded pixels are read into the line memory. The lines read are the line before the line being encoded and the line two lines before. Reference numeral 702 indicates a pixel extraction process.
In this pixel extraction processing 702, pixels are extracted from the binary image data in the line memory based on a template described later,
Get the value of context CX. Reference numeral 703 indicates a counting process. In this count processing 703, the number of appearances of the context CX extracted in the image extraction processing is counted,
The number of times the symbol of the decoded pixel is “0” and the number of times the symbol is “1” are counted and stored in the count value storage SRAM. FIG. 704 shows a count value storage SRAM.
Reference numeral 705 indicates a prime number conversion process. Prime number conversion processing 70
In 5, the symbol appearance probability is calculated based on each count value stored in the count value storage SRAM, converted into a product of prime numbers by the prime number conversion table, and the exponent is stored in the appearance probability storage SRAM. Also, the symbol "0",
The MPS and LPS of "1" are determined and the MPS is stored. 7
Reference numeral 06 denotes a prime number conversion table ROM. Reference numeral 707 denotes an appearance probability storage SRAM. Reference numeral 708 denotes a register calculation process. In this register calculation processing 708, multiplication processing of the appearance probability stored in the appearance probability storage SRAM and the A register representing the augend is performed. At the time of decoding, the lower bound value assuming LPS is always written in the C register. Reference numeral 709 indicates an A register. Reference numeral 710 indicates a C register. Reference numeral 711 indicates a code length calculation process. In this code length calculation processing 711, the code length table is searched based on the value of the A register, and the bit length n of the precision required to represent the value of the A register is calculated. Reference numeral 712 represents a code length table ROM. Reference numeral 713 indicates a lower bound value calculation process. In this lower bound value calculation processing 713, the value of the C register is converted into a binary decimal based on the prime number table. 71
Reference numeral 4 indicates a prime number table ROM. Reference numeral 715 indicates a code generation means. The code generation means 715 generates a reference code by dividing the lower bound value by 2 −n . Reference numeral 716 represents a comparison means. This comparison means 716 compares the encoded data with the reference code, and if they match, LPS,
If they do not match, MPS is output. Reference numeral 717 indicates an output buffer. The decoded data is once stored in the output buffer and then output.

【0020】図16はデコーダのフローダイアグラムを
示している。ステップ1では初期化処理を行う。ステッ
プ2ではCXを読み込む。ステップ3では素数変換処理
を行う。ステップ4ではデコーダオージェンド処理を行
う。ステップ5では符号長算出処理を行う。ステップ6
では符号化データを読み込む。ステップ7では下界値算
出処理を行う。図17はデコーダのフローダイアグラム
のつづきを示している。ステップ8では参照用符号CRE
F=C0/2-nを示している。ステップ9では比較処理
を行う。ステップ10では復号化データの出力を行う。
ステップ11ではカウント処理を行う。ステップ12の
条件分岐では画像データの復号化が終了したならば処理
を終了し、そうでなければステップ2に行く。図18は
デコーダオージェンド処理のフローダイアグラムを示し
ている。ステップ1の条件分岐ではMPS(CX)=0
ならばステップ2に行き、そうでないならばステップ3
に行く。ステップ2ではSYM0処理を行う。ステップ
3ではSYM1処理を行う。
FIG. 16 shows a flow diagram of the decoder. In step 1, initialization processing is performed. In step 2, CX is read. In step 3, prime number conversion processing is performed. In step 4, the decoder augend process is performed. In step 5, code length calculation processing is performed. Step 6
Now read the encoded data. In step 7, lower bound calculation processing is performed. FIG. 17 shows a continuation of the flow diagram of the decoder. In step 8, the reference code CRE
F = C0 / 2- n is shown. In step 9, comparison processing is performed. In step 10, the decrypted data is output.
In step 11, counting processing is performed. In the conditional branch of step 12, if the decoding of the image data is completed, the process is ended, and if not, the process goes to step 2. FIG. 18 shows a flow diagram of the decoder augend process. In the conditional branch of step 1, MPS (CX) = 0
If so, go to step 2, else step 3
go to. In step 2, SYM0 processing is performed. In step 3, SYM1 processing is performed.

【0021】図19はSYM0処理を示している。ステ
ップ1ではi=1を行う。ステップ2ではA(i)=A
(i)−P0(CX,i)、C(i)=A(i)−P1
(CX,i)、i=i+1を行う。ステップ3の条件分
岐ではi>PRMNUMならば処理を終了し、そうでな
ければステップ2に行く。図20はSYM1処理を示し
ている。ステップ1ではi=1を行う。ステップ2では
A(i)=A(i)−P0(CX,i)、C(i)=A
(i)−P1(CX,i)、i=i+1を行う。ステッ
プ3の条件分岐ではi>PRMNUMならば処理を終了
し、そうでなければステップ2に行く。図21は比較処
理を示している。ステップ1ではCREF>Cならばステ
ップ2に行き、そうでなければステップ3に行く。ステ
ップ2では復号化データI=MPSを行う。ステップ3
では復号化データI=LPSを行う。
FIG. 19 shows the SYM0 process. In step 1, i = 1 is performed. In step 2, A (i) = A
(I) -P0 (CX, i), C (i) = A (i) -P1
(CX, i), i = i + 1 is performed. In the conditional branch of step 3, if i> PRMNUM, the process is terminated, and if not, the process proceeds to step 2. FIG. 20 shows the SYM1 process. In step 1, i = 1 is performed. In step 2, A (i) = A (i) -P0 (CX, i), C (i) = A
(I) -P1 (CX, i), i = i + 1 is performed. In the conditional branch of step 3, if i> PRMNUM, the process is terminated, and if not, the process proceeds to step 2. FIG. 21 shows the comparison process. In step 1, if CREF> C, go to step 2, otherwise go to step 3. In step 2, the decrypted data I = MPS is performed. Step 3
Then, the decrypted data I = LPS is performed.

【0022】[0022]

【発明の効果】本発明によれば、上述したように確率幅
を加算演算でシンボルの出現確率に応じて正確に設定で
きるため、2値画像データを高い符号化効率で算術符号
化/復号化することができる。
As described above, according to the present invention, the probability width can be accurately set in accordance with the symbol appearance probability by the addition operation as described above, so that the binary image data is arithmetically encoded / decoded with high encoding efficiency. can do.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明にかかる2値画像符号化装置の実施例の
エンコーダ機能ブロック図である。
FIG. 1 is an encoder functional block diagram of an embodiment of a binary image encoding device according to the present invention.

【図2】本発明の実施例におけるテンプレートの説明図
である。
FIG. 2 is an explanatory diagram of a template according to the embodiment of this invention.

【図3】本発明の実施例におけるエンコーダのフローダ
イアグラムである。
FIG. 3 is a flow diagram of an encoder according to an embodiment of the present invention.

【図4】本発明の実施例におけるコンテクストカウント
処理のフローダイアグラムである。
FIG. 4 is a flow diagram of context count processing in the embodiment of the present invention.

【図5】本発明の実施例における素数変換処理のフロー
ダイアグラムである。
FIG. 5 is a flow diagram of a prime number conversion process in the embodiment of the present invention.

【図6】本発明の実施例におけるオージェンド処理のフ
ローダイアグラムである。
FIG. 6 is a flow diagram of an augend process in the example of the present invention.

【図7】本発明の実施例におけるMPS処理のフローダ
イアグラムである。
FIG. 7 is a flow diagram of MPS processing in an embodiment of the present invention.

【図8】本発明の実施例におけるLPS処理のフローダ
イアグラムである。
FIG. 8 is a flow diagram of LPS processing in the embodiment of the present invention.

【図9】本発明の実施例における符号化処理のフローダ
イアグラムである。
FIG. 9 is a flow diagram of encoding processing according to the embodiment of the present invention.

【図10】本発明の実施例における符号長算出処理のフ
ローダイアグラムである。
FIG. 10 is a flow diagram of code length calculation processing in the embodiment of the present invention.

【図11】本発明の実施例における下界値算出処理のフ
ローダイアグラムである。
FIG. 11 is a flow diagram of a lower bound value calculation process in the embodiment of the present invention.

【図12】本発明の実施例における初期化処理のフロー
ダイアグラムである。
FIG. 12 is a flow diagram of initialization processing in the embodiment of the present invention.

【図13】本発明の実施例における素数変換用テーブル
を示す図である。
FIG. 13 is a diagram showing a prime number conversion table in the embodiment of the present invention.

【図14】本発明の実施例における符号長算出用テーブ
ルを示す図である。
FIG. 14 is a diagram showing a code length calculation table in the embodiment of the present invention.

【図15】本発明の実施例におけるデコーダ機能ブロッ
ク図である。
FIG. 15 is a functional block diagram of a decoder in the embodiment of the present invention.

【図16】本発明の実施例におけるデコーダのフローダ
イアグラムである。
FIG. 16 is a flow diagram of a decoder according to an embodiment of the present invention.

【図17】本発明の実施例におけるデコーダのフローダ
イアグラムである。
FIG. 17 is a flow diagram of a decoder according to an embodiment of the present invention.

【図18】本発明の実施例におけるデコーダのオージェ
ンド処理のフローダイアグラムである。
FIG. 18 is a flow diagram of an augend process of the decoder according to the embodiment of the present invention.

【図19】本発明の実施例におけるSYM0処理のフロ
ーダイアグラムである。
FIG. 19 is a flow diagram of SYM0 processing in the embodiment of the present invention.

【図20】本発明の実施例におけるSYM1処理のフロ
ーダイアグラムである。
FIG. 20 is a flow diagram of SYM1 processing in the embodiment of the present invention.

【図21】本発明の実施例における比較処理のフローダ
イアグラムである。
FIG. 21 is a flow diagram of comparison processing in the example of the present invention.

【図22】従来例におけるストライプの説明図である。FIG. 22 is an explanatory diagram of stripes in a conventional example.

【図23】従来例におけるJBIGエンコーダの機能ブ
ロック図である。
FIG. 23 is a functional block diagram of a JBIG encoder in a conventional example.

【図24】従来例における差分レイヤエンコーダの機能
ブロック図である。
FIG. 24 is a functional block diagram of a differential layer encoder in a conventional example.

【図25】従来例における最低解像度レイヤエンコーダ
の機能ブロック図である。
FIG. 25 is a functional block diagram of a lowest resolution layer encoder in a conventional example.

【図26】従来例におけるモデルテンプレートの説明図
である。
FIG. 26 is an explanatory diagram of a model template in the conventional example.

【図27】従来例におけるJBIGエンコーダのフロー
ダイアグラムである。
FIG. 27 is a flow diagram of a JBIG encoder in a conventional example.

【図28】従来例におけるエンコーダレジスタ構造の説
明図である。
FIG. 28 is an explanatory diagram of an encoder register structure in a conventional example.

【図29】従来例におけるJBIG確率推定テーブルを
示す図である。
FIG. 29 is a diagram showing a JBIG probability estimation table in a conventional example.

【図30】従来例におけるENCODE処理のフローダ
イアグラムである。
FIG. 30 is a flow diagram of ENCODE processing in a conventional example.

【図31】従来例におけるCODELPS処理のフロー
ダイアグラムである。
FIG. 31 is a flow diagram of CODELPS processing in a conventional example.

【図32】従来例におけるCODEMPS処理のフロー
ダイアグラムである。
FIG. 32 is a flow diagram of CODEMPS processing in a conventional example.

【図33】従来例におけるRENORME処理のフロー
ダイアグラムである。
FIG. 33 is a flow diagram of RENORME processing in a conventional example.

【図34】従来例におけるBYTEOUT処理のフロー
ダイアグラムである。
FIG. 34 is a flow diagram of BYTEOUT processing in a conventional example.

【図35】従来例におけるINITENC処理のフロー
ダイアグラムである。
FIG. 35 is a flow diagram of INITENC processing in a conventional example.

【図36】従来例におけるFLUSH処理のフローダイ
アグラムである。
FIG. 36 is a flow diagram of FLUSH processing in a conventional example.

【図37】従来例におけるCLEARBITS処理のフ
ローダイアグラムである。
FIG. 37 is a flow diagram of CLEARBITS processing in the conventional example.

【図38】従来例におけるFINALWRITES処理
のフローダイアグラムである。
FIG. 38 is a flow diagram of FINALWRITES processing in the conventional example.

【符号の説明】[Explanation of symbols]

501、701 ラインメモリ 502、702 画素抽出処理 503、703 カウント処理 504、704 カウント値格納SRAM 505、705 素数変換処理 506、706 素数変換テーブル 507、707 出現確率格納SRAM 508、508 レジスタ演算処理 509、709 Aレジスタ 510、710 Cレジスタ 511、711 符号長算出処理 512、712 符号長テーブルROM 513、713 下界値算出処理 514、714 素数テーブル 515、715 符号生成手段 516、717 出力バッファ 716 比較手段 501, 701 Line memory 502, 702 Pixel extraction processing 503, 703 Count processing 504, 704 Count value storage SRAM 505, 705 Prime number conversion processing 506, 706 Prime number conversion table 507, 707 Appearance probability storage SRAM 508, 508 Register calculation processing 509, 709 A register 510, 710 C register 511, 711 Code length calculation processing 512, 712 Code length table ROM 513, 713 Lower bound value calculation processing 514, 714 Prime number table 515, 715 Code generation means 516, 717 Output buffer 716 Comparison means

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 2値画像データを算術符号化する符号化
装置であって、 符号化する画素及び、符号化注目画素の周囲の特定位置
の画素を抽出する抽出手段と、 符号化注目画素の周囲の特定位置の画素によるビットパ
ターン各々に対する白、黒、各々の出現回数、及びその
和をカウントし第1のメモリに記憶する第1の記憶手段
と、 テーブル参照等により符号化注目画素の周囲の特定位置
の画素によるビットパターンの出現回数とビットパター
ン各々に対する白、黒、各々の出現回数を、有限個の素
数を用いた積で近似した結果の、それぞれの素数のべき
数を求めるための第1の変換手段と、 ビットパターン各々に対する白、黒、各々の出現回数の
素数べき列から符号化注目画素の周囲の特定位置の画素
によるビットパターン出現回数の素数べき列を素数要素
毎に減算する減算手段と、 前記減算手段の該結果を第2のメモリに記憶する第2の
記憶手段と、 確率幅を前記変換手段で素数べき列とし、確率幅更新の
際にビットパターン各々に対する白、黒、出現確率の素
数べき列と確率幅の素数べき列とを素数要素毎に加算す
る加算手段と、 前記素数べき列をテーブル参照手段等により整数に変換
する第2の変換手段と、 確率幅レジスタに格納された
素数べき列からテーブル参照等により符号のビット長n
を出力する出力手段と、 前記第2の変換手段で求めた整数値を被除数、2-nを除
数とする除算手段と、を備えていることを特徴とした2
値画像符号化装置。
1. An encoding device for arithmetically encoding binary image data, comprising: a pixel to be encoded and an extraction means for extracting a pixel at a specific position around the pixel of interest to be encoded; A first storage unit that counts the number of appearances of each of white, black, and each of the bit patterns by pixels at specific peripheral positions and the sum thereof and stores the first memory in a first memory; To obtain the exponent of each prime number of the result obtained by approximating the number of appearances of the bit pattern by the pixel at the specific position and the number of appearances of white, black, and each for each bit pattern by a product using a finite number of prime numbers From the first conversion means and a sequence of prime powers of the number of appearances of white, black and each for each bit pattern, the number of appearances of the number of bit patterns by pixels at a specific position around the pixel of interest to be encoded A subtraction means for subtracting a sequence for each prime number element, a second storage means for storing the result of the subtraction means in a second memory, and a probability width as a prime power sequence by the conversion means for updating the probability width In this case, adding means for adding a prime power sequence of white, black, and appearance probability and a prime power sequence of probability width for each prime element for each bit pattern, and converting the prime power sequence into an integer by table reference means or the like. 2 conversion means, and the bit length n of the code from the sequence of prime powers stored in the probability width register by table reference or the like
2 is provided, and output means for outputting the integer value obtained by the second conversion means, and division means for making the dividend 2 −n a divisor.
Value image encoding device.
【請求項2】 2値画像データを算術復号化する復号化
装置であって、 復号化する画素の周囲の特定位置の画素を抽出する抽出
手段と、 符号化注目画素の周囲の特定位置の画素によるビットパ
ターン各々に対する白、黒、各々の出現回数、及びその
和をカウントし第1のメモリに記憶する第1の記憶手段
と、 テーブル参照等により符号化注目画素の周囲の特定位置
の画素によるビットパターンの出現回数とビットパター
ン各々に対する白、黒、各々の出現回数を、有限個の素
数を用いた積で近似した結果の、それぞれの素数のべき
数を求めるための第1の変換手段と、 ビットパターン各々に対する白、黒、各々の出現回数の
素数べき列から符号化注目画素の周囲の特定位置の画素
によるビットパターン出現回数の素数べき列を素数要素
毎に減算する減算手段と、 前記減算手段の該結果を第2のメモリに記憶する第2の
記憶手段と、 確率幅を前記変換手段で素数べき列とし、確率幅更新の
際にビットパターン各々に対する白、黒、出現確率の素
数べき列と確率幅の素数べき列とを素数要素毎に加算す
る加算手段と、 前記素数べき列をテーブル参照手段等により整数に変換
する第2の変換手段と、 確率幅レジスタに格納された
素数べき列からテーブル参照等により符号のビット長n
を出力する出力手段と、 前記第2の変換手段で求めた整数値を被除数、2-nを除
数とする除算手段と、 符号化データと参照用データを比較する比較手段と、を
備えていることを特徴とした2値画像復号化装置。
2. A decoding device for arithmetically decoding binary image data, comprising: extracting means for extracting a pixel at a specific position around a pixel to be decoded; and a pixel at a specific position around a pixel of interest to be encoded. By the first storage means for counting the number of appearances of each of the white and black, each of the bit patterns, and the sum thereof in the first memory and the pixel at a specific position around the pixel of interest to be encoded by referring to a table or the like. First conversion means for obtaining a power of each prime number as a result of approximating the number of appearances of the bit pattern and the number of appearances of each of white, black, and each of the bit patterns by a product using a finite number of prime numbers; , White, black for each bit pattern, from the sequence of prime powers of the number of occurrences of each number, the sequence of prime powers of the number of bit pattern appearances by pixels at a specific position around the pixel of interest A subtraction means for calculating, a second storage means for storing the result of the subtraction means in a second memory, a probability width made into a prime power sequence by the conversion means, and a white space for each bit pattern when updating the probability width. , Black, addition means for adding a prime power sequence of the occurrence probability and a prime power sequence of the probability width for each prime element, second conversion means for converting the prime power sequence into an integer by a table reference means, etc. The bit length n of the code from the sequence of prime numbers stored in the width register by referring to a table or the like
Output means for outputting, a division means for dividing the integer value obtained by the second conversion means into a divisor, 2 −n , and a comparison means for comparing the encoded data and the reference data. A binary image decoding device characterized by the above.
JP06140094A 1994-06-22 1994-06-22 Binary image encoding device and binary image decoding device Expired - Fee Related JP3084187B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP06140094A JP3084187B2 (en) 1994-06-22 1994-06-22 Binary image encoding device and binary image decoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP06140094A JP3084187B2 (en) 1994-06-22 1994-06-22 Binary image encoding device and binary image decoding device

Publications (2)

Publication Number Publication Date
JPH089165A true JPH089165A (en) 1996-01-12
JP3084187B2 JP3084187B2 (en) 2000-09-04

Family

ID=15260819

Family Applications (1)

Application Number Title Priority Date Filing Date
JP06140094A Expired - Fee Related JP3084187B2 (en) 1994-06-22 1994-06-22 Binary image encoding device and binary image decoding device

Country Status (1)

Country Link
JP (1) JP3084187B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7724164B2 (en) 2007-01-24 2010-05-25 Samsung Electronics Co., Ltd. Apparatus and method of dynamically caching symbols to manage a dictionary in a text image coding and decoding system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7724164B2 (en) 2007-01-24 2010-05-25 Samsung Electronics Co., Ltd. Apparatus and method of dynamically caching symbols to manage a dictionary in a text image coding and decoding system

Also Published As

Publication number Publication date
JP3084187B2 (en) 2000-09-04

Similar Documents

Publication Publication Date Title
US5045852A (en) Dynamic model selection during data compression
US4905297A (en) Arithmetic coding encoder and decoder system
US5272478A (en) Method and apparatus for entropy coding
US7365658B2 (en) Method and apparatus for lossless run-length data encoding
US6351569B1 (en) Coding method, decoding method, coding device and decoding device
US7026960B2 (en) Method and apparatus for encoding and decoding key data
JP2798172B2 (en) Image encoding / decoding device
EP0260461B1 (en) Arithmetic coding encoding and decoding method
JP2008118307A (en) Encoding apparatus and control method thereof
CN100581253C (en) Apparatus and method for decoding bitstream
WO1999037085A2 (en) Arithmetic coding-based facsimile compression with error detection
JP3084187B2 (en) Binary image encoding device and binary image decoding device
JPH1023259A (en) Image pattern converter
CN100459460C (en) Method and apparatus for encoding and decoding data
JP2006100977A (en) Printing system and printer
JPH04343576A (en) High-efficiency encoding method and high-efficiency code decoding method
JP2924416B2 (en) High efficiency coding method
JP2891818B2 (en) Encoding device
JPH07249995A (en) Data encoder
JPH07123276A (en) Digital compression encoding method of image signal
EP1761065A2 (en) Method and apparatus for encoding and decoding key data
JP4936574B2 (en) Encoding apparatus and control method thereof
JP2783221B2 (en) Decryption method
JP3859786B2 (en) Coding method for contour line of object in video signal
JPS60251763A (en) Magnifying and reducing circuit of facsimile information

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees