JP3559314B2 - Image compression device - Google Patents

Image compression device Download PDF

Info

Publication number
JP3559314B2
JP3559314B2 JP15524594A JP15524594A JP3559314B2 JP 3559314 B2 JP3559314 B2 JP 3559314B2 JP 15524594 A JP15524594 A JP 15524594A JP 15524594 A JP15524594 A JP 15524594A JP 3559314 B2 JP3559314 B2 JP 3559314B2
Authority
JP
Japan
Prior art keywords
huffman
quantization
code
coefficient
quantized
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
JP15524594A
Other languages
Japanese (ja)
Other versions
JPH089373A (en
Inventor
紳聡 阿部
Original Assignee
ペンタックス株式会社
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 ペンタックス株式会社 filed Critical ペンタックス株式会社
Priority to JP15524594A priority Critical patent/JP3559314B2/en
Publication of JPH089373A publication Critical patent/JPH089373A/en
Application granted granted Critical
Publication of JP3559314B2 publication Critical patent/JP3559314B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/005Statistical coding, e.g. Huffman, run length coding

Description

【0001】
【産業上の利用分野】
本発明は、カラー静止画像をJPEGアルゴリズムに準拠して情報圧縮する画像圧縮装置に関する。
【0002】
【従来の技術】
高解像度画像を符号化して通信伝送路を介して情報の授受を行う標準化アルゴリズムが、JPEG(Joint Photographic Expert Group)から勧告されている。このJPEGから勧告されているアルゴリズム、すなわちJPEGアルゴリズムのベースライン・プロセスでは、大幅な情報圧縮を行うため、初めに2次元DCT変換によって原画像データを空間周波数軸上の成分に分解し、そして、その空間周波数軸上で表された各データを量子化し、さらに量子化した各データを符号化する。JPEGでは、この符号化のため、所定のハフマンテーブルを推奨している。
【0003】
一方、固定長化圧縮、すなわち1つの画面に対応した画像データの量が一定値になるように情報圧縮する画像圧縮装置が従来知られている。このような画像圧縮装置では、ハフマンテーブルを用いた符号化によっても画像データの量がまだ一定値を越えている場合、量子化テーブルを変更して量子化を再び行うことにより情報圧縮を図っている。この結果、まだ画像データの量が多過ぎる場合には、設定ビット長を越えた高周波成分のデータを強制的に0にしている。
【0004】
【発明が解決しようとする課題】
しかし、このような従来の固定長化圧縮によると、量子化の結果、画像データの量が一定値よりも減少しすぎることがあり、このような場合、画像データを再生した時、原画像に比較して画質が低下することとなる。また、量子化の後、設定ビット長を越えた高周波成分のデータを強制的に0に定めた場合にも、再生画像の画質が低下するという問題が発生する。
【0005】
本発明は、以上のような問題点に鑑み、再生画像の画質を低下させることなく、画像データを固定長化圧縮することができる画像圧縮装置を提供することを目的としている。
【0006】
【課題を解決するための手段】
本発明に係る画像圧縮装置は、原画像データに直交変換を施して直交変換係数を求める直交変換手段と、直交変換係数を第1の量子化テーブルを用いて量子化することにより量子化直交変換係数を求める第1の量子化手段と、この第1の量子化手段により得られた量子化直交変換係数を、第1のハフマンテーブルを用いて符号化する第1のハフマン符号化手段と、この第1のハフマン符号化手段により得られた符号量を算定し、符号量が設定符号量以下であるか否かを判定する符号量判定手段と、この符号量判定手段により符号量が設定符号量以下ではないと判定されたとき、第2のハフマンテーブルを生成する手段と、第2のハフマンテーブルを用いて量子化直交変換係数を符号化する第2のハフマン符号化手段とを備えたことを特徴としている。
【0007】
【実施例】
以下図示実施例に基づいて本発明を説明する。
図1は本発明の第1実施例に係る画像圧縮装置のブロック図である。
【0008】
被写体Sから到来した光は集光レンズ11によって集光され、被写体像がCCD(固体撮像素子)12の受光面上に結像される。CCD12の受光面には多数の光電変換素子が配設され、また光電変換素子の上面には、例えばR、G、Bの各色フィルタ要素から成るカラーフィルタが設けられている。各光電変換素子はひとつの画素データに対応している。被写体像は、各光電変換素子によって所定の色に対応した電気信号に変換され、A/D変換器13に入力される。なお、図1の構成ではCCD12が1枚のみであるが、2枚以上のCCDが設けられた構成でもよい。
【0009】
A/D変換器13においてA/D変換された信号は、図示しない信号処理回路によって輝度信号Yと色差信号Cb、Crとに変換され、画像メモリ14に入力される。画像メモリ14は輝度信号Yおよび色差信号Cb、Crをそれぞれ格納するために、相互に独立したメモリ領域に分割されており、各メモリ領域は1画像分の記憶容量を有している。
【0010】
画像メモリ14から読み出された輝度信号Yおよび色差信号Cb、Crは、データ圧縮処理のため、DCT処理回路21に入力される。DCT処理回路21では、輝度信号Y等の原画像データが離散コサイン変換(以下DCTという)される。すなわち本実施例では、原画像データの直交変換としてDCT変換が利用される。なお、図1ではDCT処理回路21が1つの処理回路として示されているが、実際には輝度信号Yおよび色差信号Cb、Cr毎に独立したDCT処理回路が設けられている。
【0011】
DCT処理回路21、量子化処理回路22、ハフマン符号化処理回路23、制御回路24等から成る画像圧縮装置では、輝度信号Y等の画像データは1画面に関して複数のブロックに分割され、ブロック単位で処理される。また各ブロックは8×8個の画素データから構成される。
【0012】
DCT処理回路21において求められた輝度信号Yおよび色差信号Cb、CrのDCT係数は、それぞれ量子化処理回路22に入力される。量子化処理回路22も、DCT処理回路21と同様、各信号毎に設けられている。量子化処理回路22に入力された輝度信号Y、色差信号Cb、CrのDCT係数は、8×8個の量子化係数により構成される量子化テーブルによって、それぞれ量子化される。この量子化は線形量子化であり、すなわち各DCT係数は対応する量子化係数によって割算される。
【0013】
なお本実施例においては、JPEGアルゴリズムに準拠して、輝度信号YのDCT係数を量子化する量子化テーブルと、色差信号Cb、CrのDCT係数を量子化する量子化テーブルとは異なっているが、各信号において同一の量子化テーブルを用いてもよい。また、これらの量子化テーブルは、後述するように固定長化圧縮のため、制御回路24によって変更可能である。
【0014】
量子化処理回路22から出力された輝度信号Y、色差信号Cb、Crの量子化DCT係数はハフマン符号化処理回路23に入力され、所定のアルゴリズムによりハフマン符号化される。このハフマン符号化において用いられるハフマンテーブルはハフマン符号長テーブルに従って生成され、ハフマン符号長テーブルは、量子化テーブルと同様に制御回路24によって変更可能である。
【0015】
ハフマン符号化により得られた画像信号(Y’,Cb’,Cr’)は、ICメモリカード(記録媒体)Mに記録される。この画像データのICメモリカードMへの記録の際に、量子化テーブルとハフマン符号長テーブルも画像データ内に組み込まれてICメモリカードMに記録される。
【0016】
図2は、一例として、8×8画素のブロックの画像データP(Y)xy と、DCT係数S(Y)uv と、量子化DCT係数R(Y)uv と、量子化テーブルQ(Y)uv とを示している。
【0017】
図2(a)の画像データP(Y)xy は、2次元DCT変換によって、図2(b)に示す8×8=64個のDCT係数S(Y)uv に変換される。これらのDCT係数のうち、位置(0,0)にあるDCT係数S(Y)00 はDC係数であり、残り63個のDCT係数S(Y)uv はAC係数である。AC係数は、係数S(Y)01 若しくは係数S(Y)10 から係数S(Y)77 に向かって、より高い空間周波数成分が8×8画素ブロックの画像データ中にどのくらいあるかを示している。DC係数は8×8画素のブロック全体の画素値の平均値(直流成分)を表している。すなわち、各DCT係数S(Y)uv はそれぞれ所定の空間周波数に対応している。
【0018】
図2(d)は量子化処理回路21で用いられる量子化テーブルQ(Y)uv の一例を示している。このような量子化テーブルQ(Y)uv としては、上述したように、輝度信号Yと色差信号Cb、Crとで別のものでもよい。この場合、JPEGフォーマットの画像データをICメモリカードMに記録する際に、各信号に対応した位置に、その信号の量子化に使用された量子化テーブルQ(Y)uv の内容が記録される。
【0019】
量子化テーブルQ(Y)uv を用いてDCT係数S(Y)uv を量子化する式は以下のように定義される。
R(Y)uv =round(S(Y)uv /Q(Y)uv) {0≦ u,v≦7}
この式における roundは最も近い整数への近似を意味する。すなわち、DCT係数S(Y)uv 及び量子化テーブルQ(Y)uv の各要素同士の割算と四捨五入とによって、図2(c)に示すような量子化DCT係数R(Y)uv が求められる。
【0020】
このようにして量子化処理回路22において求められた量子化DCT係数R(Y)uv 、R(Cb)uv、R(Cr)uvは、ハフマン符号化処理回路23に入力される。
【0021】
次にハフマン符号化処理回路23におけるハフマン符号化について、図3〜図7を参照して説明する。
量子化DC係数R(Y)00 と量子化AC係数(量子化DC係数R(Y)00 以外の量子化DCT係数R(Y)uv )では符号化方法が異なっている。量子化DC係数R(Y)00 の符号化は次のように行われる。
【0022】
まず、現在符号化しようとするブロックの量子化DC係数R(Y)00 と一つ前に符号化されたブロックの量子化DC係数R(Y)00 との差分が求められる。この差分値が図3に示すグループの何れに属するかが判断され、そのグループの番号を表す符号語が、図4に示す符号表(DC係数の符号化テーブル)から求められる。例えば、現在符号化しようとするブロックの量子化DC係数R(Y)00 が「16」であり、一つ前に符号化されたブロックの量子化DC係数R(Y)00 が「25」である時、差分値は「−9」であるので、図3のグループ番号表から、差分値=−9の属するグループの番号(SSSS)は「4」と判別され、さらにそのグループ番号(SSSS)の符号語が図4の符号表より「 101」と判断される。
【0023】
次いで差分値が、図3のグループ番号表において、そのグループ内において何番目の値であるかが、付加ビットにより表される。例えば差分値=−9はグループ番号(SSSS)=4のグループにおいて、小さい方から7番目にあるので、付加ビットは「0110」となる。すなわち、現在符号化しているブロックの量子化DC係数R(Y)00 のハフマン符号語は「 1010110」となる。
【0024】
一方、量子化AC係数の符号化は、図5に示す処理ルーチンによって行われる。まずステップ120において、63個の量子化AC係数が図6に示す順序でジクザクスキャンされ、1次元配列データに並びかえられる。次に、ステップ122では、1次元に並べられた各量子化AC係数値が「0」であるか否かが判断される。量子化AC係数が「0」である時、ステップ124において、その「0」である量子化AC係数が連続する数がカウントされる。これにより「0」が連続する長さ、すなわちラン長(NNNN)が求められる。
【0025】
これに対し、ステップ122において量子化AC係数が「0」でないと判断された時、ステップ126において、量子化DC係数と同じようなグループ分けが行われるとともに付加ビットが求められる。この量子化AC係数のグループ分けは、量子化DC係数のグループ分けとは異なり、その量子化AC係数そのものについて行われる。すなわち、量子化AC係数が例えば「4」である時、図7に示す表を参照してグループ番号(SSSS)「3」が得られる。また、量子化AC係数「4」はグループ番号(SSSS)=3のグループにおいて小さい方から5番目にあるので、付加ビットは「 100」となる。
【0026】
ステップ130では、ハフマンテーブルのAC符号表(図9)を参照し、例えば量子化AC係数「4」の直前のデータのラン長が「0」である場合、このラン長とグループ番号(SSSS) =3とに基づいて、符号語「 100」が得られる。そして、この符号語「 100」とステップ126において得られた付加ビット「 100」を組み合わせことにより2次元ハフマン符号語「100100」が求められる。
【0027】
図2(c)の量子化DCT係数をハフマン符号化した結果を、図8の符号化データ99として示す。
【0028】
図10は、画像データの固定長化圧縮の処理の流れを示すブロック図であり、図11は、この固定長化圧縮の処理ルーチンを示すフローチャートである。これらの図を参照して、固定長化圧縮の処理を説明する。
【0029】
ステップ201では、A/D変換された画像データが画像メモリ14に格納される。画像メモリ14から読み出された画像データは、ステップ202において、DCT処理回路21によりDCT係数に変換される。DCT係数はステップ203において、第1の量子化テーブルRT1を用いて量子化され、ステップ204において、第1のハフマンテーブルHT1を用いてハフマン符号化される。なお、ハフマンテーブルHT1の一部は図9に示されている。
【0030】
ステップ205では、ハフマン符号化により得られた全符号語のビット長の総和、すなわち圧縮符号量が算定されるとともに、設定符号量以下であるか否かが判定される。この設定符号量は、固定長化圧縮により得られる符号量の目標値であり、例えばユーザーが画像圧縮装置のスイッチ等を操作することにより定められる。圧縮符号量が設定符号量以下であると判定された場合、そのハフマン符号語はステップ206において圧縮データとして出力され、記録媒体M(図1)に記録される。
【0031】
一方ステップ205において、圧縮符号量が設定符号量以下ではないと判定された場合、ステップ211において、後述するハフマン符号長テーブルが生成され、このハフマン符号長テーブルに基づいて第2のハフマンテーブルHT2が生成される。そしてステップ212では、第2のハフマンテーブルHT2を用いて量子化DCT係数をハフマン符号化した場合の圧縮符号量が算定されるとともに、この圧縮符号量が設定符号量以下であるか否かが判定される。圧縮符号量が設定符号量以下であると判定された場合、ステップ213〜216が実行されて圧縮データが記録媒体Mに記録され、圧縮符号量がまだ設定符号量よりも大きいと判定された場合、ステップ221以下が実行され、量子化テーブルを変更して再びハフマン符号化が行われる。
【0032】
すなわちステップ213では、画像データがDCT処理回路21によりDCT係数に変換される。ステップ214では、DCT係数が第1の量子化テーブルRT1により量子化される。この量子化DCT係数は、ステップ215において、第2のハフマンテーブルHT2によりハフマン符号化される。このようにして得られたハフマン符号語は、ステップ216において圧縮データとして出力され、記録媒体Mに記録される。
【0033】
一方ステップ221では、第2の量子化テーブルRT2が生成される。この量子化テーブルRT2は、少なくとも一部の量子化係数が第1の量子化テーブルRT1の量子化係数よりも大きい値を有している。したがって、第1の量子化テーブルを用いて量子化を行う場合と比較して、第2の量子化テーブルRT2を用いた量子化の方が、量子化DCT係数の絶対値が小さくなり、これによりハフマン符号語のビット長を短縮させることができる。なお、このような第2の量子化テーブルRT2の生成は従来公知であるので、その説明は省略する。
【0034】
ステップ222では、画像データがDCT処理回路21によりDCT係数に変換され、このDCT係数はステップ223において、第2の量子化テーブルRT2により量子化され、ステップ224において、第1のハフマンテーブルHT1によりハフマン符号化される。次いでステップ225では、ハフマン符号化の処理の後の圧縮符号量が算定され、設定符号量以下であるか否かが判定される。圧縮符号量が設定符号量以下であると判定された場合、そのハフマン符号語はステップ226において圧縮データとして出力され、記録媒体Mに記録される。
【0035】
一方ステップ225において、圧縮符号量が設定符号量よりも大きいと判定された場合、ステップ231において画像データがDCT処理回路21によりDCT係数に変換され、ステップ232において第2の量子化テーブルRT2により量子化される。ステップ233では、ビット量調整が行われ、設定ビット長を越えた所定の高周波成分のデータが強制的に0に定められる。次いでステップ234では、量子化DCT係数が第2のハフマンテーブルHT2によりハフマン符号化され、このハフマン符号語は、ステップ235において圧縮データとして出力され、記録媒体Mに記録される。
【0036】
次に図12〜図15を参照して、第2のハフマンテーブルを用いたハフマン符号化により達成される固定長化圧縮について説明する。図12は、ある画像データをハフマン符号化するために生成された第2のハフマンテーブルと、このハフマンテーブルを生成するための手順を示し、図13〜図15は第2のハフマンテーブルに対応した符号長等の表を示している。
【0037】
図13〜図15の各表において、最上欄の「0」〜「」の数値はグループ番号(図3、図7参照)を、左欄の「0」〜「」の数値はラン長をそれぞれ示す。なお以下の説明において、ラン長とグループ番号の組合せ(例えばラン長が「0」でグループ番号が「1」である場合は「01」)をシンボルという。図13の表中の数値は各シンボルの出現数を示しており、例えばシンボル「01」の出現数は7230である。図14の表中の各数値はJPEGにより推奨されたハフマンテーブルの各符号語の符号長を示し、図15の表中の各数値は、第2のハフマンテーブルの各符号語の符号長を示している。
【0038】
図13から理解されるように、この例の画像データにおいて、グループ番号の最大値は「4」であり、ラン長の最大値は「4」である。そして、出現数が0であるものを除くと、各シンボルの出現数はシンボル「01」が最も多く、「03」、「00」、「02」の順に少なくなっており、出現数の最も少ないシンボルは「41」である。
【0039】
図12を参照して第2のハフマンテーブルの生成手順を説明する。
まず、シンボルがその出現数の大きい順に並べられる。なお図12では、0であるシンボルとしてダミーシンボルを1個追加している。
【0040】
出現数が最も少ないシンボル「(ダミー)」と、出現数が2番目に小さいシンボル「41」とに対し、それぞれ1と0が割り当てられる。そして、この2つのシンボルを併せたもの「41(ダミー)」を1つのシンボルと見做し、このシンボル「41(ダミー)」と、出現数が次に小さいシンボル「44」に対し、それぞれ1と0が割り当てられる。以下同様にして、全てのシンボルに1または0が割り当てられる。
【0041】
次いで、上述のようにして割り当てられた1または0の数字を、割り当てられた時とは逆の順に読み出し、これにより得られた数字がそのシンボルに対する符合語となる。例えば、シンボル「03」の符合語は「110」であり、シンボル「41」の符合語は「11111111111110」である。

【0042】
このようにして得られた第2のハフマンテーブルの符号語は、JPEGにより推奨されたハフマンテーブルの符号語とは異なっており、図13〜図15の各表の比較から理解されるように、例えば出現数の最も多いシンボル「01」については、JPEGによる符号長(図14において「2」)よりも第2のハフマンテーブルの符号長(図15において「1」)の方が短くなっている。また第2のハフマンテーブルにおいて、グループ番号が「4」よりも大きく、あるいはラン長が「4」よりも大きいシンボルについては、符号語は存在しない。
【0043】
本実施例では、出現数が0より多いシンボルについて第2のハフマンテーブルを生成しており、図12〜図15に示す例では、21個の符号語が生成されている。各シンボルの出現数と、そのシンボルに対応する符号長との積を求め、各積の和を計算すると全符号量(ただし付加ビットのデータ量は含まない)が得られ、図14の符号長テーブルによると、全符号量は46785ビットであるが、図15の符号長テーブルによると、全符号量は38218ビットまで縮小されている。
【0044】
以上のように本実施例によれば、第2のハフマンテーブルを用いて画像データを情報圧縮するように構成されているため、量子化テーブルだけを変更する従来装置と比較して、画像データの情報量を減らしすぎて再生画像の画質が低下することはない。また本実施例によれば、全符号量をできるだけ圧縮できるので、一定の容量を有する記録媒体Mに対して、より多くの画像データを記録することが可能となる。
【0045】
図16と図17は第2実施例を示し、図16は、第2実施例において第2のハフマンテーブルを生成する処理を示すフローチャートであり、図17は第2のハフマンテーブルに対応した符号長の表を示している。その他の構成は第1実施例と同様である。
【0046】
これらの図を参照して、第2実施例において、第2のハフマンテーブルを用いたハフマン符号化により達成される固定長化圧縮について説明する。なお、画像データ中の各シンボルの出現数は、第1実施例と同じであり(図13参照)、またJPEGにより推奨されたハフマンテーブルの各符号語の符号長も第1実施例と同じである(図14参照)。図17の表中の各数値は、第2実施例における第2のハフマンテーブルの各符号語の符号長を示している。
【0047】
図16の処理ルーチンにおいて、最初ハフマンテーブルはJPEGに準拠して生成された図14の表が設定されている。第2のハフマンテーブルは後述するように、図14のハフマンテーブルの符号長を基にして、全符号語のビット長の総和が減少するように、2つの係数値(シンボル)に対応した符号長を相互に交換することにより生成される。
【0048】
ステップ301では、削減しようとするビット数すなわち削減ビット数BDが算出される。例えば、図14のハフマンテーブルを用いた時、図13の全符号量は46785ビットであり、これを43000ビットまで削減しようとする場合、削減ビット数BDは46785−43000=3785(ビット)である。ステップ302では、全てのシンボルについて、フラグFi が0に定められる。このフラグFi は、ステップ303が実行された後、ステップ304において1に定められる。なお添字iは、量子化DCT係数のAC成分に関しては1〜162の範囲にあり、DC成分に関しては1〜12の範囲にある。
【0049】
ステップ303では、フラグFj が0のシンボルの中で最大の出現数Nj を持つシンボルの符号長Bj と、フラグFk が0のシンボルの中で最小の符号長を有するシンボルのうち最も出現数が少ないシンボルの符号長Bk とが交換される。初めてステップ303が実行されるとき、全てのフラグは0であり、シンボル「01」が最大の出現数7230を有しており、またシンボル「02」が最小の符号長2を有している。したがってシンボル「01」と「02」の符号長が交換されるが、これらは共に2であるので、この場合にはビット長は削減されない。
【0050】
ステップ304では、ステップ303において符号長の交換が行われた、最大の出現数を持つシンボルのフラグFj が1に定められる。
【0051】
ステップ305では、ステップ303における符号長の交換により削減されたビット数が下式に従って削減ビット数BDから減算され、新たな削減ビット数BDが求められる。
BD←BD−〔(Nj Bj +Nk Bk )─(Nj Bk +Nk Bj )〕
上述のようにシンボル「01」と「02」の符号長は交換しても変化しないので、削減ビット数BDは減少しない。したがってステップ306では、BDが正であると判定される。次いでステップ307では、全てのフラグFi が1ではないと判定され、再びステップ303以下が実行される。
【0052】
次のステップ303の実行では、シンボル「03」が最大の出現数2011を有しており、またシンボル「02」が最小の符号長2を有しているため、これらのシンボルにおいて符号長の交換が行われる。このシンボル「03」の符号長は3であり、シンボル「02」の符号長2よりも長いため、ステップ303の符号長の交換処理によって全符号量は削減される。
【0053】
ステップ306では、現在の削減ビット数BDが0以下であるか否かが判定され、0以下になっていれば、すなわちさらに削減すべきビット数がなければ、これにより本ルーチンは終了する。一方、ステップ307において全てのフラグFi が1に変化していると判定された場合、これ以上交換できる符号長がないため、本ルーチンは終了する。
【0054】
図17のハフマン符号長テーブルは、図16のルーチンによって得られたハフマン符号長を示しており、図14との比較から理解されるように、全部で12個のシンボルに関して符号長が変更されている。また全符号量は42472ビットであり、固定長化圧縮の目標値である43000ビットに近く、最小限の情報圧縮が施されている。
【0055】
本実施例において第2のハフマンテーブルは、第1のハフマンテーブルの符号長を基にして、全符号量が減少するように、2つのシンボルに対応した符号長を相互に交換することにより、生成される。そして、削減ビット数BDが0以下になったことにより、図16の処理ルーチンは終了する。したがって、第1実施例の処理ルーチン(図11)と比較して、符号長が変更されるシンボルの数は少なく、短時間で固定長化圧縮が達成される。
【0056】
以上のように第2実施例によれば、短時間で固定長化圧縮が達成される点を除いて、第1実施例と同様な効果が得られる。
【0057】
なお第1および第2実施例では、量子化DCT係数の各係数値を、出現数を用いて統計処理することにより第2のハフマンテーブルを生成しているが、出現数以外の統計量を用いてもよい。
【0058】
【発明の効果】
以上のように本発明によれば、再生画像の画質を低下させることなく、画像データを固定長化圧縮することができるという効果が得られる。
【図面の簡単な説明】
【図1】本発明の第1実施例の画像圧縮装置を示すブロック図である。
【図2】第1実施例における画像データP(Y)xy 、DCT変換係数S(Y)uv 、量子化DCT係数R(Y)uv の例を示す図である。
【図3】DC係数の差分値のグループ化を示す図である。
【図4】DC係数の符号表を示す図である。
【図5】量子化AC係数の符号化を行う処理ルーチンを示すフローチャートである。
【図6】AC係数のハフマン符号化におけるジグザグスキャンを示す図である。
【図7】AC係数のグループ化を示す図である。
【図8】ハフマン符号化による符号化データの一例を示す図である。
【図9】JPEGにより推奨されたハフマンテーブルを示す図である。
【図10】画像データの固定長化圧縮の処理の流れを示すブロック図である。
【図11】画像データの固定長化圧縮の処理ルーチンを示すフローチャートである。
【図12】ある画像をハフマン符号化するために生成された第2のハフマンテーブルと、このハフマンテーブルを生成するための手順を示す図である。
【図13】図12における画像データ中の「ラン長とグループ番号の組合せ」の出現数を示す図である。
【図14】JPEGにより推奨されたハフマンテーブルの各符号語の符号長を示す図である。
【図15】第1実施例において生成された第2のハフマンテーブルの各符号語の符号長を示す図である。
【図16】第2実施例において第2のハフマンテーブルを生成する処理ルーチンを示すフローチャートである。
【図17】第2実施例において生成された第2のハフマンテーブルの各符号語の符号長を示す図である。
【符号の説明】
M ICメモリカード
[0001]
[Industrial applications]
The present invention relates to an image compression apparatus for compressing information of a color still image in accordance with the JPEG algorithm.
[0002]
[Prior art]
A standardized algorithm for encoding a high-resolution image and exchanging information via a communication transmission path is recommended by JPEG (Joint Photographic Expert Group). In the algorithm recommended by JPEG, that is, the baseline process of the JPEG algorithm, the original image data is first decomposed into components on the spatial frequency axis by a two-dimensional DCT transform in order to perform significant information compression. Each data represented on the spatial frequency axis is quantized, and each quantized data is encoded. JPEG recommends a predetermined Huffman table for this encoding.
[0003]
On the other hand, there is conventionally known an image compression apparatus for performing fixed-length compression, that is, information compression so that the amount of image data corresponding to one screen becomes a constant value. In such an image compression apparatus, when the amount of image data still exceeds a certain value even by encoding using the Huffman table, information compression is performed by changing the quantization table and performing quantization again. I have. As a result, if the amount of image data is still too large, high-frequency component data exceeding the set bit length is forcibly set to zero.
[0004]
[Problems to be solved by the invention]
However, according to such conventional fixed-length compression, as a result of quantization, the amount of image data may be reduced below a certain value. In such a case, when the image data is reproduced, As a result, the image quality is reduced. In addition, even if the data of the high-frequency component exceeding the set bit length is forcibly set to 0 after the quantization, a problem that the image quality of the reproduced image is deteriorated occurs.
[0005]
SUMMARY OF THE INVENTION In view of the above problems, an object of the present invention is to provide an image compression apparatus that can perform fixed length compression of image data without deteriorating the image quality of a reproduced image.
[0006]
[Means for Solving the Problems]
An image compression apparatus according to the present invention includes an orthogonal transform unit for performing orthogonal transform on original image data to obtain an orthogonal transform coefficient, and a quantized orthogonal transform by quantizing the orthogonal transform coefficient using a first quantization table. First quantizing means for obtaining coefficients, first Huffman encoding means for encoding the quantized orthogonal transform coefficients obtained by the first quantizing means using a first Huffman table, Code amount determining means for calculating the code amount obtained by the first Huffman coding means and determining whether the code amount is equal to or less than a set code amount; When it is determined that the above is not the case, it is provided that there are provided a means for generating a second Huffman table, and a second Huffman coding means for coding the quantized orthogonal transform coefficient using the second Huffman table. Features There.
[0007]
【Example】
Hereinafter, the present invention will be described based on illustrated embodiments.
FIG. 1 is a block diagram of an image compression apparatus according to a first embodiment of the present invention.
[0008]
Light arriving from the subject S is condensed by the condenser lens 11, and a subject image is formed on a light receiving surface of a CCD (solid-state imaging device) 12. A large number of photoelectric conversion elements are provided on the light receiving surface of the CCD 12, and a color filter including, for example, R, G, and B color filter elements is provided on the upper surface of the photoelectric conversion element. Each photoelectric conversion element corresponds to one pixel data. The subject image is converted into an electric signal corresponding to a predetermined color by each photoelectric conversion element, and is input to the A / D converter 13. In the configuration of FIG. 1, only one CCD 12 is provided, but a configuration in which two or more CCDs are provided may be employed.
[0009]
The signal A / D converted by the A / D converter 13 is converted into a luminance signal Y and color difference signals Cb and Cr by a signal processing circuit (not shown), and is input to the image memory 14. The image memory 14 is divided into mutually independent memory areas for storing the luminance signal Y and the color difference signals Cb and Cr, respectively, and each memory area has a storage capacity for one image.
[0010]
The luminance signal Y and the color difference signals Cb and Cr read from the image memory 14 are input to a DCT processing circuit 21 for data compression processing. In the DCT processing circuit 21, the original image data such as the luminance signal Y is subjected to discrete cosine transform (hereinafter referred to as DCT). That is, in the present embodiment, DCT transform is used as orthogonal transform of original image data. Although the DCT processing circuit 21 is shown as one processing circuit in FIG. 1, an independent DCT processing circuit is provided for each of the luminance signal Y, the color difference signals Cb, and Cr.
[0011]
In an image compression device including a DCT processing circuit 21, a quantization processing circuit 22, a Huffman coding processing circuit 23, a control circuit 24, and the like, image data such as a luminance signal Y is divided into a plurality of blocks for one screen, and the image data is divided into blocks. It is processed. Each block is composed of 8 × 8 pixel data.
[0012]
The DCT coefficients of the luminance signal Y and the color difference signals Cb and Cr obtained by the DCT processing circuit 21 are input to the quantization processing circuit 22, respectively. As with the DCT processing circuit 21, the quantization processing circuit 22 is provided for each signal. The DCT coefficients of the luminance signal Y and the chrominance signals Cb and Cr input to the quantization processing circuit 22 are respectively quantized by a quantization table including 8 × 8 quantization coefficients. This quantization is a linear quantization, ie each DCT coefficient is divided by the corresponding quantization coefficient.
[0013]
In the present embodiment, the quantization table for quantizing the DCT coefficients of the luminance signal Y and the quantization table for quantizing the DCT coefficients of the color difference signals Cb and Cr are different from each other in accordance with the JPEG algorithm. , The same quantization table may be used for each signal. Further, these quantization tables can be changed by the control circuit 24 for fixed length compression as described later.
[0014]
The quantized DCT coefficients of the luminance signal Y and the chrominance signals Cb and Cr output from the quantization processing circuit 22 are input to a Huffman coding processing circuit 23 and are subjected to Huffman coding by a predetermined algorithm. The Huffman table used in the Huffman coding is generated according to the Huffman code length table, and the Huffman code length table can be changed by the control circuit 24 in the same manner as the quantization table.
[0015]
The image signals (Y ′, Cb ′, Cr ′) obtained by the Huffman coding are recorded on an IC memory card (recording medium) M. When the image data is recorded on the IC memory card M, the quantization table and the Huffman code length table are also incorporated in the image data and recorded on the IC memory card M.
[0016]
FIG. 2 shows, as an example, image data P (Y) xy of a block of 8 × 8 pixels, DCT coefficient S (Y) uv, quantized DCT coefficient R (Y) uv, and quantization table Q (Y). uv.
[0017]
The image data P (Y) xy of FIG. 2A is converted into 8 × 8 = 64 DCT coefficients S (Y) uv shown in FIG. 2B by two-dimensional DCT. Among these DCT coefficients, the DCT coefficient S (Y) 00 at the position (0, 0) is a DC coefficient, and the remaining 63 DCT coefficients S (Y) uv are AC coefficients. The AC coefficient indicates from the coefficient S (Y) 01 or S (Y) 10 to the coefficient S (Y) 77 how much higher spatial frequency components are present in the image data of the 8 × 8 pixel block. I have. The DC coefficient represents the average value (DC component) of the pixel values of the entire block of 8 × 8 pixels. That is, each DCT coefficient S (Y) uv corresponds to a predetermined spatial frequency.
[0018]
FIG. 2D shows an example of the quantization table Q (Y) uv used in the quantization processing circuit 21. As described above, the quantization table Q (Y) uv may be different for the luminance signal Y and the color difference signals Cb and Cr. In this case, when the JPEG format image data is recorded on the IC memory card M, the contents of the quantization table Q (Y) uv used for quantization of the signal are recorded at the position corresponding to each signal. .
[0019]
An expression for quantizing the DCT coefficient S (Y) uv using the quantization table Q (Y) uv is defined as follows.
R (Y) uv = round (S (Y) uv / Q (Y) uv) {0 ≦ u, v ≦ 7}
Round in this equation means approximation to the nearest integer. That is, the quantized DCT coefficient R (Y) uv as shown in FIG. 2C is obtained by dividing and rounding each element of the DCT coefficient S (Y) uv and the quantization table Q (Y) uv. Can be
[0020]
The quantized DCT coefficients R (Y) uv, R (Cb) uv, and R (Cr) uv obtained in the quantization processing circuit 22 are input to the Huffman coding processing circuit 23.
[0021]
Next, Huffman encoding in the Huffman encoding processing circuit 23 will be described with reference to FIGS.
The encoding method differs between the quantized DC coefficient R (Y) 00 and the quantized AC coefficient (the quantized DCT coefficient R (Y) uv other than the quantized DC coefficient R (Y) 00 ). The encoding of the quantized DC coefficient R (Y) 00 is performed as follows.
[0022]
First, difference between the current quantized DC coefficient of a block to be coded R (Y) 00 and one previously coded blocks quantized DC coefficient R (Y) 00 is obtained. It is determined to which of the groups shown in FIG. 3 the difference value belongs, and a code word indicating the number of the group is obtained from the code table (DC coefficient coding table) shown in FIG. For example, the quantized DC coefficient R (Y) 00 of the block to be currently encoded is “16”, and the quantized DC coefficient R (Y) 00 of the block encoded immediately before is “25”. At one time, since the difference value is “−9”, the group number (SSSS) to which the difference value = −9 belongs is determined to be “4” from the group number table of FIG. Is determined to be "101" from the code table of FIG.
[0023]
Next, the number of the difference value in the group number table of FIG. 3 within the group is represented by an additional bit. For example, since the difference value = -9 is the seventh from the smallest in the group with the group number (SSSS) = 4, the additional bit is "0110". That is, the Huffman code word of the quantized DC coefficient R (Y) 00 of the block currently being encoded is “1010110”.
[0024]
On the other hand, encoding of the quantized AC coefficient is performed by a processing routine shown in FIG. First, at step 120, the 63 quantized AC coefficients are zigzag scanned in the order shown in FIG. 6 and rearranged into one-dimensional array data. Next, in step 122, it is determined whether or not the quantized AC coefficient values arranged one-dimensionally are “0”. When the quantized AC coefficient is “0”, the number of consecutive “0” quantized AC coefficients is counted in step 124. As a result, a length in which “0” continues, that is, a run length (NNNN) is obtained.
[0025]
On the other hand, when it is determined in step 122 that the quantized AC coefficient is not “0”, in step 126, the same grouping as the quantized DC coefficient is performed and additional bits are obtained. The grouping of the quantized AC coefficients is different from the grouping of the quantized DC coefficients, and is performed on the quantized AC coefficients themselves. That is, when the quantized AC coefficient is, for example, “4”, the group number (SSSS) “3” is obtained with reference to the table shown in FIG. Further, since the quantized AC coefficient “4” is the fifth in the group with the group number (SSSS) = 3 from the smallest, the additional bit is “100”.
[0026]
In step 130, referring to the AC code table of the Huffman table (FIG. 9), for example, when the run length of the data immediately before the quantized AC coefficient “4” is “0”, the run length and the group number (SSSS) = 3, the code word “100” is obtained. Then, a two-dimensional Huffman code word "100100" is obtained by combining the code word "100" and the additional bit "100" obtained in step 126.
[0027]
The result of the Huffman coding of the quantized DCT coefficient in FIG. 2C is shown as coded data 99 in FIG.
[0028]
FIG. 10 is a block diagram showing the flow of processing for fixed-length compression of image data, and FIG. 11 is a flowchart showing a processing routine for this fixed-length compression. The fixed length compression processing will be described with reference to these figures.
[0029]
In step 201, the A / D converted image data is stored in the image memory 14. At step 202, the DCT processing circuit 21 converts the image data read from the image memory 14 into DCT coefficients. The DCT coefficients are quantized in step 203 using the first quantization table RT1, and in step 204, Huffman encoded using the first Huffman table HT1. A part of the Huffman table HT1 is shown in FIG.
[0030]
In step 205, the sum of the bit lengths of all the codewords obtained by the Huffman coding, that is, the compression code amount is calculated, and it is determined whether or not it is equal to or less than the set code amount. The set code amount is a target value of the code amount obtained by the fixed-length compression, and is determined, for example, by a user operating a switch or the like of the image compression device. If it is determined that the compression code amount is equal to or less than the set code amount, the Huffman code word is output as compressed data in step 206 and recorded on the recording medium M (FIG. 1).
[0031]
On the other hand, if it is determined in step 205 that the compression code amount is not less than the set code amount, a Huffman code length table described later is generated in step 211, and the second Huffman table HT2 is generated based on the Huffman code length table. Generated. In step 212, the compressed code amount when the quantized DCT coefficient is Huffman-encoded using the second Huffman table HT2 is calculated, and it is determined whether the compressed code amount is equal to or less than the set code amount. Is done. When it is determined that the compression code amount is equal to or less than the set code amount, steps 213 to 216 are executed to record the compressed data on the recording medium M, and when it is determined that the compression code amount is still larger than the set code amount , 221 and the subsequent steps are executed, the quantization table is changed, and Huffman encoding is performed again.
[0032]
That is, in step 213, the image data is converted into DCT coefficients by the DCT processing circuit 21. In step 214, the DCT coefficient is quantized by the first quantization table RT1. In step 215, the quantized DCT coefficients are Huffman-coded by the second Huffman table HT2. The Huffman codeword thus obtained is output as compressed data in step 216 and recorded on the recording medium M.
[0033]
On the other hand, in step 221, a second quantization table RT2 is generated. In the quantization table RT2, at least some of the quantization coefficients have values larger than the quantization coefficients of the first quantization table RT1. Therefore, the absolute value of the quantized DCT coefficient is smaller in the quantization using the second quantization table RT2 than in the case where the quantization is performed using the first quantization table. The bit length of the Huffman code word can be reduced. Since the generation of the second quantization table RT2 is conventionally known, a description thereof will be omitted.
[0034]
In step 222, the image data is converted into DCT coefficients by the DCT processing circuit 21, and the DCT coefficients are quantized in step 223 by the second quantization table RT2, and in step 224, by the first Huffman table HT1. Encoded. Next, at step 225, the compression code amount after the Huffman coding process is calculated, and it is determined whether the compression code amount is equal to or less than the set code amount. If it is determined that the compression code amount is equal to or less than the set code amount, the Huffman code word is output as compressed data in step 226 and recorded on the recording medium M.
[0035]
On the other hand, when it is determined in step 225 that the compression code amount is larger than the set code amount, the image data is converted into DCT coefficients by the DCT processing circuit 21 in step 231, and the quantization is performed by the second quantization table RT 2 in step 232. Be transformed into In step 233, bit amount adjustment is performed, and data of a predetermined high-frequency component exceeding the set bit length is forcibly set to zero. Next, in step 234, the quantized DCT coefficients are Huffman-coded by the second Huffman table HT2, and this Huffman codeword is output as compressed data in step 235 and recorded on the recording medium M.
[0036]
Next, fixed-length compression achieved by Huffman coding using the second Huffman table will be described with reference to FIGS. FIG. 12 shows a second Huffman table generated for performing Huffman coding on certain image data, and a procedure for generating this Huffman table. FIGS. 13 to 15 correspond to the second Huffman table. A table such as code length is shown.
[0037]
In each of the tables of FIGS. 13 to 15, numerical values of “0” to “ A ” in the uppermost column represent group numbers (see FIGS. 3 and 7), and numerical values of “0” to “ F ” in the left column represent run lengths. Are respectively shown. In the following description, a combination of a run length and a group number (for example, “01” when the run length is “0” and the group number is “1”) is referred to as a symbol. The numerical values in the table of FIG. 13 indicate the number of appearances of each symbol. For example, the number of appearances of the symbol “01” is 7230. Each numerical value in the table of FIG. 14 indicates the code length of each code word of the Huffman table recommended by JPEG, and each numerical value in the table of FIG. 15 indicates the code length of each code word of the second Huffman table. ing.
[0038]
As understood from FIG. 13, in the image data of this example, the maximum value of the group number is “4” and the maximum value of the run length is “4”. Then, except for the case where the number of appearances is 0, the number of appearances of each symbol is the largest for the symbol “01”, and decreases in the order of “03”, “00”, and “02”, and the number of appearances is the smallest. The symbol is “41”.
[0039]
The procedure for generating the second Huffman table will be described with reference to FIG.
First, the symbols are arranged in descending order of the number of appearances. In FIG. 12, one dummy symbol is added as a symbol that is 0.
[0040]
1 and 0 are assigned to the symbol “(dummy)” with the smallest number of appearances and the symbol “41” with the second smallest number of appearances. Then, the combination of these two symbols “41 (dummy)” is regarded as one symbol, and the symbol “41 (dummy)” and the symbol “44” having the next smallest number of appearances are each 1 symbol. And 0 are assigned. Similarly, 1 or 0 is assigned to all symbols.
[0041]
Next, the numbers 1 or 0 assigned as described above are read out in the reverse order of the assignment, and the number obtained as a code word for the symbol. For example, the code word of the symbol “03” is “110”, and the code word of the symbol “41” is “11111111111110”.

[0042]
The codeword of the second Huffman table obtained in this way is different from the codeword of the Huffman table recommended by JPEG, and as can be understood from the comparison of the tables of FIGS. For example, for the symbol “01” having the largest number of appearances, the code length of the second Huffman table (“1” in FIG. 15) is shorter than the code length by JPEG (“2” in FIG. 14). . In the second Huffman table, no codeword exists for a symbol whose group number is larger than “4” or whose run length is larger than “4”.
[0043]
In the present embodiment, the second Huffman table is generated for symbols whose number of appearances is greater than 0, and in the examples shown in FIGS. 12 to 15, 21 code words are generated. When the product of the number of appearances of each symbol and the code length corresponding to the symbol is obtained and the sum of the products is calculated, the total code amount (excluding the data amount of the additional bits) is obtained. According to the table, the total code amount is 46785 bits, but according to the code length table of FIG. 15, the total code amount is reduced to 38218 bits.
[0044]
As described above, according to the present embodiment, since the image data is compressed using the second Huffman table, the image data is compared with the conventional device in which only the quantization table is changed. The amount of information is not reduced too much, so that the image quality of the reproduced image does not deteriorate. Further, according to the present embodiment, since the entire code amount can be compressed as much as possible, it is possible to record more image data on the recording medium M having a fixed capacity.
[0045]
16 and 17 show the second embodiment. FIG. 16 is a flowchart showing a process for generating a second Huffman table in the second embodiment. FIG. 17 shows a code length corresponding to the second Huffman table. Is shown. Other configurations are the same as in the first embodiment.
[0046]
With reference to these figures, a description will be given of fixed-length compression achieved by Huffman coding using the second Huffman table in the second embodiment. The number of appearances of each symbol in the image data is the same as in the first embodiment (see FIG. 13), and the code length of each codeword in the Huffman table recommended by JPEG is the same as in the first embodiment. (See FIG. 14). Each numerical value in the table of FIG. 17 indicates the code length of each codeword of the second Huffman table in the second embodiment.
[0047]
In the processing routine of FIG. 16, the Huffman table is initially set to the table of FIG. 14 generated in conformity with JPEG. As will be described later, the second Huffman table has a code length corresponding to two coefficient values (symbols) based on the code length of the Huffman table in FIG. 14 so that the sum of the bit lengths of all codewords is reduced. Are generated by exchanging.
[0048]
In step 301, the number of bits to be reduced, that is, the reduced bit number BD is calculated. For example, when the Huffman table in FIG. 14 is used, the total code amount in FIG. 13 is 46785 bits, and when trying to reduce this to 43000 bits, the reduced bit number BD is 46785-43000 = 3785 (bits). . In step 302, the flags Fi are set to 0 for all the symbols. This flag Fi is set to 1 in step 304 after step 303 is executed. The subscript i ranges from 1 to 162 for the AC component of the quantized DCT coefficient, and ranges from 1 to 12 for the DC component.
[0049]
In step 303, the code length Bj of the symbol having the largest number of occurrences Nj among the symbols having the flag Fj of 0 and the symbol having the smallest number of occurrences among the symbols having the smallest code length among the symbols having the flag Fk of 0 are provided. The code length Bk of the symbol is exchanged. When step 303 is executed for the first time, all flags are 0, symbol “01” has the largest number of occurrences 7230, and symbol “02” has the smallest code length of 2. Therefore, the code lengths of the symbols "01" and "02" are exchanged, but since both are 2, the bit length is not reduced in this case.
[0050]
In step 304, the flag Fj of the symbol having the largest number of occurrences whose code length has been exchanged in step 303 is set to 1.
[0051]
In step 305, the number of bits reduced by the exchange of the code length in step 303 is subtracted from the number of reduced bits BD according to the following equation to obtain a new number of reduced bits BD.
BD ← BD − [(NjBj + NkBk) ─ (NjBk + NkBj)]
As described above, since the code lengths of the symbols “01” and “02” do not change even if they are exchanged, the reduced bit number BD does not decrease. Therefore, in step 306, it is determined that BD is positive. Next, at step 307, it is determined that all the flags Fi are not 1, and the steps after step 303 are executed again.
[0052]
In the execution of the next step 303, the symbol “03” has the maximum number of appearances 2011 and the symbol “02” has the minimum code length 2, so that the exchange of code lengths in these symbols is performed. Is performed. Since the code length of the symbol “03” is 3, which is longer than the code length 2 of the symbol “02”, the code length exchange processing in step 303 reduces the total code amount.
[0053]
In step 306, it is determined whether or not the current number of bits BD to be reduced is equal to or less than 0. If the number is equal to or less than 0, that is, if there is no further number of bits to be reduced, the routine ends. On the other hand, if it is determined in step 307 that all the flags Fi have changed to 1, this routine ends because there is no more code length that can be exchanged.
[0054]
The Huffman code length table in FIG. 17 shows the Huffman code length obtained by the routine in FIG. 16, and as understood from the comparison with FIG. 14, the code length is changed for a total of 12 symbols. I have. The total code amount is 42472 bits, which is close to the target value of the fixed-length compression of 43000 bits, and the minimum information compression is performed.
[0055]
In this embodiment, the second Huffman table is generated based on the code length of the first Huffman table by exchanging the code lengths corresponding to the two symbols with each other so that the total code amount is reduced. Is done. Then, when the reduced bit number BD becomes 0 or less, the processing routine of FIG. 16 ends. Therefore, as compared with the processing routine of the first embodiment (FIG. 11), the number of symbols whose code length is changed is small, and fixed-length compression is achieved in a short time.
[0056]
As described above, according to the second embodiment, the same effects as those of the first embodiment can be obtained except that fixed length compression is achieved in a short time.
[0057]
In the first and second embodiments, the second Huffman table is generated by statistically processing each coefficient value of the quantized DCT coefficient using the number of appearances. May be.
[0058]
【The invention's effect】
As described above, according to the present invention, it is possible to obtain an effect that image data can be fixed-length-compressed without lowering the image quality of a reproduced image.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating an image compression apparatus according to a first embodiment of the present invention.
FIG. 2 is a diagram illustrating an example of image data P (Y) xy, a DCT transform coefficient S (Y) uv, and a quantized DCT coefficient R (Y) uv in the first embodiment.
FIG. 3 is a diagram showing grouping of difference values of DC coefficients.
FIG. 4 is a diagram showing a code table of DC coefficients.
FIG. 5 is a flowchart illustrating a processing routine for encoding a quantized AC coefficient.
FIG. 6 is a diagram illustrating a zigzag scan in Huffman coding of AC coefficients.
FIG. 7 is a diagram showing grouping of AC coefficients.
FIG. 8 is a diagram illustrating an example of encoded data obtained by Huffman encoding.
FIG. 9 is a diagram showing a Huffman table recommended by JPEG.
FIG. 10 is a block diagram showing a flow of processing for fixed-length compression of image data.
FIG. 11 is a flowchart illustrating a processing routine for fixed-length compression of image data.
FIG. 12 is a diagram illustrating a second Huffman table generated for performing Huffman coding on a certain image, and a procedure for generating the Huffman table.
13 is a diagram illustrating the number of appearances of “combination of run length and group number” in the image data in FIG. 12;
FIG. 14 is a diagram showing the code length of each codeword of the Huffman table recommended by JPEG.
FIG. 15 is a diagram illustrating the code length of each codeword of the second Huffman table generated in the first embodiment.
FIG. 16 is a flowchart illustrating a processing routine for generating a second Huffman table in the second embodiment.
FIG. 17 is a diagram showing the code length of each codeword of a second Huffman table generated in the second embodiment.
[Explanation of symbols]
M IC memory card

Claims (1)

原画像データに直交変換を施して直交変換係数を求める直交変換手段と、
前記直交変換係数を第1の量子化テーブルを用いて量子化することにより第1の量子化直交変換係数を求める第1の量子化手段と、
この第1の量子化手段により得られた量子化直交変換係数を、第1のハフマンテーブルを用いて符号化する第1のハフマン符号化手段と、
この第1のハフマン符号化手段により得られた符号量を算定し、前記符号量が設定符号量以下であるか否かを判定する符号量判定手段と、
この符号量判定手段により前記符号量が設定符号量以下ではないと判定されたとき、第2のハフマンテーブルを生成する手段と、
少なくとも一部の量子化係数が前記第1の量子化テーブルの量子化係数よりも大きい値を有する第2の量子化テーブルを用いて、前記直交変換係数を量子化することにより第2の量子化直交変換係数を求める第2の量子化手段と、
前記第2のハフマンテーブルを用いて前記第1または第2の量子化直交変換係数を符号化する第2のハフマン符号化手段とを備え
前記第2のハフマンテーブルは、前記第1のハフマンテーブルの符号長を基にして、前記第1の量子化直交変換係数に対応した係数値において、出現数が最大である係数値の符号長と最小の符号長を有する係数値のうち出現数が最小である符号長とを交換して、全符号語のビット長の総和を減少させることにより生成されることを特徴とする画像圧縮装置。
Orthogonal transformation means for performing orthogonal transformation on the original image data to obtain orthogonal transformation coefficients,
A first quantizing means for obtaining a first quantized orthogonal transform coefficients by quantizing using a first quantization table the orthogonal transform coefficients,
First Huffman encoding means for encoding the quantized orthogonal transform coefficients obtained by the first quantization means using a first Huffman table;
A code amount determining unit that calculates a code amount obtained by the first Huffman coding unit and determines whether the code amount is equal to or less than a set code amount;
Means for generating a second Huffman table when the code amount determining means determines that the code amount is not less than the set code amount;
The second quantization is performed by quantizing the orthogonal transform coefficients using a second quantization table in which at least a part of the quantization coefficients has a value larger than that of the first quantization table. Second quantization means for obtaining orthogonal transform coefficients,
A second Huffman encoding unit that encodes the first or second quantized orthogonal transform coefficient using the second Huffman table ,
The second Huffman table, based on the code length of the first Huffman table, in the coefficient value corresponding to the first quantized orthogonal transform coefficient, the code length of the coefficient value having the largest number of occurrences and An image compression apparatus characterized by being generated by exchanging a code length having the smallest number of occurrences among coefficient values having a minimum code length and reducing the sum of bit lengths of all codewords .
JP15524594A 1994-06-14 1994-06-14 Image compression device Expired - Fee Related JP3559314B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15524594A JP3559314B2 (en) 1994-06-14 1994-06-14 Image compression device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15524594A JP3559314B2 (en) 1994-06-14 1994-06-14 Image compression device

Publications (2)

Publication Number Publication Date
JPH089373A JPH089373A (en) 1996-01-12
JP3559314B2 true JP3559314B2 (en) 2004-09-02

Family

ID=15601709

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15524594A Expired - Fee Related JP3559314B2 (en) 1994-06-14 1994-06-14 Image compression device

Country Status (1)

Country Link
JP (1) JP3559314B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100186915B1 (en) * 1994-07-13 1999-05-01 모리시다 요이치 Digital coding/decoding apparatus using variable length codes
JP2781535B2 (en) * 1994-07-13 1998-07-30 松下電器産業株式会社 Digital encoding device and digital code decoding device
US6643402B1 (en) 1999-03-23 2003-11-04 Sanyo Electric Co., Ltd Image compression device allowing rapid and highly precise encoding while suppressing code amount of image data after compression
CN110999298A (en) 2017-07-05 2020-04-10 Red.Com有限责任公司 Video image data processing in an electronic device

Also Published As

Publication number Publication date
JPH089373A (en) 1996-01-12

Similar Documents

Publication Publication Date Title
US5497246A (en) Image signal processing device
EP0580454B1 (en) Coding and decoding of digital data
JP2004531995A5 (en)
JPH0832039B2 (en) Variable length coding method and apparatus thereof
WO2005079054A1 (en) Image compression device
US5737448A (en) Method and apparatus for low bit rate image compression
US6396955B1 (en) Image compression and expansion device
US5742342A (en) Apparatus for encoding an image signal using vector quantization technique
JP3532963B2 (en) Image compression device
JPWO2003079692A1 (en) Hierarchical encoding apparatus and decoding apparatus
JP3559314B2 (en) Image compression device
In et al. On RD optimized progressive image coding using JPEG
JP3469438B2 (en) Image signal processing method and apparatus, recording medium
JP3217507B2 (en) Image compression device
JPH0487460A (en) Picture processor
JPH1075450A (en) Image compressor
JP3709106B2 (en) Image compression and decompression device
JP3392949B2 (en) Image compression device and image decompression device
JP3190164B2 (en) Code amount estimation device
JP3645690B2 (en) Image compression apparatus and camera
JP3421463B2 (en) Quantization table generation device for image compression device
KR0160616B1 (en) Digital image compressing method and device
JPH0752951B2 (en) Image data compression processing method and apparatus
JP2710135B2 (en) Adaptive coding between frames / intra-frame
JP3866539B2 (en) Encoding method, decoding method, encoding device, decoding device, encoding program, decoding program, and program recording medium thereof

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040223

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040421

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: 20040506

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040521

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: 20090528

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20090528

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100528

Year of fee payment: 6

LAPS Cancellation because of no payment of annual fees