JP3648944B2 - Data encoding method, data encoding device, data decoding method, and data decoding device - Google Patents

Data encoding method, data encoding device, data decoding method, and data decoding device Download PDF

Info

Publication number
JP3648944B2
JP3648944B2 JP27726597A JP27726597A JP3648944B2 JP 3648944 B2 JP3648944 B2 JP 3648944B2 JP 27726597 A JP27726597 A JP 27726597A JP 27726597 A JP27726597 A JP 27726597A JP 3648944 B2 JP3648944 B2 JP 3648944B2
Authority
JP
Japan
Prior art keywords
prediction
bit
encoding
decoding
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP27726597A
Other languages
Japanese (ja)
Other versions
JPH10308673A (en
Inventor
政一 磯村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson 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 Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP27726597A priority Critical patent/JP3648944B2/en
Publication of JPH10308673A publication Critical patent/JPH10308673A/en
Application granted granted Critical
Publication of JP3648944B2 publication Critical patent/JP3648944B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
本発明は、2値の情報をそのまま2値のビット列にし、圧縮したり、2値以上の多値情報源を2値のビット列に変換し、その2値のビット列を圧縮するデータ符号化方法およびデータ符号化装置ならびに圧縮された2値のデータを伸長するデータ復号化方法およびデータ復号化装置に関する。
【0002】
【従来の技術】
従来、“0”と“1”からなる2値信号を扱う情報理論の世界では、算術符号化方式と呼ばれるものが知られている。この算術符号化方式は、エントロピー符号化方式であり、本質的に可逆符号化(ロスレス)の性質を持つものである。そして、その原理は、エライアスの符号化として知られている無記憶情報源に対する理想的符号化方式を実用可能な形に再編成したものとなっている。すなわち、算術符号とは、“0”と“1”の直線上の対応区間を各シンボルの生起確率に応じて不等長に分割していき、対象シンボル系列を対応する部分区間に割り当て、再帰的に分割を繰り返していくことにより得られた区間内に含まれる点の座標を、少なくとも他の区間と区別できる2進小数で表現してそのまま符号とするものである。
【0003】
この算術符号化方式は、有限個の情報源シンボルに特定の符号語を対応させるブロック符号に比べ、符号器の規模、例えば必要メモリ量などのハードウェアが小さくて済むこと、高い効率を期待できることおよび適応符号化が容易なこと等の利点がある。このこと等から、2値信号を扱う情報理論の世界では、この算術符号化方式がその情報の持つエントロピーに最も近いレベルに圧縮できるとされ、最も効率の良い符号化方式と言われている。なお、この算術符号化方式は、特に、マルコア情報源の符号化に適するものとなっている。
【0004】
この算術符号化方式として、Qコーダ、算術符号型MELコード、Mini−Maxコーダ等が提案されている。そして、これらの算術符号を改善したものとして、QMコーダと呼ばれている方式が知られている。このQMコーダは、カラー静止画符号化標準(JPEG)および2値画像符号化標準(JBIG)の両標準において、共通に使用されている。なお、このQMコーダは、2値情報源用の符号であり、JPEGのような多値情報源の符号化にあたっては、その多値情報源を2値化するための前処理を必要としている。このような場合、符号化すべき2値シンボル数は増大するが、多値情報源としての情報量を増大させることなしに2値系列に変換することが可能となっている。
【0005】
このQMコーダは、JPEGおよびJBIGの規定の中にその仕組みについて詳細に述べられているが、ここでは後述する本発明との比較のために、その概要を図21に基づき簡単に説明する。なお、算術復号型のエントロピー復号器の構成は、エントロピー符号器の構成と実質的に同一であるので、ここではその説明は省略する。
【0006】
この算術符号型のエントロピー符号器となるQMコーダ101は、算術演算部102と、状態記憶器として機能する発生確率生成手段103とを含んで構成される。この発生確率生成手段103内には、符号化に必要なシンボル発数確率を決定するために必要な状態パラメータテーブルが書き込まれている。上記の状態パラメータは、入力される状態信号106によって特定される。そして、この状態信号106によって特定された状態パラメータのテーブルに対し、発生確率生成手段103の発生確率演算パラメータが算術演算部104へ向けて出力される。
【0007】
算術演算部102は、このようにして入力される発生確率に基づき、エントロピー符号化を行い、入力されるデータ104を符号化データ105に圧縮し、符号化して出力する。そして、入力されるデータ104の値により、状態信号に対する発生確率を再計算し、演算パラメータ更新値として、発生確率生成手段103へ入力する。この更新結果が次のデータの発生確率としてテーブルに記憶されることで、QMコーダ101の圧縮効率が向上することとなる。なお、発生確率生成手段103には、状態信号106が入力される。これは例えば、マルコフモデルと呼ばれるような手法等により求められる参照画素データ等であり、圧縮率を高めるために利用される信号である。
【0008】
このように構成されるQMコーダの動作について、図22のフローチャートに基づき説明する。まず、QMコーダ101内のレジスタAに0xFFFFを、レジスタCに0x0000を代入する。また、確率推定のためのインデックスSTを初期化する(ステップS100)。次に、符号化対象のシンボル(1ビット)を取り込む(ステップS101)。そして、取り込んだシンボルが、優勢シンボルか劣勢シンボルかを判定する(ステップS102)。優勢シンボルの時はステップS103に進み、劣勢シンボルの時はステップS106に進む。
【0009】
インデックスSTによって確率推定テーブルLSZを参照し、劣勢シンボルの生起確率を求め、さらに、それをレジスタAから減じることにより優勢シンボルの生起確率を求め、その値をレジスタAに代入する(ステップS103)。その後、レジスタAの最上位ビットが“1”かどうか調べる(ステップS104)。“1”ならステップS105に進み、“0”ならステップS114に進む。そして、“1”のときは、インデックスSTによって確率推定テーブルNMPSを参照し、次のシンボルの符号化のためのインデックスSTを求めておく(ステップS105)。
【0010】
ステップS102において、劣勢シンボルのときは、インデックスSTによって確率推定テーブルLSZを参照し、劣勢シンボルの生起確率を求め、それをレジスタAに代入する(ステップS106)。その後、レジスタCにレジスタAの値を加える(ステップS107)。そして、インデックスSTによって確率推定テーブルSWITCHを参照し(ステップS108)、これが“1”のときはステップS109に進み、優勢シンボルを変更する。
【0011】
一方、ステップS110では、インデックスSTによって確率推定テーブルNLPSを参照し、次のシンボルの符号化のためのインデックスSTを求めておく。そして、ステップS111ではレジスタA,レジスタCを共に1ビット左シフトする。この左シフトにより、レジスタCから溢れた最上位ビットを符号語として出力する(ステップS112)。そして、ステップS113において、レジスタAの最上位ビットが“1”かどうか調べ、“1”のときは、ステップS111に戻ってシフトを繰り返す。最上位ビットが“0”のときはステップS114にいき、符号化したシンボルが最後のシンボルなら終了する。そうでなければステップS101に戻る。
【0012】
このようにして、QMコーダ101は、確率推定テーブルLSZ,NMPS,NLPSを利用して入力されてくる2値のビット列を圧縮して符号化する。
【0013】
【発明が解決しようとする課題】
しかしながら、このQMコーダ101等の算術符号化方式は、符号化効率は良いものの図22に示すフローチャートに示されるように、1ビットずつ符号化するため符号化速度が遅いものとなっている。このため、実用面では、レンベル・ジブ系(=LZ系)の符号化方式が優勢となっている。しかし、このLZ系の符号化方式は、符号化効率が算術符号化方式にくらべ、かなり落ちるものとなっている。このように、従来の技術には、符号化効率が算術符号化方式程度に良く、しかも符号加速度がLZ系程度に速いものが存在していない状況である。また、画像符号化やユニバーサル符号化等多くの符号化の対象は、多値情報源であり、多値情報源の効率の良い圧縮、伸長が要望されている。
【0014】
本発明は、算術符号化方式とほぼ同程度の符号化および復号化効率を達成すると共に符号化および復号化速度を大幅に向上させ、LZ系の速度に近づけた新しいデータ符号化方法およびデータ符号化装置ならびにデータ復号化方法およびデータ復号化装置を提供することを目的とする。
【0015】
【課題を解決するための手段】
かかる目的を達成するため、請求項1記載のデータ符号化方法では、“0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力された予測ビット数からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力すると共に、n個の予測ビット数より小さい数の区切りビット数で入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する予測結果符号化工程とを備え、予測が所定回数はずれたときに予測ビット数をn個より少ない新減少予測ビット数として同様の予測設定工程と予測結果符号化工程とを再帰的に繰り返している。
【0016】
このように、優勢シンボルがn個連続することを予測し、予測が当たったときには、n個のビットが1つの予測当たり信号等で表示されることとなり、圧縮効率が高まると共に符号化速度が速くなる。しかも、予測がはずれると、予測ビット数を減少させ、次の予測を行うようにしたので、予測がはずれても圧縮効率や符号化速度はそれ程減少しない。加えて、予測ビット数より少ない区切りビット数で、段階的に符号化するので、符号化時のバッファを小さくすることができる。
【0017】
また、請求項2記載の発明では、“0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力されたn個のビット列からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力すると共に、n個の予測ビット数より小さい数の区切りビット数で入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する予測結果符号化工程とを備え、予測が規定回数当たったときに、予測ビット数をn個より多い新増加予測ビット数として同様の予測設定工程と予測結果符号化工程とを繰り返している。
【0018】
このように、優勢シンボルがn個連続することを予測し、予測が当たったときには、n個のビットが1つの予測当たり信号等で表示されることとなり、圧縮効率が高まると共に符号化速度が速くなる。しかも、予測が当たれば当たる程、データの圧縮効率が一層高まると共に符号化速度が一層早くなる。加えて、予測ビット数より少ない区切りビット数で、段階的に符号化するので、符号化時のバッファを小さくすることができる。
【0019】
また、請求項3記載の発明では、請求項1記載のデータ符号化方法において、予測が規定回数当たったときに、予測ビット数をn個より多い新増加予測ビット数としている。このため、予測が当たれば当たる程、圧縮効率が高まりかつ符号化速度が速くなる。
【0020】
さらに、請求項4記載の発明では、請求項2または3記載のデータ符号化方法において、規定回数を2回とし、新増加予測ビット数を予測ビット数の2倍としている。このため、予測の当たりが続くこと、すなわち、一定の傾向が出始めてから予測ビット数を変えているので、データの圧縮効率を高めることができる。しかもその値を従前の2倍としているので、当たりによって連続した優勢シンボルのビット数と同一となり、次の予測も当たる確率が高くなる。この結果、圧縮効率を高めることができると共に符号化速度を速くすることができる。
【0021】
さらに、請求項5記載の発明では、請求項1記載のデータ符号化方法において、新減少予測ビット数が1となり、かつそのビットが劣勢シンボルのとき、以降の符号化において従来の劣勢シンボルを優勢シンボルとし、従来の優勢シンボルを劣勢シンボルとして符号化するようにしている。その結果、入力データの実態に合わせ、適切な予測ができることとなり、高い符号化速度や効率を維持できることとなる。
【0022】
さらに、請求項6記載の発明では、請求項1、2、3、4または5記載のデータ符号化方法において、区切りビット数を固定の所定値pとし、n≦pのときは、まとめて符号化するビット数をn個としている。この結果、固定の所定値pより大きな予測ビット数の場合、段階的に符号化が可能となり、符号化時のバッファを小さくすることができる。
【0023】
加えて、請求項7記載の発明では、請求項6記載のデータ符号化方法において、所定値を4としている。このため、符号化速度をそれ程落とすことなく、符号化時のバッファを小さくできると共に、このシステムに対応する復号化システムにおけるバッファを小さくでき、しかも復号速度を速くすることができる。
【0024】
加えて、請求項8記載の発明では、“0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力された予測ビット数からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力し符号化する予測結果符号化工程とを備え、この符号化工程において、符号化されるビットのパターンに対応した符号化データが予め記憶された符号化テーブルに基づいて符号化処理すると共に、予測が所定回数はずれたときに予測ビット数をn個より少ない新減少予測ビット数として同様の予測設定工程と予測結果符号化工程とを再帰的に繰り返している。
【0025】
このように、優勢シンボルがn個連続することを予測し、予測が当たったときには、n個のビットが1つの予測当たり信号等で表示されることとなり、圧縮効率が高まると共に符号化速度が速くなる。しかも、予測がはずれると、予測ビット数を減少させ、次の予測を行うようにしたので、予測がはずれても圧縮効率や符号化速度はそれ程減少しない。加えて、符号化処理を予め用意されたテーブルによって行っているので、符号化処理の速度が向上する。
【0026】
また、請求項9記載の発明では、請求項8記載のデータ符号化方法において、符号化テーブルには、8ビット以下のパターンに対応した符号化データが書き込まれ、8ビットを超える符号化対応ビットに対しては符号化テーブルを用いずに符号化している。このように、8ビット以下の小さいパターンに対して符号化テーブルを用意しているので、そのテーブル用のメモリをそれ程増加させずに符号化速度を大幅に向上させることができる。
【0027】
また、請求項10記載の発明では、“0”および“1”からなる2値の入力ビット列を圧縮して符号化するデータ符号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共にその優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する符号化制御部と、入力ビット列を一時記憶すると共に符号化すべきビット数とパターンを出力するビット列分解部と、入力ビット列のパターンに対応する符号化データを記憶した符号化テーブルを内蔵し、符号化制御部から入力する選択すべき上記符号化テーブルを示す信号ならびにビット列分解部から入力する符号化すべきビット数およびパターンから所定の圧縮ビット列とそのビット長とを出力する符号化テーブル部と、圧縮ビット列を一旦バッファリングして固定のビット長にならして出力するストリーム生成部とを備え、予測が所定回数はずれたときに、予測ビット数をn個より少ない新減少予測ビット数として符号化制御部で設定し、予測が規定回数当たったときに、予測ビット数をn個より多い新増加予測ビット数として符号化制御部で設定している。
【0028】
この結果、予測が当たればn個のビットが1つの予測当たり信号等で表示されることとなり、圧縮効率が高まると共に符号化速度が速くなる。しかも、予測が当たれば当たる程、予測ビット数を多くしているので、一層圧縮効率が高まることとなる。加えて、予測がはずれると、予測ビット数を減少させているので、予測がはずれても圧縮効率や符号化速度はそれ程減少することはない。さらに、入力してきたパターンに対応する符号化データを記憶した符号化テーブルを用意して処理するため、符号化速度が向上する。
【0029】
さらに、請求項11記載のデータ符号化装置では、請求項10記載のデータ符号化装置において、n個の予測ビット数より小さい数の区切りビット数で入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化している。このため、予測ビット数より小さい区切りビット数で、段階的に符号化することとなるので、符号化時のバッファを小さくすることができる。
【0030】
また、請求項12記載の発明では、“0”および“1”からなる2値の入力ビット列を圧縮して符号化するデータ符号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共にその優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する符号化制御部と、入力ビット列を一時記憶すると共に、n個の予測ビット数より小さい数の区切りビット数で入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する符号化部とを有している。
【0031】
この結果、予測が当たればn個のビットが1つの予測当たり信号等で表示されることとなり、圧縮効率が高まると共に符号化速度が速くなる。さらに、予測ビット数より小さい区切りで、段階的に符号化するので符号化時のバッファを小さいものとすることができる。
【0032】
また、請求項13記載のデータ復号化方法では、符号化されたデータを入力し、“0”および“1”からなる2値のビット列に復号化するデータ復号化方法において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表わされた符号語を入力する入力工程と、その符号語を復号する復号工程とを有し、入力工程では、n個の予測ビットより小さい区切りビット数で区切られて符号化されたデータを入力し、復号工程では、入力された符号語が予測当たりの値のとき優勢シンボルをn個連続して復号すると共に、予測はずれのときは、区切られた中に劣勢シンボルが含まれていたら、その区切られた部分を含むそれまで続いた優勢シンボルの部分をまとめて復号し、予測当たりが所定回数連続したときはn個より多い数の優勢シンボルが連続すると新たに予測するようにしている。
【0033】
この結果、予測が当たっている場合、1つの符号語でn個の優勢シンボルを復号できるので、伸長効率が高くなり、復号速度が速くなる。しかも予測が当たっていればいる程、1つの符号語で復号できる優勢シンボルの数を多くできるので一層伸長効率が高くなると共に、復号速度が速くなる。さらに、予測はずれのときは、予測ビット数より小さな区切りで復号することになるので、復号速度は一層高まる。
【0034】
さらに、請求項14記載のデータ復号化方法では、符号化されたデータを入力し、“0”および“1”からなる2値のビット列に復号化するデータ復号化方法において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表わされた符号語を入力する入力工程と、その符号語を復号する復号工程とを有し、入力工程では、所定の数で区切られて符号化されたデータを入力し、復号工程では、入力された符号語と予測ビットの数とから復号されるビットパターンが指定される復号テーブルに基づいて復号し、予測当たりが所定回数連続したときは、n個より多い数の優勢シンボルが連続すると新たに予測したその予測結果を入力し、予測はずれが規程回数連続したときは、n個より少ない数の優勢シンボルが連続すると新たに予測したその予測結果を入力するようにしている。
【0035】
この結果、予測が当たっている場合、1つの符号語でn個の優勢シンボルを復号できるので、伸長効率が高くなり、復号速度が速くなる。しかも予測が当たっていればいる程、1つの符号語で復号できる優勢シンボルの数を多くできるので一層伸長効率が高くなると共に、復号速度が速くなる。また、予測が外れると、予測ビット数が減少していくので、予測が外れても復号効率はそれ程落ちない。しかも、復号ビットが、予め記憶された復号テーブルに基づいて復号されるので、復号速度を高めることができる。
【0036】
また、請求項15記載の発明では、請求項14記載のデータ復号化方法において、入力工程では、n個の予測ビットより小さい区切りビット数で区切られて符号化されたデータを入力し、復号工程では、予測はずれのとき、区切られた中に劣勢シンボルが含まれていたら、その区切られた部分を含むそれまで続いた優勢シンボルの部分をまとめて復号している。
【0037】
この結果、予測ビット数より小さいビット数で復号されていくことになるので、使用するバッファを小さくできると共に復号速度を速くすることができる。
【0038】
さらに、請求項16記載の発明では、符号化されたデータとなる符号ビットを入力し、“0”および“1”からなる2値のビット列からなる復号ビットに復号化するデータ復号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとしたとき、符号ビットの優勢シンボルと予測ビット長n個を設定する復号制御部と、入力される符号語に対応する復号パターンを各予測ビット長毎に表化した復号テーブルを有する復号テーブル部と、この復号テーブル部からの復号パターンと復合するビット数を入力し記憶すると共に所定ビット数毎に出力するデコードバッファ部とを備え、入力された符号ビットが予測当たり信号の場合、優勢シンボルを復号すると共に、予測当たり信号が所定回数連続したときは予測ビット長をn個より多い数に変更している。このため、予測が当たっている場合、1つの符号語でn個の優勢シンボルを復号できるので、伸長効率が高くなり、復号速度が速くなる。しかも予測が当たっていればいる程、1つの符号語で復号できる優勢シンボルの数を多くできるので一層伸長効率が高くなると共に、復号速度が速くなる。加えて、入力される符号語に対応する復号パターンを予め表化したテーブルに基づいて復号処理を行っているので、復号速度が一層速くなる。
【0039】
また、請求項17記載の発明では、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルすると共にそのシンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表された符号ビットを復号する復号化装置において、符号ビットの予測ビット長と優勢シンボルを設定する復号制御部と、符号ビットを入力し、その符号ビットの値に応じて復号ビットを出力する復号化部と、復号ビットを入力し、一時保持すると共に復号ビットとして出力するデコードバッファ部とを備え、復号化部での復号を予測ビット長より少ない数の区切りビット数で行い、デコードバッファ部の容量を小さなものにすると共に、予測結果が所定回数連続して当たったとき、予測ビット長をn個より大きな数に変更し、予測結果が規程回数連続して外れたとき、予測ビット長をn個より小さい数に変更し、その予測ビット長が所定値となったとき、優勢シンボルと劣勢シンボルを逆転させるようにしている。
【0040】
このため、予測が当たっている場合、1つの符号語でn個の優勢シンボルを復号できるので、伸長効率が高くなり、復号速度が速くなる。しかも予測が当たっていればいる程、1つの符号語で復号できる優勢シンボルの数を多くできるので一層伸長効率が高くなると共に、復号速度が速くなる。加えて、予測が外れると、予測ビット長を短くしていき、所定の長さになると優勢シンボルと劣勢シンボルを逆転させているので、予測が外れ続けることを防止でき、復号効率を高く維持できると共に復号速度の一層の向上を図ることができる。
【0041】
さらに、請求項18記載の発明では、請求項17記載のデータ復号化装置において、復号化部に、入力される符号語に対応する復号パターンを各予測ビット長毎に表化した復号テーブルを有する復号テーブル部を設けている。このため、入力される符号語に対応する復号パターンを予め表化したテーブルに基づいて復号処理を行っているので、復号速度が一層速くなる。
【0042】
本発明のデータ符号化方法およびデータ符号化装置では、2値のビット列を入力する際、“0”か“1”を優勢シンボルと定め、その優勢シンボルがn個連続すると予測する。この予測が当たったときは、符号語として“0”または“1”のいずれか一方を出力し、符号化を完了する。はずれた場合は、“0”または“1”のいずれか他方を出力すると共に、その注目系列を分割し、それぞれの分割された系列の信号状態を上述と同様な方法で確認し符号化していく。そして、予測が当たるか分割が所定値のビット数となるまで、同様の分割と予測を繰り返し符号化する。
【0043】
このような原理に基づく符号化に当たり、本発明では、予測ビット長nで定まるビット列を一度に符号化せず、何段階にも分けて符号化をしている。このため、予測ビット長nが大きくなっても、デコードバッファ部の容量を大きくする必要がなくなる。また、本発明では、符号化を行うに当たり、入力される信号に対する出力信号を予め表化した符号化テーブルを設けている。この結果、符号化の速度が向上する。
【0044】
また、本発明のデータ復号化方法およびデータ復号化装置では、先に示したデータ符号化方法およびデータ符号化装置とは、逆のアルゴリズムを使用して復号している。このため、復号速度を速くできると共にデコードバッファ部の容量を小さくできるものとなる。
【0045】
【発明の実施の形態】
以下、本発明の実施の形態の例を図1から図20に基づき説明する。なお、本発明の前提となるアルゴリズムの概要について、図1から図3に基づいて説明すると共に、本発明の基礎となる基本的な符号化方法等を図4から図6に基づいて説明する。
【0046】
この発明のアルゴリズムは、QMコーダと同様、2値のビット列を圧縮の対象としている。まず初期値として、“0”か“1”のいずれかを優勢シンボルと定め、そのシンボルが連続すると予測する個数runを設定する。入力系列の出現確率が不明の場合は、runを1に設定するのが良い。その上で、以下に示すようなルールに従い符号化を進める。なお、個数runが予測ビット数に相当する。
【0047】
図1に示すように、runで示される注目系列がすべて優勢シンボルであると予測し、予測が当たったとき、符号語として“0”を出力し、この系列の符号化を完了する。はずれた場合は“1”を出力し、次の分割符号化工程を実行する。
予測がはずれた場合は、図2に示すように注目系列を前半部系列と後半部系列の2つに分け、前半部がすべて優勢シンボルのときは符号語として“0”を出力して、前半部系列の符号化を完了する。前半部系列に劣勢シンボルが存在するときは、符号語として“1”を出力し、次の再分割の工程を実行する。前半部系列の符号化が完了したら注目系列を後半部に移し、前半部系列と同様に符号化する。劣勢シンボルが存在する系列は、可能な限り系列を分割して上述の分割符号化工程を繰り返す。
【0048】
なお、分割は必ずしも2つの均等分割とする必要はなく、不均等な分割としたり3つ以上の分割としても良い。また、予測が当たったとき“0”ではなく、優勢シンボルを出力し、はずれた場合“1”ではなく、劣勢シンボルを出力するようにしたり、予測当たりで“1”を、予測はずれで“0”を出力するようにしても良い。
【0049】
以上がこの発明の前提となるデータ符号化の基本アルゴリズムであるが、さらに、入力系列の出現確率の変化に追随し、符号化効率を向上させるため、以下の処理を加えるようにしても良い。
【0050】
すなわち、runで予測した系列が続けて所定回数、例えば、2回当たったとき、runを2倍等に増加させる。なお、予測が的中し続けた場合、さらに予測範囲を拡大していくようにしても良い。また、runで予測した系列の後半部系列に劣勢シンボルが存在するとき、runを1/4等に減少させるようにしても良い。これは、後半部に劣勢シンボルが存在するときは、次に続く系列に劣勢シンボルが多く含まれると判断されているためである。このため、runで予測した系列の前半部系列のみに劣勢シンボルが存在するときは、後半部に劣勢シンボルが存在するときより多い値、例えばrunを1/2倍するようにしても良い。そして、runが1で、それが劣勢シンボルのときは、以降の入力系列を反転させる。すなわち、優勢シンボルを変更させる。
【0051】
この発明の符号化プロセスは、次に説明する図4および図5の符号化プロセスを改良したものであり、まずその符号化プロセスについて説明する。改良前の符号化プロセスは、図4の符号化メインルーチンと図5の符号化サブルーチンにより構成される。なお、図5中の符号化サブルーチンは、サブルーチンから同じサブルーチンを呼び出すいわゆる関数の再帰読出しを行っている。
【0052】
まず、図4の符号化メインルーチンの各ステップについて説明する。なお、符号化の対象は2値のビット列からなる入力系列となっている。最初に、予測の初期値runの設定と優勢シンボルの選択(“0”または“1”)を行う(ステップS0)。次に、ローカル変数ofsに0を、widthにrunを代入する(ステップS1)。ここでofsは、符号化のために予め定義した配列Aのポインタで、予測開始ビット位置を示す。したがって初期値は0となる。widthはofsで示したビット位置から何ビットを予測の対象にするかを示す値で、ここでは、予測の初期値runが代入される。その後、予め定義した配列AのA〔ofs〕からA〔width−1〕までに入力ビットを書き込む(ステップS2)。そして、A〔ofs〕からA〔width−1〕のすべての要素が優勢シンボルのときステップS4へ進み、ひとつでも劣勢シンボルが含まれているときは、ステップS5へ進む。
【0053】
予測が的中した場合、符号語として予測当たり信号“0”を出力し、配列Aに取り込んだ系列の符号化を完了する(ステップS4)。一方、予測はずれた場合、符号語として予測はずれ信号“1”を出力する(ステップS5)。そして、widthが1以上か否かを検出する(ステップS6)。widthが1以下ならこれ以上分割できないので、ステップS7の符号化サブルーチンへは移行せずステップS8へ移行する。一方、widthが1を超えていると、図5の符号化サブルーチンを呼び出す(ステップS7)。
【0054】
ステップS8では、予測runの再設定と必要ならば優勢シンボルの変更を行う。すなわち、このステップS8においては、基本的には予測が的中すれば、runを大きくし、はずれれば小さくする。そしてrunを小さくしても予測が所定回数はずれ続けるようなら、優勢シンボルの変更を行う。なお、予測の的中や予測のはずれをどのように評価するかについては、さまざまな方法を採用することができる。たとえば、予測がはずれた場合、直ちにrunを小さくしたり、2回以上連続してはずれたとき、初めてrunを小さくする等の方法を採用することができる。さらに、前半部系列もしくは後半部系列のみはずれた場合と、両方はずれた場合とでrunの縮小の度合いを異ならせる方法も採用できる。また、符号済みビット系列で所定の確率テーブルを引き、次の予測runを設定する等の方式も採用可能である。
【0055】
符号化メインルーチンで1次予測がはずれた場合は、ステップS7で図5に示す符号化サブルーチンを呼び出す。符号化サブルーチンへ渡す引き数は、ofsとwidthである。以下、符号化サブルーチンの各ステップについて説明する。
【0056】
符号化サブルーチンでは、予測を前半部系列と後半部系列に分けて行うため、予測の範囲を半分にする(ステップS10)。すなわち、親ルーチンから引き数として受け取ったwidthを1/2にする。そして、次のステップS11で、前半部系列(配列のA〔ofs〕からA〔ofs+width−1〕まで)がすべて優勢シンボルか否かをチェックする。すべて優勢シンボルならステップS12へ進む。ひとつでも劣勢シンボルが存在したら、直ちにステップS14へ進む。
【0057】
前半部系列がすべて優勢シンボルなら、符号語として“0”を出力する(ステップS12)。そして、前半部系列の先頭位置を示すポインタofsにwidthを加え、後半部系列の先頭位置を示すように変更する。また、前半部系列がすべて優勢シンボルのときは、後半部系列に必ず劣勢シンボルが存在するので、後半部系列の予測がはずれたことを示す符号語“1”を出力する必要がない。したがって、後述するステップS20はスキップし、ステップS21に進む。
【0058】
一方、前半部系列に劣勢シンボルが存在する場合、符号語として“1”を出力する(ステップS14)。次に、widthが1を超えているか否かをチェックする(ステップS15)。1以下の場合、これ以上分割できないので、子の符号化サブルーチン(ステップS16)の呼び出しをスキップし、ステップS17へ移行する。なお、widthが2以上なら、さらに系列を2つに分け、それぞれを符号化しなければならない。そのための子の符号化サブルーチンを呼び出す(ステップS16)。子の符号化サブルーチンは、図5に示した符号化サブルーチンと全く同一となっている。つまり、ここでは、同一ルーチン(関数)の再帰呼び出しを行う。
【0059】
符号化サブルーチンの再帰呼び出しによって前半部系列の符号化を終了すると、前半部系列の先頭位置を示すポインタofsにステップS10で設定したwidthを加え、後半部系列の先頭位置を示すように変更する(ステップS17)。その後、後半部系列(配列のA〔ofs〕からA〔ofs+width−1〕まで)がすべて優勢シンボルか否かをチェックする(ステップS18)。すべて優勢シンボルならステップS19へ進む。ひとつでも劣勢シンボルが存在したら、直ちにステップS20へ進む。そして、後半部系列がすべて優勢シンボルなら、符号語として“0”を出力する(ステップS19)。
【0060】
一方、前半部系列に劣勢シンボルが存在する場合、符号語として“1”を出力する(ステップS20)。そして、次に、widthが1を超えているか否かをチェックする(ステップS21)。1以下の場合、これ以上分割できないので、子の符号化サブルーチンを実行するステップS22をスキップし、次の注目系列の符号化工程へリターンする。なお、後半部系列についても、widthが2以上なら、さらに系列を2つに分け、それぞれ符号化する。そのため図5に示す符号化サブルーチンと同一の子の符号化サブルーチンを呼び出す(ステップS22)。この符号化サブルーチンの再帰呼び出しによって後半部系列の符号化を実行する。
【0061】
以上のような符号化プロセスの具体例を次に説明する。すなわち、符号化の具体例として、予測の初期値runを8、優勢シンボルを“0”として、“00001001”として表される入力ビットを符号化する場合について説明する。
【0062】
まず、図4の符号化メインルーチンのステップS2で、A〔0〕からA〔7〕に、上記の入力ビットを入力する。ステップS3では、A〔0〕からA〔7〕のすべてが“0”かどうか判定する。上の例の場合、ビット列に“1”が含まれているので、ステップS5に移行し、まず符号語として“1”を出力する。続いてステップS6では、widthの大きさをチェックするが、widthはこのとき8なので、符号化サブルーチン(ステップS7)に進む。
【0063】
符号化サブルーチンでは、まずステップS10で、widthを1/2の4に設定する。そしてステップS11で、入力ビットの前半部、つまりA〔0〕からA〔3〕がすべて0かどうかチェックする。この場合、すべて“0”なのでステップS12に進み、符号語として“0”を出力する。以上で前半部系列の符号化が完了する。続いてステップS13を実行し、後半部系列の符号化に移るが、前半部系列がすべて“0”の場合、後半部系列に“1”が含まれるのは明らかである。したがって、ステップS21でwidthが1以下でない限り後半部系列をさらに分割して符号化しなければならない。そこで、符号化サブルーチンを子プロセスとしてステップS22で再び呼び出す。なお、そのための前処理として、上述したようにステップS13では、ofsにwidthを加え、ofsを後半部系列の先頭位置にセットする。
【0064】
ステップS22では、ofsとwidthを引き数として子の符号化サブルーチンを呼び出す。子の符号化サブルーチンを実行するステップS22では、まず、図5に示す符号化サブルーチンのステップS10でwidthをさらに半分にして2に変更する。次のステップS11では、前半部系列、すなわちA〔4〕とA〔5〕が共に“0”であるか否かをチェックする。この場合、A〔4〕が“1”なので、次のステップS14に移行し、符号語として“1”を出力する。そしてステップS15でwidthが1を超えていると判断し、孫プロセスをステップS16で呼び出す。孫の符号化サブルーチンでは、まずステップS10においてwidthが1となる。A〔4〕は“1”なのでステップS11からステップS14へ処理が移り、符号語“1”を出力する。ステップS15では、widthが1以下なので、ステップS16をスキップし、ステップS17でofsを5に変更する。A〔5〕は“0”なのでステップS18からステップS19に処理が移り、符号語“0”を出力する。
【0065】
次に、この孫の符号化サブルーチンから抜けて、子の符号化サブルーチンのステップS17に戻る。子の符号化サブルーチンのofsは4、widthは2であるから、ステップS17でofsは6に変更される。したがってステップS18では、A〔6〕とA〔7〕をチェックすることになる。この場合、A〔7〕が“1”なのでステップS20へ移行し、符号語“1”を出力する。そして、再び孫の符号化サブルーチンをステップS22で呼び出す。孫の符号化サブルーチンでは、A〔6〕が“0”なのでステップS12で符号語“0”を出力する。そして、widthが1なので、ステップS22をスキップして子の符号化サブルーチンに復帰する。
【0066】
子の符号化サブルーチンに復帰したプロセスは、さらに符号化メインルーチンに復帰し、ステップS8で予測runの再設定と、優勢シンボルの再設定を行う。この例の場合、1次予測ははずれたが、2次予測で前半部が的中したので、runを8から4に変更し、優勢シンボルは引き続き“0”とする処理を施す。なお、予測runの設定は、2回続けてはずれたときに変更する等の設定にしても良い。
【0067】
このような符号化プロセスによって、入力ビットである“00001001”が“1011010”の符号化系列となる。したがってこの場合、8ビットの入力系列が7ビットに圧縮されたことになる。
【0068】
以上のような符号化プロセスを実行した場合の圧縮率と符号化時間を、図6に示す。この図6は、4種類のファイルについてこの符号化プロセスを使用した場合の圧縮率と符号化時間を示すと共に参考として、従来のQMコーダの圧縮率と符号化時間も示すものとなっている。図6に示されるようにこの符号化方法は、圧縮率がQMコーダと同レベルであり、符号化時間は大幅に短縮されたものとなっている。
【0069】
なお、復号化プロセスについては、符号化プロセスと逆のアルゴリズムによって、入力されてくる符号語を復号している。すなわち、復号化プロセスも、復号化メインルーチンと復号化サブルーチンにより構成され、符号化と逆のアルゴリズムによって復号している。
【0070】
このように、図4および図5に示す符号化プロセスおよびその符号化プロセスと逆のアルゴリズムを使用して行う復号化プロセスでは、圧縮率が従来のQMコーダ101と同レベルであり、一方、符号化時間や復号化時間は大幅に短縮されたものとなっている。しかし、この符号化プロセスおよび復号化プロセスにおいては、予測ビット数であるrunで定まるビット列を一度に符号化しているため、圧縮率を高めるために、runの最大値を大きく設定すると、runの個数分のビットを保存しておくためのバッファが大きくなるという問題が生じる。
【0071】
この問題は、図21に示す状態信号108をマルコフモデル化から得るような場合、そのバッファが非常に大きくなり、さらに大きな問題となる。すなわち、仮にrunをnとしたとき、バッファとしてはnビット分必要となり、さらにm状態のマルコフモデル化を行うと、バッファは各状態毎に必要となるため、n×mビットの容量になる。この容量は、runの値が大きくなると無視できなくなる大きさとなる。
【0072】
また、図4および図5に示す符号化プロセスおよびその符号化プロセスと逆のアルゴリズムを使用する復号化プロセスでは、その各処理時間は、QMコーダに比べ大幅に短縮されているものの、符号化や復号化のサブルーチンを再帰的に呼び出して符号化や復号化を行っており、このサブルーチンの再帰的呼び出しのプロセスで時間を有するものとなっている。
【0073】
このため、本発明では、図1から図5に示す符号化プロセスおよび復号化プロセスを生かしつつ、デコード用のバッファを小さくしたり、符号化や復号化の時間をさらに減少できるデータ符号化方法等を提案している。以下、その提案である本発明の実施の形態を、図7から図20に基づき説明する。
【0074】
まず、改良された本発明の第1の実施の形態のデータ符号化装置1を、図7に基づき説明する。
【0075】
このデータ符号化装置1は、エントロピー符号化装置となっており、符号化すべき2値ビット列を入力するビット列分解部2と、各予測ビット長run毎に符号化テーブルを内蔵する符号化テーブル部3と、符号化テーブル部3から入力される可変長符号を一旦バッファリングして固定のビット幅にならして出力するストリーム生成部4と、後述する状態遷移表を内蔵し、予測ビット長run等を設定する符号化制御部5とから主に構成される。ここで、符号化テーブル部3と符号化制御部5とで符号化部を構成している。
【0076】
ビット列分解部2は、符号化制御部5から予測ビット長runを指示する信号RUNと、優勢シンボルを指示する信号SWを入力する。ここで、信号RUNは、1からn(nは最大予測ビット長)の値を取る。また、信号SWは、その値が「0」のとき、“0”を優勢シンボルとし、「1」のとき、“1”を優勢シンボルとするが、その逆でも構わない。
【0077】
さらに、ビット列分解部2は、デコードすべきビット数の信号DECNUMと、デコードすべきビットのパターンとなる信号パターンDECPATNを符号化テーブル部3に出力する。信号DECNUMは、入力ビット列に、劣勢シンボルを含む4ビットのパターンが現れたとき、その4ビットとそれまで続いた優勢シンボル個数の合計数となる。なお、信号RUNが「4」未満のときは、信号RUNと同じ値が出力される。これは、この実施の形態では、区切りビット数pを「4」としているためである。
【0078】
このようにして、ビット列分解部2は、入力したビット列が信号RUNで指定されたビット数分、すべて信号SWで指定された優勢シンボルが続いたとき、すなわち、予測が的中したとき、信号DECNUMとして信号RUNの値を、信号パターンDECPATNとして“0”を出力する。
【0079】
符号化テーブル部3は、図8から図11に示すような符号化テーブルを内蔵しており、どのテーブルを用いるかは、符号化制御部5からのテーブル番号指示信号TABLEにより選択される。そして、この符号化テーブル部3は、ビット列分解部2からの信号DECNUMと信号パターンDECPATNにより所定のテーブル内を検索し、所定の圧縮ビット列DECBITとそのビット長LENGTHおよび予測の当たり外れを示すFAILを出力する。なお、信号TABLEは、信号RUNと1対1の関係を有するものとなっている。
【0080】
図8の符号化テーブルは、テーブル番号は「0」で、信号RUNの値が「1」、すなわちrunが「1」の場合を示している。図8に示されるように、runが「1」のときは、2種類の信号となっている。すなわち、デコードすべきビット数は1個であり、信号パターンは“0”と“1”の2種類となる。この2種類の入力信号に対して、圧縮ビット列DECBITと、そのビット長LENGTHと、予測の列外れを示すフラグFAILの組み合わせからなる2種類の信号が対応する。例えば、信号DECNUMが「1」で、信号パターンDECPATNが“0”の場合は、予測当たりとなり、フラグFAILは当たり信号の「0」となり、圧縮ビット列DECBITは“0”となり、ビット長LENGTHは「1」となる。
【0081】
図9の符号化テーブルは、テーブル番号が「1」で、runが2の場合を示している。なお、各符号化テーブルの信号パターンDECPATNと圧縮ビット列DECBITは、共に右側から左側に入力してくる信号を示している。この図9の場合、その信号形態は4種類となる。デコードすべきビット数はすべて2個であり、そのときの信号パターンDECPATNは“00”“10”“01”“11”の4種類となる。信号パターンDECPATNが“00”のときは、2つとも優勢シンボルのため予測が当たったこととなり、フラグFAILは当たり信号の「0」となると共に、そのときの圧縮ビット列DECBITは“0”となり、ビット長LENGTHは「1」となる。一方、信号パターンDECPATNが“10”のときは、劣勢シンボル“1”が入っており、予測が外れたこととなる。この結果、フラグFAILは、外れ信号の「1」となり、圧縮ビット列DECBITは、最初に“1”がくる。次に、“10”の前半部が“0”であるため、予測が当たり圧縮ビット列DECBITの2番目は“0”となり、“01”となる。ここで、最初に予測外れとなっているので、後半部に“1”があることとなる。このため、圧縮ビット列DECBITは、この“01”がそのまま採用される。
【0082】
信号パターンDECPATNが“01”のときは、劣勢シンボル“1”が入っており、予測が外れたこととなる。この結果、フラグFAILは外れ信号の「1」となり、圧縮ビット列DECBITは最初に“1”がくる。次に、“01”の前半部が“1”であるため、予測がまたも外れたこととなり、圧縮ビット列DECBITの2番目は“1”となる。信号パターンDECPATN“01”の後半部は“0”であるため、予測当たりとなり、圧縮ビット列DECBITの3番目は“0”となる。すなわち、信号パターンDECPATN“01”に対応する圧縮ビット列DECBITは、“011”となる。そして、ビット長LENGTHは「3」となる。同様にして、信号パターンDECPATN“11”に対する圧縮ビット列DECBITは、“111”となる。以上の9種類の信号の対応表が図9となっている。
【0083】
同様にして、テーブル番号が「2」で、runが「4」の16種類の信号の対応関係が図10に示され、テーブル番号「3」でrunが「8」の計31種類の信号の対応関係が図11に示されている。なお、図10のrunが「4」の場合では、runの値が区切りビット数pと同じとなるので、図8および図9と全く同じ関係のみのものとなるが、図11のrunが「8」の場合は、区切りビット数p(この実施の形態ではp=4)より大きくなるため、少し変更された表となる。
【0084】
次に、他の表とは若干異なるこの図11の符号化テーブルの内容を説明する。この符号化テーブルでは、デコードすべき信号のビット数DECNUMは、「8」のものと「4」のものが存在する。「8」のものは、前半部がすべて“0000”のものであり、「4」のものは、runが「8」で前半部に劣勢シンボル“1”がきた場合のものを示している。
デコードすべき信号のビット数DECNUM(以下単にDECNUMとして示す)が「8」で、信号パターンDECPATN(以下単にDECPATNとして示す)が“0000”のときは“00000000”であることを示し、予測が当たったこととなり、フラグFAIL(以下単にFAILとして示す)は当たり信号の「0」となる。そして、圧縮ビット列DECBIT(以下単にDECBITとして示す)は“0”で、ビット長LENGTH(以下単にLENGTHとして示す)は「1」となる。DECNUMが「8」で、DECPATNが“1000”のときは、“10000000”であることを示し、予測が外れたこととなり、FAILは外れ信号の「1」となる。そして、DECBITの1番目には“1”がくる。次に、前半部“0000”は予測当たりとなり、DECBITの2番目には“0”がくる。このとき、後半部“1000”に劣勢シンボル“1”が当然くることとなるため、後半部の4つの信号に対するDECBITは、特に発生しない。
【0085】
後半部“1000”の中の前半部“00”は、予測当たりであり、3番目のDECBITは“0”となる。このとき、後半部“10”に劣勢シンボル“1”が当然くることとなるため、後半部の2つの信号に対するDECBITは特に発生しない。そして、この後半部“10”の前半部“0”は予測当たりとなり、4番目のDECBITは“0”となる。こうなると、最後尾に“1”があることが当然となり、特にDECBITは発生しない。よって、DECPATN“1000”に対応するDECBITは“0001”となる。そして、LENGTHは「4」となる。これが、図11のテーブル番号「3」の表の上から2番目の状態に対応する。
【0086】
このような関係は、図11の符号化テーブルの第3番目から第16番目にも当てはまる。一方、図11のテーブル番号「3」の上から第17番目から第31番目までは、DECNUMが「4」となり、図10のテーブル番号「2」のものに近似する。すなわち、図10の符号化テーブルの第2番目から第16番目のものに、runが「8」として見たときの予測外れの“1”がすべて最初に付加されたものと、図11のDECNUM「4」のものとは同一となる。なお、符号化テーブル部3より出力される符号は、LENGTHによって指定される可変長符号になっている。
【0087】
ストリーム生成部4は、入力の可変長符号を一旦バッファリングして、出力の伝送路で定められた固定のビット幅にならして出力するものとなっている。
【0088】
符号化制御部5の基本動作は、信号RUN(以下単にRUNという)によってビット列分解部2にビットの切り出し方法を指示し、同時に信号TABLE(以下単にTABLEという)により符号化テーブルの選択を行うものとなる。そして、符号化テーブル部3からフィードバックされるFAILにより、次の符号化のためのRUNとTABLEを設定する。なお、この実施の形態では、区切りビット数pを利用した段階的な符号化を導入したため、ある予測ビット長runで符号化した際、必要に応じて途中の段階であることをこの符号化制御部5は記憶する必要がある。
【0089】
この符号化制御部5の具体的な動作は、図12に示す状態遷移表に基づくものとなっている。この状態遷移表の動作について、予測当たりが続く場合を例にして説明する。ここで、初期状態は、SS1となっている。まず、状態SS1のとき、runが「1」で、TABLEは「0」である。このため、図8に示すテーブル番号「0」の符号化テーブルが使用される。そして、予測が当たる場合は、優勢シンボルが“0”が続くことであるため、入力されるビット列入力からそのDECNUMの数である「1」個分の“0”のみを符号化テーブル部3に送り、テーブル番号「0」のテーブル(=図8の表)に基づいて、FAIL「0」と、DECBIT“0”と、LENGTH「1」とが出力される。そして、そのFAIL「0」が符号化制御部5に伝えられる。
【0090】
符号化制御部5は、図12の状態遷移表に基づき、SS1中のFAIL「0」となるものを見つけ、次の状態として状態SS0を選択する(図12の状態遷移表の上から3番目)。このとき、信号SWは“0”となるので、シンボルの逆転はなく、そのまま“0”が優勢シンボルとなる。状態SS0においても、同様な動作の結果、状態遷移表の第1番目が選択され、状態SS3が次の状態となる。これによって、2回予測が当たったこととなる。
【0091】
この状態遷移表では、2回予測が当たると、runが2倍になる。すなわち、上から7番目および8番の状態SS3となり、runが「2」となる。このように予測が当たり続けると、すなわち、入力ビット列がこの場合であると“0”であり続けると、runが「2」「2」「4」「4」「8」「8」と増えていく。また、一方、予測が外れ続けるときは、2回毎、同一runで行い小さくなっていく。すなわち、runが「8」「8」「6」「6」「4」「4」「2」「2」と小さくなっていく。そして、runが「1」のときに、予測が外れると、信号SWは反転する。
【0092】
このような状態遷移表の動作のルールをまとめると、次のとおりとなる。
【0093】
(1)同一の予測ビット長runでの予測が2回連続して的中したとき、予測ビット長runを2倍する。
【0094】
(2)同一の予測ビット長runでの予測が2回連続して外れたとき、予測ビット長runを1/2倍する。
【0095】
(3)予測ビット長runが4以下のときは、1回で符号化を実行する。
【0096】
(4)予測ビット長runが8で、DECNUM=4のときは、2回に分けて符号化を実行する。
【0097】
(5)このときは、状態SS5に遷移して、予測ビット長runを「4」で、後半のビットを符号化する。
【0098】
なお、信号SWの反転とは、この値が1のとき、信号SWを反転させるという意味である。
【0099】
なお、図12で示す状態遷移表は、runが「8」までしか示していないが、この実施の形態では、runを最大「16」としているので、run「16」のものも、図示していないが同様に作成されている。また、状態遷移表としては、runが「32」以上のものにしても良い。さらに、当たりや外れが2回続いたらrunを増加させたり減少させたりするのではなく、1回毎に変えたり3回以上の数としたり、種々のパターンを採用することができる。また、このような符号化テーブルとしては、ビット数の少ないものだけを用意し、大きなビット数、例えば、16ビット以上の場合は符号化テーブルを持たないようにすることもできる。
【0100】
次に、以上のような構成を有するデータ符号化装置1の動作を具体例を使用して説明する。
【0101】
例えば、予測が当たり続けて、run=16となった状態で、“0000010000111100………」のような形で入力してきたビット列を符号化する場合、4ビットの区切りビット数pで区切り、まず、最初は“00000100”までを符号化することとなる。これは、劣勢シンボル“1”が第1番目の区切りビット数(=最初の4ビット)部分にはなく、第2番目(=次の4ビット)に出てくるためである。そして、次に“0011”を、そして最後に“1100”を符号化することとなる。
【0102】
このため、ビット列分解部2から出力されるDECNUMは、「8」「4」「4」となる。一方、DECPATNは、“0100”“0011”“1100”(ここでは、いずれのパターンも左の数値から入力されてくるとする)となる。このような条件において、DECBITは、まず、run=16としたときの予測外れの“1”がくる。次に、“00000100”は、RUN「8」、TABLE「3」、DECNUM「8」のため、図11に示す上から5番目に相当するものであり(図11に示す各数値の場合、それぞれ右端側から入力されてくることに注意)、DECBITは“10100”となる。このため、先の“1”と合わせられた“110100”(この数値は左端から順に出力)のDECBITとLENGTH「6」が符号化テーブル部3からストリーム生成部4に出力される。
【0103】
一方、符号化制御部5内の状態遷移表でいえば、状態SS6でDECNUM「8」のとき、FAIL「1」となったこととなり、次の状態は状態SS7となる。そして、次の“0011”は、run=8でDECNUM「4」なので、テーブル番号「3」のテーブル(=図11の符号化テーブル)が採用され、その上から19番目のものが該当し、“11011”のDECNUMとLENGTH「5」が符号テーブル3から出力される。
【0104】
最後の“1100”については、前の状態が状態SS7のrun「8」、DECNUM「4」で、FAIL「1」となったため(図12の1番下の状態)、状態SS5が採用される。このため、run「4」、TABLE「2」となり、図10に示すテーブル番号「2」の符号化テーブルが使用される。そして、このテーブル番号「2」のテーブルにおいて、下から4番目が該当し“11110”のDECBITと、LENGTH「5」が符号化テーブル3からストリーム生成部4に出力される。なお、状態SS5で、FAILは「1」となるので、次は状態SS2に移る。すなわち、次の入力ビット列に対しては、run=2である図9の符号化テーブルが使用されることとなる。
【0105】
以上をまとめると、入力ビット列“0000010000111100”が“110100”,“11011”,“11110”の3つの圧縮ビット列として符号化されたこととなる。なお、入力ビット列や3つの圧縮ビット列は、共に先頭側から入力され、出力されていくものとする。この点、図8から図11の各符号化テーブルとは異なることに注意する必要がある。すなわち、各符号化テーブルでは、その表示の各値は、その表示の右端から順に入力し、出力するものとなっている。
【0106】
そして、runは、当初「16」であったのが、この4ビットの区切りビットpで段階的に符号化していく中で、runは「2」となり、次の入力ビット列に対しては、「2」の予測ビット長runで符号化されることとなる。
【0107】
一方、先に示した本発明の元となる基本的プロセスで、同じ入力ビット列“0000010000111100”を符号化すると、まずrun=16での予測外れの“1”、次に前半の8ビットを注目し、2番目に予測外れの“1”がきて、さらに前半の4ビット“0000”に注目し、予測当たりの“0”が3番目にくる。すると、後半部の4ビット“0100”に劣勢シンボルがくるとは確実なので、すぐに2つに分割し、前半の2ビット“01”に注目する。このため、予測外れの“1”が4番目にくる。次は、さらにこれを2分割し、前半の“0”に注目し、5番目に予測当たりの“0”がくる。すると、後半の“1”は劣勢シンボルが確実なので、すぐに後半の2ビット“00”に注目し、予測当たりの“0”が6番目にくる。
【0108】
以上の前半8ビットの符号化をまとめると、“110100”となる。これは、本発明による符号化ビットと全く同じとなる。続く8ビットも同様な方法で進めていくと、これらも本発明による符号化ビットと同一となる。本発明の元となる基本的プロセスと本発明とが異なる点は、符号化されたビット自体ではなく、▲1▼符号化の区切り方、▲2▼予測ビット表の変更の仕方、▲3▼符号化テーブルの活用の3点にある。
【0109】
すなわち、改良した本発明では、入力ビット列に対しrunより小さい区切りビット数p(この実施の形態ではp=4)で区切り、劣勢シンボルが存在する区切り部分までで一旦符号化を区切るようにしている。先の例では、16ビットの入力ビット列が3つに区切られて符号化されている。また、本発明では、次の入力ビット列に対し予測ビット長runは「2」となるのに対し、基本的プロセスの考え方では、予測外れは1回であり、runは「16」のままとなる。さらに、本発明の基本的プロセスの考え方では、符号化サブルーチンを再帰的に呼び出して符号化しているが、改良した本発明では、符号化テーブル、具体的には予測ビット長run毎に符号化テーブルを用いている。
【0110】
以上の3つの点は、それらが同時に利用されることによって大きな効果を生ずるが、それぞれ単独で使用されても十分効果を有する。例えば、第1の点の段階的に符号化する方法を採用すると、バッファ、例えば、ビット列分解部2やストリーム生成部4内の各バッファを小さくできるばかりか後述するマルコフモデル化によって圧縮ビット列を得ようとするときにそのバッファの容量を減少させることができる。
【0111】
第2の点の予測ビット長runの変更については、入力ビット列が途中からがらっとその性質が変わるような場合に特に有効となる。先の例では、予測が当たり続けてrun=16となったのに対し、次に性質ががらっと変わったビット列、すなわち劣勢シンボルを多く含む“0000010000111100”がきたとき、改良された本発明では、その性質に合わせrunは「2」となり、続く入力ビット列の性質に合う確率が高いものとなり、圧縮率が高くなる。しかし、本発明の基本的プロセスで処理した場合、runは「16」のままであり、次の入力ビット列の性質にそぐわない確率の高いものとなる。なお、圧縮率の向上は、具体的には0.5%から数%程度であるが、各プログラムソフト等が大容量化している現在では、このようなわずかな数値の向上効果も無視し得ないものとなっている。
【0112】
第3の点の符号化テーブルについては、サブルーチンの再帰的呼び出しによる符号化に比べ、符号化テーブルのためのメモリ容量は若干増えるものの、符号化速度が極めて速くなる。
【0113】
次に、本発明の第1の実施の形態のデータ復号化装置10について、図13に基づき説明する。
【0114】
このデータ復号化装置10は、符号化された信号のストリームを入力するストリーム切り出し部11と、予測ビット長runに応じた複数の復号テーブルを内蔵する復号テーブル部12と、復号されたビットをストアし、所定のシンボルを出力するデコードバッファ部13と、データ符号化装置1の符号化制御部5内の状態遷移表と同じ状態遷移表を有する復号制御部14とから主に構成されている。なお、復号テーブル部12と復号制御部14とで復号化部を構成している。
【0115】
ストリーム切り出し部11は、復号テーブル部12から、復号したビット数を後述するLENGTHにより指示されるので、その値に基づき、復号済みビットを廃棄して、未復号ビットの先頭が、符号化されたデータとなる復号予定の符号語信号CODE(以下単にCODEという)の最下位ビット(または最上位)に来るようにストリームを切り出す。なお、LENGTHを評価して、復号済みビットを廃棄するのは、デコードバッファ部13から廃棄指示DECREQ(以下単にDECREQという)があったときのみである。また、CODEは8ビット単位で送信される。
【0116】
復号テーブル部12は、図14から図17に示す各復号テーブルを内蔵し、復号制御部14が出力するテーブル番号指示信号TABLE(以下単にTABLEという)によりそれらを切り替えて使用する。そして、復号テーブル部12は、次の信号を出力する。
【0117】
(1)何ビット復号したかを示す信号LENGTH(以下単にLENGTHという)で、データ符号化装置1におけるLENGTHに相当するもの
(2)予測の当たり外れを示す信号FAIL(以下単にFAILという)で、データ符号化装置1におけるFAILに相当するもの
(3)復号したビット・パターン信号DECPATN(以下単にDECPATNという)で、データ符号化装置1におけるDECPATNに相当するもの
(4)復号結果が何ビットかを示す信号DECNUM(以下単にDECNUMという)で、データ符号化装置1におけるDECNUMに相当するもの
図14に示すrun=1の復号テーブルは、CODEが“0”“1”の2種類に対応する各出力が記載されている。この復号テーブルは、図8のrun=1の符号化テーブルに相当するもので、符号化テーブル中のDECBITに相当するものが、この復号テーブルではCODEとなっている。図15に示すrun=2の復号テーブルは、同様に図9のrun=2の符号化テーブルに相当するものとなっている。また、図16に示すrun=4の復号テーブルでは、図10のrun=4の符号化テーブルに相当し、図17に示すrun=8の復号テーブルは、図11のrun=8の符号化テーブルに相当している。なお、各復号テーブルにおける各数値も、符号化テーブルと同様に、各数値の右端側から入力し、出力する表示となっている。
【0118】
デコードバッファ部13は、4ビット(この実施例の場合)以下のDECPATNとDECNUMを直接的にストアし、それぞれデコードバッファ部13内のPATNREG(以下単にPATNREGという)とナンバーレジスタNUMREG(以下単にNUMREGという)にストアする。そして、デコードバッファ部13の出力がqビット幅の場合、デコードバッファ部13は、1回デコード・データを出力する度にストアしたNUMREGからqを減じる。そして、NUMREGがqより小さくなったら、DECREQをアクティブにして、新たなデータのデコード要求を発する。また、NUMREGが5以上のときは、信号SWで定まる優勢シンボルをデコード出力として出力する。一方、NUMREGが4以下になったら、PATREGの値を出力する。
【0119】
例えば、図17の上から5番目のCODE“00101”が復号テーブル部12に入力された場合、DECNUM=8、DECPATN=“0010”がデコードバッファ部13に入力されてくる。このとき、信号SWが「0」となっていたとし、出力を2ビット単位(これはq=2に相当)で行うとした場合、最初の2回の出力は優勢シンボルを出力すればよい。この場合SW=0なので、優勢シンボルは“0”である。したがって、“0000”を出力する。この4ビットを出力した時点で、NUMREGは4(=8−4)になっている。そこで、次のサイクルは、PATNREGの値を、順に出力する。すなわち、“0100”をこの表示の左端側から出力する。
【0120】
復号制御部14は、符号化制御部5と同じ状態遷移表を保有している。そして、状態の初期値は、SS1であり、FAILとDECNUMにより、次の遷移先が決定され、DECREQがアクティブのとき、その遷移先へ遷移する。
【0121】
以上のように構成されるデータ復号化装置10は、先に示したデータ符号化装置1と逆のアルゴリズムによって動作する。なお、このデータ復号化装置10は、デコードバッファ部13の出力状態によって制御されるものとなっている。すなわち、デコードバッファ部13のNUMREGが出力ビット幅qより小さくなると、DECREQがストリーム切り出し部11と復号制御部14へ出力される。ストリーム切り出し部11は、そのDECREQにより復号済みビットをそのLENGTH分廃棄する
先の例のrun=8でCODE“00101”の場合、NUMREGが「8」から「4」へ、「4」から「2」、「2」から「0」へと下がる。この「2」から「0」へ下がったときに、DECREQが発生する。そして、LENGTHが「5」であるので、CODEから復号済みの5ビットを廃棄する。このため、ストリーム切り出し部11内のCODEには、未復号ビットが最下位または最上位にきて、次の復号に備える。一方、復号制御部14では、run=8、DECNUM=8で、FAIL=1なので、状態SS7へ遷移する。このため、run=8に相当するTABLE=3を復号テーブル部12に向けて出力する。
【0122】
この結果、復号テーブル部12は、図17のテーブル番号「3」であるrun=8の復号テーブルを準備する。そして、入力してくるCODEからLENGTH、DECNUM、DECPATNおよびFAILが確定し、出力される。例えば、そのCODEの最初が“0”であれば、CODE“0”であることが確定し、LENGTH=1、DECNUM=8、DECPATN=“0000”、FAIL=「0」を出力する。一方、CODEが“01011”の場合、CODEの最初が“1”であるので、まだ確定せず、次の“1”でも、3番目の“0”でも、4番目の“1”でも確定しない。しかし、5番目の“0”が入った段階で“01011”であることが確定する。この確定によって、LENGTH=5、DECNUM=4、DECPATN=“0100”、FAIL=1がそれぞれ出力される。このようにして、順次、復号されていく。
【0123】
このデータ復号化装置10は、データ符号化装置1と同様に、本発明の基本的プロセスに基づく復号に比べると、▲1▼段階的な復号によるバッファ容量の減少化▲2▼信号の性質にあった予測ビット長runの変更▲3▼復号テーブルによる復号速度の向上という各種の有利な効果を有するものとなる。
【0124】
次に、以上のようなデータ符号化装置1やデータ復号化装置10をマルコフモデル化のような条件付き符号化や条件付き復号化を行う場合に適用した、本発明の第2の実施の形態について説明する。
【0125】
まず、条件付き符号化を行うためのデータ符号化装置を図18に基づいて説明する。なお、説明に当たり、データ符号装置1と同一部材および同一信号には、同一符号および同一名称を付し、説明を省略または簡略化する。
【0126】
このデータ符号化装置20は、ビット列分解部2と、符号化テーブル部3と、ストリーム生成部4と、データ符号化装置1の符号化制御部5内の状態遷移表と同じ表を有する状態遷移部21と、マルコフモデル等により生成される符号化条件を入力し、その条件毎に現在の状態の信号を状態遷移部21に与え、符号化後に次の状態の信号を入力し、その符号化条件の状態を記憶しておく状態記憶部22とから主に構成される。すなわち、条件付き符号化を行うためには、データ符号化装置1の符号化制御部5の状態を条件毎に管理することになる。
【0127】
したがって、マルコフモデルのような条件付き符号化を行うときは、図18に示す構成とし、条件をインデックスとして、状態記憶部22から該当する状態を取り出し、その状態を図12に示した状態遷移表により遷移させ、次の状態を再び状態記憶部22の元の番地にストアしておけば、条件毎に、状態を管理できることとなる。したがって、予測ビット長run等のパラメータも条件毎に個別に設定できることとなる。なお、マルコフモデル化する場合、ビット列分解部2には、各符号化条件毎に切り換えるバッファが複数必要となるが、この実施の形態では、予測ビット長runの数ではなく、より小さい固定の区切りビット数pで段階的に符号化しているので、そのバッファの容量はそれ程大きくならず、実用面で適したものとなっている。
【0128】
次に、条件付き復号化を行うためのデータ復号化装置30を図19に基づいて説明する。なお、説明に当たり、データ復号化装置10と同一部材および同一信号には、同一符号および同一名称を付し、説明を省略または簡略化する。
【0129】
このデータ復号化装置30は、ストーム切り出し部11と、復号テーブル部12と、デコードバッファ部13と、データ復号化装置10の復号制御部14内の状態遷移表と同じ表を有する状態遷移部31と、マルコフモデル等により生成される復号条件を入力し、その条件毎に現在の状態の信号を状態遷移部31に与え、復号後に次の状態の信号を入力し、その復号条件の状態を記憶しておく状態記憶部32とから主に構成される。
【0130】
なお、デコードバッファ部13は、復号条件が入力し、その条件毎に個別に管理されるものとなっている。このため、マルコフモデルのような条件付き復号化の場合、バッファとして非常に大きなものが必要になる。しかし、本実施の形態のデータ復号化装置30では、先に示したように段階的な復号を行うので、各バッファは小さいものでも十分対応でき、マルコフモデルのような条件付きの復号化でもデコードバッファ部13はそれ程大きな容量を必要としなくなる。
【0131】
このデータ復号化装置30においては、状態遷移を条件毎に個別に管理する点で、データ符号化装置20と同様である。ただし、このデータ復号化装置30の場合は、上述したようにさらにデコードバッファ部13も個別に管理しなければならない。このため、デコードバッファ部13は、NUMREG、PATNREGに相当するレジスタを有り得る条件数分内蔵し、復号条件によって切り換えるものとなっている。
【0132】
以上のような、本発明の第2の実施の形態の、条件付き符号化および復号化を行うデータ符号化装置20および符号化方法ならびにデータ復号化装置30および復号化方法は、先に示した第1の実施の形態のデータ符号化装置1やデータ復号化装置10の場合と同様な効果を有する。加えて、マルコフモデルのような条件付きの符号化や復号化が行え、圧縮率が高くなり、復号効率も良くなる。しかも、マルコフモデル化等の場合の大きな障害となるバッファ容量の大幅な増大という問題を防止でき、実用化に適したものとなる。
【0133】
なお、上述の各実施の形態は、本発明の好適な実施の形態の例であるが、これに限定されるものではなく、本発明の要旨を逸脱しない範囲において、種々変形実施可能である。例えば、予測が当たったときに出力する符号語としては“0”ではなく“1”とし、予測がはずれたときは“1”ではなく0”としたり、予測が当たったときは優勢シンボルを出力し、予測がはずれたときは劣勢シンボルを出力するようにしても良い。
【0134】
また、新減少予測ビット数を元の予測ビット数の1/2ではなく、1/3や1/4等にしたり、元の予測ビット数から所定数を差し引いた数等とすることができる。一方、新増加予測ビット数も元の予測ビット数の2倍ではなく、3倍や4倍等にしたり、元の予測ビット数に所定数を加えた数等とすることができる。なお、新増加予測ビット数を無制限とせず、所定の値、例えば256ビット等、2の倍数を最大値とするようにしても良い。また、新減少予測ビット数の最小値としては1ではなく、2や3等他の数値としても良い。
【0135】
また、データ符号化装置1,20やデータ復号化装置10,30をハード構成ではなく、ソフトウェアで対応するようにしても良い。すなわち、本発明のデータ符号化方法やデータ復号化方法をすべてソフトウェアで対応したり、例えば、データ符号化方法はソフトウェアで対応し、データ復号化方法は、先に示したデータ復号化装置10,30等のハードで対応するようにしても良い。
【0136】
また、本発明はいわば予測ランレングス符号化方式とも言えるものであるが、この予測ランレングス符号化方式は、2値の系列データ以外に多値系列についても適用することができる。すなわち、多値系列のデータを工夫によって2値のビット列として扱うようにすれば本発明の予測ランレングス符号化方式および復号化方式を適用することができる。例えば、ビット・プレーンに分けて、各ビット・プレーンをこの予測ランレングス符号化方式で符号化するようにしても良い。また、最上位ビットからプレーン毎にこの予測ランレングス符号化方式にて符号化を行い、“1”が出現した時点で続く下位ビットを直接ストリームに出力するようにしても良い。
【0137】
また、この予測ランレングス符号化方式を多値系列に適用する方式としては、ビット・プレーンではなくレベル・プレーン、例えばシンボルが8ビットの場合、256のレベル・プレーンに分けて行う方法もある。例えば、入力シンボルをグループに分け、グループ番号をこの予測ランレングス符号化方式で符号化する方法が考えられる。具体的には、例えば、入力シンボルを図20に示すように、グループ分けし、まず入力シンボルがグループ番号0か0以外かを示す判定ビットをこの予測ランレングス符号化方式で符号化する。もし入力シンボルが0ならこのシンボルの符号化を完了するが、そうでない場合はさらにグループ番号が1か1以外かを示す判定ビットをこの予測ランレングス符号化方式で符号化する。このようにして、グループ番号が確定するまで、判定ビットを予測ランレングス符号化方式で符号化し、確定したグループ番号が2以上の場合は、必要とする付加ビットを直接ストリームに出力する。この方法は、グループ番号が確定した時点で、上位の判定ビットの符号化を行わないので、処理速度が向上する。
【0138】
以上のような、多値系列への本発明の適用は、データ符号化の場合に限らず当然のことながら、データ復号化の場合にも同様なアルゴリズムによって適用することができる。
【0139】
【発明の効果】
以上説明したように、本発明のデータ符号化方法およびデータ符号化装置では、QMコーダ並みの符号化効率が得られる一方、符号化速度がQMコーダに比べ非常に速いものとなる。このため、現在使用されている各種の2値ビット列圧縮方式の中で最も実用性の面で優れたものとなる。しかも、段階的な符号化を行う場合は、バッファの容量を減少させることができ、マルコフモデル化等へ条件付き符号化に際し特に有利となる。また、符号化テーブル使用の場合は、符号化の速度を向上させることができる。
【0140】
また、本発明のデータ復号化方法およびデータ復号化装置では、同様に、QMコーダ並みの伸長効率が得られる一方、復号化速度がQMコーダに比べ非常に速いものとなる。このため、現在利用されている各種の2値ビット列復号方式の中で、実用上最も優れたものとなり、利便性が向上する。しかも、段階的な復号化を採用した場合は、バッファの容量を減少させることができ、マルコフモデル化等の条件付き復号化に際し特に有利となる。また、復号テーブル使用の場合は、復号化の速度を向上させることができる。
【図面の簡単な説明】
【図1】本発明の基本原理となるアルゴリズムの概要を説明するための図で、注目系列と予測ビット数runとの関係を示す図である。
【図2】本発明の基本原理となるアルゴリズムの概要を説明するための図で、図1の注目系列を分割した状態を示す図である。
【図3】本発明の基本原理となるアルゴリズムの概要を説明するための図で、図2の前半部注目系列をさらに分割した状態を示す図である。
【図4】本発明の前提となる基本的な符号化プロセスを説明するためのフローチャートで、符号化メインルーチンを示すフローチャートである。
【図5】本発明の前提となる基本的な符号化プロセスを説明するためのフローチャートで、符号化サブルーチンを示すフローチャートである。
【図6】本発明の前提となる基本的なデータ符号化方法による圧縮率と符号化時間を示す図である。
【図7】本発明のデータ符号化装置の第1の実施の形態の構成を示すブロック図である。
【図8】図7のデータ符号化装置の符号化テーブル部内の符号化テーブルを示す図で、予測ビット長が「1」の場合のテーブルを示す図である。
【図9】図7のデータ符号化装置の符号化テーブル部内の符号化テーブルを示す図で、予測ビット長が「2」の場合のテーブルを示す図である。
【図10】図7のデータ符号化装置の符号化テーブル部内の符号化テーブルを示す図で、予測ビット長が「4」の場合のテーブルを示す図である。
【図11】図7のデータ符号化装置の符号化テーブル部内の符号化テーブルを示す図で、予測ビット長が「8」の場合のテーブルを示す図である。
【図12】図7のデータ符号化装置の符号化制御部内の状態遷移表を示す図である。
【図13】本発明のデータ復号化装置の第1の実施の形態の構成を示すブロック図である。
【図14】図13のデータ復号化装置の復号テーブル部内の復号テーブルを示す図で、予測ビット長が「1」の場合のテーブルを示す図である。
【図15】図13のデータ復号化装置の復号テーブル部内の復号テーブルを示す図で、予測ビット長が「2」の場合のテーブルを示す図である。
【図16】図13のデータ復号化装置の復号テーブル部内の復号テーブルを示す図で、予測ビット長が「4」の場合のテーブルを示す図である。
【図17】図13のデータ復号化装置の復号テーブル部内の復号テーブルを示す図で、予測ビット長が「8」の場合のテーブルを示す図である。
【図18】本発明のデータ符号化装置の第2の実施の形態の構成を示すブロック図である。
【図19】本発明のデータ復号化装置の第2の実施の形態の構成を示すブロック図である。
【図20】本発明のアルゴリズムを多値系列データに適用する場合の1列を説明するための図で、入力シンボルを複数のグループに分けた状態を示す図である。
【図21】従来の算術符号型のエントロピー符号器であるQMコーダの構成を示す図である。
【図22】図21のQMコーダの動作を示すフローチャートである。
【符号の説明】
1 データ符号化装置
2 ビット列分解部
3 符号化テーブル部(符号化部の一部)
4 ストリーム生成部
5 符号化制御部(符号化部の一部)
10 データ復号化装置
11 ストリーム切り出し部
12 復号テーブル部(復号化部の一部)
13 デコードバッファ部
14 復号制御部(復号化部の一部)
CODE 復号予定の符号語信号(符号化されたデータ)
DECBIT 圧縮ビット列を示す信号
DECNUM デコードすべきビット数を示す信号
DECPATN デコードすべきパターンを示す信号
FAIL 予測の当たり外れを示す信号(フラグ)
LENGTH 圧縮ビット列のビット長および復号されたビット長を示す信号
RUN 予測ビット長を指示する信号
SW 優勢シンボルを指示する信号
TABLE 符号化テーブルや復号テーブルのテーブル番号を指定する信号
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a data encoding method for compressing binary information as it is into a binary bit string, compressing the binary information, converting a binary or higher multi-value information source into a binary bit string, and the binary encoding The present invention relates to a data encoding device, a data decoding method for decompressing compressed binary data, and a data decoding device.
[0002]
[Prior art]
Conventionally, what is called an arithmetic coding method is known in the world of information theory that handles binary signals consisting of “0” and “1”. This arithmetic coding method is an entropy coding method, and has essentially the property of lossless coding (lossless). The principle is a reorganization of an ideal encoding method for a memoryless information source known as Elias encoding into a practical form. In other words, the arithmetic code means that the corresponding section on the straight line of “0” and “1” is divided into unequal lengths according to the occurrence probability of each symbol, the target symbol sequence is assigned to the corresponding partial section, and recursion is performed. In particular, the coordinates of the points included in the section obtained by repeating the division are expressed as binary decimal numbers that can be distinguished from at least other sections, and are directly used as codes.
[0003]
Compared to a block code that associates a specific codeword with a finite number of information source symbols, this arithmetic coding method requires less hardware, such as the size of the encoder, for example, the required memory, and can be expected to be highly efficient. Further, there are advantages such as easy adaptive coding. For this reason, in the world of information theory that handles binary signals, this arithmetic coding method can be compressed to a level closest to the entropy of the information, and is said to be the most efficient coding method. Note that this arithmetic coding method is particularly suitable for coding of a Marcore information source.
[0004]
As this arithmetic coding method, a Q coder, an arithmetic code type MEL code, a Mini-Max coder, and the like have been proposed. A system called QM coder is known as an improvement of these arithmetic codes. This QM coder is commonly used in both the color still image coding standard (JPEG) and the binary image coding standard (JBIG). Note that this QM coder is a code for a binary information source, and when encoding a multi-value information source such as JPEG, pre-processing for binarizing the multi-value information source is required. In such a case, although the number of binary symbols to be encoded increases, it can be converted into a binary sequence without increasing the amount of information as a multilevel information source.
[0005]
The mechanism of this QM coder is described in detail in the specifications of JPEG and JBIG. Here, for the purpose of comparison with the present invention described later, an outline thereof will be briefly described based on FIG. The configuration of the arithmetic decoding type entropy decoder is substantially the same as the configuration of the entropy encoder, and thus the description thereof is omitted here.
[0006]
The QM coder 101 serving as an arithmetic code type entropy encoder includes an arithmetic operation unit 102 and an occurrence probability generation unit 103 that functions as a state memory. In this occurrence probability generation means 103, a state parameter table necessary for determining the symbol occurrence probability required for encoding is written. The state parameter is specified by the input state signal 106. Then, the occurrence probability calculation parameter of the occurrence probability generation unit 103 is output to the arithmetic operation unit 104 with respect to the state parameter table specified by the state signal 106.
[0007]
The arithmetic operation unit 102 performs entropy encoding based on the occurrence probability input in this way, compresses the input data 104 into encoded data 105, encodes it, and outputs it. Then, the occurrence probability for the state signal is recalculated based on the value of the input data 104, and is input to the occurrence probability generation means 103 as a calculation parameter update value. This update result is stored in the table as the occurrence probability of the next data, so that the compression efficiency of the QM coder 101 is improved. Note that the state signal 106 is input to the occurrence probability generation unit 103. This is, for example, reference pixel data obtained by a technique called a Markov model, and is a signal used to increase the compression rate.
[0008]
The operation of the QM coder configured in this way will be described based on the flowchart of FIG. First, 0xFFFF is assigned to the register A in the QM coder 101, and 0x0000 is assigned to the register C. Also, an index ST for probability estimation is initialized (step S100). Next, the encoding target symbol (1 bit) is taken in (step S101). Then, it is determined whether the captured symbol is a dominant symbol or an inferior symbol (step S102). If it is a dominant symbol, the process proceeds to step S103, and if it is an inferior symbol, the process proceeds to step S106.
[0009]
The probability estimation table LSZ is referred to by the index ST, the occurrence probability of the inferior symbol is obtained, and the occurrence probability of the dominant symbol is obtained by subtracting it from the register A, and the value is substituted into the register A (step S103). Thereafter, it is checked whether the most significant bit of the register A is “1” (step S104). If “1”, the process proceeds to step S105, and if “0”, the process proceeds to step S114. If “1”, the probability ST table NMPS is referred to by the index ST, and the index ST for encoding the next symbol is obtained (step S105).
[0010]
In step S102, when the symbol is an inferior symbol, the probability estimation table LSZ is referred to by the index ST to determine the occurrence probability of the inferior symbol, and is substituted into the register A (step S106). Thereafter, the value of register A is added to register C (step S107). Then, the probability estimation table SWITCH is referred to by the index ST (step S108). When this is "1", the process proceeds to step S109, and the dominant symbol is changed.
[0011]
On the other hand, in step S110, the index ST for encoding the next symbol is obtained by referring to the probability estimation table NLPS by the index ST. In step S111, both the register A and the register C are shifted left by 1 bit. By this left shift, the most significant bit overflowing from the register C is output as a code word (step S112). In step S113, it is checked whether the most significant bit of the register A is “1”. If “1”, the process returns to step S111 to repeat the shift. If the most significant bit is “0”, the process goes to step S114, and if the encoded symbol is the last symbol, the process ends. Otherwise, the process returns to step S101.
[0012]
In this way, the QM coder 101 compresses and encodes a binary bit string input using the probability estimation tables LSZ, NMPS, and NLPS.
[0013]
[Problems to be solved by the invention]
However, although the arithmetic coding system such as the QM coder 101 has good coding efficiency, the coding speed is slow because coding is performed bit by bit as shown in the flowchart of FIG. For this reason, in practical terms, the Lembel / jib (= LZ) encoding method is dominant. However, the encoding efficiency of this LZ system is considerably lower than that of the arithmetic encoding system. As described above, there is no conventional technique in which the coding efficiency is as good as that of the arithmetic coding system and the code acceleration is as fast as that of the LZ system. Also, many encoding targets such as image encoding and universal encoding are multi-value information sources, and efficient compression and expansion of multi-value information sources are desired.
[0014]
The present invention achieves a coding and decoding efficiency substantially the same as that of an arithmetic coding system and greatly improves the coding and decoding speed, and a new data coding method and data code close to the speed of an LZ system It is an object to provide an encoding device, a data decoding method, and a data decoding device.
[0015]
[Means for Solving the Problems]
In order to achieve this object, in the data encoding method according to claim 1, when a binary bit string consisting of “0” and “1” is input, either “0” or “1” is set as a dominant symbol. One of the other symbols is an inferior symbol, and it is predicted that the number of dominant symbols will be n, and a prediction setting step for setting the n as the number of prediction bits, and a prediction sequence consisting of the input number of prediction bits is predicted. When one of the two hits, the code word “0” or “1” is output and encoded as a prediction hit signal, and the next n bit strings are encoded. The word “0” or “1” is output as a mispredicted signal, and the input bit string is delimited by a number of delimiter bits smaller than the n predicted bits. A prediction result encoding step that collectively encodes the patterns of the dominant symbols including the pattern if the inferior symbol is included in the divided pattern, and the prediction is deviated a predetermined number of times. Similarly, the prediction setting step and the prediction result encoding step are recursively repeated with the prediction bit number set to a new reduced prediction bit number smaller than n.
[0016]
In this way, when n dominant symbols are predicted and predicted, n bits are displayed as a signal per prediction, etc., and the compression efficiency increases and the coding speed increases. Become. In addition, if the prediction is lost, the number of prediction bits is decreased and the next prediction is performed. Therefore, even if the prediction is lost, the compression efficiency and the coding speed are not reduced so much. In addition, since encoding is performed step by step with a smaller number of delimiter bits than the predicted number of bits, the buffer for encoding can be reduced.
[0017]
According to the second aspect of the present invention, when a binary bit string consisting of “0” and “1” is input, either “0” or “1” is set as the dominant symbol, and the other is set as the inferior symbol. And a prediction setting step that predicts that the number of dominant symbols will be n, and sets the n as the number of prediction bits, and a codeword when the prediction is made for a target sequence of n input bit strings. As one of the signals, “0” or “1” is output and encoded as a prediction hit signal, and the next n bit strings are encoded. The other signal of 1 ″ is output as an unpredicted signal, and the input bit string is delimited by a number of delimiter bits smaller than the n number of predicted bits, which is inferior to the delimited pattern. A prediction result encoding step that collectively encodes the pattern of the dominant symbols including the pattern if the symbol is included, and when the prediction hits the specified number of times, n prediction bits The same prediction setting process and prediction result encoding process are repeated as a larger number of new increase prediction bits.
[0018]
In this way, when n dominant symbols are predicted and predicted, n bits are displayed as a signal per prediction, etc., and the compression efficiency increases and the coding speed increases. Become. Moreover, the more successful the prediction, the higher the data compression efficiency and the higher the encoding speed. In addition, since encoding is performed step by step with a smaller number of delimiter bits than the predicted number of bits, the buffer for encoding can be reduced.
[0019]
According to a third aspect of the present invention, in the data encoding method according to the first aspect, when the prediction hits the specified number of times, the prediction bit number is set to a new increase prediction bit number larger than n. For this reason, the more successful the prediction, the higher the compression efficiency and the higher the encoding speed.
[0020]
Furthermore, in the invention according to claim 4, in the data encoding method according to claim 2 or 3, the specified number of times is set to twice, and the newly increased predicted bit number is set to twice the predicted bit number. For this reason, since the prediction hits continue, that is, the number of predicted bits is changed after a certain tendency starts to appear, the data compression efficiency can be increased. Moreover, since the value is twice that of the previous value, the number of consecutive dominant symbols is the same as the number of consecutive dominant symbols, and the probability that the next prediction will be hit increases. As a result, the compression efficiency can be increased and the encoding speed can be increased.
[0021]
Furthermore, in the data encoding method according to claim 5, in the data encoding method according to claim 1, when the number of newly predicted decrease bits is 1 and the bit is an inferior symbol, the conventional inferior symbol is dominant in the subsequent encoding. A conventional dominant symbol is encoded as an inferior symbol. As a result, an appropriate prediction can be made according to the actual state of the input data, and a high coding speed and efficiency can be maintained.
[0022]
Furthermore, in the invention according to claim 6, in the data encoding method according to claim 1, the number of delimiter bits is a fixed predetermined value p, and when n ≦ p, the code is collectively The number of bits to be converted is n. As a result, when the number of predicted bits is larger than the fixed predetermined value p, encoding can be performed in stages, and the buffer at the time of encoding can be reduced.
[0023]
In addition, according to the seventh aspect of the present invention, in the data encoding method according to the sixth aspect, the predetermined value is 4. For this reason, it is possible to reduce the buffer at the time of encoding without significantly reducing the encoding speed, to reduce the buffer in the decoding system corresponding to this system, and to increase the decoding speed.
[0024]
In addition, in the invention according to claim 8, when a binary bit string consisting of “0” and “1” is input, either “0” or “1” is used as a dominant symbol, and the other is inferior. A code word when the prediction sequence for predicting n dominant symbols and setting the n as the number of prediction bits, and when the prediction is made for the attention sequence consisting of the input prediction bit number As one of the signals, “0” or “1” is output and encoded as a prediction hit signal, and the next n bit strings are encoded. A prediction result encoding step that outputs and encodes one of the other signals as an out-of-prediction signal, and in this encoding step, encoding corresponding to a pattern of bits to be encoded The data is encoded based on a pre-stored encoding table, and when the prediction deviates a predetermined number of times, the number of prediction bits is set to a new reduced prediction bit number less than n and the same prediction setting step and prediction result code The process is recursively repeated.
[0025]
In this way, when n dominant symbols are predicted and predicted, n bits are displayed as a signal per prediction, etc., and the compression efficiency increases and the coding speed increases. Become. In addition, if the prediction is lost, the number of prediction bits is decreased and the next prediction is performed. Therefore, even if the prediction is lost, the compression efficiency and the coding speed are not reduced so much. In addition, since the encoding process is performed using a table prepared in advance, the speed of the encoding process is improved.
[0026]
According to a ninth aspect of the present invention, in the data encoding method according to the eighth aspect, encoded data corresponding to a pattern of 8 bits or less is written in the encoding table, and an encoding corresponding bit exceeding 8 bits. Is encoded without using an encoding table. Thus, since the encoding table is prepared for a small pattern of 8 bits or less, the encoding speed can be greatly improved without increasing the memory for the table so much.
[0027]
According to a tenth aspect of the present invention, in a data encoding apparatus for compressing and encoding a binary input bit string consisting of “0” and “1”, either “0” or “1” is dominant. A symbol, one of which is an inferior symbol, and predicts that there are n consecutive dominant symbols, and sets the n as the number of predicted bits, and a bit to be encoded while temporarily storing the input bit string A bit string decomposing unit for outputting numbers and patterns, and a coding table storing coding data corresponding to the pattern of the input bit string, and a signal and bit string indicating the coding table to be selected and inputted from the coding control unit Coding table unit for outputting a predetermined compressed bit string and its bit length from the number of bits and pattern to be encoded input from the decomposition unit A stream generation unit that temporarily buffers the compressed bit string and outputs the fixed bit length, and encodes the predicted number of bits as a newly reduced predicted number of bits less than n when the prediction has deviated a predetermined number of times. When the prediction hits the specified number of times, the encoding control unit sets the prediction bit number as a new increase prediction bit number larger than n.
[0028]
As a result, if the prediction is successful, n bits are displayed as one signal per prediction, and the compression efficiency increases and the encoding speed increases. In addition, since the number of prediction bits is increased as the prediction is successful, the compression efficiency is further increased. In addition, when the prediction is lost, the number of prediction bits is reduced, so that the compression efficiency and the coding speed are not reduced so much even if the prediction is lost. Furthermore, since an encoding table storing encoded data corresponding to the input pattern is prepared and processed, the encoding speed is improved.
[0029]
Furthermore, in the data encoding device according to claim 11, in the data encoding device according to claim 10, the input bit string is delimited by a number of delimiter bits smaller than the n predicted bit numbers, and the delimited pattern is inferior. If a symbol is included, the pattern of dominant symbols including the pattern up to that point is encoded together. For this reason, since encoding is performed step by step with the number of delimiter bits smaller than the predicted bit number, the buffer at the time of encoding can be reduced.
[0030]
According to the twelfth aspect of the present invention, in a data encoding apparatus for compressing and encoding a binary input bit string consisting of “0” and “1”, either “0” or “1” is dominant. A symbol, one of which is an inferior symbol, and predicting that there are n consecutive dominant symbols, and setting the n as a predicted bit number, temporarily storing an input bit string, and n Code that divides the input bit string by the number of delimiter bits smaller than the predicted number of bits, and if the delimited symbol contains an inferior symbol, the code that encodes the pattern of the dominant symbol that has been included so far, including that pattern, collectively And a control section.
[0031]
As a result, if the prediction is successful, n bits are displayed as one signal per prediction, and the compression efficiency increases and the encoding speed increases. Furthermore, since encoding is performed step by step with a smaller number of bits than the predicted number of bits, the buffer at the time of encoding can be made small.
[0032]
The data decoding method according to claim 13, wherein the encoded data is inputted and decoded into a binary bit string composed of “0” and “1”. One of “1” is a dominant symbol, the other is an inferior symbol, and the prediction result of predicting that there are n dominant symbols (n is an integer of 1 or more) is “0” and “1”. And a decoding step for decoding the code word, and the input step is delimited by a delimiter bit number smaller than n prediction bits. In the decoding process, when the input codeword has a value per prediction, n dominant symbols are decoded in succession. Symbol Is included, the portion of the dominant symbol that has continued until that point, including the delimited portion, is decoded together, and if the number of dominant symbols that are greater than n continues when a predetermined number of consecutive predictions occur, a new prediction is made. Like to do.
[0033]
As a result, when the prediction is correct, n dominant symbols can be decoded with one codeword, so that the decompression efficiency is increased and the decoding speed is increased. Moreover, the more predictable, the greater the number of dominant symbols that can be decoded with one codeword, so that the decompression efficiency becomes higher and the decoding speed becomes faster. Furthermore, when the prediction is off, decoding is performed with a break smaller than the predicted number of bits, so that the decoding speed is further increased.
[0034]
Furthermore, in the data decoding method according to claim 14, in the data decoding method in which encoded data is input and decoded into a binary bit string composed of “0” and “1”, “0” or “ One of “1” is a dominant symbol, the other is an inferior symbol, and the prediction result of predicting that there are n dominant symbols (n is an integer of 1 or more) is “0” and “1”. An input step of inputting a code word represented by a binary bit string consisting of: and a decoding step of decoding the code word. In the input step, encoded data divided by a predetermined number In the decoding process, decoding is performed based on a decoding table in which a bit pattern to be decoded is specified from the input codeword and the number of prediction bits, and when the number of predictions continues for a predetermined number of times, there are more than n. number When the dominant symbol continues, the prediction result newly input is input, and when the misprediction continues for the prescribed number of times, the prediction result newly predicted when less than n dominant symbols continue is input. Yes.
[0035]
As a result, when the prediction is correct, n dominant symbols can be decoded with one codeword, so that the decompression efficiency is increased and the decoding speed is increased. Moreover, the more predictable, the greater the number of dominant symbols that can be decoded with one codeword, so that the decompression efficiency becomes higher and the decoding speed becomes faster. Further, since the number of predicted bits decreases when the prediction is lost, the decoding efficiency does not decrease so much even if the prediction is lost. Moreover, since the decoded bits are decoded based on a previously stored decoding table, the decoding speed can be increased.
[0036]
According to a fifteenth aspect of the present invention, in the data decoding method according to the fourteenth aspect, in the input step, data encoded by being divided by a delimiter bit number smaller than n prediction bits is input, and the decoding step In the case of a misprediction, if an inferior symbol is included in the segmentation, the portion of the dominant symbol that has continued so far including the segmented portion is decoded together.
[0037]
As a result, decoding is performed with a bit number smaller than the predicted bit number, so that the buffer to be used can be reduced and the decoding speed can be increased.
[0038]
Furthermore, in the invention according to claim 16, in the data decoding apparatus for inputting the code bit that becomes the encoded data and decoding it into a decoded bit consisting of a binary bit string consisting of "0" and "1", A decoding control unit for setting a code bit dominant symbol and n prediction bit lengths when either “0” or “1” is a dominant symbol and any other is an inferior symbol, and an input codeword A decoding table unit having a decoding table in which the decoding pattern corresponding to each prediction bit length is represented, and the decoding pattern from the decoding table unit and the number of bits to be decoded are input and stored, and are output every predetermined number of bits. A decoding buffer unit, and when the input code bit is a signal per prediction, the dominant symbol is decoded and the signal per prediction continues for a predetermined number of times. When is changed the prediction bit length of the number larger than n pieces. For this reason, when the prediction is correct, n dominant symbols can be decoded with one codeword, so that the decompression efficiency is increased and the decoding speed is increased. Moreover, the more predictable, the greater the number of dominant symbols that can be decoded with one codeword, so that the decompression efficiency becomes higher and the decoding speed becomes faster. In addition, since the decoding process is performed based on a table in which the decoding pattern corresponding to the input code word is previously expressed, the decoding speed is further increased.
[0039]
In the invention of claim 17, it is predicted that either “0” or “1” is a dominant symbol, and the other is an inferior symbol, and n symbols (n is an integer of 1 or more) continue. A decoding control unit for setting a prediction bit length of a code bit and a dominant symbol in a decoding device that decodes a code bit represented by a binary bit string consisting of “0” and “1”; A decoding unit that inputs a bit and outputs a decoding bit according to the value of the code bit; and a decoding buffer unit that inputs the decoding bit, temporarily holds it, and outputs it as a decoding bit. When decoding is performed with a smaller number of delimiter bits than the predicted bit length, the capacity of the decode buffer unit is reduced, and when the prediction result hits a predetermined number of times continuously, When the measured bit length is changed to a number larger than n, and when the prediction result is out of the prescribed number of times continuously, the predicted bit length is changed to a number smaller than n, and when the predicted bit length becomes a predetermined value, The dominant symbol and the inferior symbol are reversed.
[0040]
For this reason, when the prediction is correct, n dominant symbols can be decoded with one codeword, so that the decompression efficiency is increased and the decoding speed is increased. Moreover, the more predictable, the greater the number of dominant symbols that can be decoded with one codeword, so that the decompression efficiency becomes higher and the decoding speed becomes faster. In addition, when the prediction is lost, the prediction bit length is shortened, and when the predetermined length is reached, the dominant symbol and the inferior symbol are reversed, so that it is possible to prevent the prediction from being lost and to maintain high decoding efficiency. At the same time, the decoding speed can be further improved.
[0041]
Furthermore, in the invention according to claim 18, in the data decoding device according to claim 17, the decoding unit has a decoding table in which a decoding pattern corresponding to the input code word is tabulated for each prediction bit length. A decoding table unit is provided. For this reason, since the decoding process is performed based on a table in which the decoding pattern corresponding to the input code word is previously expressed, the decoding speed is further increased.
[0042]
In the data encoding method and data encoding apparatus of the present invention, when a binary bit string is input, “0” or “1” is defined as a dominant symbol, and n dominant symbols are predicted to be consecutive. When the prediction is successful, either “0” or “1” is output as the code word, and the encoding is completed. In the case of deviation, either “0” or “1” is output, the attention sequence is divided, and the signal state of each divided sequence is confirmed and encoded in the same manner as described above. . Then, the same division and prediction are repeatedly encoded until a prediction is made or the division reaches a predetermined number of bits.
[0043]
In encoding based on such a principle, in the present invention, a bit string determined by a predicted bit length n is not encoded at a time, but is encoded in several stages. For this reason, even if the predicted bit length n increases, it is not necessary to increase the capacity of the decode buffer unit. In the present invention, an encoding table that pre-expresses an output signal for an input signal is provided for encoding. As a result, the encoding speed is improved.
[0044]
Moreover, in the data decoding method and data decoding apparatus of the present invention, decoding is performed using an algorithm reverse to that of the data encoding method and data encoding apparatus described above. Therefore, the decoding speed can be increased and the capacity of the decoding buffer unit can be reduced.
[0045]
DETAILED DESCRIPTION OF THE INVENTION
Examples of embodiments of the present invention will be described below with reference to FIGS. The outline of the algorithm as a premise of the present invention will be described with reference to FIGS. 1 to 3, and the basic encoding method and the like as the basis of the present invention will be described with reference to FIGS.
[0046]
In the algorithm of the present invention, a binary bit string is targeted for compression, as in the case of a QM coder. First, as an initial value, either “0” or “1” is defined as a dominant symbol, and the number run that is predicted to be continuous is set. If the appearance probability of the input sequence is unknown, it is preferable to set run to 1. Then, encoding is performed according to the following rules. Note that the number run corresponds to the predicted number of bits.
[0047]
As shown in FIG. 1, it is predicted that all the target sequences indicated by run are dominant symbols. When the prediction is successful, “0” is output as a code word, and the encoding of this sequence is completed. If it is off, “1” is output and the next division coding process is executed.
When the prediction is lost, as shown in FIG. 2, the sequence of interest is divided into the first half series and the second half series, and when all the first half are dominant symbols, “0” is output as the code word, and the first half Complete the encoding of the subsequence. When an inferior symbol exists in the first half series, “1” is output as the code word, and the next subdivision process is executed. When encoding of the first half sequence is completed, the sequence of interest is moved to the second half and encoded in the same manner as the first half sequence. For a sequence in which an inferior symbol exists, the sequence is divided as much as possible and the above-described division encoding process is repeated.
[0048]
The division does not necessarily need to be two equal divisions, and may be an unequal division or three or more divisions. Also, when a prediction is made, a dominant symbol is output instead of “0”, and when the prediction is lost, an inferior symbol is output instead of “1”. "May be output.
[0049]
The above is the basic algorithm of data encoding which is the premise of the present invention. Furthermore, in order to follow the change in the appearance probability of the input sequence and improve the encoding efficiency, the following processing may be added.
[0050]
That is, when a series predicted by run is successively hit a predetermined number of times, for example, twice, run is increased by a factor of two. If the prediction continues to be correct, the prediction range may be further expanded. Further, when there is an inferior symbol in the second half of the sequence predicted by run, run may be reduced to 1/4 or the like. This is because when there is an inferior symbol in the latter half, it is determined that many inferior symbols are included in the next series. For this reason, when an inferior symbol exists only in the first half of the sequence predicted by run, a larger value than when there is an inferior symbol in the second half, for example, run may be halved. When run is 1 and it is an inferior symbol, the subsequent input sequence is inverted. That is, the dominant symbol is changed.
[0051]
The encoding process of the present invention is an improvement of the encoding process shown in FIGS. 4 and 5 described below. First, the encoding process will be described. The encoding process before the improvement includes the encoding main routine of FIG. 4 and the encoding subroutine of FIG. Note that the encoding subroutine in FIG. 5 performs recursive reading of a so-called function that calls the same subroutine from the subroutine.
[0052]
First, each step of the encoding main routine of FIG. 4 will be described. Note that the encoding target is an input sequence composed of binary bit strings. First, the prediction initial value run is set and the dominant symbol is selected ("0" or "1") (step S0). Next, 0 is assigned to the local variable ofs and run is assigned to the width (step S1). Here, ofs is a pointer of the array A that is defined in advance for encoding, and indicates the prediction start bit position. Therefore, the initial value is 0. The width is a value indicating how many bits are to be predicted from the bit position indicated by ofs, and here, the initial value run of the prediction is substituted. Thereafter, the input bits are written from A [ofs] to A [width-1] of the predefined array A (step S2). Then, when all elements from A [ofs] to A [width-1] are dominant symbols, the process proceeds to step S4. When at least one inferior symbol is included, the process proceeds to step S5.
[0053]
When the prediction is correct, a prediction hit signal “0” is output as a code word, and the encoding of the sequence taken into the array A is completed (step S4). On the other hand, if the prediction is deviated, a prediction deviation signal “1” is output as a code word (step S5). And it is detected whether width is 1 or more (step S6). If the width is 1 or less, further division is not possible. Therefore, the process proceeds to step S8 without proceeding to the encoding subroutine in step S7. On the other hand, if the width exceeds 1, the encoding subroutine of FIG. 5 is called (step S7).
[0054]
In step S8, the prediction run is reset and, if necessary, the dominant symbol is changed. That is, in this step S8, basically, if the prediction is correct, run is increased, and if it is not, it is decreased. If prediction continues to deviate a predetermined number of times even when run is reduced, the dominant symbol is changed. It should be noted that various methods can be adopted as to how to evaluate the prediction target and the prediction error. For example, when the prediction is lost, it is possible to adopt a method such as immediately reducing the run, or decreasing the run for the first time when the run is continuously deviated twice or more. Furthermore, it is also possible to adopt a method in which the degree of reduction of run is different depending on whether only the first half part series or the second half part series is off or both. Further, it is possible to adopt a method such as drawing a predetermined probability table with a coded bit sequence and setting the next prediction run.
[0055]
When the primary prediction is lost in the encoding main routine, the encoding subroutine shown in FIG. 5 is called in step S7. The arguments passed to the encoding subroutine are ofs and width. Hereinafter, each step of the encoding subroutine will be described.
[0056]
In the encoding subroutine, since the prediction is divided into the first half series and the second half series, the prediction range is halved (step S10). That is, the width received as an argument from the parent routine is halved. Then, in the next step S11, it is checked whether or not all the first half series (from A [ofs] to A [ofs + width-1] in the array) are dominant symbols. If all are dominant symbols, the process proceeds to step S12. If even one inferior symbol exists, the process immediately proceeds to step S14.
[0057]
If all the first half series are dominant symbols, “0” is output as a code word (step S12). Then, the width is added to the pointer ofs indicating the head position of the first half part series to change to indicate the head position of the second half part series. Also, when all the first half series are dominant symbols, there is always an inferior symbol in the second half series, so there is no need to output a codeword “1” indicating that the prediction of the second half series has been lost. Therefore, step S20 described later is skipped, and the process proceeds to step S21.
[0058]
On the other hand, when an inferior symbol exists in the first half series, “1” is output as a code word (step S14). Next, it is checked whether or not the width exceeds 1 (step S15). If it is 1 or less, it cannot be divided any more, so the calling of the child encoding subroutine (step S16) is skipped and the process proceeds to step S17. If the width is 2 or more, it is necessary to further divide the sequence into two and encode each. A child encoding subroutine for that purpose is called (step S16). The child encoding subroutine is exactly the same as the encoding subroutine shown in FIG. That is, here, the same routine (function) is recursively called.
[0059]
When the encoding of the first half sequence is completed by recursive calling of the encoding subroutine, the width set in step S10 is added to the pointer ofs indicating the first position of the first half sequence, and the first half sequence is changed to indicate the first position ( Step S17). Thereafter, it is checked whether or not all the latter half series (from A [ofs] to A [ofs + width-1] in the array) are dominant symbols (step S18). If all are dominant symbols, the process proceeds to step S19. If even one inferior symbol exists, the process immediately proceeds to step S20. If all the latter half series are dominant symbols, “0” is output as the code word (step S19).
[0060]
On the other hand, when an inferior symbol exists in the first half series, “1” is output as a code word (step S20). Next, it is checked whether or not the width exceeds 1 (step S21). In the case of 1 or less, since further division is not possible, step S22 for executing the child encoding subroutine is skipped, and the process returns to the encoding process of the next target sequence. For the latter half of the series, if the width is 2 or more, the series is further divided into two and encoded. Therefore, the same child encoding subroutine as the encoding subroutine shown in FIG. 5 is called (step S22). Encoding of the latter half series is executed by recursive calling of this encoding subroutine.
[0061]
A specific example of the encoding process as described above will now be described. That is, as a specific example of encoding, a case will be described in which an input bit represented as “00000101” is encoded with the prediction initial value run being 8, the dominant symbol being “0”, and so on.
[0062]
First, in step S2 of the encoding main routine of FIG. 4, the above input bits are input from A [0] to A [7]. In step S3, it is determined whether all of A [0] to A [7] are “0”. In the case of the above example, since “1” is included in the bit string, the process proceeds to step S5, and “1” is first output as a code word. In step S6, the width is checked. Since the width is 8 at this time, the process proceeds to the encoding subroutine (step S7).
[0063]
In the encoding subroutine, first, the width is set to 4 of 1/2 in step S10. In step S11, it is checked whether the first half of the input bits, that is, A [0] to A [3] are all zero. In this case, since all are “0”, the process proceeds to step S12 to output “0” as the code word. This completes the encoding of the first half sequence. Subsequently, step S13 is executed, and the process proceeds to the encoding of the latter half series. When all the first half series are “0”, it is clear that “1” is included in the latter half series. Therefore, unless the width is 1 or less in step S21, the latter half sequence must be further divided and encoded. Therefore, the encoding subroutine is called again as a child process in step S22. As pre-processing for that, as described above, in step S13, width is added to ofs, and ofs is set at the head position of the second half series.
[0064]
In step S22, the child encoding subroutine is called with ofs and width as arguments. In step S22 for executing the child encoding subroutine, first, in step S10 of the encoding subroutine shown in FIG. In the next step S11, it is checked whether or not the first half series, that is, A [4] and A [5] are both “0”. In this case, since A [4] is “1”, the process proceeds to the next step S14 to output “1” as a code word. In step S15, it is determined that the width exceeds 1, and the grandchild process is called in step S16. In the grandchild encoding subroutine, the width is set to 1 in step S10. Since A [4] is “1”, the process moves from step S11 to step S14, and the codeword “1” is output. In step S15, since width is 1 or less, step S16 is skipped, and ofs is changed to 5 in step S17. Since A [5] is “0”, the process proceeds from step S18 to step S19, and the codeword “0” is output.
[0065]
Next, the process leaves the grandchild encoding subroutine and returns to step S17 of the child encoding subroutine. Since ofs of the child encoding subroutine is 4 and width is 2, ofs is changed to 6 in step S17. Therefore, in step S18, A [6] and A [7] are checked. In this case, since A [7] is “1”, the process proceeds to step S20 to output the code word “1”. Then, the grandchild encoding subroutine is called again in step S22. In the grandchild encoding subroutine, since A [6] is “0”, the code word “0” is output in step S12. Since width is 1, step S22 is skipped and the process returns to the child encoding subroutine.
[0066]
The process that has returned to the child encoding subroutine further returns to the encoding main routine, and in step S8, the prediction run is reset and the dominant symbol is reset. In this example, the primary prediction is off, but the first half is correct in the secondary prediction, so run is changed from 8 to 4 and the dominant symbol is continuously set to “0”. Note that the setting of the predicted run may be set to be changed when the prediction run is repeated twice.
[0067]
By such an encoding process, the input bit “00000101” becomes an encoded sequence of “10101010”. Therefore, in this case, the 8-bit input sequence is compressed to 7 bits.
[0068]
FIG. 6 shows the compression rate and encoding time when the encoding process as described above is executed. FIG. 6 shows the compression rate and encoding time when this encoding process is used for four types of files, and also shows the compression rate and encoding time of a conventional QM coder for reference. As shown in FIG. 6, in this encoding method, the compression rate is the same as that of the QM coder, and the encoding time is greatly shortened.
[0069]
As for the decoding process, the input codeword is decoded by an algorithm reverse to the encoding process. That is, the decoding process is also composed of a decoding main routine and a decoding subroutine, and is decoded by an algorithm reverse to the encoding.
[0070]
Thus, in the encoding process shown in FIG. 4 and FIG. 5 and the decoding process performed using an algorithm reverse to the encoding process, the compression rate is the same level as that of the conventional QM coder 101, The conversion time and decoding time are greatly shortened. However, in this encoding process and decoding process, since a bit string determined by run, which is the predicted number of bits, is encoded at a time, if the maximum value of run is set large in order to increase the compression rate, the number of runs The problem arises that the buffer for storing the minute bits becomes large.
[0071]
This problem becomes a bigger problem when the state signal 108 shown in FIG. 21 is obtained from Markov modeling because the buffer becomes very large. That is, if run is set to n, the buffer requires n bits, and if m-state Markov modeling is performed, the buffer is required for each state, so the capacity becomes n × m bits. This capacity becomes a size that cannot be ignored as the value of run increases.
[0072]
Further, in the encoding process shown in FIGS. 4 and 5 and a decoding process using an algorithm reverse to the encoding process, each processing time is significantly shortened compared to the QM coder, The decoding subroutine is recursively called to perform encoding and decoding, and this subroutine has a time in the recursive call process.
[0073]
Therefore, in the present invention, a data encoding method or the like that can reduce the decoding buffer and further reduce the encoding and decoding time while utilizing the encoding process and the decoding process shown in FIGS. Has proposed. The proposed embodiment of the present invention will be described below with reference to FIGS.
[0074]
First, an improved data encoding apparatus 1 according to the first embodiment of the present invention will be described with reference to FIG.
[0075]
The data encoding apparatus 1 is an entropy encoding apparatus, and includes a bit string decomposing unit 2 that inputs a binary bit string to be encoded, and an encoding table unit 3 that includes an encoding table for each prediction bit length run. A stream generation unit 4 that temporarily buffers and outputs a variable-length code input from the encoding table unit 3 to a fixed bit width, and a state transition table to be described later. It is mainly comprised from the encoding control part 5 which sets. Here, the encoding table unit 3 and the encoding control unit 5 constitute an encoding unit.
[0076]
The bit string decomposing unit 2 receives the signal RUN indicating the predicted bit length run and the signal SW indicating the dominant symbol from the encoding control unit 5. Here, the signal RUN takes a value from 1 to n (n is the maximum predicted bit length). Further, when the value of the signal SW is “0”, “0” is the dominant symbol, and when the value is “1”, “1” is the dominant symbol, but the reverse is also possible.
[0077]
Further, the bit string decomposing unit 2 outputs a signal DECNUM having the number of bits to be decoded and a signal pattern DECPATN which is a pattern of bits to be decoded to the encoding table unit 3. The signal DECNUM is the total number of the 4 bits and the number of dominant symbols that have continued until then when a 4-bit pattern including the inferior symbols appears in the input bit string. When the signal RUN is less than “4”, the same value as the signal RUN is output. This is because in this embodiment, the delimiter bit number p is set to “4”.
[0078]
In this manner, the bit string decomposing unit 2 performs the signal DECNUM when the input bit string continues for the number of bits specified by the signal RUN and the dominant symbol specified by the signal SW continues, that is, when the prediction is correct. The value of the signal RUN and “0” as the signal pattern DECPATN are output.
[0079]
The encoding table unit 3 incorporates an encoding table as shown in FIGS. 8 to 11, and which table is used is selected by a table number instruction signal TABLE from the encoding control unit 5. Then, the encoding table unit 3 searches the predetermined table based on the signal DECNUM and the signal pattern DECCATN from the bit string decomposing unit 2, and determines a predetermined compressed bit string DECBIT, its bit length LENGTH, and FAIL indicating a prediction hit / fail. Output. The signal TABLE has a one-to-one relationship with the signal RUN.
[0080]
The encoding table of FIG. 8 shows a case where the table number is “0” and the value of the signal RUN is “1”, that is, run is “1”. As shown in FIG. 8, when run is “1”, there are two types of signals. That is, the number of bits to be decoded is one, and there are two types of signal patterns, “0” and “1”. These two types of input signals correspond to two types of signals consisting of a combination of a compressed bit string DECBIT, its bit length LENGTH, and a flag FAIL indicating a predicted out-of-sequence. For example, when the signal DECNUM is “1” and the signal pattern DECCATN is “0”, it is per prediction, the flag FAIL is “0” of the hit signal, the compressed bit string DECBIT is “0”, and the bit length LENGTH is “ 1 ".
[0081]
The encoding table of FIG. 9 shows a case where the table number is “1” and run is 2. Note that the signal pattern DECPATN and the compressed bit string DECBIT of each coding table both indicate signals input from the right side to the left side. In the case of FIG. 9, there are four types of signal forms. The number of bits to be decoded is all two, and there are four types of signal patterns DECPATN: “00”, “10”, “01”, and “11”. When the signal pattern DECCATN is “00”, it means that both of them are prevailing symbols, so the prediction is successful, the flag FAIL is “0” of the hit signal, and the compressed bit string DECBIT at that time is “0”. The bit length LENGTH is “1”. On the other hand, when the signal pattern DECPATN is “10”, the inferior symbol “1” is included, which means that the prediction has been lost. As a result, the flag FAIL is “1” as a disconnect signal, and the compressed bit string DECBIT is initially “1”. Next, since the first half of “10” is “0”, the second prediction of the compressed bit string DECBIT is “0” and “01”. Here, since it is initially unpredictable, there is “1” in the second half. Therefore, “01” is used as it is for the compressed bit string DECBIT.
[0082]
When the signal pattern DECPATN is “01”, the inferior symbol “1” is included, which means that the prediction has been lost. As a result, the flag FAIL is “1” as a disconnect signal, and the compressed bit string DECBIT is initially “1”. Next, since the first half of “01” is “1”, the prediction is again lost, and the second of the compressed bit string DECBIT is “1”. Since the second half of the signal pattern DECPATN “01” is “0”, it is per prediction, and the third bit of the compressed bit string DECBIT is “0”. That is, the compressed bit string DECBIT corresponding to the signal pattern DECCATN “01” is “011”. The bit length LENGTH is “3”. Similarly, the compressed bit string DECBIT for the signal pattern DECCATN “11” is “111”. The correspondence table of the above nine types of signals is shown in FIG.
[0083]
Similarly, FIG. 10 shows the correspondence between 16 types of signals with a table number “2” and a run “4”, and a total of 31 types of signals with a table number “3” and a run “8”. The correspondence is shown in FIG. Note that when run in FIG. 10 is “4”, the value of run is the same as the number of delimiter bits p. Therefore, only the same relationship as in FIGS. In the case of “8”, since the number of delimiter bits is larger than p (p = 4 in this embodiment), the table is slightly changed.
[0084]
Next, the contents of the encoding table of FIG. 11 that is slightly different from the other tables will be described. In this encoding table, there are “8” and “4” bit numbers DECNUM of signals to be decoded. “8” indicates that the first half is all “0000”, and “4” indicates that run is “8” and the inferior symbol “1” comes in the first half.
When the bit number DECNUM (hereinafter simply referred to as DECNUM) of the signal to be decoded is “8” and the signal pattern DECCATN (hereinafter simply referred to as DECCATN) is “0000”, this indicates that it is “00000000”. Therefore, the flag FAIL (hereinafter simply indicated as FAIL) is “0” as the hit signal. The compressed bit string DECBIT (hereinafter simply indicated as DECBIT) is “0”, and the bit length LENGTH (hereinafter simply indicated as LENGTH) is “1”. When DECNUM is “8” and DECCATN is “1000”, it indicates that it is “10000000”, which means that the prediction has been lost, and FAIL becomes “1” as a failure signal. Then, “1” comes to the first of DECBIT. Next, the first half “0000” is per prediction, and “0” comes in the second DECBIT. At this time, since the inferior symbol “1” comes to the latter half “1000”, DECBIT for the four signals in the latter half is not particularly generated.
[0085]
The first half “00” in the second half “1000” is per prediction, and the third DECBIT is “0”. At this time, since the inferior symbol “1” comes to the latter half “10”, DECBIT for the two signals in the latter half is not particularly generated. The first half “0” of the second half “10” is per prediction, and the fourth DECBIT is “0”. In this case, it is natural that there is “1” at the end, and no DECBIT is generated. Therefore, DECBIT corresponding to DECCATN “1000” is “0001”. LENGTH is “4”. This corresponds to the second state from the top of the table of table number “3” in FIG.
[0086]
Such a relationship applies to the third to the 16th of the encoding table of FIG. On the other hand, from the top of the table number “3” in FIG. 11 to the 17th to 31st, DECNUM becomes “4”, which is close to that of the table number “2” in FIG. That is, the first to the 16th ones in the coding table in FIG. 10 are all first added with “1” which is unpredictable when run is viewed as “8”, and the DECNUM in FIG. The same as “4”. The code output from the encoding table unit 3 is a variable length code specified by LENGTH.
[0087]
The stream generation unit 4 temporarily buffers the input variable-length code, and outputs it after adjusting it to a fixed bit width determined by the output transmission path.
[0088]
The basic operation of the encoding control unit 5 is to instruct the bit string decomposing unit 2 to cut out bits by a signal RUN (hereinafter simply referred to as RUN) and at the same time to select an encoding table by means of a signal TABLE (hereinafter simply referred to as TABLE). It becomes. Then, the RUN and TABLE for the next encoding are set by FAIL fed back from the encoding table unit 3. In this embodiment, since stepwise encoding using the delimiter bit number p is introduced, when encoding with a certain prediction bit length run, it is determined that this encoding control is an intermediate step if necessary. Part 5 needs to be memorized.
[0089]
The specific operation of the encoding control unit 5 is based on the state transition table shown in FIG. The operation of this state transition table will be described by taking as an example a case in which the prediction hit continues. Here, the initial state is SS1. First, in state SS1, run is “1” and TABLE is “0”. For this reason, the encoding table of the table number “0” shown in FIG. 8 is used. When the prediction is successful, the dominant symbol is “0”, so that only “0” corresponding to the number of DECNUMs from the input bit string input is stored in the coding table unit 3. Based on the table of the table number “0” (= table of FIG. 8), FAIL “0”, DECBIT “0”, and LENGTH “1” are output. Then, the FAIL “0” is transmitted to the encoding control unit 5.
[0090]
The encoding control unit 5 finds a FAIL “0” in SS1 based on the state transition table of FIG. 12, and selects the state SS0 as the next state (third from the top of the state transition table of FIG. 12). ). At this time, since the signal SW becomes “0”, there is no inversion of the symbol, and “0” becomes the dominant symbol as it is. Also in the state SS0, as a result of the same operation, the first state transition table is selected, and the state SS3 becomes the next state. As a result, the prediction has been made twice.
[0091]
In this state transition table, run is doubled when prediction is made twice. That is, the state SS3 is the seventh and eighth from the top, and the run is “2”. If the prediction continues to hit, that is, if the input bit string is “0” in this case, the run increases to “2” “2” “4” “4” “8” “8”. Go. On the other hand, when the prediction continues to deviate, it is reduced every second with the same run. That is, run becomes “8” “8” “6” “6” “4” “4” “2” “2”. When the run is “1” and the prediction is lost, the signal SW is inverted.
[0092]
The rules of operation of such a state transition table are summarized as follows.
[0093]
(1) When predictions with the same prediction bit length run are hit consecutively twice, the prediction bit length run is doubled.
[0094]
(2) When prediction with the same prediction bit length run is consecutively missed twice, the prediction bit length run is halved.
[0095]
(3) When the prediction bit length run is 4 or less, encoding is executed once.
[0096]
(4) When the predicted bit length run is 8 and DECNUM = 4, encoding is executed in two steps.
[0097]
(5) At this time, the state transits to the state SS5, and the predicted bit length run is set to “4” and the latter half bits are encoded.
[0098]
Note that the inversion of the signal SW means that the signal SW is inverted when this value is 1.
[0099]
Note that the state transition table shown in FIG. 12 shows only run up to “8”, but in this embodiment, run is set to “16” at the maximum, so that the run is also shown as “16”. Not created as well. Further, the state transition table may have run of “32” or more. Further, if the hit or miss continues twice, the run is not increased or decreased, but can be changed every time or can be set to a number of three or more, or various patterns can be adopted. In addition, as such an encoding table, only a table having a small number of bits may be prepared, and the encoding table may not be provided when the number of bits is large, for example, 16 bits or more.
[0100]
Next, the operation of the data encoding apparatus 1 having the above configuration will be described using a specific example.
[0101]
For example, when the bit string input in the form of “0000010000111100...” Is encoded in a state where the prediction continues to run and run = 16, the bit string is delimited by the 4-bit delimiter bit number p, Initially, up to “00000100” is encoded. This is because the inferior symbol “1” does not appear in the first delimiter bit number (= first 4 bits) portion but appears in the second (= next 4 bits). Next, “0011” is encoded, and finally “1100” is encoded.
[0102]
Therefore, DECNUM output from the bit string decomposition unit 2 is “8”, “4”, and “4”. On the other hand, DECCATN becomes “0100”, “0011”, “1100” (in this case, all patterns are input from the left numerical value). Under such conditions, the DECBIT is first an unpredictable “1” when run = 16. Next, “00000100” corresponds to the fifth from the top shown in FIG. 11 because of RUN “8”, TABLE “3”, and DECNUM “8” (in the case of each numerical value shown in FIG. Note that it is input from the right end side), and DECBIT is “10100”. Therefore, DECBIT and LENGTH “6” of “110100” (the numerical values are output in order from the left end) combined with the previous “1” are output from the encoding table unit 3 to the stream generation unit 4.
[0103]
On the other hand, in the state transition table in the encoding control unit 5, when DECNUM “8” in state SS6, FAIL is “1”, and the next state is state SS7. The next “0011” is RUN = 8 and DECNUM “4”, so the table with the table number “3” (= encoding table in FIG. 11) is adopted, and the 19th one from the top is applicable, DECNUM of “11011” and LENGTH “5” are output from the code table 3.
[0104]
As for the last “1100”, since the previous state is run “8” and DECNUM “4” in state SS7 and becomes FAIL “1” (the state at the bottom in FIG. 12), state SS5 is adopted. . Therefore, run “4” and TABLE “2” are used, and the encoding table having the table number “2” shown in FIG. 10 is used. In the table with the table number “2”, the fourth from the bottom corresponds to DECBIT “11110” and LENGTH “5” are output from the encoding table 3 to the stream generation unit 4. Since FAIL is “1” in the state SS5, the process proceeds to the state SS2. That is, for the next input bit string, the encoding table of FIG. 9 with run = 2 is used.
[0105]
In summary, the input bit string “0000010000111100” is encoded as three compressed bit strings “110100”, “11011”, and “11110”. Note that both the input bit string and the three compressed bit strings are input and output from the head side. It should be noted that this is different from the encoding tables of FIGS. 8 to 11. That is, in each encoding table, each value of the display is input and output sequentially from the right end of the display.
[0106]
The run was initially “16”, but as the 4-bit delimiter bit p is used for encoding step by step, the run becomes “2”. For the next input bit string, “ It is encoded with a prediction bit length run of “2”.
[0107]
On the other hand, when the same input bit string “0000010000111100” is encoded in the basic process that is the basis of the present invention described above, firstly, an unpredicted “1” at run = 16, and then the first 8 bits. Second, the unpredicted “1” comes out, and attention is paid to the first four bits “0000”, and “0” per prediction comes third. Then, since it is certain that the inferior symbol will come in 4 bits “0100” in the second half, it is immediately divided into two, and attention is paid to the first 2 bits “01”. For this reason, the unexpected “1” comes fourth. Next, this is further divided into two, paying attention to “0” in the first half, and “0” per prediction comes fifth. Then, since the inferior symbol is certain for “1” in the second half, immediately pay attention to the two bits “00” in the second half, and “0” per prediction comes in sixth.
[0108]
The above first half 8-bit encoding is summarized as “110100”. This is exactly the same as the coded bit according to the present invention. If the subsequent 8 bits are advanced in the same manner, these are also the same as the coded bits according to the present invention. The difference between the basic process underlying the present invention and the present invention is not the encoded bits themselves, but (1) how to delimit encoding, (2) how to change the prediction bit table, and (3) There are three points in using the encoding table.
[0109]
That is, in the improved present invention, the input bit string is delimited by a delimiter bit number p smaller than run (p = 4 in this embodiment), and encoding is temporarily delimited up to the delimiter part where the inferior symbol exists. . In the previous example, a 16-bit input bit string is encoded by being divided into three. Also, in the present invention, the predicted bit length run is “2” for the next input bit string, whereas in the basic process concept, the prediction error is once and run remains “16”. . Further, according to the concept of the basic process of the present invention, encoding is performed by recursively calling an encoding subroutine. However, in the improved present invention, an encoding table, specifically, an encoding table for each prediction bit length run is used. Is used.
[0110]
The above three points produce a great effect when they are used at the same time, but they have a sufficient effect even if they are used alone. For example, if the first point-by-step encoding method is adopted, a buffer, for example, each buffer in the bit string decomposing unit 2 or the stream generating unit 4 can be made small, and a compressed bit string can be obtained by Markov modeling described later. When trying to do so, the capacity of the buffer can be reduced.
[0111]
The change of the predicted bit length run of the second point is particularly effective when the nature of the input bit string changes from the middle. In the previous example, the prediction continued to be run = 16, but when the next bit string whose characteristics changed drastically, that is, “000001011111100” containing many inferior symbols, The run is “2” in accordance with the property, and the probability that it matches the property of the subsequent input bit string is high, and the compression rate becomes high. However, when processing is performed according to the basic process of the present invention, run remains “16”, and there is a high probability that it does not match the nature of the next input bit string. The improvement in compression rate is specifically about 0.5% to a few percent, but now that each program software has increased in capacity, such a slight improvement in numerical values can be ignored. It has never been.
[0112]
As for the coding table of the third point, although the memory capacity for the coding table is slightly increased as compared with the coding by the recursive call of the subroutine, the coding speed becomes extremely fast.
[0113]
Next, the data decoding apparatus 10 according to the first embodiment of this invention will be described with reference to FIG.
[0114]
The data decoding apparatus 10 includes a stream cutout unit 11 that inputs a stream of an encoded signal, a decoding table unit 12 that includes a plurality of decoding tables corresponding to a predicted bit length run, and stores decoded bits. The decoding buffer unit 13 that outputs a predetermined symbol and the decoding control unit 14 that has the same state transition table as the state transition table in the encoding control unit 5 of the data encoding device 1 are mainly configured. The decoding table unit 12 and the decoding control unit 14 constitute a decoding unit.
[0115]
Since the stream cutout unit 11 is instructed by the LENGTH, which will be described later, from the decoding table unit 12, the decoded bits are discarded based on the value, and the head of the undecoded bits is encoded. A stream is cut out so as to come to the least significant bit (or most significant) of a codeword signal CODE (hereinafter simply referred to as CODE) to be decoded. Note that LENGTH is evaluated and the decoded bits are discarded only when there is a discard instruction DECREQ (hereinafter simply referred to as DECREQ) from the decode buffer unit 13. CODE is transmitted in units of 8 bits.
[0116]
The decoding table unit 12 incorporates each decoding table shown in FIGS. 14 to 17 and switches and uses them according to a table number instruction signal TABLE (hereinafter simply referred to as TABLE) output from the decoding control unit 14. Then, the decoding table unit 12 outputs the next signal.
[0117]
(1) A signal LENGTH (hereinafter simply referred to as LENGTH) indicating how many bits have been decoded, which corresponds to LENGTH in the data encoding device 1
(2) A signal FAIL (hereinafter simply referred to as FAIL) indicating a prediction failure, which corresponds to FAIL in the data encoding device 1
(3) Decoded bit pattern signal DECPATN (hereinafter simply referred to as DECCATN) corresponding to DECCATN in the data encoding device 1
(4) A signal DECNUM (hereinafter simply referred to as DECNUM) indicating how many bits the decoding result corresponds to, which corresponds to DECNUM in the data encoding device 1
In the decoding table of run = 1 shown in FIG. 14, outputs corresponding to two types of CODE “0” and “1” are described. This decoding table corresponds to the encoding table of run = 1 in FIG. 8, and the one corresponding to DECBIT in the encoding table is CODE in this decoding table. The decoding table of run = 2 shown in FIG. 15 corresponds to the encoding table of run = 2 of FIG. 16 corresponds to the encoding table of run = 4 in FIG. 10, and the decoding table of run = 8 shown in FIG. 17 is the encoding table of run = 8 in FIG. It corresponds to. Each numerical value in each decoding table is input and output from the right end side of each numerical value in the same manner as the encoding table.
[0118]
The decode buffer unit 13 directly stores DECCATN and DECNUM of 4 bits (in the case of this embodiment) or less, respectively, PATNREG (hereinafter simply referred to as PATNREG) and number register NUMREG (hereinafter simply referred to as NUMREG) in the decode buffer unit 13. ) Store. When the output of the decode buffer unit 13 is q bits wide, the decode buffer unit 13 subtracts q from the stored NUMREG every time the decode data is output. When NUMREG becomes smaller than q, DECREQ is activated and a new data decoding request is issued. When NUMREG is 5 or more, the dominant symbol determined by the signal SW is output as a decoded output. On the other hand, when NUMREG becomes 4 or less, the value of PATREG is output.
[0119]
For example, when the fifth CODE “00101” from the top in FIG. 17 is input to the decoding table unit 12, DECNUM = 8 and DECCATN = “0010” are input to the decoding buffer unit 13. At this time, if it is assumed that the signal SW is “0” and output is performed in units of 2 bits (this corresponds to q = 2), the first two outputs may be output as dominant symbols. In this case, since SW = 0, the dominant symbol is “0”. Therefore, “0000” is output. When these 4 bits are output, NUMREG is 4 (= 8-4). Therefore, in the next cycle, the value of PATNREG is output in order. That is, “0100” is output from the left end side of this display.
[0120]
The decoding control unit 14 has the same state transition table as that of the encoding control unit 5. The initial value of the state is SS1, and the next transition destination is determined by FAIL and DECNUM. When DECREQ is active, transition is made to that transition destination.
[0121]
The data decoding apparatus 10 configured as described above operates according to an algorithm reverse to that of the data encoding apparatus 1 described above. The data decoding apparatus 10 is controlled by the output state of the decode buffer unit 13. That is, when NUMREG of the decode buffer unit 13 becomes smaller than the output bit width q, DECREQ is output to the stream cutout unit 11 and the decoding control unit 14. The stream cutout unit 11 discards the decoded bits corresponding to the LENGTH by the DECREQ.
In the case of RUN = 8 and CODE “00101” in the previous example, NUMREG decreases from “8” to “4”, from “4” to “2”, and from “2” to “0”. When this “2” is lowered to “0”, DECREQ is generated. Since LENGTH is “5”, the 5 bits decoded from CODE are discarded. For this reason, the CODE in the stream cutout unit 11 has the undecoded bit at the least significant bit or the most significant bit to prepare for the next decoding. On the other hand, in the decoding control unit 14, since run = 8, DECNUM = 8, and FAIL = 1, the state transitions to the state SS7. Therefore, TABLE = 3 corresponding to run = 8 is output to the decoding table unit 12.
[0122]
As a result, the decoding table unit 12 prepares a decoding table of run = 8, which is the table number “3” in FIG. Then, LENGTH, DECNUM, DECCATN, and FAIL are determined and output from the input CODE. For example, if the first CODE is “0”, it is determined that CODE is “0”, and LENGTH = 1, DECNUM = 8, DECCATN = “0000”, and FAIL = “0” are output. On the other hand, when CODE is “01011”, the first CODE is “1”, so it is not yet determined, and the next “1”, the third “0”, and the fourth “1” are not determined. . However, when the fifth “0” is entered, “01011” is determined. With this determination, LENGTH = 5, DECNUM = 4, DECCATN = “0100”, and FAIL = 1 are output. In this way, decoding is sequentially performed.
[0123]
Similar to the data encoding device 1, this data decoding device 10 has (1) a reduction in buffer capacity by stepwise decoding, and (2) signal characteristics compared to decoding based on the basic process of the present invention. Change of the predicted bit length run (3) It has various advantageous effects of improving the decoding speed by the decoding table.
[0124]
Next, the second embodiment of the present invention applied to the case where the above-described data encoding device 1 or data decoding device 10 performs conditional encoding or conditional decoding such as Markov modeling. Will be described.
[0125]
First, a data encoding apparatus for performing conditional encoding will be described with reference to FIG. In the description, the same members and the same signals as those of the data encoding device 1 are denoted by the same reference numerals and the same names, and description thereof is omitted or simplified.
[0126]
This data encoding device 20 includes a state transition table having the same table as the state transition table in the bit sequence decomposition unit 2, the encoding table unit 3, the stream generation unit 4, and the encoding control unit 5 of the data encoding device 1. The coding condition generated by the part 21 and the Markov model is input, the signal of the current state is given to the state transition part 21 for each condition, the signal of the next state is input after the coding, and the coding It is mainly composed of a state storage unit 22 for storing condition states. That is, in order to perform conditional encoding, the state of the encoding control unit 5 of the data encoding device 1 is managed for each condition.
[0127]
Therefore, when performing conditional coding such as the Markov model, the configuration shown in FIG. 18 is used, the state is extracted from the state storage unit 22 using the condition as an index, and the state is shown in the state transition table shown in FIG. If the next state is stored in the original address of the state storage unit 22 again, the state can be managed for each condition. Therefore, parameters such as the predicted bit length run can be individually set for each condition. In the Markov model, the bit string decomposing unit 2 requires a plurality of buffers to be switched for each encoding condition. In this embodiment, the number of predicted bit lengths run is not a fixed fixed delimiter. Since encoding is performed step by step with the number of bits p, the capacity of the buffer is not so large and is suitable for practical use.
[0128]
Next, a data decoding apparatus 30 for performing conditional decoding will be described with reference to FIG. In the description, the same members and the same signals as those of the data decoding apparatus 10 are denoted by the same reference numerals and the same names, and description thereof is omitted or simplified.
[0129]
The data decoding device 30 includes a storm cutout unit 11, a decoding table unit 12, a decoding buffer unit 13, and a state transition unit 31 having the same table as the state transition table in the decoding control unit 14 of the data decoding device 10. And a decoding condition generated by a Markov model or the like is input, a signal of the current state is given to the state transition unit 31 for each condition, a signal of the next state is input after decoding, and the state of the decoding condition is stored The state storage unit 32 is mainly configured.
[0130]
The decoding buffer unit 13 receives decoding conditions and is managed individually for each condition. For this reason, in the case of conditional decoding such as the Markov model, a very large buffer is required. However, since the data decoding apparatus 30 according to the present embodiment performs stepwise decoding as described above, even if each buffer is small, it can sufficiently cope with decoding even with conditional decoding such as a Markov model. The buffer unit 13 does not require such a large capacity.
[0131]
This data decoding apparatus 30 is the same as the data encoding apparatus 20 in that state transitions are individually managed for each condition. However, in the case of this data decoding device 30, the decode buffer unit 13 must also be individually managed as described above. For this reason, the decode buffer unit 13 includes registers corresponding to NUMREG and PATNREG as many as possible conditions, and switches according to the decoding conditions.
[0132]
As described above, the data encoding device 20 and the encoding method and the data decoding device 30 and the decoding method for performing conditional encoding and decoding according to the second embodiment of the present invention are described above. The same effects as those of the data encoding device 1 and the data decoding device 10 of the first embodiment are obtained. In addition, conditional encoding and decoding as in the Markov model can be performed, the compression rate is increased, and the decoding efficiency is improved. In addition, it is possible to prevent the problem of a significant increase in buffer capacity, which is a major obstacle in the case of Markov modeling and the like, which is suitable for practical use.
[0133]
Each embodiment described above is an example of a preferred embodiment of the present invention, but is not limited to this, and various modifications can be made without departing from the scope of the present invention. For example, the code word that is output when the prediction is successful is “1” instead of “0”, and when the prediction is lost, it is “0” instead of “1”, or when the prediction is successful, the dominant symbol is output. However, an inferior symbol may be output when the prediction is lost.
[0134]
Further, the newly reduced predicted bit number can be set to 1/3, 1/4, or the like instead of ½ the original predicted bit number, or a number obtained by subtracting a predetermined number from the original predicted bit number. On the other hand, the newly increased predicted bit number is not twice the original predicted bit number, but can be three times or four times, or a number obtained by adding a predetermined number to the original predicted bit number. Note that the new increase prediction bit number is not limited and may be a predetermined value, for example, a multiple of 2 such as 256 bits, which is the maximum value. In addition, the minimum value of the new decrease prediction bit number is not limited to 1, but may be another value such as 2 or 3.
[0135]
Further, the data encoding devices 1 and 20 and the data decoding devices 10 and 30 may be supported by software instead of hardware configuration. That is, the data encoding method and the data decoding method of the present invention are all supported by software, for example, the data encoding method is supported by software, and the data decoding method includes the data decoding device 10, You may make it respond | correspond by hardware, such as 30.
[0136]
In addition, the present invention can be said to be a predictive run-length encoding method, but this predictive run-length encoding method can also be applied to multi-value sequences in addition to binary sequence data. That is, the prediction run-length encoding method and decoding method of the present invention can be applied if the multi-value sequence data is handled as a binary bit string by devising. For example, each bit plane may be encoded by this predictive run length encoding method by dividing into bit planes. Alternatively, encoding may be performed by this predictive run length encoding method for each plane from the most significant bit, and the lower bits that continue when “1” appears may be directly output to the stream.
[0137]
Further, as a method of applying this predictive run length coding method to a multi-value sequence, there is a method of performing division into 256 level planes instead of a bit plane, for example, when a symbol has 8 bits. For example, a method is conceivable in which input symbols are divided into groups, and group numbers are encoded by this predictive run-length encoding method. Specifically, for example, the input symbols are grouped as shown in FIG. 20, and determination bits indicating whether the input symbols are group numbers 0 or other than 0 are first encoded by this predictive run-length encoding method. If the input symbol is 0, the encoding of this symbol is completed. If not, a determination bit indicating whether the group number is 1 or other than 1 is further encoded by this predictive run length encoding method. In this way, the determination bits are encoded by the predictive run length encoding method until the group number is determined. If the determined group number is 2 or more, the necessary additional bits are output directly to the stream. In this method, since the higher-order determination bits are not encoded when the group number is determined, the processing speed is improved.
[0138]
The application of the present invention to the multi-value sequence as described above is not limited to the case of data encoding, but can be applied to the case of data decoding by a similar algorithm.
[0139]
【The invention's effect】
As described above, in the data encoding method and data encoding apparatus of the present invention, encoding efficiency similar to that of a QM coder can be obtained, while the encoding speed is much faster than that of a QM coder. For this reason, it is the most excellent in practicality among various binary bit string compression methods currently used. In addition, when performing stepwise encoding, the capacity of the buffer can be reduced, which is particularly advantageous for conditional encoding such as Markov modeling. Further, when the encoding table is used, the encoding speed can be improved.
[0140]
Similarly, in the data decoding method and data decoding apparatus of the present invention, the same decompression efficiency as that of the QM coder can be obtained, while the decoding speed is much faster than that of the QM coder. For this reason, it becomes the most practical one among various binary bit string decoding methods currently used, and the convenience is improved. In addition, when stepwise decoding is employed, the capacity of the buffer can be reduced, which is particularly advantageous for conditional decoding such as Markov modeling. Further, when the decoding table is used, the decoding speed can be improved.
[Brief description of the drawings]
FIG. 1 is a diagram for explaining an outline of an algorithm which is a basic principle of the present invention, and is a diagram showing a relationship between a target sequence and a predicted bit number run.
FIG. 2 is a diagram for explaining an outline of an algorithm which is a basic principle of the present invention, and is a diagram showing a state in which a target sequence in FIG. 1 is divided.
FIG. 3 is a diagram for explaining an outline of an algorithm that is a basic principle of the present invention, and is a diagram showing a state in which the first-half attention sequence in FIG. 2 is further divided;
FIG. 4 is a flowchart for explaining a basic encoding process which is a premise of the present invention, and is a flowchart showing an encoding main routine.
FIG. 5 is a flowchart for explaining a basic encoding process which is a premise of the present invention, and is a flowchart showing an encoding subroutine.
FIG. 6 is a diagram showing a compression rate and encoding time by a basic data encoding method as a premise of the present invention.
FIG. 7 is a block diagram showing the configuration of the first embodiment of the data encoding device of the present invention.
8 is a diagram illustrating an encoding table in an encoding table unit of the data encoding device in FIG. 7, and is a diagram illustrating a table when a predicted bit length is “1”.
9 is a diagram illustrating an encoding table in an encoding table unit of the data encoding device in FIG. 7, and is a diagram illustrating a table when a predicted bit length is “2”.
10 is a diagram illustrating an encoding table in an encoding table unit of the data encoding device in FIG. 7, and is a diagram illustrating a table when a predicted bit length is “4”.
11 is a diagram illustrating an encoding table in an encoding table unit of the data encoding device in FIG. 7, and is a diagram illustrating a table when a predicted bit length is “8”.
12 is a diagram showing a state transition table in an encoding control unit of the data encoding device in FIG. 7; FIG.
FIG. 13 is a block diagram showing the configuration of the first embodiment of the data decoding apparatus of the present invention;
14 is a diagram illustrating a decoding table in a decoding table unit of the data decoding device in FIG. 13, and a table when a predicted bit length is “1”. FIG.
15 is a diagram illustrating a decoding table in a decoding table unit of the data decoding device in FIG. 13, and a table in the case where the predicted bit length is “2”.
16 is a diagram illustrating a decoding table in a decoding table unit of the data decoding apparatus in FIG. 13, and a table in the case where the predicted bit length is “4”.
17 is a diagram illustrating a decoding table in a decoding table unit of the data decoding device in FIG. 13, and a table in the case where the predicted bit length is “8”.
FIG. 18 is a block diagram showing a configuration of a second exemplary embodiment of a data encoding device of the present invention.
FIG. 19 is a block diagram showing the configuration of the second embodiment of the data decoding apparatus of the present invention;
FIG. 20 is a diagram for explaining one column when the algorithm of the present invention is applied to multi-value series data, and shows a state in which input symbols are divided into a plurality of groups.
FIG. 21 is a diagram illustrating a configuration of a QM coder which is a conventional arithmetic code type entropy encoder.
22 is a flowchart showing the operation of the QM coder in FIG. 21. FIG.
[Explanation of symbols]
1 Data encoding device
2-bit string decomposition unit
3 Encoding table part (part of encoding part)
4 Stream generator
5 Coding control unit (part of coding unit)
10 Data decoding device
11 Stream cutout unit
12 Decoding table part (part of decoding part)
13 Decode buffer section
14 Decoding control unit (part of decoding unit)
CODE Code word signal to be decoded (encoded data)
DECBIT Signal indicating compressed bit string
DECNUM Signal indicating the number of bits to be decoded
DECCATN Signal indicating the pattern to be decoded
FAIL Signal (flag) that indicates a prediction failure
LENGTH A signal indicating the bit length of the compressed bit string and the decoded bit length
RUN Signal indicating the predicted bit length
Signal indicating SW dominant symbol
TABLE A signal that specifies the table number of the encoding table or decoding table

Claims (18)

“0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力された上記予測ビット数からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力すると共に、上記n個の予測ビット数より小さい数の区切りビット数で上記入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する予測結果符号化工程とを備え、予測が所定回数はずれたときに上記予測ビット数をn個より少ない新減少予測ビット数として同様の予測設定工程と予測結果符号化工程とを再帰的に繰り返すことを特徴とするデータ符号化方法。  When a binary bit string consisting of “0” and “1” is input, either “0” or “1” is set as the dominant symbol, the other is set as the inferior symbol, and the number of the dominant symbols is n. A prediction setting step that predicts that the number of bits is continuous and sets n as the number of prediction bits, and when a prediction is made for a target sequence that includes the input number of prediction bits, either “0” or “1” is used as a code word One of the signals is output and encoded as a prediction signal, and the next n bit strings are encoded. When the signal is off, the other signal of “0” or “1” is predicted as the code word. In addition to outputting as an outlier signal, the input bit string is delimited by a number of delimiter bits smaller than the n predicted bit numbers, and an inferior symbol is included in the delimited pattern A prediction result encoding step for collectively encoding the patterns of the dominant symbols including the pattern so far, and when the prediction deviates a predetermined number of times, the number of prediction bits is reduced to less than n. A data encoding method, wherein the same prediction setting step and prediction result encoding step as the number of bits are recursively repeated. “0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力されたn個のビット列からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力すると共に、上記n個の予測ビット数より小さい数の区切りビット数で上記入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する予測結果符号化工程とを備え、予測が規定回数当たったときに、上記予測ビット数をn個より多い新増加予測ビット数として同様の予測設定工程と予測結果符号化工程とを繰り返し行うことを特徴とするデータ符号化方法。  When a binary bit string consisting of “0” and “1” is input, either “0” or “1” is set as the dominant symbol, the other is set as the inferior symbol, and the number of the dominant symbols is n. A prediction setting step that predicts that the number of bits is continuous and sets n as the number of prediction bits, and a code word “0” or “1” is used as a prediction word when a prediction sequence is made of an input sequence of n bits. One of the signals is output and encoded as a prediction signal, and the next n bit strings are encoded. When the signal is off, the other signal of “0” or “1” is predicted as the code word. In addition to outputting as an outlier signal, the input bit string is delimited by a number of delimiter bits smaller than the number n of predicted bits, and an inferior symbol is included in the delimited pattern. And a prediction result encoding step that collectively encodes the patterns of the dominant symbols including the pattern so far, and when the prediction hits a specified number of times, the number of prediction bits is increased by more than n A data encoding method, wherein the same prediction setting step and prediction result encoding step are repeated as the number of prediction bits. 前記予測が規定回数当たったときに、前記予測ビット数をn個より多い新増加予測ビット数とすることを特徴とする請求項1記載のデータ符号化方法。  2. The data encoding method according to claim 1, wherein when the prediction hits a specified number of times, the prediction bit number is set to a new increase prediction bit number larger than n. 前記規定回数を2回とし、前記新増加予測ビット数を前記予測ビット数の2倍としたことを特徴とする請求項2または3記載のデータ符号化方法。  4. The data encoding method according to claim 2, wherein the prescribed number of times is set to 2 and the newly increased predicted bit number is twice the predicted bit number. 前記新減少予測ビット数が1となり、かつそのビットが劣勢シンボルのとき、以降の符号化において従来の劣勢シンボルを優勢シンボルとし、従来の優勢シンボルを劣勢シンボルとして符号化するようにしたことを特徴とする請求項1記載のデータ符号化方法。  When the new predicted decrease bit number is 1 and the bit is an inferior symbol, in the subsequent encoding, the conventional inferior symbol is encoded as the dominant symbol, and the conventional dominant symbol is encoded as the inferior symbol. The data encoding method according to claim 1. 前記区切りビット数を固定の所定値pとし、n≦pのときは、まとめて符号化するビット数をn個としたことを特徴とする請求項1、2、3、4または5記載のデータ符号化方法。  6. The data according to claim 1, wherein the number of delimiter bits is a fixed predetermined value p, and when n ≦ p, the number of bits to be encoded is n. Encoding method. 前記所定値pを4としたことを特徴とする請求項6記載のデータ符号化方法。  7. The data encoding method according to claim 6, wherein the predetermined value p is 4. “0”および“1”からなる2値のビット列を入力する際、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する予測設定工程と、入力された上記予測ビット数からなる注目系列について予測が当たったときに符号語として“0”または“1”のいずれか一方の信号を予測当たり信号として出力かつ符号化し、次のn個のビット列を符号化する作業に移り、はずれたときに符号語として“0”または“1”のいずれか他方の信号を予測はずれ信号として出力し符号化する予測結果符号化工程とを備え、この符号化工程において、符号化されるビットのパターンに対応した符号化データが予め記憶された符号化テーブルに基づいて符号化処理すると共に、予測が所定回数はずれたときに上記予測ビット数をn個より少ない新減少予測ビット数として同様の予測設定工程と予測結果符号化工程とを再帰的に繰り返すことを特徴とするデータ符号化方法。  When a binary bit string consisting of “0” and “1” is input, either “0” or “1” is set as the dominant symbol, the other is set as the inferior symbol, and the number of the dominant symbols is n. A prediction setting step that predicts that the number of bits is continuous and sets n as the number of prediction bits, and when a prediction is made for a target sequence that includes the input number of prediction bits, either “0” or “1” is used as a code word One of the signals is output and encoded as a prediction signal, and the next n bit strings are encoded. When the signal is off, the other signal of “0” or “1” is predicted as the code word. A prediction result encoding step that outputs and encodes as an outlier signal, and in this encoding step, encoded data corresponding to a bit pattern to be encoded is stored in advance. The same prediction setting process and prediction result encoding process are recursively repeated with the prediction bit number set to a new reduced prediction bit number smaller than n when the prediction deviates a predetermined number of times. A data encoding method characterized by the above. 前記符号化テーブルには、8ビット以下のパターンに対応した符号化データが書き込まれ、8ビットを超える符号化対応ビットに対しては前記符号化テーブルを用いずに符号化することを特徴とする請求項8記載のデータ符号化方法。  In the encoding table, encoded data corresponding to a pattern of 8 bits or less is written, and encoding corresponding bits exceeding 8 bits are encoded without using the encoding table. The data encoding method according to claim 8. “0”および“1”からなる2値の入力ビット列を圧縮して符号化するデータ符号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共にその優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する符号化制御部と、上記入力ビット列を一時記憶すると共に符号化すべきビット数とパターンを出力するビット列分解部と、上記入力ビット列のパターンに対応する符号化データを記憶した符号化テーブルを内蔵し、上記符号化制御部から入力する選択すべき上記符号化テーブルを示す信号ならびに上記ビット列分解部から入力する符号化すべきビット数およびパターンから所定の圧縮ビット列とそのビット長とを出力する符号化テーブル部と、上記圧縮ビット列を一旦バッファリングして固定のビット長にならして出力するストリーム生成部とを備え、上記予測が所定回数はずれたときに、上記予測ビット数をn個より少ない新減少予測ビット数として上記符号化制御部で設定し、上記予測が規定回数当たったときに、上記予測ビット数をn個より多い新増加予測ビット数として上記符号化制御部で設定することを特徴とするデータ符号化装置。  In a data encoding apparatus for compressing and encoding a binary input bit string consisting of “0” and “1”, either “0” or “1” is a dominant symbol, and the other is an inferior symbol. And an encoding control unit that predicts that n dominant symbols are continuous and sets the n as a predicted bit number, and a bit string decomposition unit that temporarily stores the input bit string and outputs the number of bits to be encoded and a pattern A coding table storing coded data corresponding to the pattern of the input bit string, a signal indicating the coding table to be selected input from the coding control unit, and a code input from the bit string decomposing unit A coding table unit for outputting a predetermined compressed bit string and its bit length from the number of bits and pattern to be converted, and the compressed bit A stream generation unit that temporarily buffers the column and outputs a fixed bit length, and when the prediction deviates a predetermined number of times, the prediction bit number is set to a new reduced prediction bit number less than n. A data encoding apparatus, characterized in that the encoding control unit sets the prediction bit number as a new increased prediction bit number larger than n when the prediction hits a predetermined number of times. . 前記n個の予測ビット数より小さい数の区切りビット数で前記入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化することを特徴とする請求項10記載のデータ符号化装置。  The input bit string is divided by a number of delimiter bits smaller than the n predicted bits, and if the inferior symbol is included in the delimited pattern, the patterns of the dominant symbols including the pattern are summarized. The data encoding apparatus according to claim 10, wherein the encoding is performed. “0”および“1”からなる2値の入力ビット列を圧縮して符号化するデータ符号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共にその優勢シンボルがn個連続すると予測し、そのn個を予測ビット数として設定する符号化制御部と、上記入力ビット列を一時記憶すると共に、上記n個の予測ビット数より小さい数の区切りビット数で上記入力ビット列を区切り、その区切られたパターンに劣勢シンボルが含まれていたら、そのパターンを含むそれまでに続いた優勢シンボルのパターンをまとめて符号化する符号化部とを有することを特徴とするデータ符号化装置。  In a data encoding apparatus for compressing and encoding a binary input bit string consisting of “0” and “1”, either “0” or “1” is a dominant symbol, and the other is an inferior symbol. And an encoding control unit that predicts that the number of dominant symbols will be n, sets the n as a predicted bit number, temporarily stores the input bit string, and delimits a number smaller than the n predicted bit number An input unit that divides the input bit string by the number of bits, and if the divided pattern includes an inferior symbol, includes an encoding unit that collectively encodes the pattern of the dominant symbol that includes the pattern. A characteristic data encoding apparatus. 符号化されたデータを入力し、“0”および“1”からなる2値のビット列に復号化するデータ復号化方法において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表わされた符号語を入力する入力工程と、その符号語を復号する復号工程とを有し、上記入力工程では、上記n個の予測ビットより小さい区切りビット数で区切られて符号化されたデータを入力し、上記復号工程では、入力された符号語が予測当たりの値のとき上記優勢シンボルをn個連続して復号すると共に、予測はずれのときは、上記区切られた中に劣勢シンボルが含まれていたら、その区切られた部分を含むそれまで続いた優勢シンボルの部分をまとめて復号し、予測当たりが所定回数連続したときは上記n個より多い数の優勢シンボルが連続すると新たに予測するようにしたことを特徴とするデータ復号化方法。  In a data decoding method in which encoded data is input and decoded into a binary bit string consisting of “0” and “1”, either “0” or “1” is set as a dominant symbol, A codeword in which the other is an inferior symbol, and the prediction result of the prediction that n dominant symbols (n is an integer equal to or greater than 1) is represented by a binary bit string consisting of “0” and “1” And a decoding step for decoding the codeword. In the input step, data encoded by being divided by a delimiter bit number smaller than the n predicted bits is input, In the decoding step, when the input codeword is a value per prediction, the n dominant symbols are decoded continuously, and when the prediction is out of order, if the inferior symbol is included in the segmentation, The portion of the dominant symbol that has been cut, including the cut portion, is decoded at once, and when the number of dominant symbols more than n is consecutively predicted when a predetermined number of consecutive predictions occur, a new prediction is made. A characteristic data decoding method. 符号化されたデータを入力し、“0”および“1”からなる2値のビット列に復号化するデータ復号化方法において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとすると共に、その優勢シンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表わされた符号語を入力する入力工程と、その符号語を復号する復号工程とを有し、上記入力工程では、所定の数で区切られて符号化されたデータを入力し、上記復号工程では、入力された符号語と予測ビットの数とから復号されるビットパターンが指定される復号テーブルに基づいて復号し、予測当たりが所定回数連続したときは、上記n個より多い数の優勢シンボルが連続すると新たに予測したその予測結果を入力し、予測はずれが規程回数連続したときは、上記n個より少ない数の優勢シンボルが連続すると新たに予測したその予測結果を入力するようにしたことを特徴とするデータ復号化方法。  In a data decoding method in which encoded data is input and decoded into a binary bit string consisting of “0” and “1”, either “0” or “1” is used as a dominant symbol, A codeword in which the other is an inferior symbol, and the prediction result of the prediction that n dominant symbols (n is an integer equal to or greater than 1) is represented by a binary bit string consisting of “0” and “1” And a decoding step for decoding the codeword. In the input step, the encoded data divided by a predetermined number is input. In the decoding step, the input code is input. When decoding is performed based on a decoding table in which a bit pattern to be decoded from a word and the number of prediction bits is designated and prediction per time continues for a predetermined number of times, if more than n dominant symbols continue, a prediction is newly made. The data decoding is characterized in that the prediction result is inputted, and when the deviation of the prediction continues for the prescribed number of times, the prediction result newly predicted is inputted when the number of dominant symbols less than n continues. Method. 前記入力工程では、上記n個の予測ビットより小さい区切りビット数で区切られて符号化されたデータを入力し、前記復号工程では、予測はずれのとき、上記区切られた中に劣勢シンボルが含まれていたら、その区切られた部分を含むそれまで続いた優勢シンボルの部分をまとめて復号することを特徴とする請求項14記載のデータ復号化方法。  In the input step, data encoded by being delimited by a delimiter bit number smaller than the n predicted bits is input, and in the decoding step, an inferior symbol is included in the delimiter when prediction is lost. 15. The data decoding method according to claim 14, wherein the dominant symbol portions that have continued so far including the divided portions are collectively decoded. 符号化されたデータとなる符号ビットを入力し、“0”および“1”からなる2値のビット列からなる復号ビットに復号するデータ復号化装置において、“0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルとしたとき、上記符号ビットの優勢シンボルと予測ビット長n個を設定する復号制御部と、入力される符号語に対応する復号パターンを各予測ビット長毎に表化した復号テーブルを有する復号テーブル部と、この復号テーブル部からの復号パターンと復号するビット数を入力し記憶すると共に所定ビット数毎に出力するデコードバッファ部とを備え、入力された符号ビットが予測当たり信号の場合、優勢シンボルを復号すると共に、上記予測当たり信号が所定回数連続したときは上記予測ビット長をn個より多い数に変更することを特徴とするデータ復号化装置。  In a data decoding apparatus for inputting a code bit that becomes encoded data and decoding it into a decoded bit consisting of a binary bit string consisting of “0” and “1”, either “0” or “1” Is a dominant symbol, and one of the other is an inferior symbol, the decoding control unit for setting the dominant symbol of the code bit and n prediction bit lengths, and the decoding pattern corresponding to the input code word for each prediction bit length A decoding table unit having a decoding table tabulated every time, and a decoding buffer unit that inputs and stores a decoding pattern from the decoding table unit and the number of bits to be decoded and outputs it every predetermined number of bits. When the sign bit is a signal per prediction, the dominant symbol is decoded, and when the signal per prediction continues for a predetermined number of times, the prediction bit length is set to n. Data decoding apparatus and changes the greater number. “0”または“1”のいずれか一方を優勢シンボルとし、いずれか他方を劣勢シンボルすると共にそのシンボルがn個(nは1以上の整数)連続すると予測したその予測結果が“0”および“1”からなる2値のビット列で表された符号ビットを復号する復号化装置において、上記符号ビットの予測ビット長と上記優勢シンボルを設定する復号制御部と、上記符号ビットを入力し、その符号ビットの値に応じて復号ビットを出力する復号化部と、上記復号ビットを入力し、一時保持すると共に復号ビットとして出力するデコードバッファ部とを備え、上記復号化部での復号を上記予測ビット長より少ない数の区切りビット数で行い、上記デコードバッファ部の容量を小さなものにすると共に、上記予測結果が所定回数連続して当たったとき、上記予測ビット長をn個より大きな数に変更し、上記予測結果が規程回数連続して外れたとき、上記予測ビット長をn個より小さい数に変更し、その予測ビット長が所定値となったとき、優勢シンボルと劣勢シンボルを逆転させるようにしたことを特徴とするデータ復号化装置。  One of “0” and “1” is set as a dominant symbol, and the other is set as an inferior symbol, and the prediction result predicted that n symbols (n is an integer of 1 or more) continues is “0” and “ In a decoding apparatus for decoding a code bit represented by a binary bit string consisting of 1 ″, a decoding control unit for setting a predicted bit length of the code bit and the dominant symbol, and the code bit are input, and the code A decoding unit that outputs a decoded bit according to a bit value; and a decoding buffer unit that inputs the decoded bit, temporarily holds the decoded bit, and outputs the decoded bit as a decoded bit. When the number of delimiter bits is less than the length, the capacity of the decode buffer unit is reduced, and when the prediction result hits a predetermined number of times, When the prediction bit length is changed to a number larger than n, and the prediction result deviates a predetermined number of times, the prediction bit length is changed to a number smaller than n and the prediction bit length becomes a predetermined value. A data decoding device characterized in that the dominant symbol and the inferior symbol are reversed. 前記復号化部に、入力される符号語に対応する復号パターンを各予測ビット長毎に表化した復号テーブルを有する復号テーブル部を設けたことを特徴とする請求項17記載のデータ復号化装置。  18. The data decoding apparatus according to claim 17, wherein the decoding unit is provided with a decoding table unit having a decoding table in which a decoding pattern corresponding to an input codeword is displayed for each prediction bit length. .
JP27726597A 1997-03-07 1997-10-09 Data encoding method, data encoding device, data decoding method, and data decoding device Expired - Fee Related JP3648944B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP27726597A JP3648944B2 (en) 1997-03-07 1997-10-09 Data encoding method, data encoding device, data decoding method, and data decoding device

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP5341397 1997-03-07
JP9-53413 1997-03-07
JP27726597A JP3648944B2 (en) 1997-03-07 1997-10-09 Data encoding method, data encoding device, data decoding method, and data decoding device

Publications (2)

Publication Number Publication Date
JPH10308673A JPH10308673A (en) 1998-11-17
JP3648944B2 true JP3648944B2 (en) 2005-05-18

Family

ID=26394123

Family Applications (1)

Application Number Title Priority Date Filing Date
JP27726597A Expired - Fee Related JP3648944B2 (en) 1997-03-07 1997-10-09 Data encoding method, data encoding device, data decoding method, and data decoding device

Country Status (1)

Country Link
JP (1) JP3648944B2 (en)

Also Published As

Publication number Publication date
JPH10308673A (en) 1998-11-17

Similar Documents

Publication Publication Date Title
KR100950607B1 (en) Huffman coding
US5572206A (en) Data compression method and system
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
JP3258552B2 (en) Data compression device and data decompression device
JP2766302B2 (en) Variable length code parallel decoding method and apparatus
JP3294026B2 (en) High-speed variable-length decoding device
GB2305089A (en) Method and apparatus for compressing arbitrary data
JPH09275349A (en) Data compressor and data decoder
US5877711A (en) Method and apparatus for performing adaptive data compression
US5594435A (en) Permutation-based data compression
JP2746109B2 (en) Huffman code decoding circuit
US5392036A (en) Efficient optimal data recopression method and apparatus
US6055273A (en) Data encoding and decoding method and device of a multiple-valued information source
JPH08167852A (en) Method and device for compressing data
JPH10320172A (en) Program compressing method, program decoding method and program storing device
JP3648944B2 (en) Data encoding method, data encoding device, data decoding method, and data decoding device
JP2001136075A (en) Data compression/decompression device and storage medium with data compression/decompression program recorded thereon
JP2537551B2 (en) Variable length code decoding circuit
JPH05252051A (en) Serial data decoder
JP3482820B2 (en) Data encoding method, data encoding device, data decoding method, and data decoding device
GB2311704A (en) Compression of arbitrary data using context modelling and entropy coding
KR100207428B1 (en) Variable length coding apparatus and method adaptive to changes of the hoffman codes
KR100462060B1 (en) UVLC Multiple Decoding Method
JPH05241776A (en) Data compression system
JP2934603B2 (en) Method and apparatus for decoding variable length code

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041028

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041109

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050107

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050125

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050207

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20080225

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20090225

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090225

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100225

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110225

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110225

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120225

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130225

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130225

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees