JP2005020386A - Image pickup device and image pickup method - Google Patents

Image pickup device and image pickup method Download PDF

Info

Publication number
JP2005020386A
JP2005020386A JP2003182627A JP2003182627A JP2005020386A JP 2005020386 A JP2005020386 A JP 2005020386A JP 2003182627 A JP2003182627 A JP 2003182627A JP 2003182627 A JP2003182627 A JP 2003182627A JP 2005020386 A JP2005020386 A JP 2005020386A
Authority
JP
Japan
Prior art keywords
code amount
scf
image data
value
code
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.)
Pending
Application number
JP2003182627A
Other languages
Japanese (ja)
Inventor
Yoshimasa Nakazato
佳正 中里
Katsumi Kato
勝巳 加藤
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP2003182627A priority Critical patent/JP2005020386A/en
Publication of JP2005020386A publication Critical patent/JP2005020386A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To adjust the code amount of image data to be compression-encoded without putting processing burdens on a microcomputer by a small memory capacity even for different output image sizes. <P>SOLUTION: A code amount change ratio calculation part 14a changes an SCF value to be multiplied with a basic quantization table and calculates the change ratio of the code amount of the image data corresponding to the change of the SCF value. In the case that the code amount of the image data is out of a prescribed range, an SCF value deciding part 14b refers to the calculated change ratio and decides the SCF value to turn the code amount to be within the prescribed range. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、撮像装置及び撮像方法に関し、特に、被写体の画像データを取り込み圧縮符号化する撮像装置及び撮像方法に関する。
【0002】
【従来の技術】
静止画像として撮像した被写体の画像データを取り込んで圧縮符号化する方式としてJPEG(Joint Photographic Expert Group)が知られている。
【0003】
JPEG方式では、離散コサイン変換(DCT:Discrete Cosine Transform)、量子化、エントロピー符号化などのアルゴリズムにより撮像した画像データを圧縮符号化する。
【0004】
以下、従来における量子化処理について説明する。
量子化では、量子化テーブルを用い、DCT処理後の8×8の64画素からなるブロックごとに、画像データを量子化(除算)する。量子化テーブルとは、基本量子化テーブルとスケーリングファクタ(以下SCFまたはSCF値と表記する)を乗算した値となり、以下の式で表される。
【0005】
【数1】
QTable[i,j]=SCF×BaseQTable[i,j]……(1)
なおここで、“QTable[i,j]”は量子化テーブルの[i,j]番目の値、“BaseQTable[i,j]”は基本量子化テーブルの[i,j]番目の値を示している。SCF値は量子化ステップ幅を変化させ、画像データの符号量を変化させる。SCF値を大きくするほど符号量は小さくなり、小さくするほど符号量は大きくなる。また、量子化テーブルはY(輝度)成分用のものとC(色差)成分用のものがあり、SCF値もY成分用、C成分用のものが別々に用意されている。
【0006】
一般に、符号量が大きければ画質がよくなるが、システムにおいて許容される符号量(以下制限符号量と呼ぶ)が異なる。
従来、量子化の際のSCF値を複数個の固定値として持ち、最初のSCF値で量子化し、制限符号量で規定された範囲内に収まっていなかった場合、次のSCF値を用いて量子化を行うという処理を、制限符号量の範囲内に収まるまで繰り返していた。このような場合、最適なSCF値を求めるのに、フレームメモリを実装する必要があり、コストがかかり、且つ、チップサイズが大きくなってしまうという問題があった。
【0007】
このため、SCF値に対する符号量の予測が必要になっており、いくつかの技術が開示されている。
例えば、符号量予測で、各SCF値に対する符号量をテーブルとして持ち、入力されたSCF値に応じた符号量を一意に予測するというものがある(特許文献1参照)。
【0008】
【特許文献1】
特開2002−369198号公報(段落番号〔0083〕、〔0084〕,第7図)
【0009】
【発明が解決しようとする課題】
しかし、上記の従来技術では、以下のような問題があった。
近年では、例えば、カメラモジュールで撮像し、圧縮符号化された画像データは、複数の出力画像サイズに対応していることが求められている。出力画像サイズとしては、640(画素)×480(ライン)画素のVGA(Video Graphics Array)、320×240画素のQVGA(Quarter Video Graphics Array)、352×288画素のCIF(Common Intermediate Format)、176×144画素のQCIF(Quarter Common Intermediate Format)などがある。従来では、このような出力画像サイズの違いに対応していないので、出力画像サイズごとに、SCF値に対する符号量のテーブルデータ、もしくはパラメータなどを持たなければならないという問題があった。このような場合、出力画像サイズの種類が増えるほど必要となるROM(Read Only Memory)、RAM(Random Access Memory)などのメモリ容量が膨大なものになってしまうという問題があった。
【0010】
また、従来の方法では、SCF値の制御はカメラモジュールの上位側のマイクロコンピュータ(以下マイコンと略す)で行っていたため、上位側のマイコンに処理負担がかかるという問題があった。
【0011】
また、従来の方法では、SCF値に対して、符号量を一意に決めてしまっているので、符号量のエラーに応じた符号量の調整は不可能であった。
本発明はこのような点に鑑みてなされたものであり、少ないメモリ容量でマイコンに処理負担をかけずに、符号量の調整が可能な撮像装置及び撮像方法を提供することを目的とする。
【0012】
【課題を解決するための手段】
本発明では上記課題を解決するために、被写体の画像データを取り込み圧縮符号化する撮像装置において、所定の前記画像データに対して、基本量子化テーブルに乗算するSCF値を変化させ、前記SCF値の変化に応じた前記画像データの変化割合を算出する符号量変化割合算出部と、他の前記画像データの前記符号量が所定の範囲外である場合に、前記変化割合を参照し、前記符号量を前記所定の範囲内とするような前記SCF値を決定するSCF値決定部と、を有することを特徴とする撮像装置が提供される。
【0013】
上記の構成によれば、画像データの符号量が、所定の範囲外である場合に、SCF値決定部は、符号量変化割合算出部により算出された変化割合を参照して、符号量を所定の範囲内とするようなSCF値を決定する。
【0014】
【発明の実施の形態】
以下本発明の実施の形態を図面を参照して説明する。
図1は、本発明の実施の形態の撮像装置の概略の機能ブロック図である。
【0015】
ここでは、JPEG形式に圧縮符号化する撮像装置を示している。
撮像装置10は、撮像部11と、デジタル化部12と、DCT変換部13と、量子化部14と、エントロピー符号化部15とを有し、さらに、量子化部14の量子化の際に機能する符号量変化割合算出部14aと、SCF値決定部14bとからなる。
【0016】
撮像部11は、被写体の画像データを取り込む。
デジタル化部12は、取り込んだ画像データをデジタルデータに変換する。
DCT変換部13では、離散コサイン変換を行い、画像データを周波数成分に変換する。
【0017】
量子化部14は、量子化テーブルを用いてDCT係数を量子化する。
エントロピー符号化部15は、ハフマン符号化や算術符号化などにより、出現頻度の高いデータの並びを短い符号に置き換え、頻度の低いデータの並びを長い符号に置き換える。
【0018】
符号量変化割合算出部14aは、基本量子化テーブルに乗算するSCF値を変化させ、SCF値の変化に応じた画像データの符号量の変化割合を算出する。変化割合は、基準となるSCF値のときの符号量(基準符号量)をもとに算出する。符号量の変化割合には、符号量の減少割合(以下符号減少割合と呼ぶ)または増加割合(以下符号増加割合と呼ぶ)がある。基準符号量については後述する。
【0019】
SCF値決定部14b部は、画像データの符号量が、制限符号量で規定された所定の範囲外である場合に変化割合を参照し、所定の範囲内に符号量を調整するようなSCF値を予測して決定する。
【0020】
ここで、本発明の実施の形態の撮像装置10において、符号量の変化割合を算出し用いることの理由について説明する。
図2は、SCF値とJPEG形式の画像データの符号量との関係を示す図である。
【0021】
横軸がSCF値、縦軸が符号量であり、いずれも対数軸である。またここでは、Y(輝度)成分、C(色差)成分のSCF値は同一であるとしている。なお、以下で示す図3〜図9も同様に縦軸横軸いずれも対数軸であり、Y(輝度)成分、C(色差)成分のSCF値は同一であるとしている。
【0022】
この図のように、SCF値を減少させると符号量は増加し、SCF値を増加させると符号量は減少することが分かる。
符号減少割合は、以下の式のようになる。
【0023】
【数2】
RED_RATE(X)=TOTAL(BaseSCF)/TOTAL(X)……(2)
上式において、SCF値が“X”の場合の符号減少割合“RED_RATE(X)”は、基準とするSCF値“BaseSCF”の符号量“TOTAL(BaseSCF)”(これが、基準符号量である)を、SCF値が“X”の場合の符号量“TOTAL(X)”で割ったものとして表される。
【0024】
なお、式(2)において、“TOTAL(X)/TOTAL(BaseSCF)”とすれば符号増加割合が求まる。
式(2)に従って図2で示した符号量を、符号減少割合に変換すると以下の図のようになる。
【0025】
図3は、SCF値と符号減少割合の関係を示す図である。
横軸がSCF値、縦軸は符号減少割合である。
但し、ここでは基準とするSCF値“BaseSCF=1.0”として式(2)を実行したものを示す。図のように符号減少割合は、SCF値=1.0のときの符号量を基準符号量とした場合の、相対的な符号量となる。
【0026】
図4は、同じ画を異なる3つの画像サイズでとった場合の画像データの符号量とSCF値の関係を示す図である。
なお、量子化に用いる基本量子化テーブルは同じであるとする。
【0027】
ここでは、同じ画を、VGA、QVGA、QCIFの異なる3つの画像サイズでとったときの符号量のSCF値による変化を示している。画像サイズの1番大きいVGAがもっとも符号量が多く、画像サイズがもっとも小さいQCIFの符号量がもっとも少ない。図のように、SCF値が同じでも、出力画像サイズにより符号量は大きく異なっていることが分かる。
【0028】
次にこの符号量を、式(2)に従って符号減少割合に変換すると次に示す図のようになる。
図5は、同じ画を異なる3つの画像サイズでとった場合の画像データの符号減少割合とSCF値の関係を示す図である。
【0029】
図のように、出力される画像サイズに係わらず、符号減少割合はほぼ同じになることが分かる。これは、出力される画像サイズに係わらず、SCF値の変化に対する符号量の変化の仕方が似通っているからである。
【0030】
次に出力画像サイズが同じ場合で、画の冗長度などにより極端に違った符号量となった場合について検討する。
図6は、同じ画像サイズであるが、極端に符号量の異なる画のSCF値に対する符号量の変化を示す図である。
【0031】
図のように、SCF値が同じでも、符号量は異なっていることが分かる。
次にこの符号量を、式(2)に従って符号減少割合に変換すると以下に示す図のようになる。
【0032】
図7は、符号量の異なる画のSCF値に対する符号減少割合の変化を示す図である。
図のように、符号量の異なる画についても、符号減少割合に変換することで、似通った特性となることが分かる。これは、符号量の異なる画においても、SCF値の変化に対する符号量の変化の仕方が似通っているからである。
【0033】
次に基本量子化テーブルが異なる場合について説明する。
図8は、3種類の基本量子化テーブルについてSCF値と符号量の関係を示す図である。
【0034】
図のように、基本量子化テーブルが異なると、SCF値の変化に応じて符号量の変化の仕方も異なる。これを、式(2)に従って符号減少割合に変換すると以下に示す図のようになる。
【0035】
図9は、3種類の基本量子化テーブルについてSCF値と符号減少割合の関係を示す図である。
図のように、基本量子化テーブルが異なる場合、符号減少割合が異なることが分かる。
【0036】
以上の考察により、基本量子化テーブルが同じならば、符号減少割合は出力される画像サイズや、符号量の差異に係わらず似通ったものとなることが分かった。符号増加割合についても同様であることはいうまでもない。
【0037】
このような理由から、本発明の実施の形態の撮像装置10では、SCF値に対する符号量の変化割合を算出し、例えば、テーブルデータとして持ち、これを量子化の際のSCF値の決定に用いる。
【0038】
以下、撮像装置10の動作を説明する。
被写体を撮像部11にて取り込むと、デジタル化部12にて取り込んだ画像データはデジタルデータに変換される。画像データは、DCT変換部13にて、離散コサイン変換が行われて周波数成分に変換される。
【0039】
周波数成分に変換された画像データは、量子化部14にて量子化される。符号量変化割合算出部14aでは、例えば、工場出荷前に、ある標準画像を写したときに、基本量子化テーブルに乗算するSCF値を所定のステップで変化させ、そのときの画像データのフレームの符号量の変化から、SCF値に対する符号量変化割合を算出する。算出された符号量の変化割合は、例えば、テーブル化されて(符号減少割合テーブルまたは符号増加割合テーブル)管理される。
【0040】
所定のステップ“STEP”とは、隣あったテーブル上のSCF値の割合“TBL_SCF[x+1]/TBL_SCF[x]”で表され、SCF値のとりうる範囲である1/256〜256において、例えば、対数軸上で等間隔に要素数“NUMPOINT”をとる場合は、以下の式で表される。
【0041】
【数3】

Figure 2005020386
【0042】
図10は、符号減少割合テーブルの例である。
ここで、“TBL_SCF”はテーブル上でのSCF値、“TBL_RED_RATE”はテーブル上での符号減少割合を示す。なお、図10のように、符号減少割合テーブル作成には、SCF値=1.0を真中にし、式(3)で計算したようなステップで、SCF値に対応する符号減少割合のテーブルが作成される。
【0043】
次に、SCF値決定部14bでは、圧縮符号化処理後の画像データの符号量を検出し、符号量が制限符号量で規定された範囲外である場合に、符号量の変化割合(例えば、図10のような符号減少割合テーブル)を参照し、制限符号量の範囲内に符号量を調整するようなSCF値を決定する。具体的な調整方法については後述する。
【0044】
量子化部14では、決定されたSCF値を式(1)のように基本量子化テーブルに掛け合わせ量子化テーブルを作成し、その量子化テーブルを用いて量子化を行う。
【0045】
図11は、Y(輝度)成分用の基本量子化テーブルの例である。
また、図12は、C(色差)成分用の基本量子化テーブルの例である。
図11、12のように高い周波数成 分(図の右下部分)は目立ちにくい特徴があり、低い周波数成分(図の左上部分)は目立ちやすい特徴があるので、低い周波数成分は省略を少なくするために、量子化ステップを小さく、高い周波数成分は省略を多くするために、量子化ステップを大きくしている。
【0046】
なお、人間の視覚は輝度成分に比べて色差成分の感度が低い特徴があるので、図12のC成分用の基本量子化テーブルのように色差成分の省略を多くして符号量を輝度成分に比べて少なくしている。
【0047】
量子化された画像データは、エントロピー符号化部15により、ハフマン符号化や算術符号化され、JPEGデータとして出力される。
以上のように、異なる画像サイズ、大幅に異なる符号量の画像についても同一の符号量の変化割合(例えば、図10の符号減少割合テーブル)を用いて、符号量の調整が可能であるので、少ないメモリ容量で符号量予測及び符号量の調整が可能になる。
【0048】
次に、本発明の実施の形態の撮像装置10を具体的に説明する。
図13は、撮像装置システムのハードウェア構成図である。
図のように、撮像装置システムは、図1で示した撮像装置10と対応しているカメラモジュール20と、表示制御ブロック30とからなる。
【0049】
カメラモジュール20は、レンズ21、センサ22、CDS(相関二重サンプリング)/AGC(自動利得制御)23、カメラ信号処理ブロック24、JPEGエンコーダ25、マイコン26、EEPROM(Electrically Erasable Programmable Read−Only Memory)27から構成される。
【0050】
ここで、レンズ21は、被写体に対し、集光と結像を行う。
センサ22は、光を電気信号に変換する。また、電子シャッターにより電荷の蓄積時間が可変する。センサ22は、例えばCCD(Charge Coupled Device)センサである。
【0051】
CDS/AGC23は、相関二重サンプリング回路によるノイズ除去と自動利得制御を行う。
カメラ信号処理ブロック24は、A/D(アナログ/デジタル)コンバータを有し、センサ22から入力されたアナログ信号をデジタル信号に変換する。さらに、入力信号を映像信号(図ではYUV信号)に変換し出力する。なお、“SYNC信号”は同期信号であり、カメラ信号処理ブロック24からJPEGエンコーダ25及び表示制御ブロック30に入力され、各ブロックに処理での同期をとる。YUV信号は、Y成分と、Y成分と赤色成分(Cr)の差(U)、Y成分と青色成分(Cb)の差(V)の3つの情報で色を表した形式による映像信号である。
【0052】
JPEGエンコーダ25は、カメラ信号処理ブロック24からの出力をJPEG形式にエンコード(圧縮符号化)する。
マイコン26は、図示を省略しているが、図13の撮像装置システムを制御するためのプログラムを格納したROM及びプログラムの実行時に必要なデータを一時格納するRAMを有し、撮像装置システムの各部を制御する。
【0053】
EEPROM27は、前述した基本量子化テーブル及び、符号量の変化割合を格納する。
表示制御ブロック30は、LCD(Liquid Crystal Display)出力、画像伸張などを行う。また、図示しない上位の制御ブロック(マイコン)からのコマンドをIIC(Inter Integrated Circuit)通信などで、マイコン26に通知する。
【0054】
図13において、レンズ21及びセンサ22は、図1で示した撮像部11に対応している。また、カメラ信号処理ブロック24(A/Dコンバータ)は、デジタル化部12に対応している。また、JPEGエンコーダ25と、マイコン26の機能により、DCT変換部13、量子化部14、符号量変化割合算出部14a、SCF値決定部14b、エントロピー符号化部15の機能が実現できる。
【0055】
このような撮像装置システムにおいて、被写体がレンズ21により集光され、センサ22に結像されると、センサ22は光を電気信号に変換する。さらに電気信号になった画像データに対して、CDS/AGC23でノイズ除去や自動利得制御が行われたのちカメラ信号処理ブロック24に入力され、YUV信号に変換されて表示制御ブロック30に出力される。例えば、デジタルカメラなどにおいて、シャッターが押されていない場合、表示モードによっては、映像信号は表示制御ブロック30で処理され、液晶モニタ(図示せず)上で被写体を常に表示させるようにしてもよい。このとき例えば、被写体が、30フレーム/秒で表示される。
【0056】
シャッターが押された場合、そのときのフレームの映像信号が8×8の64画素を1ブロックとして、ブロックごとにJPEGエンコーダ25で処理されJPEG形式に圧縮符号化される。
【0057】
ここで、本発明の実施の形態におけるJPEGエンコーダ25の詳細を説明する。
図14は、JPEGエンコーダ及びそのエンコード処理に用いられる構成を示す図である。
【0058】
図のように、JPEGエンコーダ25は、JPEGエンコードブロック25−1、符号量レジスタ25−2を有する。
また、JPEGエンコードブロック25−1は、Y成分用基本量子化テーブルレジスタ25−1a、C成分用基本量子化テーブルレジスタ25−1b、Y成分用SCFレジスタ25−1c、C成分用SCFレジスタ25−1dを有する。
【0059】
Y成分用基本量子化テーブルレジスタ25−1aは、量子化の際、EEPROM27から取り出されたY成分用の基本量子化テーブルを一時格納する。
C成分用基本量子化テーブルレジスタ25−1bは、量子化の際、EEPROM27から取り出されたC成分用の基本量子化テーブルを一時格納する。
【0060】
Y成分用SCFレジスタ25−1cは、量子化の際、EEPROM27から取り出されたY成分用のSCF値を一時格納する。
C成分用SCFレジスタ25−1dは、量子化の際、EEPROM27から取り出されたC成分用のSCF値を一時格納する。
【0061】
符号量レジスタ25−2は、JPEGエンコードブロック25−1から出力されたJPEG形式の画像データの符号量を計数する。例えばカウンタのような構成であればよい。
【0062】
このようなJPEGエンコーダ25において、8×8画素のブロックごとに、マイコン26の制御のもと、DCT変換処理がおこなわれ、その後、量子化処理が行われる。
【0063】
量子化処理時には、Y成分用基本量子化テーブルレジスタ25−1aにはY成分用の基本量子化テーブルが、C成分用基本量子化テーブルレジスタ25−1bにはC成分用の基本量子化テーブルが、Y成分用SCFレジスタ25−1cにはY成分用のSCF値が、C成分用SCFレジスタ25−1dにはC成分用のSCF値が、EEPROM27から取り出され格納される。
【0064】
画像データは、取り出されたこれらのものを用いて量子化される。
すなわち、SCF値を基本量子化テーブルの各要素値に掛け合わせて量子化テーブルを作成し、その量子化テーブルの各要素値で、DCT変換処理の結果得られた8×8のDCT係数を割る。このようにして量子化し、エントロピー符号化処理を行った後、得られたJPEG形式の画像データの符号量を符号量レジスタ25−2で計数する。その結果、出力符号量が上限符号量から下限符号量の制限符号量以内である場合は、そのままJPEGエンコーダ25から出力する。
【0065】
なお、上限符号量と下限符号量はJPEGエンコードブロック25−1に設定し、制限符号量エラーをマイコン26に通知するようにしてもよいし、外部から指定された値をマイコン26内部のRAMに持ち、出力される符号量と比較して、制限符号量エラーをマイコン26で検知するようにしてもよい。
【0066】
以下、出力符号量が制限符号量以内ではない場合の量子化処理を説明する。
本発明の実施の形態では、例えば、工場出荷前にある標準画像を写し、マイコン26の制御のもと、量子化の際に用いる基本量子化テーブルに乗算するSCF値を所定のステップで変化させ、SCF値の変化に応じた画像データの符号量の変化割合を算出し、例えば、図10に示したような符号減少割合テーブルとして管理する。このような符号減少割合テーブルは、EEPROM27に格納される。
【0067】
画像データの符号量が、制限符号量の範囲外である場合に、マイコン26は、初期化処理時にRAMに展開しておいたEEPROM27に格納された符号量の変化割合を参照して以下の処理を行う。
【0068】
まず目標とする符号量(以下目標符号量と呼ぶ)を定める。
目標符号量としては、例えば以下のようなものがある。
1.上限符号量と下限符号量の中間の符号量
2.上限符号量エラー時には、上限符号量よりも小さな符号量で、下限符号量エラー時には、下限符号量よりも大きな符号量。
3.どちらのエラー時にも上限符号量より少し小さな値。
【0069】
その後、符号量エラー時の符号量より、目標符号量にするための割合(以下絶対目標符号量割合と呼ぶ)を求める。絶対目標符号量割合は、エラー時の符号量を目標符号量で割ることによって算出される。
【0070】
さらに、マイコン26は、エラー時に使用したSCF値の符号量の変化割合に絶対目標符号量割合を掛け、相対的な目標符号量割合(以下相対目標符号量割合と呼ぶ)を算出する。算出した相対目標符号量割合を用いて、例えば図10のような、符号減少割合テーブルを参照して、次のフレームの量子化に用いるSCF値を決定する。
【0071】
その後、JPEGエンコードブロック25−1において、Y成分用SCFレジスタ25−1cにはY成分用のSCF値が、C成分用SCFレジスタ25−1dにはC成分用のSCF値が格納され、式(1)のように基本量子化テーブルに掛け合わせ量子化テーブルを作成し、その量子化テーブルを用いて量子化が行われる。
【0072】
上記のマイコン26による、前述した目標符号量の2番目の例についてのSCF値の自動調整処理について、フローチャートでまとめる。
図15は、SCF値の自動調整処理の流れを示すフローチャートである。
【0073】
なお、図では、主に上限符号量エラーの場合の処理内容を表記している。
また、ここでは、符号量の変化割合として符号減少割合をテーブル化したものを利用する場合について示しており、“TBL_RED_RATE[CNT]”は、カウンタ値CNTに対応する符号減少割合テーブル上での符号減少割合を示す。また、“TBL_SCF[CNT]”はカウンタ値CNTに対応する符号減少割合テーブル上のSCF値を示している。なお、カウンタ値CNTは、符号減少割合テーブル上での位置を示し、例えば、図10で示したような符号減少割合テーブルにおいて、SCF値が最小(図10の例では、TBL_SCF=0.0039の値)の場合は、カウンタ値CNT=0となり、SCF値が最大(図10の例では、TBL_SCF=256)の場合は、カウンタ値CNTも最大となる。
【0074】
SCF値の自動調整処理は、まず、カウンタ更新処理を行う。ここではカウンタ値CNTに、符号量エラー時のフレームに使用していたSCF値のカウンタ値PAST_CNTをセットする(ステップS10)。
【0075】
次に相対目標符号量割合を計算する。相対目標符号量割合は、絶対目標符号量(出力符号量/制限符号量)に、現在のカウンタ値CNTにおける符号減少割合TBL_RED_RATE[CNT]を掛けることによって算出する。ここで制限符号量は、上限符号量エラー時は上限符号量であり、下限符号量エラー時は下限符号量である(ステップ11)。
【0076】
次にカウンタ値CNTを上限符号量エラー時にはプラス1し、下限符号量エラー時にはマイナス1する(ステップS12)。
次に、上限符号量エラー時には、符号減少割合TBL_RED_RATE[CNT]が、ステップS11で算出した相対目標符号量割合を上回るか否かを判断する。上回る場合はステップS15の処理に進み、そうでない場合は、ステップS14に進む。一方、下限符号量エラー時には、符号減少割合TBL_RED_RATE[CNT]が、ステップS11で算出した相対目標符号量割合を下回るか否かを判断する。下回る場合はステップS15の処理に進み、そうでない場合は、ステップS14に進む(ステップS13)。
【0077】
ステップS14の処理では、上限符号量エラー時には、カウンタ値CNTが最大値か否かの判定を行う。ここで、カウンタ値CNTが最大値ならばステップS15へ、そうでない場合は、ステップS12からの処理を繰り返す。一方、下限符号量エラー時には、カウンタ値CNTが最小値か否かの判定を行う。ここで、カウンタ値CNTが最小値ならばステップS15へ、そうでない場合は、ステップS12からの処理を繰り返す。
【0078】
ステップS15の処理では、SCFレジスタ(図14のY成分用SCFレジスタ25−1c及びC成分用SCFレジスタ25−1d)と、量子化に用いるSCF値のカウンタ値PAST_CNTを更新する。すなわち、ステップS14までの処理で決まったカウンタ値CNTにより、SCFレジスタには、符号量の変化割合テーブル上のSCF値TBL_SCF[CNT]をセットし、量子化に用いるSCF値のカウンタ値PAST_CNTには、カウンタ値CNTをセットする。以上により、SCF値の自動調整処理を終了する。
【0079】
このように、異なる画像サイズ、符号量の画像についても同一の符号量の変化割合のデータを用いてSCF値を調整することで、少ないメモリ容量で符号量予測及び符号量の調整が可能になる。
【0080】
さらに、従来カメラモジュール20の上位の制御ブロックで行っているファイルサイズ制御をカメラモジュール20で行ったので、余分な処理を上位の制御ブロックに入れる必要がなくなる。よって、上位の制御ブロックにおけるROM、RAM容量の削減、また、処理負担を軽減することができる。
【0081】
なお、上記では、符号量の変化割合をマイコン26の制御のもと算出するとして説明したが、符号量の変化割合を、例えば、図10で示したようなテーブルデータとして外部からEEPROM27に書き込むようにしてもよい。
【0082】
また、符号量の変化割合は、前述の考察のように、基本量子化テーブルによって異なるものにするべきであるため、工場出荷前に基本量子化テーブルを変更するような場合は、変更した基本量子化テーブルに対応した符号量変化割合を前述の方法により算出して調整しなおすか、外部からEEPROM27に与えることによって対応することができる。
【0083】
また、上記では、制御可能なSCF値を1/256〜256としたが、量子化テーブルの要素の値は1〜255までであることから、基本量子化テーブルの最大要素と最小要素からSCF値の必要な制御範囲を求めるようにしてもよい。
【0084】
例えば、SCF値の制御最大値=255/基本量子化テーブルの最小値、SCF値の制御最小値=1/基本量子化テーブルの最大値、という式で制御範囲を決定する。このようにSCF値の制御範囲を限定することで、高速に制御することが可能になる。
【0085】
【発明の効果】
以上説明したように本発明では、基本量子化テーブルに乗算するSCF値を変化させ、SCF値の変化に応じた画像データの符号量の変化割合を算出して、画像データの符号量が、所定の範囲外である場合、その変化割合を参照して、符号量を所定の範囲内とするようなSCF値を決定するので、出力画像サイズに係わらず、同一の符号量の変化割合を用いて符号量の調整が可能となる。
【0086】
これによって、少ないメモリ容量で符号量の調整が可能になる。
【図面の簡単な説明】
【図1】本発明の実施の形態の撮像装置の概略の機能ブロック図である。
【図2】SCF値とJPEG形式の画像データの符号量との関係を示す図である。
【図3】SCF値と符号減少割合の関係を示す図である。
【図4】同じ画を異なる3つの画像サイズでとった場合の画像データの符号量とSCF値の関係を示す図である。
【図5】同じ画を異なる3つの画像サイズでとった場合の画像データの符号減少割合とSCF値の関係を示す図である。
【図6】同じ画像サイズであるが、極端に符号量の異なる画のSCF値に対する符号量の変化を示す図である。
【図7】符号量の異なる画のSCF値に対する符号減少割合の変化を示す図である。
【図8】3種類の基本量子化テーブルについてSCF値と符号量の関係を示す図である。
【図9】3種類の基本量子化テーブルについてSCF値と符号減少割合の関係を示す図である。
【図10】符号減少割合テーブルの例である。
【図11】Y(輝度)成分用の基本量子化テーブルの例である。
【図12】C(色差)成分用の基本量子化テーブルの例である。
【図13】撮像装置システムのハードウェア構成図である。
【図14】JPEGエンコーダ及びそのエンコード処理に用いられる構成を示す図である。
【図15】SCF値の自動調整処理の流れを示すフローチャートである。
【符号の説明】
10……撮像装置、11……撮像部、12……デジタル化部、13……DCT変換部、14……量子化部、14a……符号量変化割合算出部、14b……SCF値決定部、15……エントロピー符号化部[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an image pickup apparatus and an image pickup method, and more particularly to an image pickup apparatus and an image pickup method for taking in and compressing and encoding image data of a subject.
[0002]
[Prior art]
JPEG (Joint Photographic Expert Group) is known as a method for capturing and encoding image data of a subject captured as a still image.
[0003]
In the JPEG method, image data captured by an algorithm such as Discrete Cosine Transform (DCT), quantization, or entropy coding is compression-coded.
[0004]
Hereinafter, conventional quantization processing will be described.
In the quantization, image data is quantized (divided) for each block of 8 × 8 64 pixels after DCT processing using a quantization table. The quantization table is a value obtained by multiplying the basic quantization table and a scaling factor (hereinafter referred to as SCF or SCF value), and is represented by the following expression.
[0005]
[Expression 1]
QTable [i, j] = SCF × BaseQTable [i, j] (1)
Here, “QTable [i, j]” indicates the [i, j] -th value of the quantization table, and “BaseQTable [i, j]” indicates the [i, j] -th value of the basic quantization table. ing. The SCF value changes the quantization step width and changes the code amount of the image data. The code amount decreases as the SCF value increases, and the code amount increases as the SCF value decreases. Also, there are quantization tables for Y (luminance) components and C (color difference) components, and SCF values for Y component and C component are prepared separately.
[0006]
In general, the larger the code amount, the better the image quality, but the code amount allowed in the system (hereinafter referred to as the limited code amount) is different.
Conventionally, when the SCF value at the time of quantization has a plurality of fixed values and is quantized with the first SCF value and not within the range defined by the limited code amount, the next SCF value is used to quantize The process of performing the conversion is repeated until it falls within the range of the limited code amount. In such a case, there is a problem that it is necessary to mount a frame memory in order to obtain an optimum SCF value, which is costly and increases the chip size.
[0007]
For this reason, it is necessary to predict the code amount for the SCF value, and several techniques are disclosed.
For example, in code amount prediction, there is a code amount for each SCF value as a table, and a code amount corresponding to an input SCF value is uniquely predicted (see Patent Document 1).
[0008]
[Patent Document 1]
JP 2002-369198 (paragraph numbers [0083], [0084], FIG. 7)
[0009]
[Problems to be solved by the invention]
However, the above prior art has the following problems.
In recent years, for example, image data captured and compressed and encoded by a camera module is required to correspond to a plurality of output image sizes. As output image sizes, 640 (pixel) × 480 (line) pixel VGA (Video Graphics Array), 320 × 240 pixel QVGA (Quarter Video Graphics Array), 352 × 288 pixel CIF (Common Intermediate Format), 176 There are QCIF (Quarter Common Intermediate Format) of 144 pixels. Conventionally, since this difference in output image size is not dealt with, there is a problem that it is necessary to have code amount table data for SCF values or parameters for each output image size. In such a case, there is a problem that the required memory capacity such as ROM (Read Only Memory) and RAM (Random Access Memory) increases as the types of output image sizes increase.
[0010]
Further, in the conventional method, since the SCF value is controlled by a microcomputer on the upper side (hereinafter abbreviated as a microcomputer) of the camera module, there is a problem that a processing load is imposed on the upper microcomputer.
[0011]
In the conventional method, since the code amount is uniquely determined for the SCF value, it is impossible to adjust the code amount according to the code amount error.
The present invention has been made in view of these points, and an object of the present invention is to provide an imaging apparatus and an imaging method capable of adjusting the code amount with a small memory capacity and without placing a processing burden on a microcomputer.
[0012]
[Means for Solving the Problems]
In the present invention, in order to solve the above-described problem, in an imaging apparatus that captures and compresses and encodes image data of a subject, an SCF value multiplied by a basic quantization table is changed for the predetermined image data, and the SCF value is changed. A code amount change rate calculating unit that calculates a change rate of the image data according to the change of the image data, and when the code amount of the other image data is out of a predetermined range, the change rate is referred to, and the code And an SCF value determining unit that determines the SCF value so that the amount is within the predetermined range.
[0013]
According to the above configuration, when the code amount of the image data is outside the predetermined range, the SCF value determining unit refers to the change rate calculated by the code amount change rate calculating unit, and determines the code amount to be predetermined. The SCF value is determined so as to be within the range.
[0014]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1 is a schematic functional block diagram of an imaging apparatus according to an embodiment of the present invention.
[0015]
Here, an imaging apparatus that performs compression encoding in the JPEG format is shown.
The imaging device 10 includes an imaging unit 11, a digitizing unit 12, a DCT conversion unit 13, a quantization unit 14, and an entropy encoding unit 15, and further, when the quantization unit 14 performs quantization. It comprises a functioning code amount change rate calculating unit 14a and an SCF value determining unit 14b.
[0016]
The imaging unit 11 captures subject image data.
The digitizing unit 12 converts the captured image data into digital data.
The DCT conversion unit 13 performs discrete cosine conversion to convert image data into frequency components.
[0017]
The quantization unit 14 quantizes the DCT coefficient using the quantization table.
The entropy encoding unit 15 replaces a sequence of frequently occurring data with a short code and replaces a sequence of less frequently occurring data with a long code by Huffman coding or arithmetic coding.
[0018]
The code amount change rate calculation unit 14a changes the SCF value multiplied by the basic quantization table, and calculates the change rate of the code amount of the image data according to the change of the SCF value. The change ratio is calculated based on the code amount (reference code amount) when the SCF value is a reference. The code amount change rate includes a code amount decrease rate (hereinafter referred to as a code decrease rate) or an increase rate (hereinafter referred to as a code increase rate). The reference code amount will be described later.
[0019]
The SCF value determining unit 14b refers to the change ratio when the code amount of the image data is outside the predetermined range defined by the limited code amount, and adjusts the code amount within the predetermined range. Is determined in advance.
[0020]
Here, the reason for calculating and using the change rate of the code amount in the imaging apparatus 10 according to the embodiment of the present invention will be described.
FIG. 2 is a diagram illustrating the relationship between the SCF value and the code amount of image data in JPEG format.
[0021]
The horizontal axis is the SCF value, the vertical axis is the code amount, and both are logarithmic axes. Here, it is assumed that the SCF values of the Y (luminance) component and the C (color difference) component are the same. 3 to 9 described below are similarly logarithmic axes, and the SCF values of the Y (luminance) component and the C (color difference) component are the same.
[0022]
As shown in this figure, it is understood that the code amount increases when the SCF value is decreased, and the code amount decreases when the SCF value is increased.
The sign reduction rate is expressed by the following equation.
[0023]
[Expression 2]
RED_RATE (X) = TOTAL (BaseSCF) / TOTAL (X) (2)
In the above equation, the code reduction rate “RED_RATE (X)” when the SCF value is “X” is the code amount “TOTAL (BaseSCF)” of the reference SCF value “BaseSCF” (this is the reference code amount) Is divided by the code amount “TOTAL (X)” when the SCF value is “X”.
[0024]
In equation (2), if “TOTAL (X) / TOTAL (BaseSCF)” is used, the sign increase rate can be obtained.
When the code amount shown in FIG. 2 is converted into the code reduction ratio according to the equation (2), the following figure is obtained.
[0025]
FIG. 3 is a diagram illustrating the relationship between the SCF value and the code reduction rate.
The horizontal axis is the SCF value, and the vertical axis is the sign reduction rate.
However, here, the reference SCF value “BaseSCF = 1.0” is executed and Expression (2) is executed. As shown in the figure, the code reduction ratio is a relative code amount when the code amount when the SCF value is 1.0 is set as the reference code amount.
[0026]
FIG. 4 is a diagram showing the relationship between the code amount of image data and the SCF value when the same image is taken with three different image sizes.
It is assumed that the basic quantization table used for quantization is the same.
[0027]
Here, the change by the SCF value of the code amount when the same image is taken with three different image sizes of VGA, QVGA, and QCIF is shown. The VGA with the largest image size has the largest code amount, and the code amount of QCIF with the smallest image size is the smallest. As shown in the figure, it can be seen that even if the SCF values are the same, the code amount varies greatly depending on the output image size.
[0028]
Next, when this code amount is converted into a code reduction rate according to the equation (2), the following figure is obtained.
FIG. 5 is a diagram showing the relationship between the code reduction ratio of image data and the SCF value when the same image is taken with three different image sizes.
[0029]
As shown in the figure, it can be seen that the code reduction rate is almost the same regardless of the output image size. This is because the method of changing the code amount with respect to the change of the SCF value is similar regardless of the output image size.
[0030]
Next, consider the case where the output image size is the same and the code amount is extremely different due to the redundancy of the image.
FIG. 6 is a diagram illustrating a change in the code amount with respect to the SCF value of an image having the same image size but extremely different code amount.
[0031]
As shown in the figure, it can be seen that even if the SCF values are the same, the code amounts are different.
Next, when this code amount is converted into a code reduction rate according to the equation (2), the following figure is obtained.
[0032]
FIG. 7 is a diagram illustrating a change in the code reduction ratio with respect to the SCF values of images having different code amounts.
As shown in the figure, it can be seen that similar characteristics can be obtained by converting the images having different code amounts into the code reduction ratio. This is because, even in images with different code amounts, the method of changing the code amount with respect to the change of the SCF value is similar.
[0033]
Next, a case where the basic quantization table is different will be described.
FIG. 8 is a diagram illustrating the relationship between the SCF value and the code amount for three types of basic quantization tables.
[0034]
As shown in the figure, when the basic quantization table is different, the method of changing the code amount is also different according to the change of the SCF value. When this is converted into a code reduction ratio in accordance with equation (2), the following diagram is obtained.
[0035]
FIG. 9 is a diagram illustrating the relationship between the SCF value and the code reduction rate for three types of basic quantization tables.
As shown in the figure, it can be seen that when the basic quantization table is different, the code reduction rate is different.
[0036]
From the above considerations, it was found that if the basic quantization table is the same, the code reduction rate is similar regardless of the output image size and the difference in code amount. It goes without saying that the same applies to the sign increase rate.
[0037]
For this reason, the imaging apparatus 10 according to the embodiment of the present invention calculates the change rate of the code amount with respect to the SCF value, and has, for example, table data, which is used to determine the SCF value at the time of quantization. .
[0038]
Hereinafter, the operation of the imaging apparatus 10 will be described.
When the subject is captured by the imaging unit 11, the image data captured by the digitizing unit 12 is converted into digital data. The image data is subjected to discrete cosine transform in the DCT transform unit 13 and transformed into frequency components.
[0039]
The image data converted into the frequency component is quantized by the quantization unit 14. In the code amount change ratio calculation unit 14a, for example, when a certain standard image is copied before factory shipment, the SCF value to be multiplied by the basic quantization table is changed in a predetermined step, and the frame of the image data at that time is changed. From the code amount change, the code amount change ratio with respect to the SCF value is calculated. The calculated change rate of the code amount is managed as a table (a code decrease rate table or a code increase rate table), for example.
[0040]
The predetermined step “STEP” is represented by a ratio “TBL_SCF [x + 1] / TBL_SCF [x]” of the SCF values on the adjacent table, and in the range of 1/256 to 256 that can take SCF values, for example, When the number of elements “NUMPOINT” is taken at equal intervals on the logarithmic axis, it is expressed by the following equation.
[0041]
[Equation 3]
Figure 2005020386
[0042]
FIG. 10 is an example of a code reduction ratio table.
Here, “TBL_SCF” indicates an SCF value on the table, and “TBL_RED_RATE” indicates a code reduction rate on the table. As shown in FIG. 10, the code reduction rate table is created by creating a code reduction rate table corresponding to the SCF value in the step calculated by Equation (3) with SCF value = 1.0 in the middle. Is done.
[0043]
Next, the SCF value determination unit 14b detects the code amount of the image data after compression encoding processing, and when the code amount is outside the range defined by the limit code amount, the code amount change rate (for example, The SCF value that adjusts the code amount within the range of the limited code amount is determined with reference to the code reduction ratio table as shown in FIG. A specific adjustment method will be described later.
[0044]
The quantization unit 14 creates a quantization table by multiplying the determined SCF value by the basic quantization table as shown in Expression (1), and performs quantization using the quantization table.
[0045]
FIG. 11 is an example of a basic quantization table for the Y (luminance) component.
FIG. 12 is an example of a basic quantization table for C (color difference) components.
As shown in FIGS. 11 and 12, the high frequency component (lower right part of the figure) has a feature that is inconspicuous, and the low frequency component (upper left part of the figure) has a feature that is noticeable. Therefore, the quantization step is increased in order to reduce the quantization step and increase the omission of high frequency components.
[0046]
Since human vision has a characteristic that the sensitivity of the color difference component is lower than that of the luminance component, the omission of the color difference component is increased as in the basic quantization table for the C component in FIG. Compared to less.
[0047]
The quantized image data is subjected to Huffman coding or arithmetic coding by the entropy coding unit 15 and output as JPEG data.
As described above, the code amount can be adjusted using the same code amount change ratio (for example, the code decrease ratio table in FIG. 10) for images having different image sizes and significantly different code amounts. Code amount prediction and code amount adjustment are possible with a small memory capacity.
[0048]
Next, the imaging device 10 according to the embodiment of the present invention will be specifically described.
FIG. 13 is a hardware configuration diagram of the imaging apparatus system.
As illustrated, the imaging apparatus system includes a camera module 20 corresponding to the imaging apparatus 10 illustrated in FIG. 1 and a display control block 30.
[0049]
The camera module 20 includes a lens 21, a sensor 22, a CDS (correlated double sampling) / AGC (automatic gain control) 23, a camera signal processing block 24, a JPEG encoder 25, a microcomputer 26, an EEPROM (Electrically Erasable Programmable Read-Only Memory). 27.
[0050]
Here, the lens 21 performs focusing and image formation on the subject.
The sensor 22 converts light into an electrical signal. In addition, the charge accumulation time varies depending on the electronic shutter. The sensor 22 is, for example, a CCD (Charge Coupled Device) sensor.
[0051]
The CDS / AGC 23 performs noise removal and automatic gain control by a correlated double sampling circuit.
The camera signal processing block 24 includes an A / D (analog / digital) converter, and converts an analog signal input from the sensor 22 into a digital signal. Further, the input signal is converted into a video signal (YUV signal in the figure) and output. The “SYNC signal” is a synchronization signal, which is input from the camera signal processing block 24 to the JPEG encoder 25 and the display control block 30 to synchronize each block in processing. The YUV signal is a video signal in a format in which colors are represented by three pieces of information: a Y component, a difference (U) between the Y component and the red component (Cr), and a difference (V) between the Y component and the blue component (Cb). .
[0052]
The JPEG encoder 25 encodes (compresses) the output from the camera signal processing block 24 into the JPEG format.
Although not shown, the microcomputer 26 includes a ROM that stores a program for controlling the image pickup apparatus system of FIG. 13 and a RAM that temporarily stores data necessary for executing the program. To control.
[0053]
The EEPROM 27 stores the basic quantization table and the change rate of the code amount.
The display control block 30 performs LCD (Liquid Crystal Display) output, image expansion, and the like. In addition, a command from a higher-level control block (microcomputer) (not shown) is notified to the microcomputer 26 by IIC (Inter Integrated Circuit) communication or the like.
[0054]
In FIG. 13, the lens 21 and the sensor 22 correspond to the imaging unit 11 shown in FIG. The camera signal processing block 24 (A / D converter) corresponds to the digitizing unit 12. Moreover, the functions of the DCT conversion unit 13, the quantization unit 14, the code amount change rate calculation unit 14a, the SCF value determination unit 14b, and the entropy encoding unit 15 can be realized by the functions of the JPEG encoder 25 and the microcomputer 26.
[0055]
In such an imaging apparatus system, when a subject is condensed by the lens 21 and imaged on the sensor 22, the sensor 22 converts light into an electrical signal. Further, the image data that has become an electrical signal is subjected to noise removal and automatic gain control by the CDS / AGC 23, and then input to the camera signal processing block 24, converted into a YUV signal, and output to the display control block 30. . For example, in a digital camera or the like, when the shutter is not pressed, depending on the display mode, the video signal may be processed by the display control block 30 so that the subject is always displayed on a liquid crystal monitor (not shown). . At this time, for example, the subject is displayed at 30 frames / second.
[0056]
When the shutter is pressed, the video signal of the frame at that time is processed by the JPEG encoder 25 for each block with 64 pixels of 8 × 8 as one block, and is compressed and encoded into the JPEG format.
[0057]
Here, details of the JPEG encoder 25 in the embodiment of the present invention will be described.
FIG. 14 is a diagram showing a configuration used for the JPEG encoder and its encoding process.
[0058]
As illustrated, the JPEG encoder 25 includes a JPEG encode block 25-1 and a code amount register 25-2.
The JPEG encoding block 25-1 includes a Y component basic quantization table register 25-1a, a C component basic quantization table register 25-1b, a Y component SCF register 25-1c, and a C component SCF register 25-. 1d.
[0059]
The Y component basic quantization table register 25-1a temporarily stores the Y component basic quantization table extracted from the EEPROM 27 at the time of quantization.
The C component basic quantization table register 25-1b temporarily stores the C component basic quantization table extracted from the EEPROM 27 at the time of quantization.
[0060]
The Y component SCF register 25-1c temporarily stores the S component value for the Y component extracted from the EEPROM 27 at the time of quantization.
The C component SCF register 25-1d temporarily stores the C component SCF value extracted from the EEPROM 27 during quantization.
[0061]
The code amount register 25-2 counts the code amount of the JPEG format image data output from the JPEG encode block 25-1. For example, a configuration like a counter may be used.
[0062]
In such a JPEG encoder 25, a DCT conversion process is performed for each 8 × 8 pixel block under the control of the microcomputer 26, and then a quantization process is performed.
[0063]
At the time of quantization processing, the basic quantization table for the Y component is stored in the basic quantization table register 25-1a for the Y component, and the basic quantization table for the C component is stored in the basic quantization table register 25-1b for the C component. The Y component SCF register 25-1c is extracted from the EEPROM 27 and stored in the C component SCF register 25-1d.
[0064]
The image data is quantized using these extracted data.
That is, the SCF value is multiplied by each element value of the basic quantization table to create a quantization table, and the 8 × 8 DCT coefficient obtained as a result of the DCT conversion process is divided by each element value of the quantization table. . After quantization and entropy encoding processing in this way, the code amount of the obtained image data in JPEG format is counted by the code amount register 25-2. As a result, if the output code amount is within the limit code amount from the upper limit code amount to the lower limit code amount, the output is output from the JPEG encoder 25 as it is.
[0065]
The upper limit code amount and the lower limit code amount may be set in the JPEG encode block 25-1, and a limit code amount error may be notified to the microcomputer 26, or an externally designated value may be stored in the RAM inside the microcomputer 26. The microcomputer 26 may detect the limited code amount error as compared with the output code amount.
[0066]
Hereinafter, a quantization process when the output code amount is not within the limit code amount will be described.
In the embodiment of the present invention, for example, a standard image before factory shipment is copied, and under the control of the microcomputer 26, the SCF value to be multiplied by the basic quantization table used for quantization is changed in a predetermined step. The change rate of the code amount of the image data corresponding to the change of the SCF value is calculated and managed as a code reduction rate table as shown in FIG. 10, for example. Such a code reduction ratio table is stored in the EEPROM 27.
[0067]
When the code amount of the image data is outside the range of the limit code amount, the microcomputer 26 refers to the change rate of the code amount stored in the EEPROM 27 developed in the RAM at the time of initialization processing, and performs the following processing I do.
[0068]
First, a target code amount (hereinafter referred to as a target code amount) is determined.
Examples of the target code amount include the following.
1. Code amount intermediate between upper limit code amount and lower limit code amount
2. When the upper limit code amount error occurs, the code amount is smaller than the upper limit code amount, and when the lower limit code amount error occurs, the code amount is larger than the lower limit code amount.
3. A value slightly smaller than the upper limit code amount in both errors.
[0069]
Thereafter, a ratio (hereinafter referred to as an absolute target code amount ratio) for obtaining the target code amount is obtained from the code amount at the time of the code amount error. The absolute target code amount ratio is calculated by dividing the error code amount by the target code amount.
[0070]
Further, the microcomputer 26 multiplies the change rate of the code amount of the SCF value used at the time of the error by the absolute target code amount rate to calculate a relative target code amount rate (hereinafter referred to as a relative target code amount rate). Using the calculated relative target code amount ratio, an SCF value used for quantization of the next frame is determined with reference to a code reduction ratio table as shown in FIG. 10, for example.
[0071]
Thereafter, in the JPEG encoding block 25-1, the SCF value for the Y component is stored in the SCF register for the Y component 25-1c, and the SCF value for the C component is stored in the SCF register for the C component 25-1d. As in 1), a basic quantization table is multiplied to create a quantization table, and quantization is performed using the quantization table.
[0072]
The automatic adjustment process of the SCF value for the second example of the target code amount described above by the microcomputer 26 is summarized in a flowchart.
FIG. 15 is a flowchart showing the flow of the automatic adjustment process of the SCF value.
[0073]
In the figure, the processing contents in the case of the upper limit code amount error are mainly shown.
In addition, here, a case where a table in which the code decrease rate is tabulated as the code amount change rate is used, and “TBL_RED_RATE [CNT]” indicates the code on the code decrease rate table corresponding to the counter value CNT. Indicates the rate of decrease. “TBL_SCF [CNT]” indicates the SCF value on the code reduction rate table corresponding to the counter value CNT. The counter value CNT indicates the position on the code reduction rate table. For example, in the code reduction rate table as shown in FIG. 10, the SCF value is minimum (in the example of FIG. 10, TBL_SCF = 0.039). Value), the counter value CNT = 0, and when the SCF value is maximum (in the example of FIG. 10, TBL_SCF = 256), the counter value CNT is also maximum.
[0074]
In the automatic adjustment process of the SCF value, first, a counter update process is performed. Here, the counter value PAST_CNT of the SCF value used for the frame at the time of the code amount error is set to the counter value CNT (step S10).
[0075]
Next, the relative target code amount ratio is calculated. The relative target code amount ratio is calculated by multiplying the absolute target code amount (output code amount / restricted code amount) by the code decrease rate TBL_RED_RATE [CNT] in the current counter value CNT. Here, the limited code amount is the upper limit code amount at the time of the upper limit code amount error, and is the lower limit code amount at the time of the lower limit code amount error (step 11).
[0076]
Next, the counter value CNT is incremented by 1 when the upper limit code amount error occurs, and is decremented by 1 when the lower limit code amount error occurs (step S12).
Next, when the upper limit code amount error occurs, it is determined whether or not the code decrease rate TBL_RED_RATE [CNT] exceeds the relative target code amount rate calculated in step S11. When it exceeds, it progresses to the process of step S15, and when that is not right, it progresses to step S14. On the other hand, when the lower limit code amount error occurs, it is determined whether or not the code decrease rate TBL_RED_RATE [CNT] is below the relative target code amount rate calculated in step S11. If it is lower, the process proceeds to step S15, and if not, the process proceeds to step S14 (step S13).
[0077]
In the process of step S14, it is determined whether or not the counter value CNT is the maximum value when the upper limit code amount error occurs. If the counter value CNT is the maximum value, the process proceeds to step S15. If not, the process from step S12 is repeated. On the other hand, when the lower limit code amount error occurs, it is determined whether or not the counter value CNT is the minimum value. If the counter value CNT is the minimum value, the process proceeds to step S15. If not, the process from step S12 is repeated.
[0078]
In the process of step S15, the SCF register (Y component SCF register 25-1c and C component SCF register 25-1d in FIG. 14) and the SCF counter value PAST_CNT used for quantization are updated. That is, the SCF value TBL_SCF [CNT] on the code amount change rate table is set in the SCF register by the counter value CNT determined by the processing up to step S14, and the SCF value counter value PAST_CNT used for quantization is set in the SCF value. The counter value CNT is set. Thus, the SCF value automatic adjustment processing is completed.
[0079]
In this way, by adjusting the SCF value using the same code amount change ratio data for images of different image sizes and code amounts, it is possible to predict the code amount and adjust the code amount with a small memory capacity. .
[0080]
Furthermore, since the file size control performed in the upper control block of the conventional camera module 20 is performed in the camera module 20, it is not necessary to put extra processing in the upper control block. Therefore, the ROM and RAM capacities in the upper control block can be reduced and the processing load can be reduced.
[0081]
In the above description, the change rate of the code amount is calculated under the control of the microcomputer 26. However, the change rate of the code amount is written to the EEPROM 27 from the outside as table data as shown in FIG. It may be.
[0082]
In addition, since the change rate of the code amount should be different depending on the basic quantization table as described above, if the basic quantization table is changed before shipment from the factory, the changed basic quantum table is used. The code amount change rate corresponding to the conversion table can be calculated and adjusted again by the above-described method, or can be dealt with by giving it to the EEPROM 27 from the outside.
[0083]
In the above description, the controllable SCF value is set to 1/256 to 256. However, since the value of the quantization table element is 1 to 255, the SCF value is determined from the maximum element and the minimum element of the basic quantization table. The necessary control range may be obtained.
[0084]
For example, the control range is determined by the following equation: SCF value maximum control = 255 / basic quantization table minimum value, SCF value control minimum value = 1 / basic quantization table maximum value. By limiting the control range of the SCF value in this way, it becomes possible to control at high speed.
[0085]
【The invention's effect】
As described above, in the present invention, the SCF value multiplied by the basic quantization table is changed, the change rate of the code amount of the image data corresponding to the change of the SCF value is calculated, and the code amount of the image data is set to a predetermined value. If it is out of the range, the SCF value that determines the code amount within the predetermined range is determined with reference to the change rate, so the change rate of the same code amount is used regardless of the output image size. The code amount can be adjusted.
[0086]
As a result, the code amount can be adjusted with a small memory capacity.
[Brief description of the drawings]
FIG. 1 is a schematic functional block diagram of an imaging apparatus according to an embodiment of the present invention.
FIG. 2 is a diagram illustrating a relationship between an SCF value and a code amount of image data in JPEG format.
FIG. 3 is a diagram illustrating a relationship between an SCF value and a code reduction rate.
FIG. 4 is a diagram illustrating a relationship between a code amount of image data and an SCF value when the same image is taken with three different image sizes.
FIG. 5 is a diagram illustrating a relationship between a code reduction ratio of image data and an SCF value when the same image is taken with three different image sizes.
FIG. 6 is a diagram illustrating changes in code amount with respect to SCF values of images having the same image size but extremely different code amounts.
FIG. 7 is a diagram illustrating a change in a code reduction rate with respect to SCF values of images having different code amounts.
FIG. 8 is a diagram illustrating the relationship between SCF values and code amounts for three types of basic quantization tables.
FIG. 9 is a diagram illustrating a relationship between an SCF value and a code reduction rate for three types of basic quantization tables.
FIG. 10 is an example of a code reduction rate table.
FIG. 11 is an example of a basic quantization table for a Y (luminance) component.
FIG. 12 is an example of a basic quantization table for a C (color difference) component.
FIG. 13 is a hardware configuration diagram of the imaging apparatus system.
FIG. 14 is a diagram showing a configuration used for a JPEG encoder and its encoding process.
FIG. 15 is a flowchart showing a flow of automatic adjustment processing of an SCF value.
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 10 ... Imaging device, 11 ... Imaging part, 12 ... Digitization part, 13 ... DCT conversion part, 14 ... Quantization part, 14a ... Code amount change rate calculation part, 14b ... SCF value determination part , 15 ... Entropy encoding unit

Claims (5)

被写体の画像データを取り込み圧縮符号化する撮像装置において、
所定の前記画像データに対して、基本量子化テーブルに乗算するスケーリングファクタを変化させ、前記スケーリングファクタの変化に応じた前記画像データの符号量の変化割合を算出する符号量変化割合算出部と、
他の前記画像データの前記符号量が、所定の範囲外である場合に、前記変化割合を参照し、前記符号量を前記所定の範囲内とするような前記スケーリングファクタを決定するスケーリングファクタ決定部と、
を有することを特徴とする撮像装置。
In an imaging device that captures and encodes image data of a subject,
A code amount change rate calculating unit that calculates a change rate of a code amount of the image data according to a change in the scaling factor by changing a scaling factor to be multiplied to a basic quantization table for the predetermined image data;
A scaling factor determining unit that determines the scaling factor so that the code amount is within the predetermined range with reference to the change ratio when the code amount of the other image data is outside the predetermined range. When,
An imaging device comprising:
前記符号量変化割合算出部は、用いられる前記基本量子化テーブルの種類に応じて、前記変化割合を調整することを特徴とする請求項1記載の撮像装置。The imaging apparatus according to claim 1, wherein the code amount change rate calculation unit adjusts the change rate according to a type of the basic quantization table used. 前記符号量変化割合算出部は、用いられる前記基本量子化テーブルの最大要素値または最小要素値に応じて、前記スケーリングファクタの変化の範囲を制限することを特徴とする請求項1記載の撮像装置。The imaging apparatus according to claim 1, wherein the code amount change rate calculation unit limits a range of change of the scaling factor according to a maximum element value or a minimum element value of the basic quantization table used. . 前記符号量変化割合算出部により算出された前記変化割合を格納する記憶部をさらに備え、
前記スケーリングファクタ決定部は、前記記憶部に格納された前記変化割合を参照して前記スケーリングファクタを決定する請求項1記載の撮像装置。
A storage unit that stores the change rate calculated by the code amount change rate calculation unit;
The imaging apparatus according to claim 1, wherein the scaling factor determination unit determines the scaling factor with reference to the change ratio stored in the storage unit.
被写体の画像データを取り込み圧縮符号化する撮像方法において、
所定の前記画像データに対して、基本量子化テーブルに乗算するスケーリングファクタを変化させ、前記スケーリングファクタの変化に応じた前記画像データの符号量の変化割合を算出し、
他の前記画像データの前記符号量が、所定の範囲外である場合に、前記変化割合を参照し、前記符号量を前記所定の範囲内とするような前記スケーリングファクタを決定する、
ことを特徴とする撮像方法。
In an imaging method that captures and encodes image data of a subject,
For the predetermined image data, change the scaling factor to be multiplied to the basic quantization table, calculate the change rate of the code amount of the image data according to the change of the scaling factor,
When the code amount of the other image data is outside a predetermined range, the scaling factor is determined with reference to the change rate and the code amount within the predetermined range.
An imaging method characterized by the above.
JP2003182627A 2003-06-26 2003-06-26 Image pickup device and image pickup method Pending JP2005020386A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003182627A JP2005020386A (en) 2003-06-26 2003-06-26 Image pickup device and image pickup method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003182627A JP2005020386A (en) 2003-06-26 2003-06-26 Image pickup device and image pickup method

Publications (1)

Publication Number Publication Date
JP2005020386A true JP2005020386A (en) 2005-01-20

Family

ID=34182955

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003182627A Pending JP2005020386A (en) 2003-06-26 2003-06-26 Image pickup device and image pickup method

Country Status (1)

Country Link
JP (1) JP2005020386A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014520460A (en) * 2011-06-23 2014-08-21 ▲華▼▲為▼終端有限公司 Mobile terminal recording method, related apparatus and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014520460A (en) * 2011-06-23 2014-08-21 ▲華▼▲為▼終端有限公司 Mobile terminal recording method, related apparatus and system

Similar Documents

Publication Publication Date Title
US8233060B2 (en) Image data processing apparatus, image data processing method, and program
US8538174B2 (en) Image processing device
US7598989B2 (en) Image pickup system for reducing noise attributable to an image pickup device
US9854167B2 (en) Signal processing device and moving image capturing device
US8823832B2 (en) Imaging apparatus
US20090009659A1 (en) Image capturing apparatus and method
US20050111542A1 (en) Image processing apparatus and method, and computer program and computer-readable storage medium
WO2009060970A1 (en) Signal processing apparatus and signal processing program
US7750972B2 (en) Digital camera
KR100504649B1 (en) Device for compressing image data
EP1173026B1 (en) A method of compressing digital images
TWI421798B (en) Method and apparatus for image compression bit rate control
JP6700798B2 (en) Imaging device and control method thereof
JP2006074114A (en) Image processing apparatus and imaging apparatus
US20090021645A1 (en) Video signal processing device, video signal processing method and video signal processing program
US7286165B2 (en) Image pickup apparatus with a variable length encoder and data quantity monitor
JP3406924B2 (en) Image processing apparatus and method
JP2005020386A (en) Image pickup device and image pickup method
JP4430731B2 (en) Digital camera and photographing method
KR100771138B1 (en) Imaging device and image correcting method
JP2007020032A (en) Imaging apparatus
JP3568103B2 (en) Image compression device
JP2007043495A (en) Image processing device and image processing method
KR100634568B1 (en) Method for processing image signal capable of controlling jpeg file size and apparatus thereof
JP2006197181A (en) Signal processing apparatus and signal processing method for solid-state imaging device and image processing apparatus