JP2959831B2 - Image data encoding device - Google Patents

Image data encoding device

Info

Publication number
JP2959831B2
JP2959831B2 JP29392490A JP29392490A JP2959831B2 JP 2959831 B2 JP2959831 B2 JP 2959831B2 JP 29392490 A JP29392490 A JP 29392490A JP 29392490 A JP29392490 A JP 29392490A JP 2959831 B2 JP2959831 B2 JP 2959831B2
Authority
JP
Japan
Prior art keywords
code amount
block
encoding
amount
allocated
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 - Lifetime
Application number
JP29392490A
Other languages
Japanese (ja)
Other versions
JPH04167868A (en
Inventor
千尋 中川
佐々木  寛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Olympus Corp
Original Assignee
Olympus 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 Olympus Corp filed Critical Olympus Corp
Priority to JP29392490A priority Critical patent/JP2959831B2/en
Publication of JPH04167868A publication Critical patent/JPH04167868A/en
Application granted granted Critical
Publication of JP2959831B2 publication Critical patent/JP2959831B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は画像データを高圧縮符号化するための符号化
装置および符号化方法に関する。
Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an encoding device and an encoding method for performing high-compression encoding of image data.

〔従来の技術〕[Conventional technology]

CCDに代表される固体撮像装置等により撮像された画
像信号をメモリカード、磁気ディスクあるいは磁気テー
プ等の記憶装置にディジタルデータとして記憶する場
合、そのデータ量は膨大なものとなるため、多くのフレ
ーム画像を限られた記憶容量の範囲で記録しようとする
には、得られた画像信号のデータに対し、何等かの高能
率な圧縮を行うことが必要となる。さらにディジタル電
子スチルカメラ等においては、撮影した画像を銀塩フィ
ルムの代わりに、メモリカード、磁気ディスクあるいは
磁気テープ等の記録媒体にディジタルデータとして保存
するので、1枚のメモリカード、磁気ディスクあるいは
1巻の磁気テープに記録できる画像の枚数が規定され、
この規定枚数分の画像の記録が保証されなければなら
ず、しかも、データの記録再生処理に要する時間が短
く、且つ、一定である必要がある。
When an image signal captured by a solid-state imaging device represented by a CCD or the like is stored as digital data in a storage device such as a memory card, a magnetic disk, or a magnetic tape, the amount of data is enormous. In order to record an image in a limited storage capacity range, it is necessary to perform some highly efficient compression on the obtained image signal data. Further, in a digital electronic still camera or the like, a photographed image is stored as digital data in a recording medium such as a memory card, a magnetic disk or a magnetic tape instead of a silver halide film. The number of images that can be recorded on the magnetic tape of the volume is defined,
The recording of the specified number of images must be guaranteed, and the time required for data recording / reproducing processing must be short and constant.

同様に、ディジタルVTR(ビデオテープレコーダ)、
ディジタル動画ファイル等において、動画像を記録する
場合もフレームあたりの画像のデータ量に影響されるこ
となく、所定量のフレームを記録できなければならな
い。すなわち、静止画像であっても、動画像であって
も、必要なコマ数分を確実に記録できる必要があると共
に、データの記録再生処理に要する時間が短く、且つ、
一定である必要がある。
Similarly, digital VTRs (video tape recorders),
Even when recording a moving image in a digital moving image file or the like, a predetermined amount of frames must be recorded without being affected by the data amount of the image per frame. That is, whether it is a still image or a moving image, it is necessary to reliably record the required number of frames, and the time required for data recording / reproduction processing is short, and
Must be constant.

従って、そのためには画像データを圧縮して1コマあ
たりのデータ量を規定容量内に納まるようにする必要が
ある。
Therefore, for that purpose, it is necessary to compress the image data so that the data amount per frame falls within the specified capacity.

そのための高能率な画像データの圧縮方式として、直
交変換符号化と可変長符号化を組み合わせた符号化方法
が広く知られている。
As a high-efficiency image data compression method for that purpose, an encoding method combining orthogonal transform encoding and variable length encoding is widely known.

その代表的なものとして静止画符号化国際標準化にお
いて、検討されている方式がある。
As a typical example, there is a method being studied in international standardization of still image coding.

この方式について次に概要を説明する。 The outline of this method will be described below.

まず、画像データを所定の大きさのブロックに分割
し、分割されたブロック毎に直交変換として2次元のDC
T(離散コサイン変換)を行う。次に各周波数成分に応
じた線形量子化を行い、この量子化された値に対し、可
変長符号化としてハフマン符号化を行う。このとき、直
流成分に関しては近傍のブロックの直流成分との差分値
をハフマン符号化する。交流成分はジグザグスキャンと
呼ばれる低い周波数成分から高い周波数成分へのスキャ
ンを行い、無効(値が零)の成分の連続する個数と、そ
れに続く有効な成分の値とから2次元ハフマン符号化を
行う。以上がこの方式の基本部分である。
First, the image data is divided into blocks of a predetermined size, and a two-dimensional DC
Performs T (discrete cosine transform). Next, linear quantization according to each frequency component is performed, and Huffman coding is performed on the quantized value as variable length coding. At this time, the difference value between the DC component and the DC component of a nearby block is Huffman-coded. The AC component scans from a low frequency component to a high frequency component called a zigzag scan, and performs two-dimensional Huffman coding from the continuous number of invalid (zero value) components and the value of the valid component that follows. . The above is the basic part of this method.

この基本部分だけでは、可変長符号化であるハフマン
符号化を用いているために、符号量が画像毎に一定では
なくなってしまう。そこで、符号量の制御の方法として
次の方式が提案されている。
With only this basic part, the code amount is not constant for each image because Huffman coding, which is variable length coding, is used. Therefore, the following method has been proposed as a method of controlling the code amount.

まず、前記基本部分の処理を行うと同時に、全画面の
発生した総符号量を求める。この総符号量と目的とする
符号量とからDCT係数に対する目的とする符号量に近づ
けるのに最適な量子化幅を予測する。次にこの量子化幅
を用いて前記基本部分の量子化以降の処理を繰り返す。
そして、今回発生した総符号量と、前回発生した総符号
量と、目的とする符号量とから再び目的の符号量に近づ
けるのに最適な量子化幅を予測する。そして、この予測
した量子化幅と前回の量子化幅が充分に近づき、且つ、
目的の符号量よりも今回発生した総符号量の方が少ない
場合には処理を終了し、符号を出力する。そうでない場
合には新しい量子化幅を用いて処理を繰り返す。
First, at the same time as the processing of the basic portion is performed, the total code amount of the generated entire screen is obtained. From the total code amount and the target code amount, an optimal quantization width for approaching the target code amount for the DCT coefficient is predicted. Next, processing after the quantization of the basic portion is repeated using this quantization width.
Then, from the total code amount generated this time, the total code amount generated last time, and the target code amount, an optimum quantization width for approaching the target code amount again is predicted. Then, the predicted quantization width is sufficiently close to the previous quantization width, and
If the total code amount generated this time is smaller than the target code amount, the process ends and the code is output. Otherwise, the process is repeated using the new quantization width.

量子化幅は、各周波数成分に対する相対的な量子化特
性を表わす基本形である量子化マトリックスを用意し、
この基本形の量子化マトリックスに対して、量子化係数
αを乗じて必要な量子化幅を得る。
For the quantization width, prepare a quantization matrix that is a basic form representing the relative quantization characteristics for each frequency component,
The required quantization width is obtained by multiplying this basic quantization matrix by the quantization coefficient α.

具体的には、最初に標準的な量子化係数αを用いて得
た量子化幅により上述の基本部分での量子化を行い、こ
れを可変長符号化し、これにより得られた総符号量の情
報と、収めるべき限度となる予め設定した目標の総符号
量値との比較を行い、目標総符号量以内に達したときは
その量子化幅を使用して最終的な符号化処理を行い、目
標総符号量以内に達したときは、その量子化幅を使用し
て最終的な符号化処理を行い、目標総符号量以内に収ま
らなかったときは、発生総符号量と目標総符号量とか
ら、例えば、ニュートン−ラプソン法(Newton−Raphso
n iteration)などを用いた線形予測により、目的の総
符号量に近付くに最適な量子化係数αを求め、この求め
た量子化係数と量子化マトリックスとから、より最適化
した量子化幅を計算し、これを用いて最終的な符号化処
理を行う。
Specifically, first, the quantization in the above-described basic portion is performed using the quantization width obtained using the standard quantization coefficient α, and this is subjected to variable-length coding. The information is compared with a preset target total code amount value which is a limit to be stored, and when the total code amount reaches the target total code amount, a final encoding process is performed using the quantization width, When the total code amount is within the target total code amount, the final encoding process is performed using the quantization width, and when the total code amount does not fall within the target total code amount, the generated total code amount and the target total code amount are set. From, for example, the Newton-Raphson method (Newton-Raphso method)
n iteration) to find the optimal quantization coefficient α to approach the target total code amount, and calculate a more optimized quantization width from the obtained quantization coefficient and quantization matrix. Then, the final encoding process is performed by using this.

このような方法で、量子化幅の変更を行う。 The quantization width is changed in such a manner.

以上の動作を第9図を参照して具体的に説明すると、
まず、(a)に示すように、1フレームの画像データ
(国際標準化案で提示されている1フレームの画像は72
0×576画素)を所定の大きさのブロック(例えば、8×
8の画素よりなるブロックA,B,C…)に分割し、(b)
に示すように、この分割されたブロック毎に直交変換と
して2次元のDCT(離散コサイン変換)を行い、8×8
のマトリックス上に順次格納する。画像データは二次元
平面で眺めてみると、濃淡情報の分布に基づく周波数情
報である空間周波数を有している。
The above operation will be specifically described with reference to FIG.
First, as shown in (a), one frame of image data (one frame of an image presented in the
A block of a predetermined size (for example, 8 × 576 pixels)
Divided into blocks A, B, C...
As shown in (2), two-dimensional DCT (discrete cosine transform) is performed as an orthogonal transform for each of the divided blocks, and an 8 × 8
Are sequentially stored on the matrix. When viewed on a two-dimensional plane, the image data has a spatial frequency which is frequency information based on the distribution of density information.

従って上記DCTを行うことにより、画像データは直流
成分DCと交流成分ACに変換され、8×8のマトリックス
上には原点位置(0,0位置)に直流成分DCの値を示すデ
ータが、そして、0,7位置には横軸方向の交流成分ACの
最大周波数値を示すデータが、そして、7,0位置には縦
軸方向の最大交流成分ACの周波数値を示すデータが、さ
らに7,7位置には斜め方向の交流成分ACの最大周波数値
を示すデータが、それぞれ格納され、中間位置ではそれ
ぞれの座標位置により関係付けられる方向における周波
数データが、原点側より順次高い周波数のものが出現す
る形で格納されることになる。
Therefore, by performing the above DCT, the image data is converted into a DC component DC and an AC component AC, and data indicating the value of the DC component DC at the origin position (0, 0 position) on the 8 × 8 matrix, and At the 0,7 position, data indicating the maximum frequency value of the AC component AC in the horizontal axis direction, and at the 7,0 position, data indicating the frequency value of the maximum AC component AC in the vertical axis direction, Data indicating the maximum frequency value of the AC component AC in the diagonal direction is stored at each of the seven positions, and frequency data in the direction associated with each coordinate position appears at the intermediate position, with frequency higher than the origin side. Will be stored.

次にこのマトリックスにおける各座標位置の格納デー
タを、各周波数成分毎の量子化幅で割ることにより、各
周波数成分に応じた線形量子化を行い(c)、この量子
化された値に対し、可変長符号化としてハフマン符号化
を行う。この時、直流成分DCに関しては近隣ブロックの
直流成分との差分値をグループ番号(付加ビット数)と
付加ビットで表現し、そのグループ番号をハフマン符号
化し、得られた符号語と付加ビットを合わせて符号化デ
ータとする(d1,d2,e1,e2)。
Next, the stored data at each coordinate position in this matrix is divided by the quantization width for each frequency component to perform linear quantization according to each frequency component (c). Huffman coding is performed as variable length coding. At this time, for the DC component DC, the difference value from the DC component of the neighboring block is represented by a group number (number of additional bits) and additional bits, the group number is Huffman-coded, and the obtained code word and additional bits are combined. As encoded data (d1, d2, e1, e2).

交流成分ACに関しても、有効でない(値が“0"でな
い)係数は、グループ番号と付加ビットで表現する。
Regarding the AC component AC, coefficients that are not valid (the value is not “0”) are represented by a group number and additional bits.

そのため、交流成分ACはジグザグスキャンと呼ばれる
低い周波数成分から高い周波数成分へのスキャンを行
い、無効(値が“0")の成分の連続する個数(零のラン
数)と、それに続く有効な成分の値のグループ番号とか
ら2次元のハフマン符号化を行い、得られた符号語と付
加ビットを合わせて符号化データとする。
Therefore, the AC component AC scans from a low frequency component to a high frequency component called zigzag scan, and the continuous number of invalid (value is “0”) components (zero run number) and the succeeding valid components The two-dimensional Huffman encoding is performed from the group number of the value and the obtained codeword and additional bits are combined to obtain encoded data.

ハフマン符号化はフレーム画像あたりの上記直流成分
DCおよび交流成分ACの各々のデータ分布における発生頻
度のピークのものを中心として、この中心のものほど、
データビットを少なくし、周辺になる程、ビット数を多
くするようにビット割り当てをした形でデータを符号化
して符号語を得ることで行う。
Huffman coding is the above DC component per frame image
Centering on the peak of the occurrence frequency in each data distribution of DC and AC component AC, the more this center,
This is performed by encoding data in a form where bits are allocated so as to reduce the number of data bits and increase the number of bits as the number of data bits increases, thereby obtaining a code word.

以上がこの方式の基本部分である。 The above is the basic part of this method.

この基本部分だけでは、エントロピー符号化であるハ
フマン符号化を用いているために符号量が画像毎に一定
ではなくなってしまうから、符号量の制御の方法として
例えば、次のように処理する。
Since only the basic portion uses Huffman coding, which is entropy coding, the code amount is not constant for each image. Therefore, as a method of controlling the code amount, for example, the following process is performed.

まず、暫定的な量子化係数αを用い、定められた量子
化マトリックスにこの量子化係数αを掛け合わせて得ら
れる各周波数成分毎の量子化幅で前記基本部分の処理を
行うと同時に、全画面の発生した総符号量(総ビット
数)を求める(g)。この総符号量と、目的とする符号
量と、用いた暫定的な量子化係数αなどから、DCT係数
に対する目的とする符号量に近づけるのに最適な量子化
係数αをニュートン−ラプソン−イタレーション(Newt
on Raphson Iteration)により予測する(h)。次にこ
の量子化係数αを用い(i)、前述の基本部分の量子化
以降の処理を繰り返す。そして、今回発生した総符号量
と、前回発生した総符号量と、目的とする符号量と、今
回用いた量子化係数αと、前回用いた量子化係数αとか
ら、再び目的の符号量に近づけるのに最適な量子化係数
αをニュートン−ラプソン−イタレーションにより予測
する。
First, using the provisional quantization coefficient α, while performing the processing of the basic portion with a quantization width for each frequency component obtained by multiplying a predetermined quantization matrix by this quantization coefficient α, The total code amount (total number of bits) in which the screen has occurred is obtained (g). From the total code amount, the target code amount, and the tentative quantization coefficient α used, the optimal quantization coefficient α for approaching the target code amount for the DCT coefficient is Newton-Raphson-Iteration. (Newt
on Raphson Iteration) (h). Next, using the quantized coefficient α (i), the above-described processing after quantization of the basic part is repeated. Then, from the total code amount generated this time, the total code amount generated last time, the target code amount, the quantization coefficient α used this time, and the quantization coefficient α used last time, The optimal quantization coefficient α to be approximated is predicted by Newton-Raphson iteration.

そして、この予測した量子化係数αと前回の量子化係
数αが十分に近づき、且つ、目的の符号量よりも今回発
生した総符号量の方が少ない場合には処理を終了し、今
回発生した符号化データを出力してメモリカードに記憶
する(f)。そうでない場合には量子化係数αを変更
し、この新しい量子化係数αを用いて処理を繰り返す。
If the predicted quantization coefficient α and the previous quantization coefficient α are sufficiently close to each other, and the total code amount generated this time is smaller than the target code amount, the processing is terminated, and the current The encoded data is output and stored in the memory card (f). If not, the quantization coefficient α is changed, and the process is repeated using the new quantization coefficient α.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

上述したように、例えば、ディジタル電子スチルカメ
ラなどにおいては、1枚のメモリカードあるいは磁気デ
ィスク装置に記録できる画像の枚数が保証されていなけ
ればならず、そのため、画像データを圧縮して記録する
が、操作性の上からその処理時間はできるだけ短く、且
つ、一定である必要がある。また、高能率で画像データ
の圧縮が行える事が望まれる。これらはディジタル電子
スチルカメラに限らず、他のアプリケーションにおいて
も少なからず要求される項目である。
As described above, for example, in a digital electronic still camera or the like, the number of images that can be recorded on a single memory card or a magnetic disk device must be guaranteed. Therefore, image data is compressed and recorded. In view of operability, the processing time must be as short as possible and constant. It is also desired that image data can be compressed with high efficiency. These items are not limited to digital electronic still cameras, and are items required not only in other applications.

そして、このような要求を満たす圧縮方法として上述
の国際標準案方式があり、この方式において、前記基本
部分で例示したようなブロック毎の直交変換と可変長符
号化を組み合わせた手法では、画像データの圧縮を高能
率で行えるものの、可変長符号化を用いているが故に符
号量が一定にならず、1枚のメモリカードあるいは磁気
ディスク装置等の記録媒体に記憶できる画像の枚数が不
定になるという欠点があった。
As a compression method that satisfies such a demand, there is the above-mentioned international standard proposal method. In this method, a method that combines orthogonal transform and variable-length coding for each block as exemplified in the above-described basic part uses image data. Compression can be performed with high efficiency, but the number of images that can be stored in a single recording medium such as a memory card or a magnetic disk device becomes indefinite due to the use of variable-length coding. There was a disadvantage.

また、これを解決するための従来例で例示したような
符号量の制御の方法では、符号化の基本部分のバスを何
度繰り返すかが画像によって異なるために処理時間が不
定となるばかりでなく、一般的に処理時間を長く必要と
する欠点があった。
Further, in the method of controlling the code amount as exemplified in the conventional example for solving this, not only the number of times of repeating the bus of the basic part of the encoding differs depending on the image, but also the processing time becomes indefinite. However, there is a drawback that generally requires a long processing time.

この問題を解決する手法として、本発明者等は次のよ
うな方式を提案した(特願平1−283761号,特願平2−
137222号参照)。
As a method for solving this problem, the present inventors have proposed the following method (Japanese Patent Application Nos. 1-28761 and 2-76).
137222).

この提案した方式は直交変換と可変長符号化を組み合
わせた圧縮方式において、発生符号量の制御を行うため
に、画像メモリに記憶した標本化した画像信号を、画面
を構成する画素の隣接する複数個ずつを単位にブロック
分けし、この分割されたブロック毎に直交変換を行って
から、この変換出力を暫定的な量子化幅で量子化した
後、この量子化出力を可変長符号化すると共に、各ブロ
ック毎の発生符号量と画像全体の総符号量を算出し、次
に前記暫定的な量子化幅、前記総発生符号量および、1
画像当りの目的とする総符号量とから新しい量子化幅を
予測する。また、これと合わせて、前記各ブロック毎の
発行符号量と、前記総発生符号量と、1画像当りの目的
とする総符号量とから、各ブロック毎の割当符号量を算
出する(統計処理;第1パスの処理)。
The proposed method is a compression method that combines orthogonal transform and variable-length coding. In order to control the amount of generated codes, a sampled image signal stored in an image memory is converted to a plurality of adjacent pixels of a screen. After dividing each block into blocks and performing orthogonal transformation on each of the divided blocks, quantizing the transformed output with a provisional quantization width, and then performing variable length coding on the quantized output, , Calculate the generated code amount for each block and the total code amount of the entire image, and then calculate the provisional quantization width, the total generated code amount, and 1
A new quantization width is predicted from the target total code amount per image. At the same time, the assigned code amount for each block is calculated from the issued code amount for each block, the total generated code amount, and the target total code amount per image (statistical processing). First pass processing).

そして、前記新しい量子化幅を用いて再び画像メモリ
の画像信号を前記ブロック分け、直交変換、量子化、可
変長符号化を行うと共に、各ブロックについてその発生
符号量がそのブロックの前記割当符号量を越える場合に
は、途中で可変長符号化を中止して次のブロックの処理
に移ると云った処理を行って行く(符号化処理;第2パ
スの処理)。
Then, the image signal of the image memory is divided again into blocks by using the new quantization width, orthogonal transformation, quantization, and variable length encoding are performed. For each block, the generated code amount is the allocated code amount of the block. Is exceeded, the variable-length coding is stopped halfway and the process of moving to the process of the next block is performed (coding process; second-pass process).

これにより、画像全体の総発生符号量が目的の総符号
量を越えないように符号量の制御を行おうと云うもので
ある。
Thus, the code amount is controlled so that the total generated code amount of the entire image does not exceed the target total code amount.

しかしながら、上記方式は大変に良好な結果が得られ
るものの、少なくとも各ブロックの発生符号量をそれぞ
れ記憶するためのメモリが必要であるため、回路規模が
大きくなり、それに伴って消費電力の増大を招くことに
なる。消費電力の増大は、小型化が非常に重要視されて
いる携帯型の製品にとって、電池部分の占める割合が大
きくなり、重量が増えたり、また、回路規模の増大によ
って全体の大きさも大きくなる等、極めて不都合であ
り、また、低価格の製品に対してはコストアップの要因
となるなど、上記方式を利用することには問題がある。
However, although the above method can obtain very good results, at least a memory for storing the generated code amount of each block is required, so that the circuit scale becomes large, and the power consumption increases accordingly. Will be. The increase in power consumption means that for portable products where miniaturization is very important, the proportion of the battery part increases, the weight increases, and the overall size increases due to the increase in circuit scale. However, there is a problem in using the above method because it is extremely inconvenient and causes a cost increase for a low-priced product.

近年では、製品が高価でも、画像の質を重視するケー
スや、画像の質を多少犠牲にしても安価な製品を望むと
云った様々なユーザのニーズがあり、これに応えるため
には上記方式のように、やや複雑な回路になるが高画質
の得られる方式だけでなく、若干画質を犠牲にしても、
簡単な回路で実現できる方式も必要である。また、この
2つの方式は圧縮データに監視、相互に再生時の互換性
がなくてはならない。
In recent years, there have been various user needs such as cases in which the quality of the image is emphasized even if the product is expensive, and a desire for an inexpensive product even if the image quality is somewhat sacrificed. Although it becomes a slightly complicated circuit like this, it is not only a method that can obtain high image quality, but even if the image quality is slightly sacrificed,
A method that can be realized by a simple circuit is also required. In addition, these two methods require that the compressed data be monitored and mutually compatible during reproduction.

そこで、この発明の目的とするところは、画質をでき
るだけ損なわずに、簡単な回路構成により、一定の処理
時間内で、一定の符号量以内に収まるように符号化でき
るようにした画像データの符号化装置および符号化方法
を提供することにある。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a method of encoding image data that can be encoded within a predetermined code amount within a predetermined processing time with a simple circuit configuration without impairing image quality as much as possible. An encoding device and an encoding method are provided.

〔課題を解決するための手段〕[Means for solving the problem]

上記目的を達成するため、本発明は次のように構成す
る。すなわち、本発明は、画像データをブロックに分割
し、この分割された各ブロックは順にそれぞれ直交変換
を行ってこの変換出力を量子化手段により量子化し、こ
の量子化出力を可変長符号化手段に与えて可変長符号化
し、各ブロック毎にデータの符号化をする符号化装置に
おいて、 第1には前記ブロックの符号化にあたり、当該符号化
処理するブロックでの符号化処理により発生した符号量
と当該ブロックでの割当符号量とに基づいてこの発生符
号量の前記割当符号量に対する過不足量を算出すると共
に、画像当りの許される符号量である目的の総符号量以
下の所定の符号量を総ブロック数で割ることにより、決
定された1ブロック当たりの基準符号量に前記算出した
過不足量を加えた符号量を次に処理するブロックの前記
割当符号量として求める符号量割当手段と、各ブロック
毎に前記符号量割当手段により割り当てられた割当符号
量を越えないように、前記可変長符号化を打ち切るべく
前記可変長符号化手段を制御する打切手段とを備えて構
成する。
To achieve the above object, the present invention is configured as follows. That is, according to the present invention, the image data is divided into blocks, each of the divided blocks is subjected to orthogonal transform in turn, and the transform output is quantized by a quantizing means, and the quantized output is sent to a variable length encoding means. In the coding apparatus, the variable length coding is performed and the data is encoded for each block. First, when encoding the block, the code amount generated by the encoding process in the block to be encoded and Based on the allocated code amount in the block and the amount of excess or deficiency of the generated code amount with respect to the allocated code amount, a predetermined code amount equal to or less than a target total code amount which is an allowable code amount per image is calculated. By dividing by the total number of blocks, a code amount obtained by adding the calculated excess / deficiency amount to the determined reference code amount per block is set as the allocated code amount of a block to be processed next. Code amount allocating means, and a truncation means for controlling the variable length coding means to terminate the variable length coding so as not to exceed the allocated code amount allocated by the code amount allocating means for each block. It comprises.

また、第2には圧縮率を指定する圧縮率指定手段と、
この圧縮率指定手段にて指定された圧縮率に応じて画面
あたりの許される目的総符号量および量子化幅および1
ブロック当たりの基準割当符号量とを決定する圧縮率選
択手段と、前記ブロックの符号化にあたり、当該符号化
処理するブロックでの符号化処理により発生した符号量
と当該ブロックでの割当符号量とに基づいてこの発生符
号量の前記割当符号量に対する過不足量を算出すると共
に、前記圧縮率選択手段により決定された1ブロック当
たりの基準符号量に前記算出した過不足量を加えた符号
量を次に処理するブロックの前記割当符号量として求め
る符号量割当手段と、各ブロック毎に前記符号量割当手
段により割り当てられた割当符号量を越えないように前
記可変長符号化を打ち切るべく前記可変長符号化手段を
制御する打切手段と、前記可変長符号化手段により可変
長符号化された変換係数を符号として出力する符号化出
力手段と、前記量子化手段に対し、前記圧縮率選択手段
により決定された前記量子化幅を用いて量子化を行わせ
るべく制御する制御手段とを備えて構成する。
Secondly, a compression ratio specifying means for specifying a compression ratio,
According to the compression ratio designated by the compression ratio designation means, the permissible target total code amount and quantization width per screen and 1
Compression ratio selecting means for determining a reference allocation code amount per block, and, in coding the block, a code amount generated by a coding process in a block to be subjected to the coding process and an allocation code amount in the block. Based on the calculated code amount, the amount of excess or deficiency with respect to the allocated code amount is calculated, and the code amount obtained by adding the calculated excess or deficiency amount to the reference code amount per block determined by the compression ratio selecting means is calculated as follows. Code amount allocating means for obtaining the allocated code amount of the block to be processed, and the variable length code for terminating the variable length coding so as not to exceed the allocated code amount allocated by the code amount allocating unit for each block. Truncation means for controlling the coding means, coding output means for outputting as a code the transform coefficient subjected to variable-length coding by the variable-length coding means, To means, constituting a control means for controlling so as to perform quantization using the quantization width determined by the compression ratio selection means.

更に、本発明は画像データをブロックに分割し、この
分割された各ブロックは順にそれぞれ直交変換を行って
低い周波数成分から順に高い周波数成分へと前記ブロッ
ク毎の画像データを成分分解し、この変換出力を量子化
手段により量子化し、この量子化出力を可変長符号化手
段に与えて可変長符号化し、各ブロック毎にデータの符
号化をする符号化装置において、 第3には前記ブロックの符号化にあたり、当該符号化
処理するブロックでの符号化処理により発生した符号量
と当該ブロックでの割当符号量とに基づいてこの発生符
号量の前記割当符号量に対する過不足量を算出すると共
に、画像当りの許される符号量である目的の総符号量に
応じて予め決定した1ブロック当たりの基準符号量に前
記算出した過不足量を加えた符号量を次に処理するブロ
ックの前記割当符号量として求める符号量割当手段と、
各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように、前記可変長符号化を打
ち切るべく前記可変長符号化手段を制御する打ち切り手
段と、前記量子化手段に対し、予め定めた量子化幅を用
いて量子化を行わせるべく制御する制御手段とを備え、
前記可変長符号化手段には前記直交変換により得られる
前記各ブロック単位の画像データのうち、直流成分につ
いては手前の符号化処理ブロックでの直流成分との差分
を得ると共にこの差分を可変長符号化する直流成分用の
符号化処理部と、この直流成分の符号化処理部の処理が
終った後、前記交流成分について可変長符号化する交流
成分用の符号化処理部とを設け、前記符号化打ち切り手
段は交流成分用の符号化処理部に対してのみ打ち切り制
御を可能にする構成とする。
Further, according to the present invention, the image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform in order to decompose the image data of each block into low-frequency components to high-frequency components in order. An encoding device which quantizes an output by a quantizing means, supplies the quantized output to a variable-length encoding means, performs variable-length encoding, and encodes data for each block. On the basis of the amount of code generated by the encoding process in the block to be encoded and the amount of allocated code in the block, the amount of generated code and the amount of excess or deficiency with respect to the allocated code amount are calculated. The code amount obtained by adding the calculated excess / deficiency amount to the reference code amount per block predetermined according to the target total code amount, which is the allowable code amount per block, is then processed. Code amount allocating means for determining as the allocated code amount of the block to be processed,
With respect to the truncation means for controlling the variable length encoding means to terminate the variable length coding so as not to exceed the allocated code amount allocated by the code amount allocation means for each block, Control means for controlling to perform quantization using a predetermined quantization width,
The variable-length coding means obtains a difference between the DC component of the image data of each block obtained by the orthogonal transformation and the DC component in the preceding coding processing block, and uses the difference as a variable-length code. An encoding processing unit for a DC component to be converted, and an encoding processing unit for an AC component for performing variable-length encoding on the AC component after the processing of the encoding processing unit for the DC component is completed. The cut-off unit is configured to enable the cut-off control only for the AC component encoding processing unit.

また、第4には前記可変長符号化手段により符号化さ
れた画像全体の変換係数の符号量を算出する符号量算出
手段と、この符号量算出手段により算出された画像全体
の符号量と、画面あたりの許される目的総符号量とから
最適な量子化幅を予測すると共に、前記量子化手段にこ
の予測量子化幅を与える量子化幅予測手段と、前記ブロ
ックの符号化にあたり、当該符号化処理するブロックで
の符号化処理により発生した符号量と当該ブロックでの
割当符号量とに基づいてこの発生符号量の前記割当符号
量に対する過不足量を算出すると共に、前記目的総符号
量に基づき決定された1ブロック当たりの基準符号量に
前記算出した過不足量を加えた符号量を次に処理するブ
ロックの前記割当符号量として求める符号量割当手段
と、各ブロック毎に前記符号量割当手段により割り当て
られた割当符号量を越えないように前記可変長符号化を
打ち切るべく前記可変長符号化手段を制御する打切手段
と、前記量子化手段に対し、初めに前記目的総符号量か
ら予め定めた暫定的な量子化幅を用いて最適な量子化幅
を予測する第1の符号化処理を少なくとも1回実施さ
せ、次に前記量子化幅予測手段により予測された最適な
量子化幅を用いて第2の符号化処理を実施させるべく制
御する制御手段とを設けて構成する。
Fourth, a code amount calculating unit for calculating the code amount of the transform coefficient of the entire image encoded by the variable length encoding unit, a code amount of the entire image calculated by the code amount calculating unit, A quantization width prediction unit that predicts an optimal quantization width from the permissible target total code amount per screen, and gives the predicted quantization width to the quantization unit; Based on the code amount generated by the encoding process in the block to be processed and the allocated code amount in the block, an excess / deficiency amount of the generated code amount with respect to the allocated code amount is calculated, and based on the target total code amount. Code amount allocating means for obtaining a code amount obtained by adding the calculated excess or deficiency amount to the determined reference code amount per block as the allocated code amount of a block to be processed next; The truncation means for controlling the variable length coding means to terminate the variable length coding so as not to exceed the allocated code amount allocated by the code amount allocating means; and A first encoding process for predicting an optimum quantization width using a predetermined tentative quantization width based on the quantity, and then performing the first encoding process at least once; Control means for controlling the second encoding process using the encoding width.

また、本発明は画像データをブロックに分割し、この
分割された各ブロックは順にそれぞれ直交変換を行って
この変換出力を量子化手段により量子化し、この量子化
出力を可変長符号化手段に与えて可変長符号化し、各ブ
ロック毎にデータの符号化をする符号化装置において、 第5には圧縮率を指定する圧縮率指定手段と、この圧
縮率指定手段にて指定された圧縮率に応じて画面あたり
の許される目的総符号量および暫定的に定めた量子化幅
および1ブロック当たりの基準割当符号量とを決定する
圧縮率選択手段と、前記可変長符号化手段により符号化
された変換係数の画像全体の符号量を算出する符号量算
出手段と、この符号量算出手段により算出された前記画
像全体の符号量と、前記目的総符号量とから最適な量子
化幅を予測すると共に、前記量子化手段にこの予測量子
化幅を与える量子化幅予測手段と、前記ブロックの符号
化にあたり、当該符号化処理するブロックでの符号化処
理により発生した符号量と当該ブロックでの割当符号量
とに基づいてこの発生符号量の前記割当符号量に対する
過不足量を算出すると共に、前記圧縮率選択手段により
決定された1ブロック当たりの基準符号量に前記算出し
た過不足量を加えた符号量を次に処理するブロックの前
記割当符号量として求める符号量割当手段と、各ブロッ
ク毎に前記符号量割当手段により割り当てられた割当符
号量を越えないように前記可変長符号化を打ち切るべく
前記可変長符号化手段を制御する打切手段と、前記量子
化手段に対し、初めに前記目的総符号量から予め定めた
暫定的な量子化幅を用いて最適な量子化幅を予測する第
1の符号化処理を少なくとも1回実施させ、次に前記量
子化幅予測手段により予測された最適な量子化幅を用い
て第2の符号化処理を実施させるべく制御する制御手段
とを設けて構成する。
Further, according to the present invention, the image data is divided into blocks, each of the divided blocks is subjected to orthogonal transform in turn, and the transform output is quantized by a quantizing means, and the quantized output is given to a variable length coding means. Fifth, in a coding apparatus that performs variable length coding and data coding for each block, a compression ratio designating unit that designates a compression ratio and a compression ratio designated by the compression ratio designating unit. Compression ratio selection means for determining the total target code amount allowed per screen, the provisionally determined quantization width, and the reference allocation code amount per block; and the transform coded by the variable length coding means. A code amount calculation unit for calculating the code amount of the entire image of the coefficient, and an optimal quantization width is predicted from the code amount of the entire image calculated by the code amount calculation unit and the target total code amount. A quantization width prediction unit that gives the prediction quantization width to the quantization unit; and a code amount generated by an encoding process in the block to be encoded and an assigned code in the block when encoding the block. The amount of excess or deficiency of the generated code amount with respect to the allocated code amount is calculated based on the amount and the code obtained by adding the calculated excess or deficiency amount to the reference code amount per block determined by the compression ratio selecting means. Code amount allocating means for determining the amount as the allocated code amount of a block to be processed next, and the variable length coding for terminating the variable length coding so as not to exceed the allocated code amount allocated by the code amount allocating unit for each block. Optimum quantization using a provisional quantization width predetermined from the target total code amount for the truncation means for controlling the variable length coding means and the quantization means. Control means for performing at least once a first encoding process for estimating, and then performing a second encoding process using the optimum quantization width predicted by the quantization width prediction means. Are provided.

更に第6には画像データをブロックに分割し、この分
割された各ブロックは順にそれぞれ直交変換を行って低
い周波数成分から順に高い周波数成分へと前記ブロック
毎の画像データを成分分解し、この変換出力を量子化手
段により量子化し、この量子化出力を可変長符号化手段
に与えて可変長符号化し、各ブロック毎にデータの符号
化をする符号化装置において、 前記可変長符号化手段により符号化された画像全体の
変換係数の符号量を算出する符号量算出手段と、この符
号量算出手段により算出された画像全体の符号量と、画
面あたりの許される目的総符号量とから最適な量子化幅
を予測すると共に、前記量子化手段にこの予測量子化幅
を与える量子化幅予測手段と、前記ブロックの符号化に
あたり、当該符号化処理するブロックでの符号化処理に
より発生した符号量と当該ブロックでの割当符号量とに
基づいてこの発生符号量の前記割当符号量に対する過不
足量を算出すると共に、前記目的総符号量に基づき決定
された1ブロック当たりの基準符号量に前記算出した過
不足量を加えた符号量を次に処理するブロックの前記割
当符号量として求める符号量割当手段と、前記量子化手
段に対し、初めに前記目的総符号量から予め定めた暫定
的な量子化幅を用いて最適な量子化幅を予測する第1の
符号化処理を少なくとも1回実施させ、次に前記量子化
幅予測手段により予測された最適な量子化幅を用いて第
2の符号化処理を実施させるべく制御する制御手段とを
備え、 前記可変長符号化手段には前記直交変換により得られ
る前記各ブロック単位の画像データのうち、直流成分に
ついては手前の符号化処理ブロックでの直流成分との差
分を得ると共にこの差分を可変長符号化する直流成分用
の符号化処理部と、この直流成分の符号化処理部の処理
が終った後、前記交流成分について可変長符号化する交
流成分用の符号化処理部とを設け、前記符号化打ち切り
手段は交流成分用の符号化処理部に対してのみ打ち切り
制御を可能にする構成とする。
Sixth, the image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform in order to decompose the image data for each block from low frequency components to high frequency components in order. In an encoding device, the output is quantized by a quantizing unit, the quantized output is supplied to a variable-length encoding unit and subjected to variable-length encoding, and data is encoded for each block. Code amount calculating means for calculating the code amount of the transform coefficient of the entire transformed image, and the optimal quantum based on the code amount of the entire image calculated by the code amount calculating means and the permissible target total code amount per screen. A quantization width prediction unit that predicts the quantization width and provides the prediction quantization width to the quantization unit; and, in encoding the block, codes in a block to be encoded. Calculating the excess / deficiency of the generated code amount with respect to the allocated code amount based on the code amount generated by the conversion process and the allocated code amount in the block, and calculates the amount of error per block determined based on the target total code amount. A code amount allocating means for calculating a code amount obtained by adding the calculated excess / deficiency amount to the reference code amount of the block as the allocated code amount of a block to be processed next, and the quantizing means, first, from the target total code amount. A first encoding process of predicting an optimum quantization width using a predetermined temporary quantization width is performed at least once, and then an optimum quantization width predicted by the quantization width prediction unit is calculated. Control means for performing a second encoding process by using the variable-length encoding means, wherein the variable-length encoding means includes a DC component of the image data of each block obtained by the orthogonal transform. After obtaining the difference from the DC component in the preceding coding processing block and performing the variable-length coding on the difference, the coding processing unit for the DC component and the processing of the coding processing unit for the DC component are completed. A coding processing section for an AC component that performs variable-length coding on the AC component, and the coding cut-off means enables the cut-off control only for the coding processing section for the AC component.

また、第7には画像データをブロックに分割し、この
分割された各ブロックは順にそれぞれ直交変換を行って
からこれを量子化し、この量子化データを可変長符号化
することにより、各ブロック毎にデータの符号化をする
符号化方法において、 前記データの符号化処理を行って画像全体の符号量を
調べる第1のステップと、この第1のステップで得た画
像全体の符号量から最適化に必要な量子化幅の予測を行
う第2のステップと、この予測した量子化幅を用いて前
記各ブロック毎の量子化を行う第3のステップと、前記
ブロックの符号化にあたり、当該符号化処理するブロッ
クでの符号化処理により発生した符号量と当該ブロック
での割当符号量とに基づいてこの発生符号量の前記割当
符号量に対する過不足量を算出すると共に、画像当りの
許される符号量である目的の総符号量に応じて予め決定
した1ブロック当たりの基準符号量に前記算出した過不
足量を加えた符号量を次に処理するブロックの前記割当
符号量として求める第4のステップと、この第4のステ
ップにおける各ブロック毎の割当符号量に収まる範囲で
そのブロックの可変長符号化を実施する第5のステップ
とよりなることを特徴とする。
Seventh, the image data is divided into blocks, each of the divided blocks is sequentially subjected to orthogonal transform, and then quantized, and the quantized data is subjected to variable-length coding, so that In a coding method for coding data, a first step of checking the code amount of the entire image by performing the data coding process, and optimizing the code amount of the entire image obtained in the first step A second step of predicting a quantization width required for the above, a third step of performing quantization for each of the blocks using the predicted quantization width, and a step of encoding the block. Based on the code amount generated by the encoding process in the block to be processed and the allocated code amount in the block, an excess / deficiency amount of the generated code amount with respect to the allocated code amount is calculated. A code amount obtained by adding the calculated excess / deficiency amount to a reference code amount per block predetermined according to a target total code amount which is an allowable code amount is obtained as the allocated code amount of a block to be processed next. It is characterized by comprising 4 steps and a 5th step of performing variable length coding of the block within the range of the allocated code amount for each block in the fourth step.

更に第8には画像データをブロックに分割し、この分
割された各ブロックは順にそれぞれ直交変換を行って低
い周波数成分から順に高い周波数成分へと前記ブロック
毎の画像データを成分分解し、この成分分解されたもの
を量子化した後、可変長符号化することにより各ブロッ
ク毎にデータの符号化をする符号化方法において、 前記可変長符号化処理においては前記直交変換により
得られる前記各ブロック単位の画像データのうち、直流
成分については手前の符号化処理ブロックでの直流成分
との差分を得ると共にこの差分を可変長符号化し、この
直流成分用の符号化処理が終わった後、前記交流成分に
ついて可変長符号化して、これにより最適化するに必要
な画像全体の符号量を調べる第1のステップと、この第
1のステップで得た画像全体の符号量に基づき最適化に
必要な量子化幅の予測を行う第2のステップと、この予
測した量子化幅を用いて前記各ブロック毎の量子化を行
う第3のステップと、前記ブロックの符号化にあたり、
当該符号化処理するブロックでの符号化処理により発生
した符号量と当該ブロックでの割当符号量とに基づいて
この発生符号量の前記割当符号量に対する過不足量を算
出すると共に、画像当りの許される符号量である目的の
総符号量に応じて予め決定した1ブロック当たりの基準
符号量に前記算出した過不足量を加えた符号量を次に処
理するブロックの前記割当符号量として求める第4のス
テップとよりなることを特徴とする。
Eighth, the image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform in order to decompose the image data for each block from low frequency components to high frequency components in order. In a coding method of coding data for each block by quantizing the decomposed data and performing variable length coding, the block unit obtained by the orthogonal transform in the variable length coding process Of the image data of the DC component, a difference from the DC component in the preceding encoding processing block is obtained and the difference is subjected to variable-length encoding. After the encoding process for the DC component ends, the AC component A variable-length encoding of the image, and a first step of examining the code amount of the entire image necessary for optimization, and the entire image obtained in the first step. A second step of predicting a quantization width required for optimization based on the code amount of the field, a third step of performing quantization for each block using the predicted quantization width, and In encoding
Based on the code amount generated by the encoding process in the block to be encoded and the allocated code amount in the block, an excess / deficiency amount of the generated code amount with respect to the allocated code amount is calculated. A code amount obtained by adding the calculated excess or deficiency amount to a reference code amount per block determined in advance according to a target total code amount which is a code amount to be processed is obtained as the allocated code amount of a block to be processed next. Characterized by the following steps:

〔作 用〕 このような構成において、画像データをブロックに分
割し、この分割された各ブロックは順にそのブロック毎
に直交変換を行い変換係数を得、この直交変換された変
換係数に対し、量子化手段により量子化を行ってから、
これを可変長符号化して行くが、第1の構成の場合、1
画像当りの許される符号量である目的の総符号量以下の
所定の符号量を総ブロック数で割ることにより、決定さ
れた1ブロック当たりの基準割当符号量と、このブロッ
クの前のブロックでの符号化処理における発生符号量
の、前記割当符号量に対する過不足分とを合わせて得た
現在処理中のブロック用の割当符号量を基準に、現在処
理中のブロックにおける符号化処理の発生符号量を監視
し、これが前記割当符号量を越える前にそのブロックで
の符号化を打ち切るように可変長符号化処理を行う。
[Operation] In such a configuration, the image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform for each block in order to obtain a transform coefficient. After performing quantization by the quantization means,
This is variable-length coded. In the case of the first configuration, 1
By dividing a predetermined code amount equal to or smaller than a target total code amount, which is an allowable code amount per image, by the total number of blocks, the determined reference allocation code amount per block and a block allocated before this block can be obtained. The generated code amount of the encoding process in the block currently being processed, based on the allocated code amount for the currently processed block obtained by combining the generated code amount in the encoding process with the excess or deficiency with respect to the allocated code amount. Is monitored, and the variable-length coding process is performed so that the coding in the block is terminated before this exceeds the allocated code amount.

また、第2の構成の場合、圧縮率を選択することによ
り、選択された圧縮率に対応しての目的総符号量および
量子化幅および1ブロック当たりの符号量とを決定し、
画像データをブロック化して直交変換を行い、前記量子
化幅で量子化を行った後、前記1ブロック当たりの基準
符号量と、このブロックの前のブロックでの符号化処理
における発生符号量の、前記割当符号量に対する過不足
分とを合わせて得た現在処理中のブロック用の割当符号
量を基準に、現在処理中のブロックにおける符号化処理
の発生符号量を監視し、これが前記割当符号量を越える
前にそのブロックでの符号化を打ち切るように可変長符
号化処理を行う。
In the case of the second configuration, by selecting a compression rate, a target total code amount and a quantization width corresponding to the selected compression rate and a code amount per block are determined.
After performing orthogonal transformation by blocking image data and performing quantization with the quantization width, the reference code amount per block and the generated code amount in the coding process in a block before this block are calculated. Based on the allocated code amount for the currently processed block obtained by combining the excess and deficiency with respect to the allocated code amount, the generated code amount of the encoding process in the currently processed block is monitored. Variable length encoding is performed so that the encoding in the block is terminated before the value exceeds.

また、第3の構成の場合、画像データをブロックに分
割し、この分割されたブロックは順にそのブロック毎に
直交変換を行って低い周波数成分から順に高い周波数成
分へと画像データを成分分解し、この変換出力を量子化
手段により量子化し、その後、この量子化出力を可変長
符号化手段に与えて可変長符号化し、データの符号化を
するが、前記直交変換により得られる前記各ブロック単
位の画像データのうち、直流成分についてはこのブロッ
クの手前のブロックでの直流成分との差分を得ると共
に、この差分を可変長符号化し、この直流成分用の符号
化処理が終わった後、前記交流成分について、目的総符
号量に応じて予め決定しておいた1ブロック当たりの基
準符号量と、このブロックの前のブロックでの符号化処
理における発生符号量の、前記割当符号量に対する過不
足分とを合わせて得た現在処理中のブロック用の割当符
号量を基準に、現在処理中のブロックにおける符号化処
理の発生符号量を監視し、これが前記割当符号量を越え
る前にそのブロックでの符号化を打ち切るように可変長
符号化処理を行う。
In the case of the third configuration, the image data is divided into blocks, and the divided blocks are subjected to orthogonal transform for each block in order, and the image data is decomposed into low-frequency components and high-frequency components in order. This transform output is quantized by a quantizer, and then the quantized output is supplied to a variable-length encoder to perform variable-length encoding and data encoding. Of the image data, for the DC component, a difference from the DC component in the block before this block is obtained, and the difference is subjected to variable-length coding. After the coding process for the DC component is completed, the AC component is obtained. , A reference code amount per block determined in advance according to the target total code amount, and a generated code amount in an encoding process in a block before this block. Monitoring the generated code amount of the encoding process in the block currently being processed based on the allocated code amount for the currently processed block obtained by combining the excess and deficiency with respect to the allocated code amount, and Before exceeding the amount, a variable length encoding process is performed so as to terminate the encoding in the block.

また、第4の構成の場合、画像データをブロック化し
て直交変換を行い、暫定的な量子化幅で量子化を行った
後、可変長符号化し、画像全体の符号量を算出し、これ
から最適な量子化幅を予測する。そして、次に再び直交
変換された変換係数に対し、新しい量子化幅で量子化を
行った後、目的総符号量に応じて予め決定した1ブロッ
ク当たりの基準割当符号量と、このブロックの前のブロ
ックでの符号化処理における発生符号量の、前記割当符
号量に対する過不足分とを合わせて得た現在処理中のブ
ロック用の割当符号量を基準に、現在処理中のブロック
における符号化処理の発生符号量を監視し、これが前記
割当符号量を越える前にそのブロックでの符号化を打ち
切るように可変長符号化処理を行う。
In the case of the fourth configuration, image data is divided into blocks, orthogonal transformation is performed, quantization is performed with a provisional quantization width, variable-length coding is performed, and the code amount of the entire image is calculated. Predict the optimal quantization width. Then, the orthogonally transformed transform coefficients are again quantized with a new quantization width, and a reference allocation code amount per block determined in advance according to the target total code amount, and a reference allocation code amount before this block. Based on the allocated code amount for the currently processed block obtained by combining the generated code amount in the coding process of the block with the excess or deficiency with respect to the allocated code amount. The variable length coding process is performed so as to terminate the coding in the block before the generated code amount exceeds the allocated code amount.

また、第5の構成の場合、圧縮率を選択することによ
り、選択された圧縮率に応じて目的総符号量および暫定
的量子化幅および1ブロック当たりの基準割当符号量と
を決定し、画像データをブロック化して直交変換を行
い、前記暫定的な量子化幅で量子化を行った後、可変長
符号化し、画像全体の符号量を算出し、これから最適な
量子化幅を予測し、次に再び直交変換された変換係数に
対し、前記予測して得た新しい量子化幅で量子化を行っ
た後、前記1ブロック当たりの基準割当符号量と、この
ブロックの前のブロックでの符号化処理における発生符
号量の、前記割当符号量に対する過不足分とを合わせて
得た現在処理中のブロック用の割当符号量を基準に、現
在処理中のブロックにおける符号化処理の発生符号量を
監視し、これが前記割当符号量を越える前にそのブロッ
クでの符号化を打ち切るように可変長符号化処理を行
う。
Further, in the case of the fifth configuration, by selecting a compression ratio, the target total code amount, the provisional quantization width, and the reference allocation code amount per block are determined according to the selected compression ratio. After performing orthogonal transformation by blocking data and performing quantization with the provisional quantization width, variable-length coding is performed, and the code amount of the entire image is calculated. After the orthogonally transformed transform coefficients are again quantized with the new quantization width obtained by the prediction, the reference allocation code amount per block and the coding in the block before this block are performed. The generated code amount of the encoding process in the block currently being processed is monitored based on the allocated code amount for the currently processed block obtained by combining the generated code amount in the processing with the excess or deficiency of the allocated code amount. And this is Performing variable length coding process to abort the coding in the block before exceeding the amount of codes.

また、第6の構成の場合、画像データをブロックに分
割し、この分割されたブロックは順にそのブロック毎に
直交変換を行って低い周波数成分から順に高い周波数成
分へと前記ブロック毎の画像データを成分分解し、この
変換出力を量子化手段により量子化し、その後、この量
子化出力を可変長符号化手段に与えて可変長符号化し、
データの符号化をするが、前記直交変換により得られる
前記各ブロック単位の画像データのうち、直流成分につ
いてはこのブロックの手前のブロックでの直流成分との
差分を得ると共に、この差分を可変長符号化し、前記交
流成分についてはこの直流成分用の符号化処理が終わっ
た後、最適化するに必要な画像全体の符号量を調べ、こ
れにより最適な量子化幅を予測し、この予測量子化幅を
用いて前記各ブロック毎の量子化を行い、目的総符号量
に応じて予め決定しておいた1ブロック当たりの基準割
当符号量と、このブロックの前のブロックでの符号化処
理における発生符号量の、前記割当符号量に対する過不
足分とを合わせて得た現在処理中のブロック用の割当符
号量を基準に、現在処理中のブロックにおける符号化処
理の発生符号量を監視し、これが前記割当符号量を越え
る前にそのブロックでの符号化を打ち切るように可変長
符号化処理を行う。
In the case of the sixth configuration, the image data is divided into blocks, and the divided blocks are sequentially subjected to orthogonal transform for each block, and the image data for each block is sequentially converted from a low frequency component to a high frequency component. Decompose the components, quantize the transformed output by the quantizing means, and then provide the quantized output to the variable-length coding means to perform variable-length coding,
Data is encoded. Among image data of each block obtained by the orthogonal transform, a difference between a DC component and a DC component of a block before this block is obtained, and this difference is variable-length. After the coding process for the DC component is completed, the coding amount of the entire image necessary for optimization is checked for the AC component, and the optimum quantization width is thereby predicted. Quantization of each block is performed using a width, and a reference allocation code amount per block, which is determined in advance according to a target total code amount, and a generation amount in a coding process in a block before this block. The code amount, based on the allocated code amount for the currently processed block obtained by combining the excess and deficiency with respect to the allocated code amount, based on the generated code amount of the encoding process in the currently processed block. Vision, and which performs variable length coding process to abort the coding in the block before exceeding the allocated code quantity.

また、第7の方法においては、画像データをブロック
に分割し、この分割された各ブロックは順にそれぞれ直
交変換を行ってからこれを量子化し、この量子化データ
を可変長符号化することにより、各ブロック毎にデータ
の符号化をするにあたり、前記データの符号化処理を行
って画像全体の符号量を調べ、これにより得た画像全体
の符号量から最適化に必要な量子化幅の予測を行い、こ
の予測した量子化幅を用いて前記各ブロック毎の量子化
を行い、また、前記ブロックの符号化にあたり、当該符
号化処理するブロックでの符号化処理により発生した符
号量と当該ブロックでの割当符号量とに基づいてこの発
生符号量の前記割当符号量に対する過不足量を算出する
と共に、画像当りの許される符号量である目的の総符号
量に応じて予め決定した1ブロック当たりの基準符号量
に前記算出した過不足量を加えた符号量を次に処理する
ブロックの前記割当符号量として求め、この求めた各ブ
ロック毎の割当符号量に収まるように、各ブロックの可
変長符号化を実施する。
Further, in the seventh method, the image data is divided into blocks, and each of the divided blocks is subjected to an orthogonal transform in order, then quantized, and the quantized data is subjected to variable-length coding. In encoding data for each block, the encoding process of the data is performed to check the code amount of the entire image, and the prediction of the quantization width required for optimization is performed based on the code amount of the entire image obtained thereby. Performing quantization for each block using the predicted quantization width, and, when encoding the block, the amount of code generated by the encoding process in the block to be encoded and Of the generated code amount with respect to the allocated code amount based on the allocated code amount, and is determined in advance according to the target total code amount which is the allowable code amount per image. The code amount obtained by adding the calculated excess / deficiency amount to the reference code amount per block is determined as the allocated code amount of the next block to be processed. Perform variable length coding of blocks.

更に第8の方法においては、画像データをブロックに
分割し、この分割された各ブロックは順にそれぞれ直交
変換を行って低い周波数成分から順に高い周波数成分へ
と前記ブロック毎の画像データを成分分解し、この成分
分解されたものを量子化した後、可変長符号化すること
により各ブロック毎にデータの符号化をするにあたり、
前記可変長符号化処理においては前記直交変換により得
られる前記各ブロック単位の画像データのうち、直流成
分については手前の符号化処理ブロックでの直流成分と
の差分を得ると共にこの差分を可変長符号化し、この直
流成分用の符号化処理が終わった後、前記交流成分につ
いて可変長符号化して、これにより最適化するに必要な
画像全体の符号量を調べ、これにより得た画像全体の符
号量に基づき最適化に必要な量子化幅の予測を行い、こ
の予測した量子化幅を用いて前記各ブロック毎の量子化
を行い、また、前記ブロックの符号化にあたり、当該符
号化処理するブロックでの符号化処理により発生した符
号量と当該ブロックでの割当符号量とに基づいてこの発
生符号量の前記割当符号量に対する過不足量を算出する
と共に、画像当りの許される符号量である目的の総符号
量に応じて予め決定した1ブロック当たりの基準符号量
に前記算出した過不足量を加えた符号量を次に処理する
ブロックの前記割当符号量として求める。
Further, in an eighth method, the image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform in order to decompose the image data for each block from low frequency components to high frequency components in order. After quantizing the component-decomposed data, the data is encoded for each block by performing variable-length encoding.
In the variable-length encoding process, of the image data in each block obtained by the orthogonal transform, a difference between the DC component and the DC component in the preceding encoding processing block is obtained, and this difference is referred to as a variable-length code. After the coding process for the DC component is completed, the AC component is subjected to variable-length coding, thereby checking the code amount of the entire image necessary for optimization, and thereby obtaining the code amount of the entire image. Based on the prediction of the quantization width required for optimization, perform quantization for each block using the predicted quantization width, and, when encoding the block, in the block to be subjected to the encoding process Calculating the excess / deficiency of the generated code amount with respect to the allocated code amount on the basis of the code amount generated by the encoding process and the allocated code amount in the block. Determined as the assigned code amount of a block to be processed next code amount in which the addition of the calculated deficiency amount to the reference code amount per block which is determined in advance according to the total code amount of interest is a code amount allowed.

このように本装置は、目的とする符号量から1ブロッ
ク当たりの符号量を決定し、順次符号化出力を見なが
ら、所望の符号量内で収まるように、可変長符号化をブ
ロック単位で制御し、符号化出力を最終出力として得る
ようにしたものである。
As described above, the present apparatus determines the code amount per block from the target code amount, and controls the variable-length coding in block units so as to be within the desired code amount while sequentially watching the coded output. Then, an encoded output is obtained as a final output.

また、本装置は最初に少なくとも1回の統計処理を行
い、量子化幅を最適化してから符号化処理を行うと、更
に良好な結果が得られるため、まず統計処理により量子
化幅を最適化するに必要な画像全体の符号量を調べ、次
にこの統計処理により得た情報をもとに最適化された符
号化を行うための処理に入り、順次、符号化出力を見な
がら所望の符号量内で収まるように、可変長符号化をブ
ロック単位で制御し、符号化出力を最終出力として得る
ようにしたものである。
In addition, the present apparatus performs at least one statistical process first, optimizes the quantization width, and then performs the encoding process, so that a better result can be obtained. The amount of code of the entire image necessary to perform the coding is checked, and then the processing for performing the optimized coding based on the information obtained by the statistical processing is performed. The variable length coding is controlled on a block basis so as to be within the amount, and the coded output is obtained as the final output.

そのため、最初に画像のブロック化、このブロック化
された画像の要素に対する目的とする符号量から予め決
定された量子化幅を使用しての量子化、この量子化によ
り得られた変換係数の可変長符号化、そして、この可変
長符号化に当たり、目的とする符号量から予め求めた1
ブロック当たりの割り当て符号量とそれまでの符号化に
より発生した割り当て符号量の過不足とを加えたブロッ
クの割り当て符号量に収まる範囲内での当該要素の可変
長符号化、処理対象画像の全符号の保存のための出力処
理と云った処理を行い、最終出力を得るようにしたもの
であるから、得られた画像データに対し、一定の符号量
以内に収まるように符号化できるようになり、画像の記
憶枚数が規定される場合等では、記憶手段の記憶容量に
対して、一定の記憶可能枚数を保証することができる
他、一度の符号化処理で処理が終るから、一定の処理時
間内で符号化を行うことができるようになる。また、符
号量の制御は1ブロック当たりの割り当て符号量と、そ
のブロックまでの割り当て符号量の過不足のみを用いる
ので、大きな記憶領域を必要とせず、比較的簡単な構成
で実現できる。更に符号化の打ち切りは、高い周波数の
成分に対して行うので、画質の劣化も比較的少ない。
Therefore, first, the image is blocked, the quantization is performed using a quantization width determined in advance from the target code amount for the elements of the blocked image, and the transform coefficient obtained by the quantization is varied. In the long coding and the variable length coding, 1 is obtained in advance from a target code amount.
Variable-length coding of the relevant element within the range of the allocated code amount of the block, including the allocated code amount per block and the excess or shortage of the allocated code amount generated by the previous coding, and all codes of the image to be processed Since the final output is obtained by performing a process called an output process for storing the image data, the obtained image data can be encoded so as to be within a certain code amount. In the case where the number of stored images is specified, for example, a fixed number of storable images can be guaranteed for the storage capacity of the storage unit. To perform encoding. In addition, since the control of the code amount uses only the allocated code amount per block and the excess or deficiency of the allocated code amount up to the block, a large storage area is not required and a relatively simple configuration can be realized. Further, since the coding is discontinued for high frequency components, the deterioration of the image quality is relatively small.

また、最初に暫定的な量子化幅を使用しての統計処理
を少なくとも一回行って最適な量子化幅を予測した後、
これに基づき得られた最適な量子化幅を用いて符号化す
る方法では、少なくとも一回の統計処理のパスと符号化
処理のパスの決まった回数のパスで処理が終わるから、
一定の処理時間内で符号化を行うことができると共に、
符号化における符号の打ち切りの発生が非常に少なくな
る上に、符号化の打ち切りは高い周波数の成分に対して
行うため、画質の劣化も殆どない。
Also, after first performing statistical processing using the provisional quantization width at least once to predict the optimal quantization width,
In the method of encoding using the optimal quantization width obtained based on this, since the processing ends in at least one fixed number of passes of the statistical processing pass and the encoding processing pass,
Encoding can be performed within a certain processing time,
Occurrence of code truncation in encoding is extremely reduced, and since the code truncation is performed on high frequency components, there is almost no deterioration in image quality.

従って、この発明によれば、簡単な構成により、一定
の処理時間内で一定の符号量内に収まるように符号化で
きるようになる他、画質の劣化も殆どない。更に本発明
によれば、符号自体には影響を及ぼさないので、従来例
で示した国際標準案方式や本発明の課題の項で示した再
生時の互換性を保つことができる。言い換えれば再生装
置は共通で良い。
Therefore, according to the present invention, with a simple configuration, encoding can be performed within a fixed code amount within a fixed processing time, and there is almost no deterioration in image quality. Further, according to the present invention, since the code itself is not affected, the compatibility at the time of reproduction described in the international standard scheme shown in the conventional example and the subject of the present invention can be maintained. In other words, the playback device may be common.

〔実施例〕〔Example〕

以下、本発明の実施例を図面に基づいて説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.

初めに本発明を分かり易くするために、本発明の基本
的な考え方を説明しておく。
First, to make the present invention easy to understand, a basic concept of the present invention will be described.

すなわち、本発明は例えば、1つの画像(画面)をブ
ロックに区分し、これら各ブロックを順に、ブロック単
位でそのブロックの構成画素のデータを直交変換してこ
れを更に量子化し、圧縮符号化するにあたり、1画像当
りの最終的に収めたい符号量である目的総符号量に基づ
いて予め決定した量子化幅により、前記各ブロックの画
像データを順に量子化すると共に、この量子化したもの
を符号化し、この符号化により得られる符号量が、前記
目的総符号量から予め決定した1ブロック当たりの基準
割当符号量と、このブロックより一つ前の処理順番に当
ったブロックにおける当該符号化処理での発生符号量の
割当符号量に対する過不足分とを加えた量にて定まるそ
のブロックの許容される符号量である割当符号量に収ま
るように、符号量を監視しながら符号化を進め、EOB(E
nd Of Block)符号を含め、符号量が前記割当符号量に
達するとそのブロックの符号化は終了させるが、直流成
分は調整割当符号量を越える場合でも、必ず符号化さ
せ、そのときの前記割当符号量に対する過不足を記憶し
ておき、次のブロックの符号化に移ると共に当該次のブ
ロックにおいてこの過不足量分を基準割当符号量に加え
て調整し、このブロックでの割当符号量とし、この割当
符号量の範囲で可変長符号化すると云ったものである。
That is, in the present invention, for example, one image (screen) is divided into blocks, and the data of the constituent pixels of the blocks are orthogonally transformed in block units in order, and further quantized and compression-coded. The image data of each block is sequentially quantized by a quantization width determined in advance based on a target total code amount which is a code amount desired to be finally contained in one image, and the quantized data is encoded. The code amount obtained by this coding is determined by the reference allocation code amount per block determined in advance from the target total code amount and the coding process in the block that is in the processing order one block before this block. The code amount is set so as to be within the allocated code amount which is the allowable code amount of the block determined by the amount obtained by adding the excess or deficiency to the allocated code amount of the generated code amount. View to promoting the encoding while, EOB (E
nd Of Block), when the code amount reaches the allocated code amount, the coding of the block is terminated. However, even when the DC component exceeds the adjusted allocated code amount, the DC component is always coded. The excess or deficiency for the code amount is stored, and the process proceeds to the encoding of the next block, and in the next block, the excess or deficiency is added to the reference allocated code amount and adjusted. The variable length coding is performed within the range of the allocated code amount.

また、もう一つの考え方として、本発明は前記各ブロ
ックを順に、ブロック単位でそのブロックの構成画素の
データを量子化し、圧縮符号化するにあたり、1画像当
りの最終的に収めたい符号量である目的総符号量に基づ
いて予め決定した量子化幅により、前記各ブロックの画
像データを順に量子化してその符号量から最適な量子化
幅を予測し、この予測した最適量子化幅を用いて再び、
上記各ブロックの画像データを順に量子化すると共に、
この量子化したものを符号化し、この符号化により得ら
れる符号量が、前記目的総符号量から予め決定した1ブ
ロック当たりの基準割当符号量と、このブロックより一
つ前の処理順番に当ったブロックにおける当該符号化処
理での発生符号量の割当符号量に対する過不足分とを加
えた量にて定まるそのブロックの許容される符号量であ
る割当符号量に収まるように、符号量を監視しながら符
号化を進め、EOB符号を含め、符号量が前記割当符号量
に達するとそのブロックの符号化は終了させるが、直流
成分は調整割当符号量を越える場合でも、必ず符号化さ
せ、そのときの前記割当符号量に対する過不足を記憶し
ておき、次のブロックの符号化に移ると共に当該次のブ
ロックにおいてこの過不足量分を基準割当符号量に加え
て調整し、このブロックでの割当符号量とし、この割当
符号量の範囲で可変長符号化すると云ったものである。
Further, as another concept, the present invention quantizes the data of the constituent pixels of each block in order in a block unit, and compresses and codes the data. The image data of each block is sequentially quantized by a quantization width determined in advance based on the target total code amount, and an optimum quantization width is predicted from the code amount, and again using the predicted optimum quantization width. ,
While quantizing the image data of each block in order,
This quantized code is coded, and the code amount obtained by this coding corresponds to the reference allocation code amount per block determined in advance from the target total code amount and the processing order immediately before this block. The code amount is monitored so as to be within the allocated code amount, which is the allowable code amount of the block, which is determined by the amount obtained by adding the excess or deficiency to the allocated code amount of the generated code amount in the corresponding encoding process in the block. When the code amount reaches the allocated code amount, including the EOB code, the coding of the block is terminated, but even if the DC component exceeds the adjusted allocated code amount, the block is always coded. The amount of excess or deficiency with respect to the allocated code amount is stored, and the process proceeds to the encoding of the next block, and the amount of excess or deficiency is adjusted by adding the excess or deficiency amount to the reference allocated code amount in the next block. The assigned code amount using the clock, in which say that the variable length coding in the range of the assigned code amount.

前者は1パス、後者は2パス方式であり、いずれもあ
る量子化幅で量子化してこれを可変長符号化するに際
し、各ブロックに割り当てた基準割当符号量を一つの基
準とし、各ブロックでの発生符号量にばらつきがあるの
を、次のブロックで吸収することで調整しようと云うも
ので、この調整したものを割当符号量とし、この割当符
号量の範囲でブロックでの符号化を実施し、割当符号量
を越えるときはそのブロックの符号化を打ち切るように
する。しかし、画像データは直交変換により直流成分と
交流成分に分解されおり、視覚的に影響の大きい直流成
分については符号量が仮に割当符号量を越えても符号化
打ち切りは行わず、次のブロックでの割当符号量をその
オーバした分だけ差し引き、また、交流成分に入って割
当符号量をオーバする危険が生じた場合は符号化を打ち
切る。また、符号化により発生した符号量が割当符号量
に満たないときはその余剰分を、次のブロックの割当符
号量に加えて、当該次のブロックでの割当符号量を多く
する。交流成分の打ち切りに関しては、高い周波数成分
は特に周波数が高くなる程、視覚的影響が少ないと云う
傾向があることを逆に利用している。このようにして、
一つ前の処理ブロックでの符号量が割当符号量に対して
過不足を生じた場合に、その過不足分を次のブロックの
割当符号量に反映させ、調整すると云う手法をとってい
る点に特徴がある。
The former is a one-pass method, and the latter is a two-pass method. In both cases, when quantizing with a certain quantization width and performing variable-length coding, the reference allocation code amount allocated to each block is used as one reference. Is to adjust by absorbing the variation in the generated code amount in the next block. This adjusted value is used as the allocated code amount, and the coding in the block is performed within the range of the allocated code amount. However, when the allocated code amount is exceeded, the coding of the block is terminated. However, the image data is decomposed into a DC component and an AC component by orthogonal transformation, and the coding is not discontinued even if the code amount exceeds the allocated code amount for the DC component that has a large influence on the visual component. Is deducted by the excess amount, and if there is a danger of entering the AC component and exceeding the allocated code amount, the coding is terminated. When the code amount generated by encoding is less than the allocated code amount, the surplus amount is added to the allocated code amount of the next block, and the allocated code amount in the next block is increased. Concerning the discontinuation of the AC component, the fact that a higher frequency component tends to have less visual influence as the frequency becomes higher is used. In this way,
When the code amount in the immediately preceding processing block exceeds or decreases the allocated code amount, the excess or deficiency is reflected in the allocated code amount of the next block and adjusted. There is a feature.

2パス方式を具体的に述べると、本発明では最初に第
1パスの処理として、目的総符号量から予め求めた暫定
的な量子化幅を用いて統計処理を行い、最適な量子化係
数を予測する。次に、第2パスの処理として最終的な符
号化処理を実施する。第2パス目は各ブロック毎に前記
予測量子化係数により量子化すると共に、これを符号化
し、この符号化により得られる符号量が、目的とする総
符号量に基づいて予め決定した1ブロック当たりの基準
割当符号量と、そのブロックの1つ前のブロック(a)
についての符号化処理で生じた符号量の過不足分(当該
1つ前のブロック(a)に割り当てられた割当符号量に
対する当該ブロック(a)での発生符号量との差分)と
を加えた量で定まる割当符号量内に収まるように、符号
量を監視しながら、符号化を進め、EOB符号を含め、符
号量が割当符号量に達するとそのブロックの符号化は終
了させるが、直流成分は割当符号量を越える場合でも必
ず符号化させ、そのときの割当符号量の過不足を記憶し
ておき、次のブロックの符号化に移って行く。
To describe the two-pass method in detail, in the present invention, first, as the first pass processing, statistical processing is performed using a provisional quantization width obtained in advance from the target total code amount, and an optimal quantization coefficient is calculated. Predict. Next, a final encoding process is performed as a process of the second pass. In the second pass, each block is quantized by the predictive quantization coefficient and encoded, and the code amount obtained by this encoding is determined per block determined in advance based on the target total code amount. Of the reference allocation code amount and the block (a) immediately before that block
(A difference between the allocated code amount allocated to the immediately preceding block (a) and the generated code amount in the current block (a)) is added. While monitoring the code amount so as to be within the allocated code amount determined by the amount, the coding is advanced, and when the code amount including the EOB code reaches the allocated code amount, the coding of the block is terminated, but the DC component Is always encoded even if it exceeds the allocated code amount, the excess or shortage of the allocated code amount at that time is stored, and the process proceeds to the encoding of the next block.

この1ブロック当たりの割当符号量を用いたブロック
毎の符号化打ち切りによる符号量制御は、それのみで画
像全体の符号量制御を行わせることもできれば、おおよ
その符号量制御を行ったときの符号量が目的の符号量を
オーバしたときの微調整に使用することもできる。
The code amount control based on the coding termination for each block using the allocated code amount per block can be used to control the code amount of the entire image by itself, or the code at the time when the approximate code amount control is performed. It can also be used for fine adjustment when the amount exceeds the target code amount.

統計処理を行わずに1パスで符号化を行う場合が先に
述べた1パス方式であり、1パスで符号化を終了するた
め、短時間で処理が行えると云う非常に大きな効果が得
られるが、いつも似たような画像、つまり符号化により
発生する符号量が同じような画像を符号化するようなシ
ステムでないと、画像によってはあまり良好な画質が得
られないことがある。
The case of performing encoding in one pass without performing statistical processing is the one-pass method described above. Since the encoding is completed in one pass, a very large effect that processing can be performed in a short time can be obtained. However, if the system does not always encode similar images, that is, images having the same code amount generated by encoding, very good image quality may not be obtained depending on the image.

これに対し、統計処理を用いる場合が2パス方式であ
り、この統計処理と1ブロック当たりの割り当て符号量
を用いたブロック毎の符号化打ち切りによる符号量制御
とを組み当わせたときに、特に大きな効果が得られる。
以下、この場合を例にとって詳細に説明する。
On the other hand, when the statistical processing is used, the two-pass method is used. When this statistical processing is combined with the code amount control by block-based coding termination using the allocated code amount per block, particularly, A great effect can be obtained.
Hereinafter, this case will be described in detail as an example.

統計処理は最適な量子化幅を予測するものであり、こ
の最適化された量子化幅を符号化処理で使用すること
で、ほぼ目的の総符号量に近付けることができるように
なる。そして、この時点で符号量が目的総符号量内に収
まれば、この処理だけで十分であるが、1画像のデータ
量の上限が規定されている場合、1バイトはおろか、1
ビットでも目的の符号量をオーバすることは許されな
い。そこで、オーバしたときの処理法が必要になる。
The statistical processing predicts an optimal quantization width. By using the optimized quantization width in the encoding processing, it becomes possible to approximate the target total code amount. At this point, if the code amount falls within the target total code amount, this processing alone is sufficient. However, when the upper limit of the data amount of one image is defined, let alone 1 byte,
It is not permissible for the bit to exceed the target code amount. Therefore, a processing method when overrun is required.

それがブロック毎の割当符号量による制御である。こ
れは符号化を行ったときの符号量が目的総符号量(1画
像のデータ量の上限対応の値)をオーバした時の微調整
に使用するものである。符号化処理を統計処理において
予測した最適な量子化幅で実行した結果を見て、オーバ
しなかったときは終了、オーバしたときは後処理と云う
ようにしても良いが、その場合、統計処理、符号化処
理、後処理の3ステップとなり、時間がかかるばかりで
なく、符号化処理と後処理の間で、長さの異なる符号を
繋ぎ合わせることなく区別がつくように、保存する必要
が生じ、多くのメモリが必要となると云う問題があるか
ら、符号化処理の最中に微調整を行うことが望まれる。
しかし、無闇にデータを落とすことは画質の劣化に繋が
るので、避けねばならない。
That is the control based on the allocated code amount for each block. This is used for fine adjustment when the code amount at the time of encoding exceeds the target total code amount (a value corresponding to the upper limit of the data amount of one image). The result of executing the encoding process at the optimum quantization width predicted in the statistical process may be referred to as “end” if not exceeded, and “post-processing” if the result is exceeded. , Encoding and post-processing, which is not only time-consuming, but also requires saving so that codes of different lengths can be distinguished between the encoding and post-processing without joining. However, since there is a problem that a large amount of memory is required, it is desired to perform fine adjustment during the encoding process.
However, dropping data indiscriminately leads to deterioration of image quality, and therefore must be avoided.

そこで、本発明では各ブロックの高い周波数成分から
省略して行くことにより視覚的な影響を最小にする。と
ころが、符号量がオーバするか否かは符号化を終了して
みないと分からないので、本発明ではそれを各ブロック
毎に符号化の時点で判定させるようにする。
Therefore, in the present invention, visual effects are minimized by omitting high frequency components in each block. However, it is impossible to determine whether or not the code amount is exceeded until the coding is completed. Therefore, in the present invention, it is determined for each block at the time of coding.

目的総符号量に応じて予め定めた暫定的な量子化幅と
1ブロック当たりの割当符号量を決めておき、これを
「各ブロックの符号量がこれを越えない限り画像全体の
符号量が目的の符号量を越えることはない」と云うガイ
ドラインにし、このガイドラインを各ブロック毎の割当
符号量として監視の基準にする。そして、本発明におけ
る符号化処理では各ブロックにおいて、ブロックの割当
符号量を越えないように各ブロックにおいて符号化を打
ち切る。
A predetermined tentative quantization width and an allocated code amount per block are determined in advance according to the target total code amount, and the code amount of the entire image is determined as long as the code amount of each block does not exceed this. Will not exceed the code amount of this block ", and this guideline is used as a reference for monitoring as the allocated code amount for each block. Then, in the encoding process according to the present invention, in each block, the encoding is terminated in each block so as not to exceed the allocated code amount of the block.

各ブロックは直交変換により、そのブロックでの画像
データが持つ空間周波数に応じて周波数成分別に分解さ
れ、そのデータが量子化されているので、各ブロックの
符号化においては、低い周波数成分から高い周波数成分
を順次、符号化してゆく際に、ガイドライン(割当符号
量)を越えないように監視しながら符号化を進める。こ
こで、このガイドラインでは十分すぎて割り当てられた
符号量を全部使わずに符号化を終了してしまうブロック
と、逆に足りないブロックとが存在すると云う画像が一
般的である。そこで、オーバしなかったブロック、すな
わち、EOBを含めて発生した符号量が割り当てられた符
号量よりも少なかった、あるいは丁度同じだったブロッ
クは問題なく符号化を終了、つまりEOBを出力する。途
中でオーバしてしまうブロックは割り当てられた符号量
を越える前に符号化を打ち切り、それ以上の高周波数成
分は符号化せずに、カットしてしまうことで割当符号量
内収まるようにする。要するに、途中でオーバしてしま
うブロックはオーバする前にそのブロックの符号化を終
了、つまり、EOBを出力する。そして、この途中打ち切
りで割当符号量に対する余りが生じることが多いので
(可変長符号化であるため、データ値により符号長が変
わることから途中で打ち切ると余りが生じることが多
い)、その余りを1ブロックの基準割当符号量に加え、
次のブロックの割当符号量とする。
Each block is decomposed into individual frequency components according to the spatial frequency of the image data in the block by orthogonal transformation, and the data is quantized. When the components are sequentially encoded, the encoding is performed while monitoring so as not to exceed the guideline (assigned code amount). Here, in general, an image is used in which the guideline is too large, and there is a block in which coding is completed without using all of the allocated code amount and a block in which the coding amount is insufficient. Therefore, the block that has not exceeded, that is, the block in which the code amount generated including the EOB is smaller than the allocated code amount or just the same, terminates the coding without any problem, that is, outputs the EOB. Blocks that are overrun on the way are discontinued before coding exceeds the allocated code amount, and high frequency components beyond that are cut off without coding, so that they fall within the allocated code amount. In short, the encoding of the block that ends in the middle of the block is completed before the block is over, that is, the EOB is output. Since the remainder of the allocated code amount often occurs during this halfway truncation (since variable length coding causes a change in the code length depending on the data value, there is often a surplus when truncation occurs halfway). In addition to the reference code amount of one block,
It is assumed to be the allocated code amount of the next block.

極端に圧縮率を高くしない限り、現実にはありえない
が、万一、与えられた割当符号量が直流成分さえも符号
化するに足りない場合には、直流成分のみは符号化を実
施し、そのブロックの符号化を終了、つまり、EOBを出
力する。そして足りなかった符号量は不足分として、次
のブロックに繰越、その不足分を1ブロックの基準割当
符号量から減じ、次のブロックの割当符号量とする。こ
のとき、EOBもハフマン符号の一つであるから、EOBも含
めて割当符号量内に収まるように符号化打ち切り制御す
る必要がある。
Unless the compression ratio is extremely high, this is not possible, but in the unlikely event that the assigned code amount is insufficient to encode even the DC component, only the DC component is encoded and the encoding is performed. The encoding of the block is completed, that is, the EOB is output. Then, the insufficient code amount is taken as a shortage and carried over to the next block, and the shortage is subtracted from the reference allocation code amount of one block to obtain the allocation code amount of the next block. At this time, since the EOB is one of the Huffman codes, it is necessary to control the coding to be discontinued so that the EOB and the EOB are within the allocated code amount.

このようにして、例えば、大部分のブロックは打ち切
る必要無く符号化を終了し、残りの一部は極く高い周波
数の一部が省略されて、符号化を終了したとすれば、欠
落する情報は極めてわずかであり、しかも、欠落するの
は視覚的に影響の少ない高い周波数成分の情報にとどめ
ることができる。そして、この方式により統計処理、符
号化処理の2ステップで必ず符号化を終了することがで
き、従来のように何度も最適化を繰り返すことが不要で
あるとともに、比較的簡単な機構で符号量の制御がで
き、従来のように多数の作業用メモリも必要とせずに、
総符号量を規定値内に収めることができるようになり、
しかも、画質の劣化も抑制できる。
In this way, for example, if most blocks end coding without having to abort, and some of the remaining parts have a very high frequency omitted, and the coding is finished, the missing information will be lost. Is extremely small, and the missing information can be limited to information of high frequency components which have little visual influence. With this method, encoding can be always completed in two steps of statistical processing and encoding processing, so that it is not necessary to repeat optimization as many times as in the past, and the encoding is performed by a relatively simple mechanism. Control the volume and without the need for a lot of working memory as before,
The total code amount can be kept within the specified value,
In addition, deterioration of image quality can be suppressed.

本発明は画像の各ブロックにおける発生符号量は各々
異なる、つまり、局所的な符号量の片寄りはあるが、数
ブロックあるいは数十ブロックのかたまりをマイクロブ
ロックとしてとらえることにすると、このマイクロブロ
ック毎の発生符号量は比較的片寄りが少ないことに着目
したものである。よって、1ブロック当たりの基準割当
符号量を固定しておいても、発生符号量の割当符号量に
対する余剰分を、以降のブロックの割当符号量へと繰り
越すことにより、各ブロックの発生符号量の変化に適応
させながらも、マイクロブロックでは発生符号量を制御
していることになる。
According to the present invention, the amount of generated code in each block of an image is different. That is, although there is a local deviation in the amount of code, a block of several blocks or several tens of blocks is considered as a microblock. The code amount pays attention to relatively small deviation. Therefore, even if the reference allocated code amount per block is fixed, the surplus amount of the generated code amount with respect to the allocated code amount is carried over to the allocated code amount of the subsequent blocks, so that the generated code amount of each block is reduced. This means that the generated code amount is controlled in the micro block while adapting to the change.

この原理では、符号化の一番最初の方に発生符号量の
多いブロックが集中すると、本来の効果が得られないこ
とがあるが、通常このようなケースは殆どあり得ない
し、万一、あったとしても画像の視覚的にあまり重要で
はない位置にその影響が現れるので、問題は少ないが、
画像全体の目的の符号量の例えば90%をブロックの数で
割って1ブロック当たりの基準割当符号量にすると共
に、残りの10%をあたかも前ブロックでの割当符号量の
剰余分であるかのようにして最初のブロックの符号化の
際に与えると云った手法を採れば解決できる。
According to this principle, if blocks with a large amount of generated code are concentrated at the very beginning of the encoding, the original effect may not be obtained.However, such a case is rarely possible. It ’s less of a problem, because the effect is likely to appear in less important parts of the image,
For example, 90% of the target code amount of the entire image is divided by the number of blocks to obtain a reference allocated code amount per block, and the remaining 10% is determined as if it is a surplus of the allocated code amount in the previous block. This can be solved by adopting a method that is given at the time of encoding the first block.

以上の原理を用いた本装置の実施例を説明する。 An embodiment of the present apparatus using the above principle will be described.

第1図に本発明による画像データの符号化装置をディ
ジタル電子スチルカメラに適用した一実施例を、また、
第2図には本発明による画像データの符号化装置の構成
をそれぞれブロック図で示す。なお、本発明とは直接関
係のないディジタル電子スチルカメラの機構は図示およ
び説明を省略する。
FIG. 1 shows an embodiment in which the image data encoding apparatus according to the present invention is applied to a digital electronic still camera.
FIG. 2 is a block diagram showing the configuration of an image data encoding device according to the present invention. The illustration and description of the mechanism of the digital electronic still camera which is not directly related to the present invention is omitted.

第1図に示すように、ディジタル電子スチルカメラ本
体(以下、電子カメラ本体と称する)1は画像を撮像す
る撮像系40と、この撮像系40の出力に対し、所定の信号
処理を行う信号処理回路60と、直交変換、線形量子化、
可変長符号化機能等を持ち、前記信号処理回路60の出力
を圧縮符号化して出力する符号化回路80と、この符号化
回路80により符号化された画像データおよび量子化幅
(またはこれに対応した情報)を記録媒体71に記録する
記録系70と、所望のデータ圧縮率を設定入力するスイッ
チ30、システム全体の制御を司る制御回路90とから構成
される。
As shown in FIG. 1, a digital electronic still camera main body (hereinafter, referred to as an electronic camera main body) 1 includes an imaging system 40 for capturing an image, and a signal processing for performing a predetermined signal processing on an output of the imaging system 40. Circuit 60, orthogonal transform, linear quantization,
An encoding circuit 80 having a variable-length encoding function and the like for compressing and encoding the output of the signal processing circuit 60 and outputting the image data and the quantization width encoded by the encoding circuit 80 (or corresponding to the ) On a recording medium 71, a switch 30 for setting and inputting a desired data compression ratio, and a control circuit 90 for controlling the entire system.

電子カメラ本体1の操作部には画像の圧縮率を設定す
るスイッチ30が設けられており、スイッチ30は制御回路
90に接続されている。
The operation unit of the electronic camera body 1 is provided with a switch 30 for setting an image compression ratio.
Connected to 90.

前記撮像系40は光学像を結像するためのレンズ40a
と、CCD等の撮像素子40bとを備える。前記信号処理回路
60は増幅およびノイズ除去等を行うアンプ60aと、アナ
ログ信号をディジタル信号に変換するA/D変換器60bと、
RAM等からなるバッファメモリ60cと、色信号形成等を行
うプロセス回路60dとを備える。符号化回路80は例え
ば、DCT(離散コサイン変換)等の直交変換を行う直交
変換回路4、線形量子化を行う量子化回路6、可変長符
号化としてハフマン符号化を行うハフマン符号化回路8
を備え、更に量子化幅予測回路12,符号量算出回路14、
符号量割当回路20、符号打切回路16および符号化回路80
内の制御処理を行う制御回路18とを有している。
The imaging system 40 includes a lens 40a for forming an optical image.
And an image sensor 40b such as a CCD. The signal processing circuit
Reference numeral 60 denotes an amplifier 60a for performing amplification and noise removal, and an A / D converter 60b for converting an analog signal to a digital signal.
A buffer memory 60c including a RAM and the like, and a process circuit 60d for performing color signal formation and the like are provided. The encoding circuit 80 includes, for example, an orthogonal transformation circuit 4 that performs orthogonal transformation such as DCT (discrete cosine transformation), a quantization circuit 6 that performs linear quantization, and a Huffman encoding circuit 8 that performs Huffman encoding as variable-length encoding.
And further, a quantization width prediction circuit 12, a code amount calculation circuit 14,
Code amount allocating circuit 20, code truncation circuit 16, and coding circuit 80
And a control circuit 18 for performing a control process inside.

前記記録系70はインタフェース回路70aおよび記録媒
体として用いられるICメモリを内蔵したメモリカード71
とからなる。メモリカード71は電子カメラ本体1に対
し、着脱可能となっている。制御回路90はマイクロプロ
セッサ(MPU)により実現されている。
The recording system 70 is a memory card 71 having a built-in interface circuit 70a and an IC memory used as a recording medium.
Consists of The memory card 71 is detachable from the electronic camera body 1. The control circuit 90 is realized by a microprocessor (MPU).

第6図に電子カメラ本体1の外観を斜視図で示す。図
は双眼鏡形のものを示しており、48は操作部におけるLC
D(液晶)表示器、30は操作部におけるスイッチ30であ
り、その他、テレ・ワイド切り替えスイッチ、シャッタ
操作ボタン50等が設けられている。また、49はファイン
ダである。LCD表示器48には制御回路90の制御のもとに
撮影モードやコマ数、日付、時間等、種々の値や状態が
表示される。本電子カメラでは、電子カメラ本体1の操
作部に設けられたスイッチ30を操作することにより、画
像の圧縮率を所望の値に設定することができる。すなわ
ち、制御回路90には予め標準的な複数種の圧縮率情報が
設定されており、これがスイッチ30の操作により設定さ
れる撮影可能枚数の値をもとに、装着されているメモリ
カード(記録媒体)の容量から、適用する圧縮率を求
め、この求めた圧縮率の値およびメモリカードに記録で
きる画像の枚数の値に換算されて操作部のLCD表示器48
に表示させるようになっている。そして、ユーザがスイ
ッチ30を押すと、制御回路90はスイッチ30が押される毎
に、これらの値を変更する。
FIG. 6 is a perspective view showing the external appearance of the electronic camera body 1. The figure shows a binocular type, 48 is the LC in the operation unit
A D (liquid crystal) display 30 is a switch 30 in the operation unit, and is further provided with a tele-wide switch, a shutter operation button 50, and the like. 49 is a finder. Under the control of the control circuit 90, the LCD display 48 displays various values and states such as a shooting mode, the number of frames, date and time. In this electronic camera, the image compression ratio can be set to a desired value by operating the switch 30 provided on the operation unit of the electronic camera body 1. That is, standard plural types of compression ratio information are set in the control circuit 90 in advance, and based on the value of the number of recordable images set by the operation of the switch 30, this is set in the attached memory card (recording The compression rate to be applied is obtained from the capacity of the medium, and is converted into the value of the obtained compression rate and the value of the number of images that can be recorded on the memory card, and the LCD display 48
Is displayed. Then, when the user presses the switch 30, the control circuit 90 changes these values each time the switch 30 is pressed.

ユーザは表示される変更値を見ながら、所望の値のと
ころでスイッチ30を押すのを止めることにより、制御回
路90はその時点での撮影可能画像枚数指示値に対応する
指示圧縮率を設定するようになっている。これは圧縮率
に応じて定まる画像当りの標準的な総符号量を制御回路
90が求めて、これを目的符号量設定情報として符号化回
路80に与えることで行う。また、トリガスイッチである
シャッタ操作ボタン50が押されることにより、シャッタ
機能が作動して撮像素子40bには被写体像が結像され、
撮像素子40bにはこの像に対応して電荷像が蓄積される
ので、これを読出し制御することで撮像素子40bから映
像信号を得ることができる。これらの制御も制御回路90
が司る。
The user stops pressing the switch 30 at the desired value while watching the displayed change value, so that the control circuit 90 sets the designated compression ratio corresponding to the designated number of shootable images at that time. It has become. This is a control circuit that controls the standard total code amount per image determined according to the compression ratio.
The calculation is performed by the 90 and given to the encoding circuit 80 as target code amount setting information. When the shutter operation button 50, which is a trigger switch, is pressed, a shutter function is activated and a subject image is formed on the image sensor 40b.
Since a charge image is stored in the image sensor 40b corresponding to this image, a video signal can be obtained from the image sensor 40b by reading and controlling the charge image. These controls are also performed by the control circuit 90.
Governs.

第1図における撮像系40は、撮影レンズ40aやCCD等の
撮像デバイスよりなる撮像素子40bを有し、前記撮影レ
ンズ40aにより撮像素子40b上に結像された光学像を画像
信号に変換して信号処理回路60に出力するものである。
信号処理回路60は増幅器60a、A/D変換器60b、バッファ
メモリ60c、プロセス回路60dが含まれ、このプロセス回
路60dにより前記撮像素子40bにより得られた画像信号を
カラー信号のY、R−Y(以下、このR−YをCr(クロ
マレッド)と略称する)、B−Y(以下、このB−Yを
Cb(クロマブルー)と略称する)の各色成分に分離させ
ると共にガンマ補正やホワイトバランス処理等を行うよ
うにしてある。
The imaging system 40 in FIG. 1 has an imaging device 40b composed of an imaging device such as an imaging lens 40a and a CCD, and converts an optical image formed on the imaging device 40b by the imaging lens 40a into an image signal. The signal is output to the signal processing circuit 60.
The signal processing circuit 60 includes an amplifier 60a, an A / D converter 60b, a buffer memory 60c, and a process circuit 60d. The process circuit 60d converts the image signal obtained by the image pickup device 40b into Y, RY of color signals. (Hereinafter, this RY is abbreviated as Cr (chroma red)), BY (hereinafter, this BY is referred to as
Cb (Chroma Blue)), and separates each color component, and performs gamma correction and white balance processing.

A/D変換器60bによりディジタル変換された撮像系40の
出力映像信号は、例えば、1フレーム分の容量を有する
バッファメモリ60cに画像データが格納され、読み出さ
れてプロセス回路60dに与えられることにより、輝度信
号系であるY成分とクロマ(C;色差信号)系であるCr,C
b成分に分離される。バッファメモリ60cに格納された画
像データは、例えば最初に輝度系の信号について統計処
理を行うべく、プロセス回路によりプロセス処理して画
像信号のY成分データを得、これを符号化回路80に与え
て、Y成分データについての符号化処理を行い、該処理
が終ったならば、次にクロマ系Cr、Cb成分のデータにつ
いてプロセス処理した後、符号化処理を行う。
The output video signal of the imaging system 40 that has been digitally converted by the A / D converter 60b is, for example, image data stored in a buffer memory 60c having a capacity of one frame, read, and provided to a process circuit 60d. , The Y component, which is a luminance signal system, and the Cr, C, which is a chroma (C; color difference signal) system
It is separated into b components. The image data stored in the buffer memory 60c is processed by a process circuit to obtain Y component data of the image signal, for example, in order to first perform statistical processing on a luminance signal, and the obtained Y data is given to the encoding circuit 80. , And Y component data, and when the process is completed, next, process the chroma Cr and Cb component data and then perform the encoding process.

信号処理回路60にはブロック化機能があり、バッファ
メモリ60cより読み出され、プロセス処理されて得たY
成分用およびCr,Cb成分用の画像データ(1フレーム
分、若しくは1フィールド分)を、所定の大きさのブロ
ックに分割するブロック化処理を行うことができる。こ
こでは例としてブロックサイズは8×8とするが、この
ブロックサイズは8×8に限るものではなく、またYと
C(クロマ系)でブロックサイズが異なっても良い。
The signal processing circuit 60 has a blocking function. The signal processing circuit 60 reads out from the buffer memory 60c and processes the Y.
Blocking processing for dividing the image data (for one frame or one field) for the component and the Cr and Cb components into blocks of a predetermined size can be performed. Here, the block size is 8 × 8 as an example, but this block size is not limited to 8 × 8, and the block size may be different between Y and C (chroma system).

本実施例では、輝度系Yのデータを読出してブロック
化し、後段の処理系に与えて、このY成分データについ
ての統計処理を行わせ、該統計処理が終了したならば、
次にクロマ系Cr、Cb成分のデータについての統計処理に
入るべく該クロマ系Cr、Cb成分のデータの読出しとブロ
ック化に入る。クロマ系のブロック化は、最初にCr成分
の画像データについてすべてのブロック化を行い、その
後に、Cb成分の画像データをブロック化して行くものと
する。
In the present embodiment, the data of the luminance system Y is read out and divided into blocks, which are provided to a subsequent processing system to perform statistical processing on the Y component data. When the statistical processing is completed,
Next, in order to enter the statistical processing for the data of the chroma Cr and Cb components, the reading of the data of the chroma Cr and Cb components and the blocking are started. In the chroma blocking, it is assumed that all the image data of the Cr component are firstly blocked, and then the image data of the Cb component is blocked.

符号化回路80は第2図に示す構成となっている。第2
図において、4は直交変換回路であり、ブロック化され
て入力された各画像データを受けて、この画像データに
対し、各ブロック毎に2次元の直交変換を行うものであ
る。直交変換としてはコサイン変換、サイン変換、フー
リエ変換、アダマール変換などが使用できる。直交変換
を行うことにより、変換係数としての画像データが得ら
れる。この変換係数としての画像データは直交変換であ
るが故に、画像の持つ空間周波数を周波数成分別に分解
したデータとなる。
The encoding circuit 80 has the configuration shown in FIG. Second
In the figure, reference numeral 4 denotes an orthogonal transformation circuit which receives each piece of image data input as a block and performs two-dimensional orthogonal transformation on this image data for each block. As the orthogonal transform, cosine transform, sine transform, Fourier transform, Hadamard transform and the like can be used. By performing the orthogonal transform, image data as a transform coefficient is obtained. Since the image data as the transform coefficient is an orthogonal transform, it is data obtained by decomposing the spatial frequency of the image for each frequency component.

6は量子化回路であり、前記直交変換回路4の出力す
る画像データ(変換係数)を受けると、第1回目の量子
化では予め設定された各周波数成分毎の量子化幅に、撮
影モードに応じて予め設定された量子化係数αを掛けて
補正した量子化幅で、変換係数の量子化を行い、第2回
目では前回の処理により決定された最適量子化係数αを
用いて量子化を行う構成としてある。
Numeral 6 denotes a quantization circuit, which receives image data (transformation coefficient) output from the orthogonal transformation circuit 4 and sets a predetermined quantization width for each frequency component in the first quantization, and switches to a shooting mode. Quantization of the transform coefficient is performed using the quantization width corrected by multiplying the quantization coefficient α set in advance in accordance with the quantization coefficient. In the second time, quantization is performed using the optimal quantization coefficient α determined in the previous process. There is a configuration to perform.

8は可変長符号化回路であり、可変長符号化回路8は
量子化回路6の出力する前記量子化出力を可変長符号化
するものである。可変長符号化としてはハフマン符号
化、算術符号化などを利用する。可変長符号化ではブロ
ック毎の符号量、画像全体の符号量などが画像毎に変化
する。どのような可変長符号化を用いるかは本発明とは
直接関係が無いが、ここではハフマン符号化を使用した
一例を示すこととする。
Reference numeral 8 denotes a variable length coding circuit. The variable length coding circuit 8 performs variable length coding on the quantized output output from the quantization circuit 6. Huffman coding, arithmetic coding and the like are used as variable length coding. In variable length coding, the code amount for each block, the code amount for the entire image, and the like change for each image. Although what kind of variable length coding is used is not directly related to the present invention, an example using Huffman coding will be described here.

可変長符号化回路8では、入力した量子化された変換
係数を第9図に示す順序でスキャンするジグザグ・スキ
ャンと呼ばれる手法により、低い周波数成分から高い周
波数成分への走査を行う。第9図の走査順序の1番目の
直流成分[DC]のデータは、直前に可変長符号化を行っ
たブロックの直流成分との差分値をハフマン符号化して
出力する。交流成分[AC]については第9図の走査順序
の2番目から64番目まで順番に変換係数を見て行き、変
換係数が0でない(すなわち、有効な)係数が出て来た
らその直前に存在した連続した0(無効)の係数の数
(ゼロラン)とその有効係数の値とで2次元のハフマン
符号化して出力すると云った動作をする。
The variable length encoding circuit 8 scans from the low frequency components to the high frequency components by a method called zigzag scanning in which the input quantized transform coefficients are scanned in the order shown in FIG. The data of the first DC component [DC] in the scanning order in FIG. 9 is obtained by Huffman-encoding the difference value between the DC component of the block on which the variable-length coding has been performed immediately before and output. For the AC component [AC], look at the conversion coefficients in order from the second to the 64th in the scanning order in FIG. 9, and if a conversion coefficient that is not 0 (ie, a valid coefficient) comes out, it exists immediately before that. An operation of performing two-dimensional Huffman encoding on the number of consecutive 0 (invalid) coefficients (zero run) and the value of the effective coefficient is output.

また、ある係数以降64番目の係数まで連続して無効係
数が続く場合はブロックの終りを示すEOB(エンド・オ
ブ・ブロック)の符号を出力する。また、打ち切り信号
が入力されると符号化を終了し、EOBを付加して出力す
る。そして、その各符号について発生した符号長を符号
量算出回路14に出力する。
When an invalid coefficient continues from a certain coefficient to the 64th coefficient, an EOB (end of block) code indicating the end of the block is output. Also, when the censoring signal is input, the coding is terminated, and EOB is added and output. The code length generated for each code is output to the code amount calculation circuit 14.

符号量算出回路14は入力されたY、Cr、Cb各成分の各
符号毎の符号長の積算を行い、Y、Cr、Cb各成分の符号
量を計算し、この画像全体の符号量のデータについて量
子化幅予測回路12に出力すると共に、各色成分毎の符号
量と画像全体の符号量のデータについては符号量割当て
回路20に出力する構成としてある。
The code amount calculation circuit 14 calculates the code amount of each of the Y, Cr, and Cb components by calculating the code length of each of the input Y, Cr, and Cb components, and calculates the code amount data of the entire image. Is output to the quantization width prediction circuit 12, and the code amount data for each color component and the code amount of the entire image are output to the code amount assignment circuit 20.

量子化幅予測回路12は第1パスの開始にあたり制御回
路18から目的とする符号量の情報を受け、この符号量情
報から次式 log BR=a×log SF+b ……(1) 但し、BRは符号量(1画素あたりのビット数)、SFは量
子化係数、a,bは定数。
At the start of the first pass, the quantization width prediction circuit 12 receives information on the target code amount from the control circuit 18, and from this code amount information, the following equation log BR = a × log SF + b (1) where BR is The code amount (the number of bits per pixel), SF is a quantization coefficient, and a and b are constants.

の関係を用いて量子化係数αの初期値を設定し、量子化
回路6に出力し、第2パスの開始に先駆けて、符号量算
出回路14から入力された画像全体の符号量と、1画像当
りの許容される最大のデータ量である目的総符号量とか
ら、例えば、(1)式の関係を用い、線形予測により目
的総符号量に近づけるのに最適な量子化係数αを、今回
実際に使用した量子化係数を勘案して予測するものであ
る。
The initial value of the quantization coefficient α is set by using the relationship (1) and is output to the quantization circuit 6, and prior to the start of the second pass, the code amount of the entire image input from the code amount calculation circuit 14 and 1 From the target total code amount, which is the maximum amount of data per image, the optimum quantization coefficient α for approximating the target total code amount by linear prediction using, for example, the relationship of equation (1), The prediction is performed in consideration of the actually used quantization coefficient.

ここで、量子化係数を如何にして最適な値にするか
が、重要な課題となるので、この点について少し説明す
る。
Here, how to make the quantization coefficient an optimum value is an important issue, and this point will be described a little.

画像データを前処理し、この出力を量子化し、この量
子化出力を可変長符号化する場合、この量子化の量子化
幅を変化させると発生する符号量が変化することは良く
知られている。これは、ハフマン符号化に代表される可
変長符号化は、符号化するデータの発生確率の偏りを利
用してそのデータを表現するのに必要な符号量を減少さ
せると云うものであることから、前記「量子化幅を変化
させる」と云うことは、量子化値の発生確率を変化させ
ることでもあるから、量子化幅を変化させることにより
発生符号量も変化することがわかる。
It is well known that when image data is pre-processed, its output is quantized, and when this quantized output is subjected to variable-length encoding, changing the quantization width of the quantization changes the amount of code generated. . This is because variable-length coding represented by Huffman coding reduces the amount of code necessary to represent data using the bias in the probability of occurrence of the data to be coded. Since "changing the quantization width" also means changing the probability of occurrence of the quantization value, it can be seen that changing the quantization width also changes the generated code amount.

ところで、同じ量子化幅で同一の符号化を行っても、
そのときの画像データによって発生符号量は異なる。し
かし、1つの画像データに対して量子化幅を変化させて
同一の符号化を行った場合は量子化幅は、発生符号量と
の間には一定の関係が得られる。また、多くの画像デー
タで量子化幅と発生符号量の関係を求めると、最も発生
頻度の高い関係が統計的に得られることが明らかになっ
た。
By the way, even if the same encoding is performed with the same quantization width,
The generated code amount differs depending on the image data at that time. However, when the same encoding is performed by changing the quantization width for one image data, a fixed relationship is obtained between the quantization width and the generated code amount. In addition, when the relationship between the quantization width and the generated code amount is obtained for many pieces of image data, it has been found that the relationship having the highest frequency of occurrence can be obtained statistically.

具体的には多くの場合、次の関係が得られた。すなわ
ち、ある量子化幅に対する相対的な比をSFとし、発生符
号量1画素あたりのビット数(ビットレート)で表わし
てこれをBRとすると上記(1)式の関係が成立する。
(1)式において、aは同一の符号化であれば、画像に
よらず略一定であり、bは画像に依存する。このbの値
は画像により、一定の分布を持ち、この発生頻度分布か
ら代表的なbが得られる。
Specifically, in many cases, the following relationship was obtained. That is, if the relative ratio with respect to a certain quantization width is SF, and it is represented by the number of bits (bit rate) per pixel of the generated code amount, and is represented by BR, the relationship of the above equation (1) holds.
In the equation (1), if a is the same encoding, a is substantially constant regardless of the image, and b depends on the image. The value of b has a certain distribution depending on the image, and a typical b is obtained from the occurrence frequency distribution.

故に(1)式の関係から最適な量子化係数を求めるこ
とができる。
Therefore, the optimum quantization coefficient can be obtained from the relationship of the expression (1).

上記符号量割当回路20は符号量算出回路14から入力さ
れた各色成分毎の画像データの符号量、画像全体の符号
量と、目的総符号量とから各色成分毎の1ブロックあた
りの割当符号量を算出して符号化打切回路16に出力する
ものである。
The code amount allocating circuit 20 calculates the allocated code amount per block for each color component from the code amount of the image data for each color component input from the code amount calculation circuit 14, the code amount of the entire image, and the target total code amount. Is calculated and output to the encoding truncation circuit 16.

ここでの算出の方法は、例えば、各色成分毎の符号量
の比で、目的総符号量を比例配分し、更に各色成分毎の
割当符号量をブロック数で割る。例えば、ある色成分の
符号量と目的総符号量との乗算を行い、それを画像全体
の符号量で割った後、その色成分のブロック数で更に割
ることにより、その色成分の1ブロック当たりの割当符
号量を決定する。この結果、各色成分の割当符号量は、
その色成分での実際の符号量に応じて符号量が少ない場
合はそれ相応に、間に合う程度に抑えられ、符号量の多
い色成分にはそれ相応に多く割り当てられる。
In this calculation method, for example, the target total code amount is proportionally distributed based on the ratio of the code amount for each color component, and the allocated code amount for each color component is further divided by the number of blocks. For example, the code amount of a certain color component is multiplied by the target total code amount, and the result is divided by the code amount of the entire image, and then further divided by the number of blocks of the color component. Is determined. As a result, the assigned code amount of each color component is
If the code amount is small in accordance with the actual code amount of the color component, the code amount is appropriately suppressed to a sufficient extent, and the color component with a large code amount is allocated a correspondingly large amount.

符号量割当回路20は符号量情報テーブルとブロック割
当符号量データテーブルとを持ち、符号量情報テーブル
における該当ブロック位置の符号量情報を符号量算出回
路14から入力された符号量情報に書き替える一方、符号
量算出回路14から入力された各色成分毎の符号量および
画像全体の符号量と、目的総符号量とから各色成分の1
ブロック当たりの基準割当符号量を算出し、この算出し
た各色成分の1ブロック当たりの基準割当符号量のデー
タをブロック割当符号量データテーブルに格納する。こ
のブロック割当符号量データテーブルの各色成分別の1
ブロック当たりの基準割当符号量は、該当の色成分が可
変長符号化処理される際に符号化打切回路16に与えられ
る。
The code amount allocating circuit 20 has a code amount information table and a block allocated code amount data table, and rewrites the code amount information of the corresponding block position in the code amount information table with the code amount information input from the code amount calculating circuit 14. From the code amount for each color component and the code amount of the entire image input from the code amount calculation circuit 14, and the target total code amount, one of the color components is calculated.
The reference allocation code amount per block is calculated, and the data of the calculated reference allocation code amount per block of each color component is stored in the block allocation code amount data table. 1 for each color component in the block allocation code amount data table
The reference assigned code amount per block is given to the coding truncation circuit 16 when the corresponding color component is subjected to the variable length coding process.

符号化打切回路16は、符号量割当回路20からの該当色
成分の1ブロック当たりの基準割当符号量と1つ手前の
ブロックでの発生符号量の割当符号量に対する過不足分
を加えて該当ブロックの割当符号量とすると共に、符号
量割当回路20からの各符号の符号長を割当符号量から減
算し、割当符号量の残りが、送出すべき符号量とEOBの
符号との合計符号量より小さくなった場合には打切り信
号を出力して可変長符号化回路8に与え、そのブロック
の符号化を終了し、該ブロックの割当符号量から送出し
た符号量を減じてその値を割当符号量の余りとして保持
すると云った機能を有する。
The coding truncation circuit 16 adds the reference allocated code amount per block of the corresponding color component from the code amount allocating circuit 20 and the excess or deficiency of the generated code amount in the immediately preceding block to the allocated code amount. And the code length of each code from the code amount allocating circuit 20 is subtracted from the allocated code amount, and the remainder of the allocated code amount is calculated based on the total code amount of the code amount to be transmitted and the EOB code. If the value becomes smaller, a truncation signal is output and given to the variable length coding circuit 8, the coding of the block is completed, the transmitted code amount is subtracted from the allocated code amount of the block, and the value is assigned to the allocated code amount. It has the function of holding as the remainder.

従って、符号化打切回路16ではこの割当符号量を参照
し、入力された送出すべき符号量およびEOBの符号を送
出しても割当符号量を越えない場合は、打切りは行われ
ず、そのブロックの符号化を終了し、該ブロックの割当
符号量から送出すべき符号量を減じてその値を割当符号
量の余りとして保持すると云った動作を行う。また、符
号化打切回路16ではこの割当符号量を参照し、入力され
た送出すべき直流成分の符号とEOBの符号を送出するの
に割当符号量が十分でない場合には、この2つの符号を
送出した後、そのブロックの符号化を終了し、該ブロッ
クの割当符号量から送出した符号量を減ずる、すなわ
ち、割当符号量の余りは負の値として保持すると云った
動作を行う。
Therefore, the encoding truncation circuit 16 refers to the allocated code amount, and if the input code amount to be transmitted and the code of the EOB are transmitted but the allocated code amount does not exceed the truncated value, the truncation is not performed, and the block is not terminated. The operation of terminating the encoding, subtracting the code amount to be transmitted from the allocated code amount of the block, and holding the value as the remainder of the allocated code amount is performed. Also, the encoding truncation circuit 16 refers to this allocated code amount, and if the allocated code amount is not enough to transmit the input DC component code to be transmitted and the EOB code, the two codes are determined. After the transmission, the coding of the block is terminated, and the operation of subtracting the transmitted code amount from the allocated code amount of the block, that is, maintaining the remainder of the allocated code amount as a negative value, is performed.

10は符号出力回路であり、この符号出力回路10は可変
長符号化回路8より入力される可変長の符号をつなぎ合
わせるもので、この繋ぎ合わせた符号をメモリカード等
の記録媒体にて構成される記録系22に書き込むように機
能する。
Reference numeral 10 denotes a code output circuit. The code output circuit 10 connects variable-length codes input from the variable-length coding circuit 8, and is configured by a recording medium such as a memory card. It functions to write to the recording system 22.

本システムでは撮影モードに応じて定めた初期時用標
準の量子化係数αを使用して最初に統計処理を行い(第
1パス)、最適化するに必要な色成分毎の情報量や画像
全体の情報量等を調べ、次にこの統計処理により得た情
報をもとに最適化された符号化を行うための処理に入る
(第2パス)。
In this system, statistical processing is first performed using a standard quantization coefficient α for the initial time determined according to the shooting mode (first pass), and the amount of information for each color component necessary for optimization and the entire image Then, a process for performing optimized coding based on the information obtained by the statistical processing is started (second pass).

そのため、最初に画像のブロック化、このブロック化
された画像の要素に対する標準の量子化係数αを使用し
ての量子化、量子化により得られた変換係数の可変長符
号化、そして、この可変長符号化により得られる各色成
分の各要素の符号量情報と画像全体の符号量情報より最
適な符号量にするに必要な符号化係数αの予測、各色成
分の各要素における1ブロック当たりの基準割当符号量
の決定、これらに基づく処理対象画像への最適符号化の
処理モードへの移行、この処理モードの実施における画
像のブロック化処理、このブロック化された画像の要素
に対する前記予測量子化係数αを使用しての量子化処
理、この量子化により得られた変換係数の可変長符号
化、処理対象画像の全符号の保存のための出力処理と云
った手順を実施させるが、その全体の制御管理は図にお
ける制御回路18により行うようにしてあるものとする。
尚、制御回路18のこのような機能はマイクロプロセッサ
(MPU)を使用することで容易に実現できる。
Therefore, first block the image, quantize the elements of the blocked image using a standard quantization coefficient α, variable-length encode the transform coefficients obtained by quantization, and Prediction of a coding coefficient α necessary for obtaining an optimum code amount from code amount information of each element of each color component obtained by long coding and code amount information of the entire image, a reference per block in each element of each color component Determining the amount of code to be allocated, shifting to a processing mode of optimal coding for a processing target image based on these, blocking the image in the execution of this processing mode, the predictive quantization coefficient for the elements of the blocked image A procedure such as quantization processing using α, variable-length coding of transform coefficients obtained by this quantization, and output processing for storing all codes of a processing target image is performed. Overall control managing shall we have to carry out by the control circuit 18 in FIG.
Note that such a function of the control circuit 18 can be easily realized by using a microprocessor (MPU).

以上が符号化回路80の構成である。 The above is the configuration of the encoding circuit 80.

第1図における記録系70はインタフェース回路70aと
これに着脱自在に接続される記録媒体71があり、符号化
回路80により符号化されて出力された画像データおよび
量子化幅(またはこれに対応した情報)はインタフェー
ス回路70aを介して記録媒体71に記録される構成となっ
ている。
The recording system 70 in FIG. 1 includes an interface circuit 70a and a recording medium 71 detachably connected to the interface circuit 70a. The image data encoded and output by the encoding circuit 80 and the quantization width (or corresponding to the Information) is recorded on the recording medium 71 via the interface circuit 70a.

次に上記第1図および第2図に示す構成の本装置の作
用を説明するが、全体の概要を掴むために初めに動作遷
移図である第8図を参照して基本動作を説明する。
Next, the operation of the present apparatus having the structure shown in FIGS. 1 and 2 will be described. First, the basic operation will be described with reference to FIG. 8, which is an operation transition diagram, in order to grasp the general outline.

カメラの使用者がカメラを使用するにあたり、スイッ
チ30を操作して所望とする撮影可能枚数を設定する。こ
れにより設定撮影可能枚数に応じ、制御回路90が最適符
号量を求めて、これを目的符号量設定情報として符号化
回路80に与える。このようにして撮影可能枚数が設定さ
れる。
When the camera user uses the camera, the user operates the switch 30 to set a desired number of recordable images. Thus, the control circuit 90 obtains the optimum code amount in accordance with the set number of recordable images and supplies the optimum code amount to the encoding circuit 80 as target code amount setting information. Thus, the number of shootable images is set.

次に撮影を行うと、撮影レンズ40aの後方におかれた
撮像素子40b上に被写体像が光学像として結像される。
そして、この撮像素子40bはこの結像された光学像を画
像信号に変換して出力する。撮像素子40bにより得られ
た画像信号は信号処理回路60に入力され、ここで信号処
理回路60内の増幅回路60aにより増幅、A/D変換器60bに
よるA/D変換後、バッファメモリ60cに一時保持される。
そして、この後、バッファメモリ60cから読み出され、
信号処理回路60内のプロセス回路60dにより帯域補正、
色信号形成等の処理が行われる。
Next, when photographing is performed, a subject image is formed as an optical image on an image sensor 40b located behind the photographing lens 40a.
Then, the imaging device 40b converts the formed optical image into an image signal and outputs the image signal. The image signal obtained by the image sensor 40b is input to the signal processing circuit 60, where the image signal is amplified by the amplifier circuit 60a in the signal processing circuit 60, A / D converted by the A / D converter 60b, and temporarily stored in the buffer memory 60c. Will be retained.
And after this, it is read from the buffer memory 60c,
Band correction by the process circuit 60d in the signal processing circuit 60,
Processing such as color signal formation is performed.

ここで、後の符号化処理がY(輝度)、Cr,Cb(いず
れも色差)信号の順序で行われるため、色信号形成もこ
れに合わせて行われる。すなわち、画像信号は8×8の
マトリックスでブロック化されて読み出され、プロセス
回路ではこのブロック化された画像信号データからY成
分、Cr成分(R−Y成分)、Cb成分(B−Y成分)の順
序でこれら各色成分の信号を分離させると共に、ガンマ
補正やホワイトバランス処理等を行う。
Here, since the subsequent encoding process is performed in the order of the Y (luminance), Cr, and Cb (all color difference) signals, the color signal formation is also performed accordingly. That is, the image signal is read out after being blocked in an 8 × 8 matrix, and the process circuit extracts a Y component, a Cr component (RY component), and a Cb component (BY component) from the blocked image signal data. ), The signals of these color components are separated, and gamma correction and white balance processing are performed.

プロセス回路60dにより分離された8×8のマトリッ
クスのブロック化画像信号における各色成分の画像信号
データは、符号化回路80に入力される。これにより、1
フレーム分(若しくは1フィールド分)の画像データ
は、上記所定の大きさのブロックに分割されて順次、符
号化回路80に入力される。尚、プロセス回路60dにより
処理された各色成分の画像信号は、Y、Cr、Cbの各成分
別にバッファメモリに記憶させ、後の処理において、読
出して使用するようにしても良い。
The image signal data of each color component in the block image signal of the 8 × 8 matrix separated by the process circuit 60d is input to the encoding circuit 80. This gives 1
The image data for the frame (or for one field) is divided into blocks of the predetermined size and sequentially input to the encoding circuit 80. The image signal of each color component processed by the process circuit 60d may be stored in a buffer memory for each of Y, Cr, and Cb components, and may be read out and used in a later process.

本実施例では、信号処理回路60からは1画像分の画像
信号データにおけるY成分(輝度成分)について出力が
行われ、これについての後段での処理(統計処理)が済
んだ後に、次にCr成分の画像データについて総てのブロ
ック化を行い、これについて後段での統計処理を行い、
その後に、Cb成分の画像をブロック化し、これについて
後段での統計処理を行ってゆくと云った処理を行う。
In this embodiment, the Y component (luminance component) of the image signal data for one image is output from the signal processing circuit 60, and after this processing (statistical processing) at the subsequent stage is completed, the Cr component is then output. All the image data of the components are divided into blocks, and statistical processing is performed on the block at a later stage.
Thereafter, a process is performed in which the image of the Cb component is divided into blocks, and statistical processing in the subsequent stage is performed on the blocks.

符号化回路80では、信号処理回路60より受けたこの入
力データを直交変換回路4に与える。すると、直交変換
回路4はブロック化された入力画像データ(以下、ブロ
ック画像データと呼ぶ)に対し、各ブロック毎に例え
ば、離散コサイン変換(DCT)による2次元の直交変換
を行う。このDCTによる直交変換と云うのは、ある波形
を周波数成分に分割し、これを入力サンプル数と同じ数
だけの各々異なる周波数のコサイン波で表現すると云っ
た処理である。
The encoding circuit 80 supplies the input data received from the signal processing circuit 60 to the orthogonal transform circuit 4. Then, the orthogonal transform circuit 4 performs, for each block, two-dimensional orthogonal transform by, for example, discrete cosine transform (DCT) on the input image data (hereinafter, referred to as block image data) that has been divided into blocks. The orthogonal transform by the DCT is a process of dividing a certain waveform into frequency components and expressing this by the same number of cosine waves of different frequencies as the number of input samples.

そして、直交変換されたブロック画像データ(変換係
数)は図示しないバッファメモリにおける8×8のマト
リックス上の対応する周波数成分位置に格納され(マト
リックスの原点位置が直流成分、それ以外は交流成分で
原点位置より離れるに従い周波数が高くなるような関係
を持たせたマトリックスに格納する)、これが量子化回
路6に入力される。
The orthogonally transformed block image data (transformation coefficients) are stored at corresponding frequency component positions on an 8 × 8 matrix in a buffer memory (not shown). This is stored in a matrix having a relationship in which the frequency increases as the distance from the position increases), and this is input to the quantization circuit 6.

すると量子化回路6はこのブロック画像データ(変換
係数)に対して1パス目(第1回目)の量子化を行う。
この第1回目の量子化では、予め設定された各周波数成
分毎(周波数成分はブロックの各マトリックス位置に対
応して決まる)の量子化マトリックスに対し、撮影に当
り使用者が設定した画質設定値に対応して制御回路18よ
り与えられる標準(暫定)の量子化係数αを掛けた量子
化幅で、変換係数の量子化を行う(第8図(h1,i))。
この時の量子化マトリックスは輝度系とクロマ系とでそ
れぞれで同じであっても良いが、それぞれに適した量子
化マトリックスを設定する方が良い結果が得られる。
Then, the quantization circuit 6 performs the first pass (first pass) quantization on the block image data (transformation coefficient).
In the first quantization, an image quality set value set by a user upon photographing is applied to a predetermined quantization matrix for each frequency component (frequency components are determined corresponding to each matrix position of a block). , The transform coefficient is quantized with a quantization width obtained by multiplying the standard (temporary) quantization coefficient α given by the control circuit 18 (FIG. 8 (h1, i)).
The quantization matrix at this time may be the same for each of the luminance system and the chroma system. However, better results can be obtained by setting appropriate quantization matrices.

量子化されたブロック画像データ(変換係数)は可変
長符号化回路8に入力され、ここで、可変長符号化され
る。可変長符号化回路8では量子化されて入力された変
換係数を第7図に示す順序でジグザグスキャンし、低い
周波数成分から高い周波数成分への走査を行う。すなわ
ち、変換係数は8×8のマトリックスに周波数成分に対
応して格納されており、原点に近いほど、周波数が低い
ので、ジグザグスキャンすることで低い周波数成分から
高い周波数成分へと走査できる。
The quantized block image data (transform coefficients) is input to the variable length coding circuit 8, where it is subjected to variable length coding. The variable length coding circuit 8 performs a zigzag scan of the quantized and input transform coefficients in the order shown in FIG. 7 to scan from a low frequency component to a high frequency component. That is, the transform coefficients are stored in a 8.times.8 matrix corresponding to the frequency components. Since the frequency is lower as the position is closer to the origin, zigzag scanning enables scanning from lower frequency components to higher frequency components.

第7図の走査順序の1番目のデータは直流成分DCであ
るから、この直流成分DCのデータは直前に可変長符号化
を行ったブロック(一つ前のブロック)の直流成分DCと
の差分値diff−DCをハフマン符号化する(第8図(d
1),(e1))。
Since the first data in the scanning order in FIG. 7 is the DC component DC, the data of the DC component DC is the difference from the DC component DC of the block (the immediately preceding block) on which the variable-length coding was performed immediately before. The value diff-DC is Huffman-coded (see FIG. 8 (d
1), (e1)).

交流成分ACについては第7図の走査順序の2番目から
64番目まで順番に変換係数を見て行き、変換係数が0で
ない(すなわち、有効な)係数が出て来たらその直前に
存在した連続した0(無効)の係数の数(ゼロラン)と
その有効係数の値とで2次元のハフマン符号化を行う
((d2),(e2))。
For the AC component AC, from the second scanning order in Fig. 7
Look at the transform coefficients in order up to the 64th, and when a transform coefficient that is not 0 (ie, valid) comes out, the number of consecutive 0 (invalid) coefficients that existed immediately before (zero run) and its validity Two-dimensional Huffman coding is performed with the coefficient values ((d2), (e2)).

また、可変長符号化回路8は、ある係数以降64番目の
係数まで連続して無効係数が続く場合はブロックの終り
を示すEOB(エンド・オブ・ブロック)の符号を与え
る。そして、その符号について発生した符号長を符号量
算出回路14に出力する(g1)。そして、1画像分の全ブ
ロックについてこのような処理を実行して行く。
Further, the variable-length encoding circuit 8 gives an EOB (end of block) code indicating the end of a block when an invalid coefficient continues from a certain coefficient to the 64th coefficient. Then, the code length generated for the code is output to the code amount calculation circuit 14 (g1). Then, such processing is executed for all blocks of one image.

Y成分についてのこのような処理が終了したなら、次
にCr、Cb各成分についても同様の処理を行う。
After such processing for the Y component is completed, similar processing is performed for each of the Cr and Cb components.

一方、符号量算出回路14は入力されたY、Cr、Cb各成
分の各色成分毎に1画像全体の符号量の計算をすべく、
Y、Cr、Cb各成分の各色成分毎の符号量の算出と、その
符号量の画像全体についての積算を行う(g2)と共に、
1つの色成分について全てのハフマン符号化処理を終了
した段階で、各色成分毎の符号量のデータを符号量割当
回路20に出力する。符号量割当回路20はこの各色成分毎
の符号量のデータをブロック割当符号量テーブルにおけ
る該当色成分の符号量として書き込む。
On the other hand, the code amount calculation circuit 14 calculates the code amount of the entire image for each of the input Y, Cr, and Cb color components.
Calculation of the code amount for each color component of each of the Y, Cr, and Cb components and integration of the code amount for the entire image are performed (g2).
When all the Huffman encoding processes for one color component are completed, the data of the code amount for each color component is output to the code amount assignment circuit 20. The code amount assignment circuit 20 writes the code amount data for each color component as the code amount of the corresponding color component in the block assignment code amount table.

そして、1画素分の全ブロックについてY、Cr、Cb各
成分すべてのハフマン符号化処理を終了した段階で、制
御回路18の制御により符号量算出回路14は、この画像全
体の符号量のデータを量子化幅予測回路12に出力すると
共に、画像全体の符号量のデータを、符号量割当回路20
に出力する。
Then, at the stage where the Huffman encoding process for all the Y, Cr, and Cb components has been completed for all the blocks for one pixel, the code amount calculation circuit 14 controls the code amount data of the entire image under the control of the control circuit 18. The data is output to the quantization width prediction circuit 12 and the data of the code amount of the entire image is
Output to

量子化幅予測回路12はこの入力された画像全体の符号
量データと目的総符号量データとから、例えば、線形予
測により目的総符号量の値に近づけるのに最適な量子化
係数αを、実際に使用した量子化係数に基づいて予測す
る(第8図(h2))。
From the input code amount data of the entire image and the target total code amount data, for example, the quantization width prediction circuit 12 determines the optimum quantization coefficient α to approximate the target total code amount by linear prediction. (H2) in FIG. 8 based on the quantized coefficients used in (1).

また、符号量割当回路20は入力された各色成分毎の符
号量および画像全体の符号量と、目的総符号量とから各
色成分の1ブロック当たりの基準割当符号量を、例えば
各色成分毎の符号量の比で、目的総符号量を比例配分す
る等して算出する(第8図(h3))。
Further, the code amount allocating circuit 20 determines a reference allocated code amount per block of each color component from the input code amount of each color component, the code amount of the entire image, and the target total code amount, for example, the code amount of each color component. The target total code amount is calculated, for example, by proportional distribution using the ratio of the amounts (FIG. 8 (h3)).

具体的には、ある色成分の1ブロック当たりの基準割
当符号量を決定するには、当該色成分の符号量と目的総
符号量とを乗算し、それを画像全体の符号量で割ること
で得た結果を用いて、その色成分におけるブロック数で
割り、以てその色成分の1ブロック当たりの基準割当符
号量とする。そして、この算出した各色成分の1ブロッ
ク当たりの基準割当符号量のデータをブロック割当符号
量データテーブルに格納する。このブロック割当符号量
データテーブルの各色成分別割当符号量のデータは、該
当の色成分が可変長符号化処理される際に符号化打切回
路16に与えられることになる。
Specifically, to determine the reference assigned code amount per block of a certain color component, the code amount of the color component is multiplied by the target total code amount, and the result is divided by the code amount of the entire image. The obtained result is divided by the number of blocks in the color component to obtain a reference assigned code amount per block of the color component. Then, the calculated data of the reference assigned code amount per block of each color component is stored in the block assigned code amount data table. The data of the allocated code amount for each color component in the block allocated code amount data table is supplied to the coding abort circuit 16 when the corresponding color component is subjected to the variable length coding process.

以上で1パス目、すなわち、各ブロックの割当符号量
の決定及び量子化幅の最適化のための第1の符号化(統
計処理)を終了する。
Thus, the first pass, that is, the first encoding (statistical processing) for determining the code amount to be allocated to each block and optimizing the quantization width is completed.

次に2パス目の処理に入る。この2パス目の処理は第
2の符号化(符号化処理)であり、目的総符号量に収ま
るように最適化した最終の符号化出力を得る処理であ
る。
Next, the process enters the second pass. The process of the second pass is the second encoding (encoding process), and is a process of obtaining a final encoded output optimized to be within the target total code amount.

この処理はまず、Y成分について行い、Y成分が終了
した後にCr,Cb成分について行うようにする。すなわ
ち、初めに画像データをブロック化して読出し、これに
ついて抽出されて信号処理回路60から出力されるY成分
(輝度系)の画像信号データを符号化回路80に入力する
(a)。入力されたブロック化画像データは符号化回路
80における直交変換回路4に入力され、再び直交変換が
行われる(b)。この直交変換により得られた変換係数
は量子化回路6に入力され、再び量子化が行われる
(c)。ただし、このとき使用する量子化係数αは前回
のパスにおいて量子化幅予測回路12が算出した予測の最
適量子化係数αである。
This process is first performed for the Y component, and is performed for the Cr and Cb components after the Y component is completed. That is, first, the image data is divided into blocks and read out, and the Y component (luminance) image signal data extracted and output from the signal processing circuit 60 is input to the encoding circuit 80 (a). The input block image data is encoded by an encoding circuit.
The signal is input to the orthogonal transformation circuit 4 in 80 and the orthogonal transformation is performed again (b). The transform coefficient obtained by this orthogonal transform is input to the quantization circuit 6, where the quantization is performed again (c). However, the quantization coefficient α used at this time is the optimum quantization coefficient α for the prediction calculated by the quantization width prediction circuit 12 in the previous pass.

次に、量子化したブロック画像データの変換係数は、
可変長符号化回路8に入力される。可変長符号化は統計
処理の時と同様、このブロック画像データの変換係数の
うち、まず直流成分DCの差分値diff−DCをハフマン符号
化し((d1),(e1))、次に交流成分ACをジグザグス
キャンで順次データ抽出して2次元のハフマン符号化を
行う((d2),(e2))。
Next, the transform coefficient of the quantized block image data is
It is input to the variable length coding circuit 8. In the variable length coding, as in the case of the statistical processing, of the conversion coefficients of the block image data, first, the difference value diff-DC of the DC component DC is Huffman-coded ((d1), (e1)), and then the AC component The AC is sequentially extracted by zigzag scanning to perform two-dimensional Huffman coding ((d2), (e2)).

但し、一つの要素(マトリックス内の一つの位置)に
対するハフマン符号が発生する度に符号量割当回路20か
ら、そのブロック割当符号量データテーブルに格納され
ている当該要素における送出すべき1ブロック当たりの
基準割当符号量を符号化打切回路16に出力し、一方、符
号化打切回路16ではこの各色成分の1ブロック当たりの
基準割当符号量と前ブロックでの符号化処理における割
当符号量に対する余りを加えて該当ブロックの割当符号
量とすると共に、送出すべき符号量およびEOBの符号を
送出しても割当符号量を越えない場合は、打切り信号を
発生せず、該ブロックの割当符号量から送出すべき符号
量を減ずる処理を行う。
However, every time a Huffman code for one element (one position in the matrix) is generated, the code amount allocating circuit 20 outputs one block per one block to be transmitted in the element stored in the block allocated code amount data table. The reference allocated code amount is output to the coding truncation circuit 16. On the other hand, the coding truncation circuit 16 adds the reference allocated code amount per block of each color component and the remainder to the allocated code amount in the coding process in the previous block. If the allocated code amount is not exceeded even if the code amount to be transmitted and the code of the EOB are transmitted, the truncation signal is not generated and the block is transmitted from the allocated code amount. A process for reducing the power amount is performed.

そして、送出すべき該ブロックの符号量とEOBの符号
との合計の符号量が割当符号量の残りの符号量を上まわ
ったときに、符号化打切回路16は可変長符号化回路8に
打切り信号を出力し、そのブロックのハフマン符号化を
終了させると共に、該ブロックの割当符号量から送出し
た符号量を減じてその値を割当符号量の余りとして保持
する。そして、可変長符号化回路8は量子化回路6より
得られる次のブロックのハフマン符号化に移る。
Then, when the total code amount of the code amount of the block to be transmitted and the code of the EOB exceeds the remaining code amount of the allocated code amount, the coding truncation circuit 16 truncates to the variable length coding circuit 8. A signal is output, Huffman coding of the block is terminated, and the transmitted code amount is subtracted from the allocated code amount of the block, and the value is retained as the remainder of the allocated code amount. Then, the variable length encoding circuit 8 shifts to the Huffman encoding of the next block obtained by the quantization circuit 6.

また、符号化打切回路16では、直流成分とEOBの符号
を送出するに割当符号量が足りない場合には、これらの
符号量は送出させた後、符号化打切回路16は可変長符号
化回路8に打ち切り信号を出力し、そのブロックのハフ
マン符号化を終了させると共に、該ブロックの割当符号
量から送出した符号量を減じて割当符号量の余りを負の
値として保持する。
Further, in the coding truncation circuit 16, when the allocated code amount is not enough to transmit the DC component and the code of EOB, the code truncation circuit 16 transmits the DC amount and the EOB code, and then the coding truncation circuit 16 sets the variable length coding circuit. 8 to terminate the Huffman encoding of the block, subtract the transmitted code amount from the allocated code amount of the block, and retain the remainder of the allocated code amount as a negative value.

従って、可変長符号化回路8は符号化打切回路16から
打切り信号が入力されるまで、変換されたハフマン符号
を、符号出力回路10に出力し、打切り信号発生前にマト
リックスのすべての要素に対するハフマン符号化が終わ
った場合には、可変長符号化回路8はEOBの符号を符号
出力回路10に出力する。また、可変長符号化回路8はマ
トリックスの全ての要素に対するハフマン符号化が終わ
る前に打切り信号が入力された場合には、その符号の代
りにEOBの符号を符号出力回路10に出力することにな
る。符号出力回路10ではこの符号化されたデータを一時
記憶する。
Therefore, the variable length encoding circuit 8 outputs the converted Huffman code to the code output circuit 10 until the truncation signal is input from the encoding truncation circuit 16, and outputs the Huffman codes for all the elements of the matrix before the truncation signal is generated. When the encoding is completed, the variable length encoding circuit 8 outputs the code of the EOB to the code output circuit 10. Also, if the truncation signal is input before the Huffman coding for all elements of the matrix is completed, the variable-length coding circuit 8 outputs an EOB code to the code output circuit 10 instead of the code. Become. The code output circuit 10 temporarily stores the coded data.

そして、可変長符号化回路8は量子化回路6より得ら
れる次のブロックのハフマン符号化に移る。
Then, the variable length encoding circuit 8 shifts to the Huffman encoding of the next block obtained by the quantization circuit 6.

このような動作を繰り返し、1画面の画像の全ブロッ
クの処理が終わることにより、全ての符号化処理を終了
する。Y成分に対するこのような処理が終ると、次に同
様の手法でクロマ系成分(Cr,Cb)の処理に入る。クロ
マ系成分の処理でも量子化回路6は前回のパスにおいて
量子化幅予測回路12が算出した予測の最適量子化係数α
を使用する。
Such an operation is repeated, and the processing of all the blocks of the image of one screen is completed, thereby completing all the encoding processing. When such processing for the Y component is completed, processing for chroma-based components (Cr, Cb) is then started in the same manner. Even in the processing of the chroma component, the quantization circuit 6 calculates the optimum quantization coefficient α of the prediction calculated by the quantization width prediction circuit 12 in the previous pass.
Use

クロマ系成分について、1画面分の画像の全ブロック
の上記2パス目の処理が終わることにより、全ての符号
化処理を終了する。
When the processing of the second pass is completed for all the blocks of the image for one screen for the chroma components, all the encoding processes are completed.

この終了にあたり、符号出力回路10では最適化された
1画像分のハフマン符号化データを記録系22に出力し、
記録系22におけるメモリカードと云った記憶媒体71に書
き込む(f)。これは、符号出力回路10の出力により行
われるが、符号出力回路10は可変長符号化回路8からの
可変長符号であるハフマン符号をつなぎ合わせ、記憶媒
体71であるメモリカードに与えることで書き込む。この
符号出力回路10の出力による記憶媒体71への書き込み
は、第2パスが終わった段階でまとめて行うようにして
も良いが、第1パスが終って第2パス実行に入った段階
で可変長のハフマン符号をつなぎ合わせた結果が、1バ
イト若しくは数バイト単位、まとまり次第、順次、記憶
媒体へ書き込むようにしても良い。
At the end of this, the code output circuit 10 outputs the optimized Huffman coded data for one image to the recording system 22,
The data is written to a storage medium 71 such as a memory card in the recording system 22 (f). This is performed by the output of the code output circuit 10. The code output circuit 10 connects the Huffman codes, which are the variable length codes from the variable length coding circuit 8, and writes them by giving them to a memory card as a storage medium 71. . The writing to the storage medium 71 by the output of the code output circuit 10 may be performed collectively at the end of the second pass, but may be changed at the end of the first pass and the start of the second pass. The results obtained by joining the long Huffman codes may be written to the storage medium sequentially in units of one or several bytes, as soon as they are collected.

尚、これに先立ち、符号出力回路10では符号化に使用
した最適量子化係数αを当該符号化した画像の記憶デー
タにおけるヘッダ部分に書き込み、再生時の手掛かりと
して残す。
Prior to this, the code output circuit 10 writes the optimum quantization coefficient α used for coding in the header portion of the storage data of the coded image, and leaves it as a clue at the time of reproduction.

以上、本装置においては、撮影可能枚数に応じて定ま
る記録画像一枚当たりの総符号量(目的総符号量)に対
応して1ブロック当たりの基準割当符号量を定め、これ
に当該ブロックの前のブロックでの割当符号量に対する
発生符号量の過不足分を調整して当該ブロックの割当符
号量とし、これを利用して各ブロックの発生符号量を制
御することにより、画像全体の発生符号量が目的総符号
量を越えないようにしたものであり、この点が本発明の
重要なポイントとなっている。
As described above, in the present apparatus, the reference allocated code amount per block is determined in accordance with the total code amount per target image (target total code amount) determined according to the number of shootable images. The amount of generated code for the block is adjusted by adjusting the excess or deficiency of the generated code amount with respect to the allocated code amount of the block, and the generated code amount of the entire image is controlled by using this to control the generated code amount of each block. Is designed not to exceed the target total code amount, which is an important point of the present invention.

よって、本実施例で使用したブロックサイズ、直交変
換の種類、可変長符号化の種類等に限定されるものでは
ない。また、統計処理は必ずしも1回である必要はな
く、無くても良いし、複数回でも良い。
Therefore, the present invention is not limited to the block size, the type of orthogonal transform, the type of variable length coding, and the like used in the present embodiment. Further, the statistical processing need not always be performed once, but may be omitted, or may be performed a plurality of times.

但し、統計処理を実施して量子化幅を最適化すること
により、本発明の効果は特に顕著となり、また、処理時
間と、得られる効果の面から考えて、統計処理を一回実
施するのが最も得策である。また、統計処理において、
色成分毎の総符号量を得て、これを利用して1ブロック
当たりの符号量を決定するのではなく、経験的に各色成
分毎に符号量を重み付けしても良く、また、各色成分毎
の重み付けはせずに、1ブロック当たりの符号量は同一
でも良く、統計処理における統計量は1ブロック当たり
の基準割当符号量の決定には必ずしも必要ではない。ま
た統計処理は暫定的な量子化幅で、実際に符号化を行っ
て符号量を求めるものに限られるものではなく、例え
ば、アクティビティを計算することにより、求めるもの
であっても良い。
However, by optimizing the quantization width by performing statistical processing, the effect of the present invention becomes particularly remarkable. In addition, considering the processing time and the obtained effect, it is necessary to perform statistical processing once. Is the best solution. In statistical processing,
Instead of obtaining the total code amount for each color component and using this to determine the code amount per block, the code amount may be empirically weighted for each color component. Without weighting, the code amount per block may be the same, and the statistic amount in the statistical processing is not always necessary for determining the reference allocated code amount per block. Further, the statistical processing is not limited to the provisional quantization width, and is not limited to the processing of actually performing the encoding to obtain the code amount, but may be the calculation by calculating the activity, for example.

また、各色成分内での1ブロック当たりの割当符号量
は必ずしも均一である必要は無く、画像に対するブロッ
ク位置で重み付け、例えば、画像の中心部のブロックに
は周辺のブロックよりも多くの符号量を割り当てるよう
にしても良い。また、本実施例内でも示したように、目
的総符号量を全て1ブロック当たりの基準割当符号量に
割り振る必要は必ずしもなく、例えば、目的の符号量を
1ブロック当たりの基準割当符号量に割り当てたときに
割り切れなかった余りを、最初のブロックに対し、前ブ
ロックまでの過不足分として与える等しても良い。
Also, the allocated code amount per block in each color component does not necessarily need to be uniform, but is weighted by the block position with respect to the image. For example, a larger code amount is assigned to a block at the center of an image than to peripheral blocks. You may make it assign. Further, as shown in the present embodiment, it is not always necessary to allocate the target total code amount to the reference allocation code amount per block. For example, the target code amount is allocated to the reference allocation code amount per block. The remainder that is not divisible when the first block may be given to the first block as an excess or deficiency up to the previous block.

また、圧縮率は可変でなくとも良く、一種類の圧縮率
に固定であり、目的総符号量、量子化幅、1ブロック当
たりの基準割当符号量などが全て、固定値として与えら
れても良く、このようにした場合にはその構成はより簡
単になる。また、画像データバッファメモリは直交変換
回路4と量子化回路6との間にあっても良く、むしろこ
のようにすると符号化処理におけるブロック化と直交変
換のプロセスを省略できる。しかし、精度を保つために
は、この場合、画像メモリのサイズが大きくなる。
Also, the compression rate may not be variable, and may be fixed to one type of compression rate, and the target total code amount, the quantization width, the reference allocation code amount per block, and the like may all be given as fixed values. In this case, the configuration becomes simpler. Further, the image data buffer memory may be provided between the orthogonal transformation circuit 4 and the quantization circuit 6, and in this case, the processes of blocking and orthogonal transformation in the encoding process can be omitted. However, in order to maintain accuracy, the size of the image memory is increased in this case.

また、プロセス処理もA/D変換の前に行うようにし、
その後にディジタル化するようにしても構わない。ま
た、本装置においては、ブロック毎の可変長符号化を低
周波数成分より行い、画質への視覚的影響の比較的少な
い高周波成分が符号化の打ち切りにより省略されるよう
にしているので、画質の劣化を最小限に抑えて、しか
も、高圧縮で符号化できるようになる。
Also, process processing should be performed before A / D conversion,
After that, it may be digitized. In addition, in the present apparatus, variable-length coding for each block is performed from low-frequency components, and high-frequency components having relatively little visual effect on image quality are omitted by terminating the coding. It is possible to perform encoding with high compression while minimizing deterioration.

以上、詳述した第1図および第2図の構成の本発明
は、要するに、目的総符号量から予め決定した1ブロッ
ク当たりの基準割当符号量とそのブロックの前のブロッ
クでの発生符号量の、割当符号量に対する過不足分とを
加えた割当符号量に、符号量が収まるように、ブロック
毎に符号量を監視しながら、符号化を進め、符号量が割
当符号量に達すると、そのブロックの符号化は終了させ
るが、直流成分は割当符号量を越える場合でも必ず符号
化させ、そのときの割当符号量の過不足を記憶してお
き、次のブロックの符号化に移ってゆくというものであ
る。これは、画像の各ブロックにおける発生符号量は各
々異なる、つまり、局所的な符号量の片寄りはあるが、
数ブロックあるいは数十ブロックのかたまりをマイクロ
ブロック(8×8マトリックスのいくつかのかたまり)
としてとらえることにすると、このマイクロブロック毎
の発生符号量は比較的片寄りが少ないことに着目したも
のである。
The present invention having the configurations shown in FIGS. 1 and 2 described above is, in short, a basic allocation code amount per block determined in advance from the target total code amount and a code amount generated in a block before the block. When the code amount is monitored by monitoring the code amount for each block so that the code amount falls within the allocated code amount obtained by adding the excess or deficiency to the allocated code amount, when the code amount reaches the allocated code amount, Although the coding of the block is terminated, the DC component is always coded even if it exceeds the allocated code amount, the excess or deficiency of the allocated code amount at that time is stored, and the process proceeds to the coding of the next block. Things. This is because the amount of generated code in each block of the image is different, that is, although there is a local shift in the amount of code,
A block of several blocks or tens of blocks is a micro block (several blocks of an 8 × 8 matrix)
It is noted that the generated code amount for each microblock has a relatively small deviation.

よって、ブロック毎の符号量を適応的に割り当てず
に、ブロック当たりの割当符号量の割り当て方を固定し
ておき、目的とする符号量を、その割り当て方に従って
配分してブロック当たりの基準割当符号量を決定して
も、発生符号量の割当符号量に対する余剰分を、以降の
ブロックの割当符号量へと繰り越すことにより、各ブロ
ックの発生符号量の変化に適応させながらも、マイクロ
ブロックでは発生符号量を制御していることになる。
Therefore, instead of adaptively allocating the code amount for each block, the method of allocating the allocated code amount per block is fixed, and the target code amount is allocated according to the allocation method, and the reference allocated code per block is allocated. Even if the amount is determined, the surplus amount of the generated code amount with respect to the allocated code amount is carried over to the allocated code amount of the subsequent blocks, thereby adapting to the change in the generated code amount of each block. You are controlling the amount.

ブロック毎の割当符号量を画像毎に適応的に割り当て
ようとすると、画像毎に各ブロック毎の統計量などを求
める作業と、この結果、得られる各ブロック毎の基準割
当符号量を記憶しておくメモリが必要となるが、本方式
ではこれらが不要になると共に、圧縮率が変わっても、
同じハードウェアで対処でき、従って、目的圧縮率別
(符号量別)のハードウェアを用意する必要がないか
ら、応用する装置のコストダウンと小形化が図れる。さ
らにブロックの割当符号量は基準割当符号量に前ブロッ
クでの過不足分を加えて決め、これを基準に符号化を制
御するので、処理が単純化でき、従って、処理時間を短
くすることができる。
In order to adaptively allocate the allocated code amount for each block to each image, an operation of obtaining a statistic for each block for each image and the like, and storing a reference allocated code amount for each block obtained as a result, In this method, these are not required, and even if the compression ratio changes,
The same hardware can cope with it, and therefore, it is not necessary to prepare hardware for each target compression rate (for each code amount), so that it is possible to reduce the cost and size of the applied device. Furthermore, the allocated code amount of the block is determined by adding the excess or deficiency in the previous block to the reference allocated code amount, and the coding is controlled based on this, so that the processing can be simplified, and therefore the processing time can be shortened. it can.

上述した第2図の構成の符号化回路80は、圧縮符号化
において、一連の処理を目的符号量に基づき、算出した
暫定的な量子化幅で第1パスの処理を行い、その結果を
もとに最適な量子化幅を求めてこの最適な量子化幅によ
り第2パスを実施し、最終的な圧縮符号化データを得る
と云った二回の処理で完成させるもので、第1パスによ
り最適なαを見付けるようにするものである。
The above-described encoding circuit 80 in the configuration of FIG. 2 performs a series of processes in the first pass with the calculated tentative quantization width based on the target code amount in the compression encoding. The second pass is performed using the optimum quantization width in order to obtain the final compression-encoded data. This is to find the optimum α.

第3図においては符号化回路80の処理の流れをわかり
易くするために、第1パスでの信号の流れを点線の矢印
で、また、第2パスでの信号の流れを実線の矢印で
それぞれ図示してある。この信号の流れに沿ってざっと
動作を追ってみると次のようになる。
In FIG. 3, the signal flow in the first pass is indicated by a dotted arrow, and the signal flow in the second pass is indicated by a solid arrow in order to make the processing flow of the encoding circuit 80 easy to understand. Is shown. The following is a brief description of the operation following the flow of this signal.

画像データの符号化が行われるに当り、目的とする総
符号量が符号化回路80の制御回路18内に設定される。こ
れはスイッチ30の操作により、使用者が所望の撮影可能
枚数を設定することにより、この設定した撮影可能枚数
に応じて制御回路90が最適符号量を選択し、これを目的
総符号量の情報として符号化回路80に与えることで実現
している。尚、初期状態では予め定めた標準的な撮影可
能枚数に設定される。
When the image data is encoded, the target total code amount is set in the control circuit 18 of the encoding circuit 80. This is because the user sets the desired number of recordable images by operating the switch 30, and the control circuit 90 selects the optimal code amount according to the set number of recordable images, and uses this information as the target total code amount information. Is provided to the encoding circuit 80. In the initial state, the number is set to a predetermined standard photographable number.

撮影が行われると、これにより撮像系40内の撮像素子
から画像信号が出力される。この出力された画像信号は
信号処理回路60内においてディジタル信号に変換され、
バッファメモリに記憶された後、8×8画素のブロック
単位で読み出され、Y成分、次にCr成分、次にCb成分に
分離される。この分離は最初にY成分について行われ、
8×8画素のブロック単位で出力されるY成分の画像デ
ータは直交変換回路4に入力されて、ブロック毎に直交
変換(本例ではDCT;離散コサイン変換(Discrete Cosin
e Transform)が行われる。
When photographing is performed, an image signal is output from the image sensor in the image pickup system 40. This output image signal is converted into a digital signal in the signal processing circuit 60,
After being stored in the buffer memory, it is read out in blocks of 8 × 8 pixels and separated into a Y component, then a Cr component, and then a Cb component. This separation is first performed on the Y component,
The image data of the Y component output in units of 8 × 8 pixels is input to the orthogonal transform circuit 4 and orthogonally transformed (DCT; Discrete Cosin in this example) for each block.
e Transform) is performed.

直交変換回路4で得られたDCT変換係数は量子化回路
6に入力され、一方、制御回路18から目的総符号量が量
子化幅予測回路12に出力され、量子化幅予測回路12では
目的総符号量から式(1)の関係を用いて量子化係数α
の初期値を設定し、量子化回路6に出力する。量子化回
路6では、入力された量子化係数αを用いて、変換係数
を線形量子化する。量子化された変換係数は可変長符号
化回路8に入力され、可変長符号化(本例ではハフマン
符号化)が行われる。
The DCT transform coefficients obtained by the orthogonal transform circuit 4 are input to the quantization circuit 6, while the control circuit 18 outputs the target total code amount to the quantization width prediction circuit 12, and the quantization width prediction circuit 12 From the code amount, the quantization coefficient α is calculated using the relationship of the equation (1).
Is set and output to the quantization circuit 6. The quantization circuit 6 linearly quantizes the transform coefficient using the input quantization coefficient α. The quantized transform coefficients are input to the variable-length coding circuit 8, where variable-length coding (Huffman coding in this example) is performed.

ここで入力された量子化係数は、ジグザグスキャンと
呼ばれる低周波数成分から高周波数成分への走査が行わ
れ、一番目の直流成分のデータは直前に可変長符号化を
行ったブロックの直流成分との差分値がハフマン符号化
されて出力される。
The input quantization coefficient is scanned from a low-frequency component to a high-frequency component called zigzag scan, and the first DC component data is the same as the DC component of the block that has just been subjected to variable length coding. Are subjected to Huffman coding and output.

交流成分については走査順序の2番目から64番目まで
順番に変換係数を見てゆき、変換係数が0でない(すな
わち、有効な)係数が出てきたら、その直前に存在した
連続した0(零;無効)の係数の(ゼロラン)とその有
効係数との値で、2次元のハフマン符号化が行われる。
また、ある係数以降、64番目の係数まで、連続して無効
出力が続く場合には、ブロックの終りを示すEOBの符号
を出力する。可変長符号化回路8は、以上のような符号
化が行われ、1つの符号が発生する毎に、その符号長を
符号量算出回路14に出力する。
For the AC component, the conversion coefficients are sequentially examined from the second to the 64th in the scanning order. If a conversion coefficient that is not 0 (that is, a valid coefficient) appears, a continuous 0 (zero; Two-dimensional Huffman coding is performed with the value of (invalid) coefficient (zero run) and its effective coefficient.
If the invalid output continues to the 64th coefficient after a certain coefficient, the code of the EOB indicating the end of the block is output. The variable length coding circuit 8 performs the above-described coding, and outputs the code length to the code amount calculation circuit 14 every time one code is generated.

符号量算出回路14は入力された各符号長を色成分毎に
累積し、記憶する。
The code amount calculation circuit accumulates and stores the input code lengths for each color component.

Y成分についてのこのような処理が終了すると、次に
Cr成分、そしてCb成分についても同様の処理を行う。
When such processing for the Y component is completed,
The same processing is performed for the Cr component and the Cb component.

一画像について、符号化が終了すると、符号量算出回
路14は累積した色成分毎の符号量を加算して画像全体の
符号量を総符号量値として算出する。この総符号量値は
量子化幅予測回路12に出力され、また、各色成分毎の符
号量及び画像全体の符号量割当回路20に出力される。
When encoding of one image is completed, the code amount calculation circuit 14 adds the accumulated code amounts of the respective color components and calculates the code amount of the entire image as a total code amount value. The total code amount value is output to the quantization width prediction circuit 12, and is output to the code amount allocation circuit 20 for the code amount of each color component and the entire image.

以上の第1パスの符号化処理が終了すると、量子化幅
予測回路12では第1パスでの符号化により求められた総
画像符号量と、制御回路18から与えられた目的符号量と
から、より適した量子化係数αを予測し、量子化回路6
に出力する。また、符号量割当回路20は符号量算出回路
14から入力された各色成分毎の符号量、画像全体の符号
量と、目的符号量およびブロック数から、各色成分毎の
1ブロック当たりの割当符号量を算出する。
When the above-described first pass encoding process is completed, the quantization width prediction circuit 12 calculates the total image code amount obtained by the encoding in the first pass and the target code amount given from the control circuit 18, A more suitable quantization coefficient α is predicted, and the quantization circuit 6
Output to The code amount assignment circuit 20 is a code amount calculation circuit.
From the code amount of each color component, the code amount of the entire image, the target code amount, and the number of blocks, which are input from step 14, the allocated code amount per block for each color component is calculated.

続いて同じ画像データに対して第2パスの符号化処理
が行われる。第2パスでは信号処理回路60内のメモリか
ら読み出された画像データは、最初にY成分、次にCr成
分、次にCb成分に分離され、それぞれの成分の画像デー
タは8×8画素のブロック化等の処理が行われた後、直
交変換回路4に入力され、ブロック毎に直交変換(DCT
変換)され、これにより、直交変換回路4で得られたDC
T変換係数は量子化回路6に入力される。
Subsequently, a second pass encoding process is performed on the same image data. In the second pass, the image data read from the memory in the signal processing circuit 60 is first separated into a Y component, then a Cr component, and then a Cb component, and the image data of each component is 8 × 8 pixels. After processing such as blocking is input to the orthogonal transform circuit 4, the orthogonal transform (DCT) is performed for each block.
Conversion), whereby the DC obtained by the orthogonal transformation circuit 4 is obtained.
The T transform coefficients are input to the quantization circuit 6.

量子化回路6においては、与えられたこの予測による
新たな量子化係数αによる補正済み量子化幅を用いて、
DCT変換係数を線形量子化する。量子化された係数は可
変長符号化回路8に入力され、第1パスの符号化時と同
様の方式でハフマン符号化される。ここで符号化時に発
生した符号量は第1パスの終了時に求められ、符号量割
当回路20に記憶されている1ブロック当たりの割当符号
量と、前ブロックでの割当符号量の過不足とを加えた当
該ブロックの割当符号量との比較が行われ、これを越え
た場合には符号打切回路16の働きにより、そのブロック
内でそれ以降の符号化が打ち切られる。また、当該ブロ
ックの符号化を終了した時点での割当符号量の過不足
は、符号量割当回路20に記憶される。
In the quantization circuit 6, the corrected quantization width by the new quantization coefficient α based on the given prediction is used to calculate
Linearly quantizes the DCT transform coefficients. The quantized coefficients are input to the variable length coding circuit 8, and are subjected to Huffman coding in the same manner as in the first pass coding. Here, the amount of code generated at the time of encoding is obtained at the end of the first pass, and the amount of code per block stored in the code amount allocating circuit 20 and the amount of code allocated in the previous block are determined. The comparison with the added code amount of the block is performed, and if the amount exceeds the value, the subsequent code is stopped in the block by the operation of the code cutoff circuit 16. Further, the excess or deficiency of the allocated code amount at the time when the encoding of the block is completed is stored in the code amount allocating circuit 20.

以上の方法により目的総符号量に制御された符号化デ
ータは順次、符号出力回路10を経由して記録系70に出力
され、記録される。
The coded data controlled to the target total code amount by the above method is sequentially output to the recording system 70 via the code output circuit 10 and recorded.

次に記録系70にて記録された記録媒体71の圧縮符号化
記録画像データの再生について説明する。
Next, reproduction of the compression-encoded recording image data of the recording medium 71 recorded by the recording system 70 will be described.

第4図に再生機の構成を示す。図において、100は再
生機本体であり、この再生機本体100は読取部102、復号
化回路104および処理回路106および制御回路108を備え
る。読取部102は記憶媒体71を着脱でき、記憶媒体71の
内容をインタフェース回路110を介して読出すようにな
っている。
FIG. 4 shows the configuration of the regenerator. In the figure, reference numeral 100 denotes a playback device main body, which includes a reading unit 102, a decoding circuit 104, a processing circuit 106, and a control circuit 108. The reading unit 102 can attach and detach the storage medium 71, and reads the contents of the storage medium 71 via the interface circuit 110.

復号化回路104は第5図のような機能ブロックを有す
る。すなわち、112はハフマン符号化データを復号化す
るハフマン復号部、114はこのハフマン復号されて得ら
れたデータを、記憶媒体71から読み出されて設定入力さ
れた量子化幅の情報に基づいて逆量子化する逆量子化
部、116はこの逆量子化されて得られたデータを逆DCT変
換して映像信号データとして出力するIDCT(逆DCT変
換)部、そして、118はこれらの制御を司る制御部であ
る。
The decoding circuit 104 has functional blocks as shown in FIG. That is, 112 is a Huffman decoding unit that decodes the Huffman coded data, and 114 is the Huffman-decoded data read out from the storage medium 71 based on the quantization width information read out from the storage medium 71 and set and input. An inverse quantization unit for quantizing 116, an IDCT (inverse DCT transform) unit for inverse DCT transforming the data obtained by the inverse quantization and outputting it as video signal data, and a control unit 118 for controlling these Department.

処理回路106はバッファメモリ120、エンコーダ122お
よびD/A変換器124を備える。バッファメモリ120は復号
化回路104から出力された映像信号データを一時保持す
るメモリであり、エンコーダ122はこのバッファメモリ1
20から読み出される映像信号データをNTSC方式の映像信
号に変換するものであり、D/A変換器124はこのNTSC方式
の映像信号をアナログ変換してテレビ用の映像信号とし
て出力するためのものである。
The processing circuit 106 includes a buffer memory 120, an encoder 122, and a D / A converter 124. The buffer memory 120 is a memory for temporarily holding the video signal data output from the decoding circuit 104, and the encoder 122
The D / A converter 124 converts the video signal data read from the video signal 20 into an NTSC video signal, and converts the NTSC video signal into an analog signal and outputs it as a TV video signal. is there.

前記制御回路108は再生機本体100全体の制御を司るも
のであり、再生機本体100の読取部102に対し、符号化時
の量子化幅の情報を読み出すべく制御して、その結果、
記録媒体71から読み出された符号化時の量子化幅の情報
を復号化回路104の逆量子化部114に設定させ、続いて制
御回路108は記録媒体71から圧縮符号化された映像信号
データを読出すべく、読取部102を制御すると云った制
御を行う。また、図示しないが再生機本体100には、コ
マ送りスイッチ等があり、このスイッチにより指定され
たコマ位置の映像を再生したりすることができる。この
ような制御も制御回路108が行う。
The control circuit 108 controls the entire reproduction apparatus main body 100, and controls the reading unit 102 of the reproduction apparatus main body 100 to read the information of the quantization width at the time of encoding.
The information of the quantization width at the time of encoding read from the recording medium 71 is set in the inverse quantization unit 114 of the decoding circuit 104, and then the control circuit 108 controls the video signal data compressed and encoded from the recording medium 71. Is controlled to control the reading unit 102 in order to read the data. Although not shown, the reproducing apparatus main body 100 has a frame feed switch and the like, and can reproduce a video at a frame position designated by the switch. The control circuit 108 also performs such control.

次に上記構成の再生機の動作を説明する。圧縮符号化
された映像信号データが記録された記録媒体(メモリカ
ード)71が再生機本体100の読取部102に装着されると、
まず、制御回路108は読取部102に対し、符号化時の量子
化幅の情報を読み出すべく制御する。その結果、読取部
102において記録媒体71から符号化時の量子化幅の情報
が読み出され、この情報は復号化回路104の逆量子化部1
14に設定される。続いて制御回路108は記録媒体71から
映像信号を読出すべく、読取部102を制御するので、読
取部102は記録媒体71から映像信号を順次読み出し、復
号化回路104に入力する。これを受けた復号化回路104で
は、ハフマン復号部112においてハフマン符号を復号
し、量子化係数を得る。こうして得られた量子化係数は
逆量子化回路114に与えて逆量子化する。ここでの逆量
子化は先に設定されている前記量子化幅の情報を用いて
行われる。
Next, the operation of the reproducing apparatus having the above configuration will be described. When the recording medium (memory card) 71 on which the compression-encoded video signal data is recorded is mounted on the reading unit 102 of the player main body 100,
First, the control circuit 108 controls the reading unit 102 to read information on the quantization width at the time of encoding. As a result, the reading unit
In 102, information on the quantization width at the time of encoding is read from the recording medium 71, and this information is used as the inverse quantization unit 1 of the decoding circuit 104.
Set to 14. Subsequently, since the control circuit 108 controls the reading unit 102 to read the video signal from the recording medium 71, the reading unit 102 sequentially reads the video signal from the recording medium 71 and inputs the video signal to the decoding circuit 104. In the decoding circuit 104 receiving this, the Huffman decoding unit 112 decodes the Huffman code to obtain a quantized coefficient. The quantization coefficient thus obtained is supplied to the inverse quantization circuit 114 to be inversely quantized. Here, the inverse quantization is performed by using the information of the quantization width previously set.

逆量子化により得られた変換係数は、IDCT部116にお
いてブロック毎に逆DCT変換され、元の映像信号に復元
される。このようにしてY,Cr,Cbの順で映像信号が復元
されて復号化回路104から出力され、処理回路106内のバ
ッファメモリ120に書き込まれる。1画面の映像信号デ
ータの書き込みが終了すると、バッファメモリ120から
通常のテレビ信号の走査順で映像信号データが読み出さ
れ、エンコーダ122においてNTSC方式の映像信号に変換
される。更にD/A変換器124によりアナログ信号に変換さ
れ、出力される。この映像信号をテレビモニタに入力す
ることにより、画像がテレビ映像として再生され、映像
として鑑賞でき、また、ビデオプリンタ等のプリント装
置に与えてプリントすることにより、ハードコピーが得
られるので、写真等と同様な形で鑑賞することができる
ようになる。
The transform coefficient obtained by the inverse quantization is subjected to inverse DCT for each block in the IDCT unit 116, and restored to the original video signal. In this way, the video signal is restored in the order of Y, Cr, and Cb, output from the decoding circuit 104, and written to the buffer memory 120 in the processing circuit 106. When the writing of the video signal data for one screen is completed, the video signal data is read out from the buffer memory 120 in the normal scanning order of the television signal, and is converted into an NTSC video signal by the encoder 122. Further, the signal is converted into an analog signal by the D / A converter 124 and output. By inputting this video signal to a television monitor, the image is reproduced as a television video and can be viewed as a video, and a hard copy can be obtained by giving it to a printing device such as a video printer and printing it. It can be viewed in the same way as.

以上説明したように、カメラは所望の撮影可能枚数を
設定でき、撮影可能枚数を設定することで、カメラでは
これに対応する圧縮率を自動設定すると共に、この設定
圧縮率に応じて定まる暫定的な量子化幅を用いて、1画
面分の撮影画像データを量子化し、可変長符号化し、そ
の結果得られるその1画面分の撮影画像データの符号量
より最適量子化幅を予測し、この予測した最適量子化幅
により前記1画面分の撮影画像データを量子化し、可変
長符号化するようにし、符号化された映像信号の再生時
には撮影時に使用した前記最適量子化幅を用いて復号す
ることにより、所望の圧縮率での符号化を圧縮率別にハ
ードウェアを設けることなく、共通の一つのハードウェ
アで実現でき、同様に所望の圧縮率で符号化された画像
データの復号化を圧縮率別にハードウェアを設けること
なく、共通の一つのハードウェアで実現できる。
As described above, the camera can set a desired number of shootable images, and by setting the number of shootable images, the camera automatically sets a compression rate corresponding to the settable number of shots and temporarily sets a compression rate corresponding to the set compression rate. The quantized image data for one screen is quantized using a variable quantization width, and is subjected to variable length encoding. The optimal quantization width is predicted from the code amount of the captured image data for one screen obtained as a result. Quantizing the captured image data for one screen by the optimized quantization width and performing variable-length encoding, and decoding the encoded video signal using the optimal quantization width used at the time of shooting when reproducing the encoded video signal. Accordingly, encoding at a desired compression rate can be realized by one common hardware without providing hardware for each compression rate, and similarly, decoding of image data encoded at a desired compression rate can be performed by compression. Without providing any hardware rate by, it can be realized by a single common hardware.

尚、実施例では符号化の過程が第1パス、第2パスの
2回の処理で終了する2パス方式としたが、これに限る
ものではなく、圧縮率から設定した量子化幅を用いて1
回のパスで符号化する方式でも実用上、十分な画像が得
られるし、第1パスを更に何度か繰り返しても、さらに
良好な結果が得られる。
In the embodiment, a two-pass method is used in which the encoding process is completed in two processes of a first pass and a second pass. However, the present invention is not limited to this, and a quantization width set from a compression ratio is used. 1
In practice, a sufficient image can be obtained even if the coding is performed in one pass, and a better result can be obtained even if the first pass is repeated several times.

また、記録媒体にメモリカードを用いた例を示した
が、その他、フロッピディスク、光ディスク、磁気テー
プ等を利用することもできる。また、カメラと再生機が
別体となっているものを示したが、カメラが再生機の機
能を合せ持つ一体型のものでもよい。さらにまた、実施
例では量子化幅の値そのものを記録媒体に記録するよう
にしたが、量子化幅値を変換あるいは符号化して記録す
るようにしても良い。
In addition, although an example in which a memory card is used as a recording medium has been described, a floppy disk, an optical disk, a magnetic tape, or the like may be used. Although the camera and the playback device are shown as being separated from each other, the camera may be of an integrated type having the functions of the playback device. Furthermore, in the embodiment, the quantization width value itself is recorded on the recording medium. However, the quantization width value may be converted or encoded and recorded.

以上の実施例では目的総符号量から量子化幅を設定し
ていたが、複数の目的総符号量をモードで切換えて使用
するようなアプリケーションにおいては、それぞれのモ
ードに対応する量子化幅および1ブロック当たりの割当
符号量を予め用意しておき、これをモードで切り換えて
使用するようにしても勿論差支えない。
In the above embodiment, the quantization width is set based on the target total code amount. However, in an application in which a plurality of target total code amounts are switched and used in a mode, the quantization width and the 1st corresponding to each mode are used. Of course, it is of course possible to prepare an allocated code amount per block in advance and use it by switching between modes.

尚、本発明は上記し、且つ、図面に示す実施例に限定
することなくその要旨を変更しない範囲内で適宜変形し
て実施し得るものであり、本発明はスチル画像に限らず
動画像等、種々の画像に対しての圧縮符号化に適用でき
るものである。
The present invention is not limited to the embodiments described above and shown in the drawings, and can be appropriately modified and implemented without departing from the scope of the present invention. , Can be applied to compression encoding of various images.

また、上記実施例では圧縮率対応情報より総符号量の
情報を与え、この総符号量に対応した量子化幅を与える
ことのできる量子化係数の予測を行い、この予測された
量子化係数に基づく量子化幅で量子化を行うようにして
いるが、予め圧縮率対応情報に対する量子化幅の関係を
計算で求めてテーブル化しておき、これをメモリ等に記
憶して、圧縮率対応情報から直接、量子化幅の情報(す
なわち、量子化係数或いは量子化幅の値)を出力させる
ようにすることもできる。このようにすれば、所望の圧
縮率に対応する情報を入力すると、この入力された圧縮
率対応情報に対応して一義的に定まる量子化幅の情報を
読出して出力でき、即座に最適量子化幅を設定できて直
ちに量子化回路にこの量子化幅で画像信号データを量子
化させることができるようになる。1ブロック当たりの
基準割当符号量についても同様である。
Further, in the above embodiment, information of the total code amount is given from the compression ratio corresponding information, and a quantization coefficient capable of giving a quantization width corresponding to the total code amount is predicted, and the predicted quantization coefficient is Although the quantization is performed with the quantization width based on, the relation of the quantization width with respect to the compression ratio correspondence information is calculated in advance and tabulated, and this is stored in a memory or the like, and the compression ratio correspondence information is stored. It is also possible to directly output quantization width information (that is, quantization coefficient or quantization width value). In this way, when the information corresponding to the desired compression ratio is input, the information of the quantization width uniquely determined corresponding to the input compression ratio corresponding information can be read and output, and the optimum quantization can be immediately performed. As soon as the width can be set, the quantization circuit can quantize the image signal data with this quantization width. The same applies to the reference assigned code amount per block.

この構成によれば、メモリ等に各種の圧縮率に対応し
た最適量子化幅の情報と1ブロック当たりの基準割当符
号量を予め記憶させて、これを入力圧縮率対応情報に対
応して読出すだけで最適量子化幅と1ブロック当たりの
基準割当符号量の情報を与えることができるので、目的
総符号量に収まるよう符号化するに当り、その処理を極
めて短時間で行える他、ハードウェアも簡単で済むよう
になる。
According to this configuration, the information of the optimal quantization width corresponding to various compression ratios and the reference allocation code amount per block are stored in a memory or the like in advance, and are read out corresponding to the input compression ratio corresponding information. Alone can provide information on the optimal quantization width and the reference allocation code amount per block, so that when encoding to fit into the target total code amount, the processing can be performed in a very short time, and hardware It will be easy.

〔発明の効果〕〔The invention's effect〕

以上詳述したように、本発明によれば、大規模なハー
ドウェアを必要とせずに、符号量の制御が行えると共
に、短時間で符号化処理が行えるので、ハードウェアの
コストダウンと小形化を図ることができる等、電子カメ
ラシステム等に最適な画像データの符号化装置および符
号化方法を提供できる。
As described in detail above, according to the present invention, it is possible to control the code amount and to perform the encoding process in a short time without requiring large-scale hardware. Therefore, it is possible to provide an image data encoding apparatus and an encoding method that are optimal for an electronic camera system and the like.

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

第1図は本発明の第1の実施例を示すブロック図、第2
図は本発明装置の要部構成例を示すブロック図、第3図
は第2図回路の動作の流れを説明するためのブロック
図、第4図および第5図は再生機の構成を示すブロック
図、第6図は本発明による電子カメラ本体の外観を示す
斜視図、第7図は8×8画素に分けられたブロックのジ
グザグ・スキャンを説明するための図、第8図は本発明
の原理的な作用を説明するための動作遷移図、第9図は
従来技術を説明するための動作遷移図である。 1……電子カメラ本体、6……量子化回路、8……可変
長符号化回路、10……符号出力回路、12……量子化幅予
測回路、14……符号量算出回路、16……符号化打切回
路、18,18a……制御回路、20……符号量割当回路、24…
…DCPM回路、30……スイッチ、40……撮像系、48……LC
D表示器、60……信号処理回路、80……符号化回路、70
……記録系、71……記録媒体、90……制御回路、100…
…再生機本体、102……読取部、104……復号化回路、10
6……処理回路、108……制御回路、110……インタフェ
ース回路、112……ハフマン復号部、114……逆量子化
部、116……IDCT(逆DCT変換)部、118……制御部。
FIG. 1 is a block diagram showing a first embodiment of the present invention, and FIG.
FIG. 3 is a block diagram showing an example of the configuration of a main part of the apparatus of the present invention, FIG. 3 is a block diagram for explaining the operation flow of the circuit of FIG. 2, and FIGS. FIG. 6, FIG. 6 is a perspective view showing the appearance of the electronic camera body according to the present invention, FIG. 7 is a diagram for explaining zigzag scanning of a block divided into 8 × 8 pixels, and FIG. FIG. 9 is an operation transition diagram for explaining the principle operation, and FIG. 9 is an operation transition diagram for explaining the prior art. DESCRIPTION OF SYMBOLS 1 ... Electronic camera main body, 6 ... Quantization circuit, 8 ... Variable length encoding circuit, 10 ... Code output circuit, 12 ... Quantization width prediction circuit, 14 ... Code amount calculation circuit, 16 ... Encoding truncation circuit, 18, 18a ... control circuit, 20 ... code amount allocation circuit, 24 ...
... DCPM circuit, 30 ... Switch, 40 ... Imaging system, 48 ... LC
D display, 60: Signal processing circuit, 80: Encoding circuit, 70
... recording system, 71 ... recording medium, 90 ... control circuit, 100 ...
... Reproducer body, 102 ... Reading unit, 104 ... Decoding circuit, 10
6 Processing circuit, 108 Control circuit, 110 Interface circuit, 112 Huffman decoding unit, 114 Inverse quantization unit, 116 IDCT (inverse DCT transform) unit, 118 Control unit.

フロントページの続き (56)参考文献 特開 平2−104078(JP,A) 茂木千佳子、外2名,“DCT符号化 における符号量制御方式”,1990年電子 情報通信学会春季全国大会講演論文集, 社団法人電子情報通信学会,平成2年3 月,分冊7,P.62(D−310) (58)調査した分野(Int.Cl.6,DB名) H04N 1/41 - 1/419 H04N 7/24 - 7/68 Continuation of the front page (56) References JP-A-2-104078 (JP, A) Chikako Mogi, et al., "Code amount control method in DCT coding", Proc. Of the 1990 IEICE Spring Conference. , The Institute of Electronics, Information and Communication Engineers, March 1990, Volume 7, p. 62 (D-310) (58) Field surveyed (Int. Cl. 6 , DB name) H04N 1/41-1/419 H04N 7/24-7/68

Claims (6)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】画像データをブロックに分割し、この分割
された各ブロックは順にそれぞれ直交変換を行ってこの
変換出力を量子化手段により量子化し、この量子化出力
を可変長符号化手段に与えて可変長符号化し、各ブロッ
ク毎にデータの符号化をする符号化装置において、 前記ブロックの符号化にあたり、当該符号化処理するブ
ロックでの符号化処理により発生した符号量と当該ブロ
ックでの割当符号量とに基づいてこの発生符号量の前記
割当符号量に対する過不足量を算出すると共に、画像当
りの許される符号量である目的の総符号量以下の所定の
符号量を総ブロック数で割ることにより、予め決定した
1ブロック当たりの基準符号量に前記算出した過不足量
を加えた符号量を次に処理するブロックの前記割当符号
量として求める符号量割当手段と、 各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように、前記可変長符号化を打
ち切るべく前記可変長符号化手段を制御する打切手段と を備えたことを特徴とする画像データの符号化装置。
An image data is divided into blocks, each of the divided blocks is subjected to an orthogonal transform in turn, and the transform output is quantized by a quantizing means, and the quantized output is supplied to a variable length coding means. An encoding apparatus that performs variable-length encoding on each block and encodes data for each block. In encoding the block, the amount of code generated by the encoding process in the block to be encoded and the allocation in the block. Calculate the excess or deficiency of the generated code amount with respect to the allocated code amount based on the code amount and divide a predetermined code amount equal to or less than a target total code amount which is an allowable code amount per image by the total block number. Thus, the code amount obtained by adding the calculated excess / deficiency amount to the predetermined reference code amount per block is determined as the allocated code amount of the next block to be processed. Allocating means; and truncating means for controlling the variable-length coding means to terminate the variable-length coding so as not to exceed the allocated code amount allocated by the code amount allocating means for each block. An image data encoding device characterized by the above-mentioned.
【請求項2】画像データをブロックに分割し、この分割
された各ブロックは順にそれぞれ直交変換を行って低い
周波数成分から順に高い周波数成分へと前記ブロック毎
の画像データを成分分解し、この変換出力を量子化手段
により量子化し、この量子化出力を可変長符号化手段に
与えて可変長符号し、各ブロック毎にデータの符号化を
する符号化装置において、 前記ブロックの符号化にあたり、当該符号化処理するブ
ロックでの符号化処理により発生した符号量と当該ブロ
ックでの割当符号量とに基づいてこの発生符号量の前記
割当符号量に対する過不足量を算出すると共に、画像当
りの許される符号量である目的の総符号量以下の所定の
符号量を総ブロック数で割ることにより、予め決定した
1ブロック当たりの基準符号量に前記算出した過不足量
を加えた符号量を次に処理するブロックの前記割当符号
量として求める符号量割当手段と、 各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように、前記可変長符号化を打
ち切るべく前記可変長符号化手段を制御する打切手段
と、 前記量子化手段に対し、予め定めた量子化幅を用いて量
子化を行わせるべく制御する制御手段とを備え、 前記可変長符号化手段には、前記直交変換により得られ
る前記各ブロック単位の画像データのうち、直流成分に
ついては手前の符号化処理ブロックでの直流成分との差
分を得ると共にこの差分を可変長符号化する直流成分用
の符号化処理部と、この直流成分の符号化処理部の処理
が終った後、前記交流成分について可変長符号化する交
流成分用の符号化処理部とを設け、前記符号化打切手段
は交流成分用の符号化処理部に対してのみ打ち切り制御
を可能にする構成とすることを特徴とする画像データの
符号化装置。
2. The image data is divided into blocks, and each of the divided blocks is subjected to an orthogonal transform in order to decompose the image data for each block from low frequency components to high frequency components in order. The output is quantized by a quantizing unit, and the quantized output is supplied to a variable-length encoding unit to perform variable-length coding, and encodes data for each block. Based on the code amount generated by the encoding process in the block to be encoded and the allocated code amount in the block, an excess or deficiency amount of the generated code amount with respect to the allocated code amount is calculated, and an allowable amount per image is calculated. By dividing a predetermined code amount equal to or less than the target total code amount, which is the code amount, by the total number of blocks, the calculated reference code amount per block is calculated as described above. Code amount allocating means for obtaining the code amount obtained by adding the excess or deficiency amount as the allocated code amount of a block to be processed next, and the code amount allocated by the code amount allocating unit for each block so as not to exceed the allocated code amount. Aborting means for controlling the variable-length encoding means to abort the variable-length coding, and a control means for controlling the quantization means to perform quantization using a predetermined quantization width, The variable-length encoding means obtains a difference between the DC component of the image data of each block obtained by the orthogonal transformation and the DC component of the preceding encoding processing block, and sets the difference to a variable length. An encoding processing unit for a DC component to be encoded and an encoding processing unit for an AC component for performing variable-length encoding on the AC component after the processing of the encoding processing unit for the DC component are completed. The coding truncation means coding device of the image data, characterized by a configuration allowing only abort control the encoding processing section for the AC components.
【請求項3】画像データをブロックに分割し、この分割
された各ブロックは順にそれぞれ直交変換を行って低い
周波数成分から順に高い周波数成分へと前記ブロック毎
の画像データを成分分解し、この変換出力を量子化手段
により量子化し、この量子化出力を可変長符号化手段に
与えて可変長符号化し、各ブロック毎にデータの符号化
をする符号化装置において、 前記可変長符号化手段により符号化された画像全体の変
換係数の符号量を算出する符号量算出手段と、 この符号量算出手段により算出された画像全体の符号量
と、画面あたりの許される目的総符量とから最適な量子
化幅を予測すると共に、前記量子化手段にこの予測量子
化幅を与える量子化幅予測手段と、 前記ブロックの符号化にあたり、当該符号化処理するブ
ロックでの符号化処理により発生した符号量と当該ブロ
ックでの割当符号量とに基づいてこの発生符号量の前記
割当符号量に対する過不足量を算出すると共に、前記目
的総符号量以下の所定の符号量を総ブロック数で割るこ
とにより、決定された1ブロック当たりの基準符号量に
前記算出した過不足量を加えた符号量を次に処理するブ
ロックの前記割当符号量として求める符号量割当手段
と、 各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように前記可変長符号化を打ち
切るべく前記可変長符号化手段を制御する打切手段と、 前記量子化手段に対し、初めに前記目的総符号量から予
め定めた暫定的な量子化幅を用いて最適な量子化幅を予
測する第1の符号化処理を少なくとも1回実施させ、次
に前記量子化幅予測手段により予測された最適な量子化
幅を用いて第2の符号化処理を実施させるべく制御する
制御手段と を設けて構成することを特徴とする画像データの符号化
装置。
3. The image data is divided into blocks, and each of the divided blocks is subjected to orthogonal transform in order to decompose the image data of each block from low frequency components to high frequency components in order. In an encoding device, the output is quantized by a quantizing unit, the quantized output is supplied to a variable-length encoding unit and subjected to variable-length encoding, and data is encoded for each block. Code amount calculating means for calculating the code amount of the transform coefficient of the entire transformed image, and the optimal quantum based on the code amount of the entire image calculated by the code amount calculating means and the permissible target total code amount per screen. A quantization width prediction unit that predicts a quantization width and gives the prediction quantization width to the quantization unit; and, in encoding the block, codes in a block to be encoded. Based on the amount of code generated by the processing and the amount of code allocated in the block, the amount of excess or deficiency of the amount of generated code with respect to the allocated amount of code is calculated, and a predetermined amount of code equal to or less than the target total amount of code is calculated as a total Code amount allocating means for obtaining a code amount obtained by adding the calculated excess / deficiency amount to the determined reference code amount per one block as the allocated code amount of a block to be processed next by dividing by a number; The truncation means for controlling the variable length coding means so as to terminate the variable length coding so as not to exceed the code amount allocated by the code amount allocation means; A first encoding process of estimating an optimal quantization width from a total code amount using a predetermined temporary quantization width is performed at least once, and then the quantization width prediction unit performs And a control means for performing control so as to execute the second coding process using the predicted optimum quantization width.
【請求項4】画像データをブロックに分割し、この分割
された各ブロックは順にそれそれ直交変換を行って低い
周波数成分から順に高い周波数成分へと前記ブロック毎
の画像データを成分分解し、この変換出力を量子化手段
により量子化し、この量子化出力を可変長符号化手段に
与えて可変長符号化し、各ブロック毎にデータの符号化
をする符号化装置において、 前記可変長符号化手段により符号化された画像全体の変
換係数の符号量を算出する符号量算出手段と、 この符号量算出手段により算出された画像全体の符号量
と、画面あたりの許される目的総符号量とから最適な量
子化幅を予測すると共に、前記量子化手段にこの予測量
子化幅を与える量子化幅予測手段と、 前記ブロックの符号化にあたり、当該符号化処理するブ
ロックでの符号化処理により発生した符号量と当該ブロ
ックでの割当符号量とに基づいてこの発生符号量の前記
割当符号量に対する過不足量を算出すると共に、前記目
的総符号量以下の所定の符号量を総ブロック数で割るこ
とにより、決定された1ブロック当たりの基準符号量に
前記算出した過不足量を加えた符号量を、次の処理する
ブロックの前記割当符号量として求める符号量割当手段
と、 各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように、前記可変長符号化を打
ち切るべく前記可変長符号化手段を制御する打切手段
と、 前記量子化手段に対し、初めに前記目的総符号量から予
め定めた暫定的な量子化幅を用いて最適な量子化幅を予
測する第1の符号化処理を少なくとも1回実施させ、次
に前記量子化幅予測手段により予測された最適な量子化
幅を用いて第2の符号化処理を実施させるべく制御する
制御手段とを備え、 前記可変長符号化手段には、前記直交変換により得られ
る前記各ブロック単位の画像データのうち、直流成分に
ついては手前の符号化処理ブロックでの直流成分との差
分を得ると共にこの差分を可変長符号化する直流成分用
の符号化処理部と、この直流成分の符号化処理部の処理
が終った後、前記交流成分について可変長符号化する交
流成分用の符号化処理部とを設け、前記打切手段は交流
成分用の符号化処理部に対してのみ打ち切り制御を可能
にする構成とすることを特徴とする画像データの符号化
装置。
4. The image data is divided into blocks, and each of the divided blocks is subjected to an orthogonal transform in order to decompose the image data for each block from low frequency components to high frequency components in order. In the encoding device, the transform output is quantized by a quantizing unit, and the quantized output is supplied to a variable length encoding unit to perform variable length encoding, and encodes data for each block. Code amount calculating means for calculating the code amount of the transform coefficient of the entire coded image; optimal code amount based on the code amount of the entire image calculated by the code amount calculating means and the permissible target total code amount per screen. A quantization width prediction unit that predicts a quantization width and provides the prediction quantization width to the quantization unit; and, in encoding the block, a code in a block to be encoded. Calculating the excess or deficiency of the generated code amount with respect to the allocated code amount based on the code amount generated by the conversion process and the allocated code amount in the block, and calculating a predetermined code amount equal to or less than the target total code amount. Code amount allocating means for calculating a code amount obtained by adding the calculated excess / deficiency amount to the determined reference code amount per block by dividing by the number of blocks as the allocated code amount of the next block to be processed; The truncation means for controlling the variable length coding means so as to terminate the variable length coding so as not to exceed the code amount allocated by the code amount allocation means for each block; Performs a first encoding process of predicting an optimum quantization width from the target total code amount using a predetermined temporary quantization width at least once, and then executes the quantization width prediction means. And control means for performing the second encoding process using the optimal quantization width predicted by the above, wherein the variable-length encoding means includes a unit for each block obtained by the orthogonal transform. Among the image data, for the DC component, an encoding processing unit for a DC component that obtains a difference from the DC component in the preceding encoding processing block and performs variable-length encoding of the difference, and an encoding process of the DC component After the processing of the unit is completed, an AC component encoding processing unit that performs variable-length encoding on the AC component is provided, and the truncation unit enables the discontinuation control only for the AC component encoding processing unit. A coding device for image data, wherein
【請求項5】画像データをブロックに分割し、この分割
された各ブロックは順にそれぞれ直交変換を行ってこの
変換出力を量子化手段により量子化し、この量子化出力
を可変長符号化手段に与えて可変長符号化し、各ブロッ
ク毎にデータの符号化をする符号化装置において、 前記ブロックの符号化にあたり、当該符号化処理するブ
ロックでの符号化処理により発生した符号量と当該ブロ
ックでの割当符号量とに基づいてこの発生符号量の前記
割当符号量に対する過不足量を算出すると共に、画像当
りの許される符号量である目的の総符号量のうちの各色
分毎の符号量を該色分のブロック数で割ることにより、
予め決定した1ブロック当たりの基準符号量に前記算出
した過不足量を加えた符号量を次に処理するブロックの
前記割当符号量として求める符号量割当手段と、 各ブロック毎に前記符号量割当手段により割り当てられ
た割当符号量を越えないように、前記可変長符号化を打
ち切るべく前記可変長符号化手段を制御する打切手段と
を備えたことを特徴とする画像データの符号化装置。
5. The image data is divided into blocks, each of the divided blocks is subjected to orthogonal transform in turn, and the transform output is quantized by a quantizing means, and the quantized output is supplied to a variable length coding means. An encoding apparatus that performs variable-length encoding on each block and encodes data for each block. In encoding the block, the amount of code generated by the encoding process in the block to be encoded and the allocation in the block. The amount of excess or deficiency of the generated code amount with respect to the allocated code amount is calculated based on the code amount, and the code amount for each color of the target total code amount, which is the allowable code amount per image, is calculated for the color. By dividing by the number of blocks per minute,
Code amount allocating means for obtaining a code amount obtained by adding the calculated excess / deficiency amount to a predetermined reference code amount per block as the allocated code amount of a block to be processed next; And censoring means for controlling the variable-length coding means so as to stop the variable-length coding so as not to exceed the allocated code amount allocated by (1).
【請求項6】前記量割当手段は画像の中心部のブロック
には周辺のブロックよりも多くの符号量を割り当てるよ
うにしたことを特徴とする前記請求項1〜5いずれか1
項に記載の画像データの符号化装置。
6. The apparatus according to claim 1, wherein said amount allocating means allocates a larger amount of code to a block in a central portion of the image than a peripheral block.
An image data encoding apparatus according to any one of the preceding claims.
JP29392490A 1990-10-31 1990-10-31 Image data encoding device Expired - Lifetime JP2959831B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP29392490A JP2959831B2 (en) 1990-10-31 1990-10-31 Image data encoding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP29392490A JP2959831B2 (en) 1990-10-31 1990-10-31 Image data encoding device

Publications (2)

Publication Number Publication Date
JPH04167868A JPH04167868A (en) 1992-06-15
JP2959831B2 true JP2959831B2 (en) 1999-10-06

Family

ID=17800927

Family Applications (1)

Application Number Title Priority Date Filing Date
JP29392490A Expired - Lifetime JP2959831B2 (en) 1990-10-31 1990-10-31 Image data encoding device

Country Status (1)

Country Link
JP (1) JP2959831B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR950010913B1 (en) * 1992-07-23 1995-09-25 삼성전자주식회사 Vlc & vld system
US5914787A (en) 1992-11-19 1999-06-22 Olympus Optical Co., Ltd. Electronic imaging apparatus
JP2626521B2 (en) * 1993-11-29 1997-07-02 日本電気株式会社 Image transcoder
JP2935334B2 (en) * 1994-07-28 1999-08-16 日本電気株式会社 Code amount control method
JPH10336654A (en) 1997-06-02 1998-12-18 Nec Corp Image encoder
JP3356663B2 (en) 1997-10-22 2002-12-16 松下電器産業株式会社 Image encoding device, image encoding method, and recording medium recording image encoding program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
茂木千佳子、外2名,"DCT符号化における符号量制御方式",1990年電子情報通信学会春季全国大会講演論文集,社団法人電子情報通信学会,平成2年3月,分冊7,P.62(D−310)

Also Published As

Publication number Publication date
JPH04167868A (en) 1992-06-15

Similar Documents

Publication Publication Date Title
JP3012698B2 (en) Image data encoding apparatus and encoding method
US5291282A (en) Image data coding apparatus and method capable of controlling amount of codes
JP3085465B2 (en) Image data encoding apparatus and encoding method
JP3093233B2 (en) Image encoding apparatus and method
US8120671B2 (en) Digital camera for recording a still image while shooting a moving image
JP2959831B2 (en) Image data encoding device
JP2952000B2 (en) Image data encoding apparatus and encoding method
JP3795932B2 (en) Image data compression encoding method and apparatus
JPWO2002080575A1 (en) Image processing apparatus, image processing method, image processing program, and recording medium
JP3406924B2 (en) Image processing apparatus and method
JP3037961B2 (en) Electronic camera device and image data encoding device
JP3038022B2 (en) Electronic camera device
JP2002252759A (en) Image quantization method and device, and image coder utilizing them
JP3192133B2 (en) Electronic camera device
JPH04114564A (en) Picture signal recording device
JPH04207352A (en) Encoding device and encoding method for image data
JPH04179371A (en) Device and method for encoding picture data
JPH04207266A (en) Encoder and encoding method for image data
JPH07115668A (en) Device and method for compressing image
JP3055954B2 (en) Electronic still camera
JPH04343579A (en) Image signal processor
JPH04220875A (en) Encoding device for picture data
JPH04329763A (en) Device and method for coding picture data
JPH06276476A (en) Electronic still camera device
JPH04326858A (en) Device and method for encoding picture data