JP2009004878A - Image processor, image processing method and image processing program, and imaging device - Google Patents

Image processor, image processing method and image processing program, and imaging device Download PDF

Info

Publication number
JP2009004878A
JP2009004878A JP2007161497A JP2007161497A JP2009004878A JP 2009004878 A JP2009004878 A JP 2009004878A JP 2007161497 A JP2007161497 A JP 2007161497A JP 2007161497 A JP2007161497 A JP 2007161497A JP 2009004878 A JP2009004878 A JP 2009004878A
Authority
JP
Japan
Prior art keywords
image processing
encoding
unit
code
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2007161497A
Other languages
Japanese (ja)
Inventor
Koji Ozaki
浩治 尾崎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sony Corp
Original Assignee
Sony Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sony Corp filed Critical Sony Corp
Priority to JP2007161497A priority Critical patent/JP2009004878A/en
Publication of JP2009004878A publication Critical patent/JP2009004878A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To change quantization values in units of image processing, and to facilitate changing processing for quantization values. <P>SOLUTION: An image processing unit 101 performs image enlargement/reduction processing etc., to a digital image signal. Image data after the image processing are JPEG-encoded by a DCT unit 102, a quantization unit 103, and a variable-length encoding/decoding unit 104. An arrangement of data of a code 105 is prescribed through processing of the image processing unit 101. A quantization table adjustment unit 108 which performs code rearrangement performs the rearrangement and outputs a code 109. The code 109 is decoded in a regular processing direction prescribed by an encoding format, for example, JPEG, so as to obtain a desired image. For adjustment of quantization values, conversion between variable-length codes differing in quantization value is performed by replacement of codes using a variable-length code replacement table. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

この発明は、画像信号の圧縮等に適用可能な画像処理装置、画像処理方法および画像処理プログラム、並びに撮像装置に関する。   The present invention relates to an image processing apparatus, an image processing method, an image processing program, and an imaging apparatus that can be applied to compression of an image signal.

画像の歪みを補正する処理、色収差を補正する処理、画像のサイズを拡大または縮小する処理等の画像処理がデジタルスチルカメラ等の撮像装置においてしばしばなされる。また、画像処理で発生した画像データをJPEG(Joint Photographic Experts Group) 、MPEG(Moving Picture Experts Group Phase)等の圧縮符号化によって圧縮することが通常なされている。これらの圧縮符号化においては、マクロブロックと称される画像の単位で符号化を行うようにしている。   Image processing such as processing for correcting image distortion, processing for correcting chromatic aberration, and processing for enlarging or reducing the size of an image is often performed in an imaging apparatus such as a digital still camera. In addition, image data generated by image processing is usually compressed by compression encoding such as JPEG (Joint Photographic Experts Group) or MPEG (Moving Picture Experts Group Phase). In such compression encoding, encoding is performed in units of images called macroblocks.

このように、画像処理の単位が整数個のマクロブロック、すなわち、符号化ブロックからなり、符号化ブロックの配列が符号化で規定されている順序と異なる場合には、後で符号化するデータの分をメモリに保管しておく必要がある。その結果、一時保管用のメモリが必要とされる問題がある。   In this way, when the unit of image processing is an integer number of macroblocks, that is, encoded blocks, and the arrangement of the encoded blocks is different from the order defined by the encoding, the data to be encoded later The minutes need to be stored in memory. As a result, there is a problem that a memory for temporary storage is required.

上述したように、画像サイズ変換のような画像処理を行う場合に、圧縮符号化の符号化単位で画像データを切り出して符号化する時に、メモリからの読み出しを高速に行う必要が生じたり、大容量のメモリを必要とする問題が生じる。   As described above, when image processing such as image size conversion is performed, when image data is cut out and encoded in a coding unit of compression coding, it is necessary to read from memory at high speed or A problem arises that requires a large amount of memory.

このような高速読み出し処理および大容量メモリを必要とする問題点を解決することができる符号化装置が下記の特許文献1によって提案されている。   An encoding apparatus capable of solving such a problem that requires high-speed reading processing and a large-capacity memory has been proposed in Patent Document 1 below.

特開2006−238407号公報JP 2006-238407 A

かかる特許文献1に記載の符号化装置の処理の流れを図18に示す。画像処理部101は、撮像素子からの撮像信号に基づいて形成されたデジタル画像信号に対して、画像の回転処理、リサイズと称される解像度の変換による画像の拡大縮小処理、トリミング処理等を施す。画像処理に適したブロックサイズによる画像処理単位、画像処理順序により、記憶媒体に記録された撮像結果を順次切り出して実行される。   FIG. 18 shows a flow of processing of the encoding device described in Patent Document 1. The image processing unit 101 performs image rotation processing, image enlargement / reduction processing by resolution conversion called resizing, trimming processing, and the like on a digital image signal formed based on an imaging signal from an imaging device. . The imaging results recorded in the storage medium are sequentially cut out and executed in accordance with the image processing unit and the image processing order with a block size suitable for image processing.

画像処理部101からの画像データが(8×8)画素のブロック単位でDCT(Discrete Cosine Transform:離散コサイン変換) 部102において、空間領域から周波数領域へ変換される。DCT部102からの係数データが量子化部103において量子化される。量子化部103の出力が可変長符号化部104に供給され、エントロピー符号化によって情報量が圧縮される。これらのDCT部102、量子化部103および可変長符号化部104によって、JPEG符号化装置が構成される。   Image data from the image processing unit 101 is converted from a spatial domain to a frequency domain in a DCT (Discrete Cosine Transform) unit 102 in units of (8 × 8) pixel blocks. The coefficient data from the DCT unit 102 is quantized in the quantization unit 103. The output of the quantization unit 103 is supplied to the variable length coding unit 104, and the amount of information is compressed by entropy coding. The DCT unit 102, the quantization unit 103, and the variable length encoding unit 104 constitute a JPEG encoding apparatus.

可変長符号化部104の出力に得られる符号105のデータの並びは、画像処理部101の処理によって規定されるものである。これに対してJPEGの符号化処理は、マクロブロックによる符号化処理単位を順次ラスタ走査順に符号化処理することがフオーマットにより規定されている。したがって、画像処理の順序の並びを有する符号105を復号した場合に、所望の画像と異なった画像になってしまう。   The arrangement of the code 105 data obtained at the output of the variable length coding unit 104 is defined by the processing of the image processing unit 101. On the other hand, in the JPEG encoding process, the format stipulates that encoding processing units of macroblocks are sequentially encoded in raster scanning order. Therefore, when the code 105 having the order of the image processing is decoded, an image different from the desired image is obtained.

この問題を解決するために、大容量のバッファメモリを使用しないで、符号並べ替え部106により並べ替えを行い、並べ替え後の符号107を出力する。符号107は、例えば記憶媒体に記録される。この符号107は、符号化フォーマット例えばJPEGで規定されている正規の処理方向でもって復号した場合に所望の画像が得られる。   In order to solve this problem, rearrangement is performed by the code rearrangement unit 106 without using a large-capacity buffer memory, and the rearranged code 107 is output. Reference numeral 107 is recorded in, for example, a storage medium. When the code 107 is decoded in a normal processing direction defined by an encoding format such as JPEG, a desired image can be obtained.

上述した符号化方法において、量子化方法が所定のものである場合には、符号化中に符号107の符号量を制御することができない問題があった。例えばJPEGの場合では、量子化テーブルを可変することができないように規定されている。また、符号並べ替えによって符号量が変化するが、その変化を考慮して量子化テーブルを規定するものではなかった。さらに、符号量を制御するために、符号107を復号して再度符号化すると、処理時間が長くなったり、処理に必要なメモリ量が増加する問題があった。   In the encoding method described above, when the quantization method is a predetermined one, there is a problem that the code amount of the code 107 cannot be controlled during the encoding. For example, in the case of JPEG, it is defined that the quantization table cannot be changed. Further, although the code amount changes due to code rearrangement, the quantization table is not defined in consideration of the change. Further, when the code 107 is decoded and encoded again in order to control the code amount, there are problems that the processing time becomes long and the memory amount necessary for the process increases.

したがって、この発明の目的は、量子化テーブルや量子化スケールを含めた量子化値が一つと規定されている場合でも、複数の量子化値を用いて符号量を細かく調整でき、また、復号および再符号化を行わないでも符号量の調整が可能で、さらに、並べ替えの処理と同時に符号量を調整することができる画像処理装置、画像処理方法および画像処理プログラム、並びに撮像装置を提供することにある。   Therefore, an object of the present invention is to finely adjust the code amount using a plurality of quantized values, even when a quantized value including a quantization table and a quantizing scale is defined as one, and decoding and decoding To provide an image processing device, an image processing method, an image processing program, and an imaging device capable of adjusting the code amount without re-encoding and further adjusting the code amount simultaneously with the rearrangement process. It is in.

上述した課題を解決するために、この発明は、画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、
画像処理部の処理単位の領域毎に量子化値を調整すると共に、画像処理部の処理方向から符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更ステップと
を有する画像処理方法である。
また、この発明は、画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法であって、
変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、量子化値変更ステップとを有する画像処理方法において、
量子化値変更ステップは、少なくとも1つの符号は可変長符号と量子化値とから新たな量子化値に対応する可変長符号へ直接置き換えを行うことで量子化値を変更する画像処理方法である。
In order to solve the above-described problems, the present invention provides an image processing method in which image data processed by an image processing unit is encoded in a predetermined encoding unit by an encoding unit.
An encoding step of performing conversion in the order of data output from the image processing unit, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient;
A rearrangement / quantization value change step for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to a normal processing direction defined by encoding. An image processing method.
The present invention is also an image processing method for encoding image data in a predetermined encoding unit by an encoding unit,
In an image processing method having an encoding step for performing conversion, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient, and a quantization value changing step,
The quantization value changing step is an image processing method for changing a quantization value by directly replacing at least one code from a variable length code and a quantization value to a variable length code corresponding to a new quantization value. .

この発明は、画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法をコンピュータによって実行させるプログラムにおいて、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、
画像処理部の処理単位の領域毎に量子化値を調整すると共に、画像処理部の処理方向から符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更ステップと
を有する画像処理方法のプログラムである。
The present invention relates to a program for causing a computer to execute an image processing method for encoding image data processed by an image processing unit in a predetermined encoding unit in an encoding unit.
An encoding step of performing conversion in the order of data output from the image processing unit, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient;
A rearrangement / quantization value change step for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to a normal processing direction defined by encoding. A program for an image processing method.

この発明は、画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理装置において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化部と、
画像処理部の処理単位の領域毎に量子化値を調整すると共に、画像処理部の処理方向から符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更部と
を有する画像処理装置である。
The present invention relates to an image processing apparatus for encoding image data processed by an image processing unit in a predetermined encoding unit by an encoding unit.
An encoding unit that performs conversion in the order of data output from the image processing unit, quantizes coefficient data generated by the conversion, and variable-length-encodes the quantized coefficient;
A reordering / quantization value changing unit that adjusts the quantization value for each processing unit area of the image processing unit and performs reordering from the processing direction of the image processing unit to a normal processing direction defined by encoding. An image processing apparatus.

この発明は、撮像素子によって撮影された画像データに対して画像処理を行う画像処理部と、画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化する符号化部を有する撮像装置において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化部と、
画像処理部の処理単位の領域毎に量子化値を調整すると共に、画像処理部の処理方向から符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更部と
を有する撮像装置である。
The present invention includes an image processing unit that performs image processing on image data captured by an image sensor, and an encoding unit that encodes image data processed by the image processing unit in a predetermined encoding unit by an encoding unit. In an imaging apparatus having
An encoding unit that performs conversion in the order of data output from the image processing unit, quantizes coefficient data generated by the conversion, and variable-length-encodes the quantized coefficient;
A reordering / quantization value changing unit that adjusts the quantization value for each processing unit area of the image processing unit and performs reordering from the processing direction of the image processing unit to a normal processing direction defined by encoding. It is an imaging device having.

この発明においては、例えば画像処理単位でもって量子化値を調整することによって、細かな単位でもって符号量を制御することができる。JPEGのような符号化後に量子化値を変更するので、単一の量子化値を使用することが規定されている符号化方法であっても、規定に反しないで符号量を細かく調整することができる。また、符号量制御のために、可変長符号と量子化値とから新たな量子化値に対応する可変長符号へ直接置き換えを行うことによって、復号および再符号化の処理を行わないようにできるので、処理時間が長くなること、使用するメモリ量が増大することを回避することができる。さらに、並べ替えと同時に符号量を調整する場合、並べ替えのために得た情報を有効に利用して符号量の調整の精度を高くすることができる。   In the present invention, for example, by adjusting the quantization value in units of image processing, it is possible to control the code amount in fine units. Since the quantization value is changed after encoding such as JPEG, even if the encoding method is specified to use a single quantization value, the code amount is finely adjusted without violating the specification. Can do. In addition, for code amount control, decoding and re-encoding processing can be avoided by directly replacing a variable-length code and a quantized value with a variable-length code corresponding to a new quantized value. Therefore, it is possible to avoid an increase in processing time and an increase in the amount of memory used. Further, when the code amount is adjusted simultaneously with the rearrangement, the accuracy of the adjustment of the code amount can be increased by effectively using the information obtained for the rearrangement.

この発明の一実施形態について説明すると、図1は、この発明による撮像装置例えばデジタルスチルカメラの一実施形態の構成を示す。図1において、参照符号1がレンズ装置を示し、参照符号2がCCD(Charge Coupled Device)、CMOS(Complementary Metal Oxide Semiconductor) 等の撮像素子を示す。撮像素子2に対しては、例えばBayer 配列の三原色カラーフィルタが設けられており、撮像素子2の出力として三原色信号が得られる。この三原色信号がA/Dコンバータ3によってデジタル信号へ変換される。   An embodiment of the present invention will be described. FIG. 1 shows a configuration of an embodiment of an imaging apparatus according to the present invention, for example, a digital still camera. In FIG. 1, reference numeral 1 indicates a lens device, and reference numeral 2 indicates an image sensor such as a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS). For example, a three-primary color filter having a Bayer array is provided for the image sensor 2, and a three-primary color signal is obtained as an output of the image sensor 2. The three primary color signals are converted into digital signals by the A / D converter 3.

A/Dコンバータ3からのデジタル撮像信号がLSI(Large Scale Integrated Circuit :大規模集積回路) の構成とされたデジタル処理のカメラ信号処理部4に入力される。カメラ信号処理部4では、ホワイトバランス補正処理、補間処理、フィルタリング処理、マトリクス演算処理、ガンマ補正処理、輝度信号(Y)生成処理、色差信号(Cr,Cb)生成処理等を行う。カメラ信号処理部4によって生成された画像信号がディスプレイ5に供給され、撮像画像が表示される。また、カメラ信号処理部4からの画像データがサイズ変換、圧縮処理等を受けて内部または外部のストレージ9に記憶される。   A digital image pickup signal from the A / D converter 3 is input to a digital processing camera signal processing unit 4 having an LSI (Large Scale Integrated Circuit) configuration. The camera signal processing unit 4 performs white balance correction processing, interpolation processing, filtering processing, matrix calculation processing, gamma correction processing, luminance signal (Y) generation processing, color difference signal (Cr, Cb) generation processing, and the like. The image signal generated by the camera signal processing unit 4 is supplied to the display 5 and a captured image is displayed. Further, the image data from the camera signal processing unit 4 is subjected to size conversion, compression processing, etc., and stored in the internal or external storage 9.

ホワイトバランス補正処理は、被写体の色温度環境の違い、カラーフィルタによる感度の違いによる各色間のアンバランスが補正する。補間処理は、存在していない色信号を補間する処理である。フィルタリング処理は、高域周波数補正処理であり、輪郭強調のための処理である。マトリクス演算処理は、撮像信号をsRGBへ変換する処理である。ガンマ補正処理によって、表示装置が有する非線形特性の逆補正を予め行うことで、最終的にリニアな特性が実現される。   In the white balance correction process, an unbalance between colors due to a difference in color temperature environment of the subject and a difference in sensitivity due to the color filter is corrected. The interpolation process is a process for interpolating color signals that do not exist. The filtering process is a high-frequency correction process and is a process for contour enhancement. The matrix calculation process is a process for converting the imaging signal into sRGB. By performing reverse correction of the non-linear characteristic of the display device in advance by the gamma correction process, a linear characteristic is finally realized.

輝度信号生成処理は、ガンマ補正されたRGB信号を所定の合成比で合成することによって輝度信号を生成する。色差信号生成処理ブロックは、ガンマ補正されたRGB信号を所定の合成比で合成することによって色差信号を生成する。生成された色差信号が帯域制限の処理を受け、色差信号CbおよびCrが生成される。   In the luminance signal generation process, a luminance signal is generated by synthesizing the gamma-corrected RGB signal at a predetermined synthesis ratio. The color difference signal generation processing block generates a color difference signal by synthesizing the gamma-corrected RGB signal at a predetermined synthesis ratio. The generated color difference signal is subjected to band limitation processing, and color difference signals Cb and Cr are generated.

カメラ信号処理部4の出力(Y,Cr,Cb)がサイズ変更等の画像処理を行う画像処理部6に入力され、例えば画像サイズが等倍、拡大または縮小される。画像処理部6の出力データが例えばJPEGの符号化/復号化部7に入力される。符号化/復号化部7は、DCTと量子化逆量子化器と可変長符号化/復号化器とから構成されている。なお、画像処理部6は、撮像信号に対して直接的に画像処理を施す場合に限らず、ストレージ9に記録されている符号化データを符号化/復号化部7において復号した画像データに対して画像処理を施す場合もある。   The output (Y, Cr, Cb) of the camera signal processing unit 4 is input to an image processing unit 6 that performs image processing such as a size change, and for example, the image size is enlarged, enlarged, or reduced. The output data of the image processing unit 6 is input to the JPEG encoding / decoding unit 7, for example. The encoder / decoder 7 includes a DCT, a quantization inverse quantizer, and a variable length encoder / decoder. Note that the image processing unit 6 is not limited to performing image processing directly on the imaging signal, and the image data recorded in the storage 9 is decoded with respect to the image data decoded by the encoding / decoding unit 7. In some cases, image processing may be performed.

DCTでは、(8×8)画素のブロック単位にDCT演算がなされ、DC(Direct Current :直流) 係数成分およびAC(Alternate Current:交流) 係数成分からなるDCT係数成分が得られる。DC係数成分およびAC係数成分が量子化テーブルによって量子化される。量子化されたDC係数成分は、直前のブロックのDC係数成分との差分値が符号化される。但し、区切りを示す所定の値のコードである区切りコードが挿入された直後は、DC係数成分の値自体が符号化される。また、区切りコードの長さは、量子化テーブルを変更しても変わらないため、区切りコード以外の符号量変化が全体の符号量変化となる。区切りコードの挿入の有無では、区切りコードがない方が量子化前のDC係数値が小さくなるのが通常であり、このため区切りコード分を除いて比較しても符号量は小さくなることが多い。量子化されたAC係数成分の場合には、ブロック内でジグザクスキャンによって並べ替えた後に可変長符号化される。量子テーブルを変化させる場合でも、同じDCTブロックのDC係数成分およびAC係数成分に対しては同一の量子化テーブルでもって量子化がなされる。   In DCT, a DCT operation is performed for each block of (8 × 8) pixels, and a DCT coefficient component including a DC (Direct Current) coefficient component and an AC (Alternate Current) coefficient component is obtained. The DC coefficient component and the AC coefficient component are quantized by the quantization table. The quantized DC coefficient component is encoded with a difference value from the DC coefficient component of the immediately preceding block. However, immediately after a delimiter code that is a code of a predetermined value indicating a delimiter is inserted, the value of the DC coefficient component itself is encoded. Further, since the length of the delimiter code does not change even if the quantization table is changed, the change in the code amount other than the delimiter code becomes the entire code amount change. In the presence or absence of a delimiter code, it is normal that the DC coefficient value before quantization is smaller when there is no delimiter code. For this reason, the amount of code is often small even when compared excluding the delimiter code. . In the case of the quantized AC coefficient component, it is subjected to variable length coding after being rearranged by zigzag scanning within the block. Even when the quantum table is changed, the DC coefficient component and the AC coefficient component of the same DCT block are quantized with the same quantization table.

なお、同じDCTブロックのDC係数成分およびAC係数成分に対しては異なる量子化テーブルでもって量子化を行ってもよいが、DCTブロック数が画像内にある程度の数があればDCT内で変化させなくても十分符号量の制御が可能であり、また、管理が煩雑になるので、ここでは、同一の量子化テーブルを用いる。   Note that the DC coefficient component and the AC coefficient component of the same DCT block may be quantized using different quantization tables. However, if there is a certain number of DCT blocks in the image, it is changed within the DCT. The code amount can be sufficiently controlled even if it is not necessary, and the management becomes complicated, so the same quantization table is used here.

符号化/復号化部7によって圧縮された圧縮画像データが並べ替え・量子化値調整(変更)部8に供給される。並べ替え・量子化値調整部8は、JPEGで規定された正規の処理方向へ圧縮画像データを並べ替えると共に、量子化値を符号量を一定とするために変更する。ここで、正規の処理方向とは、JPEGで復号した場合に元の画像が得られる符号化の順序を意味する。また、量子化値は、JPEGの場合では、量子化テーブルを意味する。量子化テーブルと量子化スケールを組み合わせて量子化を行う場合には、量子化テーブルおよび量子化スケールが量子化値である。符号化画像データがストレージ9に記憶される。なお、符号化/復号化部7が復号処理を行う場合には、ストレージ9の読み出しデータを逆量子化し、逆量子化出力を逆DCTするようになされる。   The compressed image data compressed by the encoding / decoding unit 7 is supplied to the rearrangement / quantization value adjustment (change) unit 8. The rearrangement / quantization value adjustment unit 8 rearranges the compressed image data in the normal processing direction defined by JPEG, and changes the quantization value to make the code amount constant. Here, the normal processing direction means an encoding order in which an original image is obtained when decoding with JPEG. In addition, the quantization value means a quantization table in the case of JPEG. When quantization is performed by combining a quantization table and a quantization scale, the quantization table and the quantization scale are quantization values. The encoded image data is stored in the storage 9. When the encoding / decoding unit 7 performs a decoding process, the read data of the storage 9 is inversely quantized and the inversely quantized output is inversely DCTed.

上述したデジタルスチルカメラの信号処理等を制御するために、CPU(Central Processing Unit) 11が備えられている。カメラ信号処理部4、画像処理部6、符号化/復号化部7、並べ替え回路8、ストレージ9は、CPUバス12を介してCPU11と接続され、CPU11によって制御可能な構成とされている。CPU11には、ユーザが操作するスイッチ、GUI(Graphical User Interface)等のキー13の出力が入力される。さらに、CPUバス12に対してプログラム等が格納されているROM14およびCPU11の作業用のメモリとしてのRAM15が接続されている。RAM15には、CPU11の制御によって画像データが蓄積可能とされている。なお、図1の構成では、簡単のため、ストレージ9から読み出された圧縮画像データをデコードしてディスプレイ5に表示するための構成については省略されている。   A CPU (Central Processing Unit) 11 is provided to control the signal processing and the like of the digital still camera described above. The camera signal processing unit 4, the image processing unit 6, the encoding / decoding unit 7, the rearrangement circuit 8, and the storage 9 are connected to the CPU 11 via the CPU bus 12 and can be controlled by the CPU 11. The CPU 11 receives an output of a key 13 such as a switch operated by a user and a GUI (Graphical User Interface). Further, a ROM 14 storing programs and the like and a RAM 15 as a working memory for the CPU 11 are connected to the CPU bus 12. Image data can be stored in the RAM 15 under the control of the CPU 11. In the configuration of FIG. 1, for simplicity, the configuration for decoding the compressed image data read from the storage 9 and displaying it on the display 5 is omitted.

この発明は、上述したデジタルスチルカメラの構成中で、画像処理部6、符号化/復号化部7、並べ替え・量子化値(JPEGでは上述したように量子化テーブル)調整部8における処理において、高速の処理および大容量メモリを不要とするものである。なお、この一実施形態におけるJPEGは、符号化単位としてのマクロブロックのサイズが(16×8)画素であり、マクロブロックが(8×8)画素の輝度(Y)ブロックの2個と、それぞれが(8×8)画素の色差(Cr,Cb)ブロックとから構成されている。色差データの水平方向の画素の間隔は、輝度データの2倍とされている。したがって、1画素当たりの平均ビット数は、(Y=8ビット、Cr=4ビット,Cb=4ビット)の16ビットとなる。輝度データおよび二つの色差データは、分離してそれぞれ処理の対象とされる。色差データの処理は、輝度データと同様であるので、以下の説明では、輝度データの処理について説明する。   In the configuration of the above-described digital still camera, the present invention performs processing in the image processing unit 6, the encoding / decoding unit 7, and the rearrangement / quantization value (quantization table as described above in JPEG) adjustment unit 8. High-speed processing and large-capacity memory are unnecessary. Note that the JPEG in this embodiment has a macroblock size of (16 × 8) pixels as a coding unit, two macroblock (8 × 8) luminance (Y) blocks, Are composed of (8 × 8) pixel color difference (Cr, Cb) blocks. The interval between the pixels of the color difference data in the horizontal direction is twice that of the luminance data. Therefore, the average number of bits per pixel is 16 bits (Y = 8 bits, Cr = 4 bits, Cb = 4 bits). The luminance data and the two color difference data are separately processed. Since the processing of the color difference data is the same as that of the luminance data, the luminance data processing will be described in the following description.

最初に、この発明の処理の概略について図2を参照して説明する。画像処理部101は、撮像素子からの撮像信号に基づいて形成されたデジタル画像信号、または記憶媒体から読み出されたデジタル画像信号に対して、リサイズと称される解像度の変換による画像の拡大縮小処理、画像の回転処理、色収差補正処理、画像歪み補正処理、カメラ信号処理、白黒反転処理、色空間変換処理、フィルタリング処理等の画像処理を行う。画像処理に適したブロックサイズによる画像処理単位、画像処理順序により、記憶媒体に記録された撮像結果が順次切り出される。   First, the outline of the processing of the present invention will be described with reference to FIG. The image processing unit 101 enlarges / reduces an image by converting a resolution called resizing a digital image signal formed based on an imaging signal from an imaging device or a digital image signal read from a storage medium. Image processing such as processing, image rotation processing, chromatic aberration correction processing, image distortion correction processing, camera signal processing, black-and-white inversion processing, color space conversion processing, and filtering processing is performed. The imaging results recorded in the storage medium are sequentially cut out in accordance with the image processing unit and the image processing order with a block size suitable for image processing.

画像処理部101からの画像データが(8×8)画素のブロック単位でDCT部102において、空間領域から周波数領域へ変換される。DCT部102からの(8×8)の係数データが量子化部103に対してジグザクスキャンの順序で出力され、量子化部103において量子化される。量子化は、係数データを量子化テーブル内の量子化値でそれぞれ除算し、除算結果を四捨五入する処理である。量子化値は、(8×8)の係数データに対して同一ではなく、各係数データに対して適切な値の量子化値が使用される。しかしながら、この明細書においては、発明の理解を容易とするために、単一の値の量子化値からなる量子化テーブルが使用されるものとする。   The image data from the image processing unit 101 is converted from the spatial domain to the frequency domain in the DCT unit 102 in units of (8 × 8) pixel blocks. The (8 × 8) coefficient data from the DCT unit 102 is output to the quantization unit 103 in the zigzag scan order, and is quantized by the quantization unit 103. Quantization is a process of dividing coefficient data by the quantization value in the quantization table and rounding off the division result. The quantization value is not the same for (8 × 8) coefficient data, and an appropriate quantization value is used for each coefficient data. However, in this specification, in order to facilitate understanding of the invention, it is assumed that a quantization table including a single value of a quantization value is used.

量子化部103の出力が可変長符号化/復号化部104に供給され、エントロピー符号化によって情報量が圧縮される。例えばゼロランとレベルとに応じた可変長符号が割り当てられる。これらのDCT部102、量子化部103および可変長符号化/復号化部104によって、JPEGエンコーダが構成される。   The output of the quantization unit 103 is supplied to the variable length coding / decoding unit 104, and the information amount is compressed by entropy coding. For example, variable length codes corresponding to zero runs and levels are assigned. The DCT unit 102, the quantization unit 103, and the variable length encoding / decoding unit 104 constitute a JPEG encoder.

可変長符号化/復号化部104の出力に得られる符号105のデータの並びは、画像処理部101の処理によって規定されるものである。これに対してJPEG等の符号化処理は、マクロブロックによる符号化処理単位を順次ラスタ走査順に符号化処理することがフオーマットにより規定されている。したがって、画像処理の順序の並びを有する符号105を復号した場合に、所望の画像と異なった画像になってしまう。   The arrangement of the code 105 data obtained at the output of the variable length encoding / decoding unit 104 is defined by the processing of the image processing unit 101. On the other hand, in encoding processing such as JPEG, the format specifies that encoding processing units of macroblocks are sequentially encoded in raster scanning order. Therefore, when the code 105 having the order of the image processing is decoded, an image different from the desired image is obtained.

この問題を解決するために、大容量のバッファメモリを使用しないで、符号並べ替え・量子化値調整部108により並べ替えを行い、符号109を出力する。符号109は、例えば記憶媒体に記録される。この符号109は、符号化フォーマット例えばJPEGで規定されている正規の処理方向でもって復号した場合に所望の画像が得られる。   In order to solve this problem, rearrangement is performed by the code rearrangement / quantization value adjustment unit 108 without using a large-capacity buffer memory, and a code 109 is output. The code | symbol 109 is recorded on a storage medium, for example. When the code 109 is decoded in a normal processing direction defined by an encoding format such as JPEG, a desired image can be obtained.

符号化処理についてより具体的に図3を参照して説明する。簡単のために、DCTブロックが(4×4)画素からなるものとしている。DCT部102によって、(4×4)の係数データが得られる。左上コーナーにDC成分値(例えば8)が存在する。   The encoding process will be described more specifically with reference to FIG. For simplicity, it is assumed that the DCT block consists of (4 × 4) pixels. The DCT unit 102 obtains (4 × 4) coefficient data. There is a DC component value (for example, 8) in the upper left corner.

量子化部103によって量子化値(例えば3の値)でもって各係数データが除算され、除算結果が四捨五入されることで量子化係数が得られる。量子化係数が例えばジグザグスキャンの順序で順に出力されると共に、ゼロの数が計数される。その結果、レベルとゼロの数(ゼロラン)との組合せのデータが得られる。   Each coefficient data is divided by a quantization value (for example, a value of 3) by the quantization unit 103, and the division result is rounded to obtain a quantized coefficient. The quantized coefficients are sequentially output in the order of, for example, zigzag scanning, and the number of zeros is counted. As a result, a combination of the level and the number of zeros (zero run) is obtained.

レベルとゼロの数との組合せのデータが可変長符号化部104に供給される。可変長符号化部104が備えるハフマンテーブルが参照されて可変長符号(ハフマン符号)が得られる。   Data of a combination of the level and the number of zeros is supplied to the variable length coding unit 104. A variable length code (Huffman code) is obtained by referring to the Huffman table provided in the variable length coding unit 104.

図3に示される一連の処理がJPEGの符号化である。符号量を調整する一つの方法として、図4に示すように復号化を行う方法がある。上述した符号化により得られた可変長符号を可変長復号化部111によって復号する。復号の結果、レベルとゼロの数(ゼロラン)との組合せのデータが得られる。逆量子化部112は、量子化と逆の処理、すなわち、各係数データに対して(3)を乗じる。その結果、(4×4)のDCT係数成分が得られる。   A series of processes shown in FIG. 3 is JPEG encoding. One method for adjusting the code amount is to perform decoding as shown in FIG. The variable length decoding unit 111 decodes the variable length code obtained by the encoding described above. As a result of decoding, data of a combination of the level and the number of zeros (zero run) is obtained. The inverse quantization unit 112 multiplies each coefficient data by (3), which is the reverse process of quantization. As a result, (4 × 4) DCT coefficient components are obtained.

量子化部103は、符号量を調整するために、異なる値の量子化値例えば(4)の量子化値によって各係数データを除算し、除算結果を四捨五入して量子化係数が得られる。量子化値が(3)に対して(4)へ増大されているので、量子化係数がより小さくなる。量子化係数が例えばジグザグスキャンの順序で順に出力されると共に、ゼロの数が計数される。その結果、レベルとゼロの数との組合せのデータが得られる。   In order to adjust the code amount, the quantization unit 103 divides each coefficient data by the quantized values of different values, for example, the quantized value of (4), and rounds the division result to obtain the quantized coefficients. Since the quantization value is increased from (3) to (4), the quantization coefficient becomes smaller. The quantized coefficients are sequentially output in the order of, for example, zigzag scanning, and the number of zeros is counted. As a result, a combination of level and number of zeros is obtained.

レベルとゼロの数との組合せのデータが可変長符号化部104に供給される。可変長符号化部104が備えるハフマンテーブルが参照されてハフマン符号が得られる。例えば量子化テーブルを順に増加(または減少)させて、発生する可変長符号の符号量が割り当て符号量以下になるように、復号化と再符号化とが繰り返しなされ、最適な量子化テーブルが求められる。   Data of a combination of the level and the number of zeros is supplied to the variable length coding unit 104. A Huffman code is obtained by referring to the Huffman table provided in the variable length coding unit 104. For example, the quantization table is increased (or decreased) in order, and decoding and re-encoding are repeated so that the code amount of the generated variable-length code is less than or equal to the assigned code amount, and an optimal quantization table is obtained. It is done.

このように、DCT係数データを使用して復号化および再符号化によって、例えば1画面の符号量をほぼ割り当て符号量とする方法は、処理時間が長くなったり、復号化のためのメモリを必要とする問題がある。   As described above, the decoding and re-encoding using the DCT coefficient data, for example, a method in which the code amount of one screen is substantially allocated code amount, requires a long processing time and requires a memory for decoding. There is a problem.

復号化および再符号化を行わないで量子化テーブルを調整する方法として、図5に示すように、可変長符号置き換えテーブル121を使用するものが好ましい。可変長符号置き換えテーブル121による符号の置き換えでもって、量子化値が相違する可変長符号同士の変換を行うことができる。この符号の置き換え処理は、並べ替え・量子化値調整部8においてなされる。   As a method for adjusting the quantization table without performing decoding and re-encoding, it is preferable to use a variable-length code replacement table 121 as shown in FIG. Conversion of variable length codes having different quantization values can be performed by code replacement by the variable length code replacement table 121. This code replacement process is performed in the rearrangement / quantization value adjustment unit 8.

図5に示す例は、図3および図4を参照して説明した量子化値が(3)の可変長符号を量子化値(4)の可変長符号へ変換する例である。この場合には、可変長符号を復号し、再符号化することが不要であり、処理時間を短縮化することができる。但し、可変長符号置き換えテーブル121を使用できるのは、AC係数成分であり、DC係数成分は、可変長符号置き換えテーブル121を使用した量子化値の変更ができない。AC係数成分とDC係数成分に対する符号化処理は、並列的になされる。DC係数成分に対する符号化処理については後述する。   The example shown in FIG. 5 is an example in which the variable length code with the quantization value (3) described with reference to FIGS. 3 and 4 is converted into the variable length code with the quantization value (4). In this case, it is not necessary to decode and re-encode the variable length code, and the processing time can be shortened. However, the AC coefficient component can be used for the variable length code replacement table 121, and the quantized value using the variable length code replacement table 121 cannot be changed for the DC coefficient component. The encoding process for the AC coefficient component and the DC coefficient component is performed in parallel. The encoding process for the DC coefficient component will be described later.

可変長符号置き換えテーブル121の作成方法について図6および図7を参照して説明する。なお、図7の例は、複数の量子化値(3)と(4)とを量子化値(5)へ変換する場合である。最初のステップS101において、符号量などから新規の量子化値を決定する。例えば後述するように、並べ替えのための必要とされる事前符号化で得られた符号長の情報を利用して初期的な量子化値の値が設定される。   A method for creating the variable-length code replacement table 121 will be described with reference to FIGS. The example of FIG. 7 is a case where a plurality of quantized values (3) and (4) are converted into quantized values (5). In the first step S101, a new quantization value is determined from the code amount or the like. For example, as will be described later, an initial quantized value is set using code length information obtained by pre-encoding required for rearrangement.

ステップS102において、量子化値変更前のすべてのブロックのハフマン符号をすべて列挙する。図7には、ステップS102に対応して列挙された元のハフマン符号の一例が示されている。各ハフマン符号の意味については、テーブルTBLに示されている。   In step S102, all the Huffman codes of all blocks before the quantization value change are listed. FIG. 7 shows an example of the original Huffman codes listed corresponding to step S102. The meaning of each Huffman code is shown in the table TBL.

ステップS103では、以前に同一量子化値で且つ同一ハフマンテーブルのブロックを処理したか否かが判定される。若し、判定結果が肯定であれば、ステップS104に処理が移り、次のブロックが処理対象とされる。   In step S103, it is determined whether a block having the same quantization value and the same Huffman table has been processed before. If the determination result is affirmative, the process moves to step S104, and the next block is set as a processing target.

ステップS103の判定結果が否定であれば、ステップS105において、ブロックの量子化値を読み出し、新規の列に量子化値変更前の変更前ハフマン符号に対応する値を作成する。図7には、ステップS105に対応して、作成された量子化値変更前の変更前ハフマン符号に対応する値(1,2,3,4,5,6)(テーブルTBL参照)が示されている。   If the determination result in step S103 is negative, the quantization value of the block is read in step S105, and a value corresponding to the pre-change Huffman code before the quantization value change is created in a new column. FIG. 7 shows values (1, 2, 3, 4, 5, 6) (see table TBL) corresponding to the generated pre-change Huffman code before changing the quantized value, corresponding to step S105. ing.

ステップS106において、変更前ハフマン符号に対応する値を変更前量子化値(3)で逆量子化する。図7には、ステップS106に対応して、逆量子化の結果の値(3,6,9,12,15,18)が示されている。   In step S106, the value corresponding to the pre-change Huffman code is inversely quantized with the pre-change quantized value (3). FIG. 7 shows values (3, 6, 9, 12, 15, 18) of the result of inverse quantization corresponding to step S106.

ステップS107において、変更前ハフマン符号に対応する値を変更後量子化値(5)によって量子化する。図7には、ステップS107に対応して、量子化係数(1,1,2,2,3,4)が示されている。   In step S107, the value corresponding to the pre-change Huffman code is quantized with the post-change quantization value (5). FIG. 7 shows the quantization coefficients (1, 1, 2, 2, 3, 4) corresponding to step S107.

ステップS108において、変更後の量子化値で量子化した値を変更後ハフマン符号で符号化する。図7には、ステップS108に対応して、量子化係数(1,1,2,2,3,4)を変更後ハフマン符号で符号化した結果が示されている。   In step S108, the value quantized with the changed quantization value is encoded with the changed Huffman code. FIG. 7 shows the result of encoding the quantized coefficients (1, 1, 2, 2, 3, 4) with the changed Huffman code corresponding to step S108.

ステップS109において、すべてのブロックについて処理が終了したか否かが判定される。処理が終了したと判定されると、可変長符号置き換えテーブル作成処理が終了する。そうでない場合には、ステップS104にて次のブロックへ処理が移行する。   In step S109, it is determined whether or not processing has been completed for all blocks. When it is determined that the process is finished, the variable-length code replacement table creation process is finished. If not, the process proceeds to the next block in step S104.

上述した処理は、量子化値が(3)の場合であるが、量子化値が(4)の場合の処理の例が図7に示されている。すなわち、ステップS105において、量子化値変更前の変更前ハフマン符号(元の符号)に対応する値が作成される。   The process described above is for the case where the quantized value is (3), but FIG. 7 shows an example of the process when the quantized value is (4). That is, in step S105, a value corresponding to the pre-change Huffman code (original code) before the quantization value change is created.

ステップS106において、変更前ハフマン符号に対応する値が変更前の量子化値(4)によって逆量子化される。ステップS107において、変更前ハフマン符号に対応する値を変更後の量子化値(5)で量子化する。ステップS108において、変更後の量子化値で量子化した値を変更後ハフマン符号で符号化する。   In step S106, the value corresponding to the pre-change Huffman code is inversely quantized with the quantized value (4) before the change. In step S107, the value corresponding to the pre-change Huffman code is quantized with the post-change quantization value (5). In step S108, the value quantized with the changed quantization value is encoded with the changed Huffman code.

上述したように作成された可変長符号置き換えテーブルの各欄の意味が図8Aに示され可変長符号置き換えテーブルの参照方法が図8Bに示されている。元の符号の列は、変更前符号を意味する。量子化値3および量子化値4は、変更前の量子化値である。残りの符号が変更後の符号である。   The meaning of each column of the variable length code replacement table created as described above is shown in FIG. 8A, and the reference method of the variable length code replacement table is shown in FIG. 8B. The original code string means the code before change. The quantized value 3 and the quantized value 4 are quantized values before being changed. The remaining codes are the codes after the change.

図8Bに示すように、例えば変更前の量子化値が量子化値4で、元の符号が(100)の場合、変更後の新しい符号が(011)である。   As shown in FIG. 8B, for example, when the quantized value before the change is the quantized value 4 and the original code is (100), the new code after the change is (011).

JPEGは、係数データを一つの量子化テーブルで量子化する符号化方法である。しかしながら、JPEG符号化後には、図9に示すように、1枚の画像を例えば3個の領域A,B,Cに分割する場合に、各領域の量子化テーブルを個々に設定することができる。各領域は、画像処理の単位であり、各領域のデータは、並べ替えの対象のデータである。そして、最終的には、領域A,B,Cそれぞれを図6での一つのブロックとして処理して図6の処理を行い、図8の変換テーブルを作成し、図8のテーブルでの変換や後述する図13の処理を行うことで、領域A,B,Cそれぞれで用いた複数の量子化テーブルが一つに変更されて符号化の規格に合った符号化データが形成される。   JPEG is an encoding method in which coefficient data is quantized using a single quantization table. However, after JPEG encoding, as shown in FIG. 9, when one image is divided into, for example, three areas A, B, and C, the quantization table for each area can be individually set. . Each area is a unit of image processing, and data in each area is data to be rearranged. Finally, each of the areas A, B, and C is processed as one block in FIG. 6 and the processing in FIG. 6 is performed to create the conversion table in FIG. By performing the processing of FIG. 13 described later, a plurality of quantization tables used in each of the regions A, B, and C are changed to one, and encoded data that conforms to the encoding standard is formed.

画像全体で発生する符号量をほぼ一定とする符号化方法の一例について説明する。例えば領域A、B、Cからなる画像をJPEGで符号化し、発生した可変長符号を上述したように作成された可変長符号置き換えテーブルを使用して設定された量子化値に対応するものに変更する。例えば領域Aを量子化値4で符号化した結果、符号量の余裕がなくなったので、領域Bを量子化値5で符号化する。領域AおよびBの符号化の結果、符号量に余裕が生じたので、領域Cを量子化値3で符号化する。最後に、領域A,B,Cそれぞれを図6での一つのブロックとして処理し、領域A,B,Cそれぞれで用いた複数の量子化値を一つの量子化値5に変更する。   An example of an encoding method for making the code amount generated in the entire image substantially constant will be described. For example, an image consisting of regions A, B, and C is encoded with JPEG, and the generated variable length code is changed to one corresponding to the quantization value set using the variable length code replacement table created as described above. To do. For example, as a result of encoding the region A with the quantization value 4, there is no more code amount, so the region B is encoded with the quantization value 5. As a result of encoding regions A and B, there is a margin in the code amount, so region C is encoded with quantized value 3. Finally, each of the regions A, B, and C is processed as one block in FIG. 6, and a plurality of quantization values used in each of the regions A, B, and C are changed to one quantization value 5.

このように量子化値を変更する処理について図10のフローチャートを参照して説明する。最初のステップS201において、画像の一部分を初期量子化値で符号化する。画像の一部分は、各画像処理の単位の領域より小さな領域である。ステップS202において、発生した符号量がその画像の一部分に割り当てられた符号量より大きいか否かが判定される。   Processing for changing the quantized value in this way will be described with reference to the flowchart of FIG. In the first step S201, a part of the image is encoded with an initial quantized value. A part of the image is an area smaller than a unit area of each image processing. In step S202, it is determined whether or not the generated code amount is larger than the code amount assigned to a part of the image.

符号量が大きいと判定されると、ステップS203において、量子化値が大きくされる。一方、符号量が大きくないと判定されると、ステップS204において、量子化値が小さくされる。このようにして、画像の一部分を符号化した結果の符号量に基づいて適切な量子化値が決定される。   If it is determined that the code amount is large, the quantization value is increased in step S203. On the other hand, if it is determined that the code amount is not large, the quantization value is decreased in step S204. In this way, an appropriate quantization value is determined based on the code amount as a result of encoding a part of the image.

ステップS205において、ある領域例えば領域AがステップS203またはS204において決定された量子化値でもって符号化される。   In step S205, a certain region, for example, region A is encoded with the quantized value determined in step S203 or S204.

ステップS206において、全領域A、B、Cを符号化したか否かが判定される。全ての領域を符号化したと判定されると、処理が終了する。全ての領域を符号化していないと判定されると、処理がステップS202に戻る。   In step S206, it is determined whether or not all regions A, B, and C have been encoded. If it is determined that all regions have been encoded, the process ends. If it is determined that not all regions are encoded, the process returns to step S202.

処理終了後それぞれの領域を図6での1つのブロックとして処理して図6の処理を行い、図8の変換テーブルを作成し、図8のテーブルでの変換や後ほど説明する図13の処理を行うことで、領域A,B,Cそれぞれで用いた複数の量子化テーブルが一つに変更されて符号化の規格に合った符号化データが形成される。   After each process is completed, each area is processed as one block in FIG. 6 and the process in FIG. 6 is performed to create the conversion table in FIG. 8, and the conversion in the table in FIG. 8 and the process in FIG. As a result, the plurality of quantization tables used in each of the regions A, B, and C are changed to one, and encoded data that conforms to the encoding standard is formed.

上述したAC係数成分に対する符号化方法においては、画像処理単位と対応する領域単位で量子化値を変更している。量子化値の変更に代えてハフマン符号化のためのハフマンテーブルを変更しても良い。また、量子化値とハフマンテーブルの両方を変更しても良い。すなわち、図11に示すように、画像全体が6個の領域からなる場合、各領域が量子化値(例えば3または4)とハフマンテーブル(テーブルAまたはB)との組合せでもって符号化される。   In the encoding method for the AC coefficient component described above, the quantization value is changed in units of regions corresponding to the image processing units. Instead of changing the quantization value, a Huffman table for Huffman coding may be changed. Further, both the quantization value and the Huffman table may be changed. That is, as shown in FIG. 11, when the entire image is composed of six regions, each region is encoded with a combination of a quantization value (for example, 3 or 4) and a Huffman table (table A or B). .

複数の量子化値を用いて符号化するときに、どのような変換係数分布をとるかの統計情報(ヒストグラムなど)を取得することにより量子化後の量子化係数分布が予想できるため、ハフマン符号の符号割り当ての一般的方法である、よく発生する量子化係数に短いハフマン符号を割り当てることにより全体の符号量を少なくすることができる。   When encoding using multiple quantized values, the quantized coefficient distribution after quantization can be predicted by obtaining statistical information (such as a histogram) on what transform coefficient distribution to take, so the Huffman code The overall code amount can be reduced by assigning short Huffman codes to frequently generated quantization coefficients, which is a general method of code assignment.

量子化値およびハフマンテーブルを変更する場合に使用できる可変長符号置き換えテーブルの一例を図12に示す。量子化値のみを変更する場合に使用する可変長符号置き換えテーブル(図8)と同様に、元の符号の列は、変更前符号を意味する。量子化値3/huffmanAは、変更前の量子化値3およびハフマンテーブルAを意味する。量子化値4/huffmanAは、変更前の量子化値4およびハフマンテーブルAを意味する。量子化値4/huffmanBは、変更前の量子化値4およびハフマンテーブルBを意味する。残りの符号が変更後の符号である。   An example of a variable-length code replacement table that can be used when changing the quantization value and the Huffman table is shown in FIG. Similar to the variable-length code replacement table (FIG. 8) used when only the quantized value is changed, the original code string means the code before change. The quantized value 3 / huffmanA means the quantized value 3 and the Huffman table A before the change. The quantized value 4 / huffmanA means the quantized value 4 and the Huffman table A before the change. The quantized value 4 / huffman B means the quantized value 4 and the Huffman table B before the change. The remaining codes are the codes after the change.

また、発生しない符号部分は、符号が無しとされる。さらに、二つのハフマンテーブルAおよびBの両方に同じ符号が存在する場合には、ハフマンテーブルAおよびBの両方に値が入る。例えば変更前の量子化値およびハフマンテーブルが量子化値4/huffmanAで、元の符号が(110)の場合、新しい符号が(101)となる。   In addition, the code portion that does not occur is unsigned. Further, when the same code exists in both of the two Huffman tables A and B, values are entered in both the Huffman tables A and B. For example, when the quantized value and the Huffman table before the change are the quantized value 4 / huffmanA and the original code is (110), the new code is (101).

上述した符号化処理は、AC係数成分に対するものである。DC係数成分は、隣接する直前のブロックのDC係数成分との差分がハフマン符号化される。以下にDC係数成分に対する符号化について説明する。   The encoding process described above is for AC coefficient components. The difference between the DC coefficient component and the DC coefficient component of the immediately preceding block is Huffman encoded. The encoding for the DC coefficient component will be described below.

上述したAC係数については、可変長符号置き換えテーブルによって量子化値変換後の可変長符号を得ることができるが、DC係数は、そのような符号の置き換えを適用することができない。図13に示すように、例えばハフマン符号(100)を可変長復号化(処理および回路の何れかによる)131によって復号し、例えば3の復号結果が得られる。逆量子化132によって差分値12が得られる。量子化値変更前の前置復号値例えば1との加算133がなされ、DC係数値13が復号される。   As for the AC coefficient described above, a variable-length code after quantization value conversion can be obtained by the variable-length code replacement table, but such a code replacement cannot be applied to the DC coefficient. As shown in FIG. 13, for example, a Huffman code (100) is decoded by variable length decoding (either by processing or a circuit) 131, and, for example, a decoding result of 3 is obtained. The difference value 12 is obtained by the inverse quantization 132. A pre-decoded value before changing the quantized value, for example, 1 is added 133, and the DC coefficient value 13 is decoded.

次に、量子化値変更後の前置復号値がDC係数値から減算される。例えば量子化値の変更によって前置復号値が1から2に変化すると、減算134において(13−2=11)の減算がなされ、差分値11が得られる。量子化135によって差分値が量子化され、量子化出力(2)が得られる。量子化出力が可変長符号化136によって可変長符号化され、ハフマン符号(011)が得られる。   Next, the pre-decoded value after changing the quantized value is subtracted from the DC coefficient value. For example, when the pre-decoded value changes from 1 to 2 due to the change of the quantized value, subtraction of (13-2 = 11) is performed in the subtraction 134, and the difference value 11 is obtained. The difference value is quantized by the quantization 135, and a quantized output (2) is obtained. The quantized output is variable-length encoded by the variable-length encoding 136 to obtain a Huffman code (011).

DC係数値の場合では、量子化値の変更の結果、前値復号値が変化する場合があるので、DC係数値まで復号し再符号化する処理が必要である。さらに、並べ替え処理と関連するDC係数成分の処理について説明する。   In the case of a DC coefficient value, the previous value decoded value may change as a result of the change of the quantized value. Therefore, a process of decoding up to the DC coefficient value and re-encoding is necessary. Further, processing of DC coefficient components related to the rearrangement processing will be described.

この発明の一実施の形態では、画像処理に供する画像処理単位、画像処理順序で、復号化、画像処理、符号化を繰り返した後、1画面分の符号化データを並べ直して記録することにより、画像処理結果を一時保持するバッファメモリを小容量化することができる。図14Aに示すように、9個のマクロブロック1〜3、7〜9、13〜15による第1の画像処理単位AR1を画像処理により生成した後、残るマクロブロック4〜6、10〜12、16〜18による第2の画像処理単位AR2を画像処理により生成したとする。この場合には、符号化は、第1の画像処理単位AR1、第2の画像処理単位AR2を例えばJPEGによって順次符号化することになり、矢印で示すように、各画像処理単位AR1、AR2のマクロブロックをそれぞれラスタ走査する順序により符号化して符号化データを生成することになる。   In one embodiment of the present invention, after repeating decoding, image processing, and encoding in an image processing unit and image processing order for image processing, the encoded data for one screen is rearranged and recorded. The buffer memory that temporarily holds the image processing result can be reduced in capacity. As shown in FIG. 14A, after the first image processing unit AR1 with nine macroblocks 1-3, 7-9, 13-15 is generated by image processing, the remaining macroblocks 4-6, 10-12, It is assumed that the second image processing unit AR2 by 16 to 18 is generated by image processing. In this case, encoding is performed by sequentially encoding the first image processing unit AR1 and the second image processing unit AR2 by, for example, JPEG, and as indicated by arrows, the image processing units AR1 and AR2 are encoded. Encoded data is generated by encoding each macroblock in the order of raster scanning.

これに対して、図14Bに示すように、これら画像処理単位AR1、AR2による1つの画像をJPEGによって符号化する場合、各マクロブロックを示す数字の順序により、この1つの画像のマクロブロックをラスタ走査する順序で符号化データを生成することになる。したがって、図14Aに示す順序のデータを復号した結果の画像は、原画像と異なったものとなる。   On the other hand, as shown in FIG. 14B, when one image by these image processing units AR1 and AR2 is encoded by JPEG, the macroblock of this one image is rasterized according to the numerical order indicating each macroblock. The encoded data is generated in the scanning order. Therefore, the image obtained as a result of decoding the data in the order shown in FIG. 14A is different from the original image.

この発明の一実施の形態では、図14Aに示す順序により得られる符号化データを、並べ替え・量子化値調整部8において、図14Bに示す順序に並べ直して出力する。JPEGによる符号化では、直前マクロブロックのDC係数値を前置保持し、続くマクロブロックでは、この前置保持したDC係数値との差分値が可変長符号化される。したがって、図14Aに示す例では、マクロブロック7、13のそれぞれのDC係数値と、マクロブロック3、9のそれぞれのDC係数値との差分値が求められ、各差分値が可変長符号化される。同様に、マクロブロック4、10、16のそれぞれのDC係数値と、マクロブロック15、6、12のDC係数値との差分値が可変長符号化される。   In one embodiment of the present invention, encoded data obtained in the order shown in FIG. 14A is rearranged in the order shown in FIG. 14B by the rearrangement / quantization value adjusting unit 8 and output. In JPEG encoding, the DC coefficient value of the immediately preceding macroblock is held in advance, and in the subsequent macroblock, the difference value from the DC coefficient value held in front is variable-length encoded. Therefore, in the example shown in FIG. 14A, a difference value between each DC coefficient value of the macroblocks 7 and 13 and each DC coefficient value of the macroblocks 3 and 9 is obtained, and each difference value is variable-length encoded. The Similarly, the difference value between the DC coefficient values of the macroblocks 4, 10, and 16 and the DC coefficient values of the macroblocks 15, 6, and 12 is variable-length encoded.

なお、JPEGの規格では、JPEGデータのブロック毎の区切りに区切りコードが挿入されるように規定されている。可変長符号化されている1ブロック分のJPEGデータがバイトの整数倍の長さとなるようにスタッフィングビットが付加され、その後に区切りコード(16ビット)が付加される。最小符号化単位としてのJPEG MCU(Minimum Coded Unit)は、マクロブロックに対応して発生したデータである。ハフマン符号化がなされているので、JPEG MCUは、可変ビット長を有する。区切りコードは、並びに替え単位の区切りを示している。この区切りは、ECS(Entropy Coded Segment) と称される。したがって、並べ替えは、ECS単位でなされる。JPEGデータのDC(直流)係数は、前のブロックのDC係数との差分のデータを伝送するようにしており、区切りコードの次のDC係数のデータは、差分ではなく、DC係数の値そのものとされている。   In the JPEG standard, it is defined that a delimiter code is inserted as a delimiter for each block of JPEG data. Stuffing bits are added so that the variable length encoded JPEG data for one block has a length that is an integral multiple of bytes, and then a delimiter code (16 bits) is added. A JPEG MCU (Minimum Coded Unit) as a minimum coding unit is data generated corresponding to a macroblock. Since Huffman coding is performed, the JPEG MCU has a variable bit length. The delimiter code indicates the delimiter of the replacement unit. This division is called ECS (Entropy Coded Segment). Therefore, the rearrangement is performed in units of ECS. The DC (direct current) coefficient of the JPEG data is transmitted as a difference data from the DC coefficient of the previous block, and the data of the DC coefficient next to the delimiter code is not the difference but the DC coefficient value itself. Has been.

この発明の一実施の形態では、スタッフィングビットと区切りコードとを挿入しないようにして、画像処理単位毎に、画像処理結果を符号化処理するようになされる。しかしながら、これに限らず、スタッフィングビットおよび/または区切りコードを挿入するようにして、並べ替え部における並べ替え時、スタッフィングビット、区切りコードを削除するようにしてもよい。また、区切りコードを設けた場合、直後のマクロブロックでは、DC係数値がそのままDC係数に符号化処理されることになる。これによりこの場合、DC係数の処理が別途必要になるが、例えば記録して保持したDC係数値によりダミーのマクロブロックを作成し、このダミーのマクロブロックとの連続により符号化データを生成した後、ダミーのマクロブロックによる符号化データを削除する等により実行することができる。因みに、このダミーのマクロブロックは、並べ直した符号化データにおいて、処理対象のマクロブロックの直前のマクロブロックの実際の画像データを適用するようにしてもよい。   In one embodiment of the present invention, an image processing result is encoded for each image processing unit without inserting a stuffing bit and a delimiter code. However, the present invention is not limited to this, and a stuffing bit and / or a delimiter code may be inserted, and the stuffing bit and the delimiter code may be deleted when rearranging in the rearrangement unit. When a delimiter code is provided, the DC coefficient value is directly encoded into the DC coefficient in the macroblock immediately after. As a result, in this case, DC coefficient processing is separately required. For example, after a dummy macroblock is created from DC coefficient values recorded and held, and encoded data is generated continuously with the dummy macroblock. This can be executed by deleting the encoded data of the dummy macroblock. Incidentally, the dummy macroblock may be applied with the actual image data of the macroblock immediately before the macroblock to be processed in the rearranged encoded data.

これに対して画像処理単位AR1、AR2を1つの画像として符号化する場合、マクロブロック7、13は、水平方向の走査終了端である右端(図面に向って)のマクロブロック6、12のDC係数値との差分値によりDC係数値が符号化され、第2の画像処理単位AR2の水平方向への走査開始端側のマクロブロック4、10、16では、第1の画像処理単位AR1の水平方向への走査終了端側、マクロブロック3、9、15のDC係数値との差分値によりDC係数値が符号化される。   On the other hand, when the image processing units AR1 and AR2 are encoded as one image, the macroblocks 7 and 13 are the DCs of the macroblocks 6 and 12 at the right end (toward the drawing) that is the scanning end in the horizontal direction. The DC coefficient value is encoded by the difference value from the coefficient value. In the macroblocks 4, 10, and 16 on the scanning start end side in the horizontal direction of the second image processing unit AR2, the horizontal value of the first image processing unit AR1 is set. The DC coefficient value is encoded by the difference value from the DC coefficient values of the macroblocks 3, 9, 15 on the scanning end end side in the direction.

したがって、単に画像処理の順序により得られるマクロブロック単位の符号化データを1画面まとめた符号化の順序により並べ直し、さらには制御コードを設定し直しただけでは、正しく復号することが困難になる。   Accordingly, it is difficult to correctly decode the encoded data in units of macroblocks obtained by the order of image processing, by rearranging the encoded data in one screen and further resetting the control code. .

したがって、画像処理単位のマクロブロックをラスタ走査の順序により符号化する際に、このラスタ走査における各水平方向の走査終了端のマクロブロックで、検出されるDC係数値を取得して記録し、隣接するマクロブロックにおける符号化の際に、前置保持したDC係数値に代えて記録したDC係数値を使用する。なお、隣接するマクロブロックは、並べ替えた後において、隣接するマクロブロックである。   Therefore, when encoding a macroblock of an image processing unit in the raster scan order, the detected DC coefficient value is acquired and recorded in the macroblock at the end of each horizontal scan in the raster scan, and is adjacent to each other. At the time of encoding in the macroblock to be used, the recorded DC coefficient value is used instead of the DC coefficient value held in advance. An adjacent macroblock is an adjacent macroblock after rearrangement.

図14の例では、マクロブロック1〜3、7〜9、13〜15による第1の画像処理単位AR1を符号化する際に、水平方向の走査終了端のマクロブロック6、12、18のDC係数値を記録して保持する。続く第2の画像処理単位AR2を符号化する場合、記録して保持したマクロブロック3、9、15のDC係数値を使用して水平方向への走査開始端のマクロブロック4、10、16の符号化を行う。   In the example of FIG. 14, when encoding the first image processing unit AR <b> 1 by the macroblocks 1 to 3, 7 to 9, and 13 to 15, the DC of the macroblocks 6, 12, and 18 at the scanning end in the horizontal direction. Record and retain coefficient values. When the subsequent second image processing unit AR2 is encoded, the DC coefficients of the recorded macroblocks 3, 9, and 15 are used to record the macroblocks 4, 10, and 16 at the scanning start end in the horizontal direction. Encoding is performed.

図15は、並べ替えに適した符号の出力方法を示す。符号化部201は、JPEGの符号化を行う。画像処理部からの画像データ211として処理単位AR1の例えばマクロブロック7、8、9が符号化部201に対して入力される。左端のマクロブロックのDC係数値との差分を形成するために必要なマクロブロックのDC係数値212が入力される。例えばマクロブロック6のDC係数値が入力される。符号化部201において、マクロブロック7のDC係数値と、マクロブロック3のDC係数値の代わりのマクロブロック6のDC係数値との差分が演算され、差分が可変長符号化される。   FIG. 15 shows a code output method suitable for rearrangement. The encoding unit 201 performs JPEG encoding. For example, macroblocks 7, 8, and 9 of the processing unit AR1 are input to the encoding unit 201 as image data 211 from the image processing unit. A DC coefficient value 212 of a macroblock necessary for forming a difference from the DC coefficient value of the leftmost macroblock is input. For example, the DC coefficient value of the macro block 6 is input. In the encoding unit 201, the difference between the DC coefficient value of the macroblock 7 and the DC coefficient value of the macroblock 6 instead of the DC coefficient value of the macroblock 3 is calculated, and the difference is variable-length encoded.

マクロブロック7以外の左端のマクロブロック1のDC係数値との差分を形成するために、前の画像の水平方向の走査終了端のマクロブロックのDC係数値が必要とされ、マクロブロック13のDC係数値との差分を形成するために、マクロブロック12のDC係数値が必要とされる。画像の先頭のマクロブロック1の場合では、例えば差分を形成せずに値自身が伝送される。したがって、処理単位AR1およびAR2の符号化に先行して、マクロブロック6、12および18の符号化が先行してなされる。   In order to form a difference from the DC coefficient value of the leftmost macroblock 1 other than the macroblock 7, the DC coefficient value of the macroblock at the horizontal scanning end of the previous image is required, and the DC of the macroblock 13 is obtained. In order to form a difference with the coefficient value, the DC coefficient value of the macroblock 12 is required. In the case of the first macroblock 1 of the image, for example, the value itself is transmitted without forming a difference. Therefore, encoding of the macroblocks 6, 12 and 18 precedes encoding of the processing units AR1 and AR2.

符号化部201からは、並べ替え前の符号213と、並べ替え前の符号長214と、画像右端のDC係数値215とが出力される。符号長214は、3個のマクロブロック例えばマクロブロック7,8,9の符号長である。画像右端のDC係数値215は、例えばマクロブロック9のDC係数値である。この画像右端のDC係数値は、次の画像処理単位AR2の左端に位置するマクロブロック4,10,16のDC係数値の符号化に使用される。   The encoding unit 201 outputs a code 213 before rearrangement, a code length 214 before rearrangement, and a DC coefficient value 215 at the right end of the image. The code length 214 is the code length of three macroblocks, for example, macroblocks 7, 8, and 9. The DC coefficient value 215 at the right end of the image is, for example, the DC coefficient value of the macro block 9. The DC coefficient value at the right end of the image is used for encoding the DC coefficient values of the macroblocks 4, 10, and 16 located at the left end of the next image processing unit AR2.

上述したように、画像処理単位による符号化を開始する前に、右端のマクロブロック6、12を符号化してマクロブロック6、12のDC係数値を取得して保持するようになされる。   As described above, before starting encoding in units of image processing, the rightmost macroblocks 6 and 12 are encoded, and the DC coefficient values of the macroblocks 6 and 12 are acquired and held.

図16は、符号並べ替えと符号化時に必要なDC係数値の事前取得の処理を示すものである。図16の例では、画像処理単位が(2×3)マクロブロックの大きさとされ、3個の画像処理単位によって1枚の画像が構成されている。画像処理部からは、A1,A2,A3,A4,・・・の順序のデータ系列221が入力される。符号化部でJPEG符号化がなされ、並べ替え前の符号が並べ替えによって、JPEGで規定された正規の符号順序のデータ系列222が形成される。   FIG. 16 shows the process of obtaining DC coefficient values required at the time of code rearrangement and encoding. In the example of FIG. 16, the size of the image processing unit is (2 × 3) macroblocks, and one image is constituted by three image processing units. A data series 221 in the order of A1, A2, A3, A4,... Is input from the image processing unit. The encoding unit performs JPEG encoding, and the data sequence 222 in the normal code order defined by JPEG is formed by rearranging the codes before rearrangement.

データ系列222において、丸で囲んだマクロブロックB1,C1,A4,B4,C4のそれぞれのDC係数値を予測符号化するためには、事前に四角で囲んだマクロブロックA3,B3,C3,A6,B6のDC係数値が取得されている必要がある。この例では、左端のマクロブロックA4の符号化のためにマクロブロックC3のDC係数値が必要とされるので、右端に位置するマクロブロックC3は、事前に符号化しておくことが必要となる。   In the data series 222, in order to predictively encode the respective DC coefficient values of the macro blocks B1, C1, A4, B4, and C4 circled, the macro blocks A3, B3, C3, and A6 circled in advance are enclosed. , B6 DC coefficient values need to be acquired. In this example, since the DC coefficient value of the macroblock C3 is required for encoding the leftmost macroblock A4, it is necessary to encode the macroblock C3 located at the rightmost end in advance.

このように、画像の水平走査の終端(右端)に位置する符号化単位としてのマクロブロックを事前に符号化(DCT化、量子化、可変長符号化)するようになされる。DC係数値の予測符号化のためには、量子化および可変長は不要である。しかしながら、この右端に位置する複数のマクロブロックを事前に符号化して符号長を取得すると、符号長からそのマクロブロックが属する画像の発生符号量を推定することが可能となる。この推定結果に基づいて、量子化値の初期値を設定することができる。   In this way, a macroblock as a coding unit located at the end (right end) of horizontal scanning of an image is coded in advance (DCT, quantization, variable length coding). Quantization and variable length are not required for predictive coding of DC coefficient values. However, if a plurality of macroblocks located at the right end are encoded in advance to obtain a code length, it is possible to estimate a generated code amount of an image to which the macroblock belongs from the code length. Based on this estimation result, an initial value of the quantized value can be set.

図17は、CPU11の制御によりなされるDC係数値の処理手順を示すフローチャートである。処理手順を開始すると、ステップS301からステップS302に移り、画像処理単位による繰り返しの符号化処理ではDC係数値を検出できないマクロブロック(MCU)について、ストレージ9、符号化/復号化部7の制御により符号化データを復号して画像データを生成し、この画像データを画像処理部8により画像処理する。また処理結果による画像データを符号化/復号化部7により符号化処理し、これにより画像処理単位による繰り返しの符号化処理ではDC係数値を用意できないマクロブロックのDC係数値を事前に検出する。   FIG. 17 is a flowchart showing a DC coefficient value processing procedure performed under the control of the CPU 11. When the processing procedure is started, the process proceeds from step S301 to step S302, and the macroblock (MCU) in which the DC coefficient value cannot be detected by the repetitive encoding process by the image processing unit is controlled by the storage 9 and the encoding / decoding unit 7. The encoded data is decoded to generate image data, and the image processing unit 8 performs image processing on the image data. Also, the image data based on the processing result is encoded by the encoding / decoding unit 7, thereby detecting in advance a DC coefficient value of a macroblock for which a DC coefficient value cannot be prepared by repeated encoding processing in units of image processing.

続いてCPU11は、順次、画像処理単位で復号化処理、画像処理して画像データをバッファメモリに格納する。ステップS303において、画像処理結果を格納するバッファメモリから、ラスタ走査の順序により1マクロブロック分の画像データが符号化/復号化部7に入力され、ステップS304において、DCT処理がなされ、ステップS305において、DCTにより得られる係数データが量子化される。   Subsequently, the CPU 11 sequentially performs decoding processing and image processing in units of image processing, and stores the image data in the buffer memory. In step S303, image data for one macroblock is input to the encoding / decoding unit 7 from the buffer memory that stores the image processing result in the order of raster scanning. In step S304, DCT processing is performed, and in step S305. The coefficient data obtained by DCT is quantized.

ステップS306において、処理中のマクロブロックが画像処理単位の水平方向の走査開始端に位置するものか否かが判定される。ステップS306の判定結果が肯定であると、ステップS306からステップS307に処理が移る。ステップS307において、ステップS310の処理でDC差分値の計算対象である前置保持によるDC係数値が記録して保持したDC係数値に置き換えられた後、ステップS308に処理が移る。ステップS306の判定結果が否定であると、処理がステップS306からステップS308に移る。   In step S306, it is determined whether or not the macro block being processed is positioned at the scanning start end in the horizontal direction of the image processing unit. If the determination result of step S306 is affirmative, the process moves from step S306 to step S307. In step S307, after the DC coefficient value by pre-holding, which is the calculation target of the DC difference value in step S310, is replaced with the recorded and held DC coefficient value, the process moves to step S308. If the determination result of step S306 is negative, the process proceeds from step S306 to step S308.

ステップS308において、処理中のマクロブロックが画像処理単位の水平方向の走査終了端か否かが判定される。ステップS308の判定結果が肯定であると、ステップS309において、ステップS305で検出されたDC係数値が記録されて、処理がステップS310に移る。ステップS308の判定結果が否定であると、処理がステップS308からステップS310に移る。   In step S308, it is determined whether or not the currently processed macroblock is the end of scanning in the horizontal direction of the image processing unit. If the determination result of step S308 is affirmative, the DC coefficient value detected in step S305 is recorded in step S309, and the process proceeds to step S310. If the determination result of step S308 is negative, the process proceeds from step S308 to step S310.

ステップS310において、ステップS305で量子化されたDC係数値から前のDC係数値が減算され、差分値が生成される。ステップS311において、このステップS310で計算した差分値と、ステップS305で量子化したAC値に係る係数データとがハフマン符号化される。ステップS312において、全てのマクロブロックについて処理が完了したか否かが判断される。ステップS312の判定結果が否定であると、ステップS312からステップS303に処理が戻る。ステップS312の判定結果が肯定であると、処理手順を終了する(ステップS313)。   In step S310, the previous DC coefficient value is subtracted from the DC coefficient value quantized in step S305 to generate a difference value. In step S311, the difference value calculated in step S310 and the coefficient data relating to the AC value quantized in step S305 are Huffman encoded. In step S312, it is determined whether processing has been completed for all macroblocks. If the determination result of step S312 is negative, the process returns from step S312 to step S303. If the determination result of step S312 is affirmative, the processing procedure ends (step S313).

以上、この発明の実施の形態について具体的に説明したが、この発明は、上述の実施の形態に限定されるものではなく、この発明の技術的思想に基づく各種の変形が可能である。例えばデジタルスチルカメラにおける画像処理としては、並べ替え時に復号化された画
像を180度回転させる処理を行っても良い。回転の処理の場合では、DC成分係数値を保持するマクロブロックは、各水平方向の走査における走査終了端のマクロブロックのみではなく、水平走査開始端側のマクロブロックである場合もある。
Although the embodiment of the present invention has been specifically described above, the present invention is not limited to the above-described embodiment, and various modifications based on the technical idea of the present invention are possible. For example, as an image process in a digital still camera, a process of rotating an image decoded at the time of rearrangement by 180 degrees may be performed. In the case of rotation processing, the macroblock that holds the DC component coefficient value is not limited to the scanning end macroblock in each horizontal scan, but may be a macroblock on the horizontal scanning start end side.

また、この発明は、デジタルスチルカメラに限らず、JPEGまたはMPEGの符号化装置を備える画像記録装置、パーソナルコンピュータ、PDA(Personal Digital Assistants) 、画像送信装置、携帯端末、携帯電話等に適用することができる。   Further, the present invention is not limited to a digital still camera, but is applied to an image recording apparatus, a personal computer, a PDA (Personal Digital Assistants), an image transmission apparatus, a portable terminal, a cellular phone, and the like provided with a JPEG or MPEG encoding apparatus. Can do.

この発明が適用された撮像装置の構成を示すブロック図である。1 is a block diagram illustrating a configuration of an imaging apparatus to which the present invention is applied. この発明による符号化および並べ替えの処理の流れを説明するための略線図である。It is a basic diagram for demonstrating the flow of the process of an encoding and rearrangement by this invention. JPEG符号化処理を説明するための略線図である。It is a basic diagram for demonstrating a JPEG encoding process. 復号化および再符号化によって量子化値を変更する処理の一例を説明するための略線図である。It is a basic diagram for demonstrating an example of the process which changes a quantization value by decoding and re-encoding. 可変長符号置き換えテーブルによって量子化値を変更する処理の一例を説明するための略線図である。It is a basic diagram for demonstrating an example of the process which changes a quantization value with a variable-length code replacement table. 可変長符号置き換えテーブルの作成方法の一例を説明するためのフローチャートである。It is a flowchart for demonstrating an example of the preparation method of a variable-length code replacement table. 可変長符号置き換えテーブルの作成方法の一例を説明するための略線図である。It is a basic diagram for demonstrating an example of the production method of a variable-length code replacement table. 可変長符号置き換えテーブルの説明に使用する略線図である。It is a basic diagram used for description of a variable-length code replacement table. 領域ごとに量子化値を変更する処理を説明するための略線図である。It is a basic diagram for demonstrating the process which changes a quantization value for every area | region. 領域ごとに量子化値を変更する処理を説明するためのフローチャートである。It is a flowchart for demonstrating the process which changes a quantization value for every area | region. 領域ごとに量子化値およびハフマンテーブルを変更する処理を説明するための略線図である。It is a basic diagram for demonstrating the process which changes a quantization value and a Huffman table for every area | region. 量子化値およびハフマンテーブルを変更する場合の可変長符号置き換えテーブルの説明に使用する略線図である。It is a basic diagram used for description of the variable-length code replacement table in the case of changing a quantization value and a Huffman table. DC係数成分に関して量子化値を変更する処理を説明するための略線図である。It is a basic diagram for demonstrating the process which changes a quantization value regarding DC coefficient component. 並べ替えの処理を説明するための略線図である。It is a basic diagram for demonstrating the process of rearrangement. 並べ替えに適した符号の出力方法を説明するための略線図である。It is a basic diagram for demonstrating the output method of the code | symbol suitable for rearrangement. 並べ替え処理とDC係数成分の符号化の処理を説明するための略線図である。It is a basic diagram for demonstrating the rearrangement process and the process of encoding of a DC coefficient component. DC係数成分の符号化処理を説明するためのフローチャートである。It is a flowchart for demonstrating the encoding process of a DC coefficient component. 先に提案されている符号化および並べ替えの処理の流れを説明するための略線図である。It is a basic diagram for demonstrating the flow of the process of an encoding and rearrangement proposed previously.

符号の説明Explanation of symbols

2 撮像素子
4 カメラ信号処理部
6 画像処理部
7 符号化/復号化部
8,108 並べ替え・量子化値調整部
11 CPU
2 Image Sensor 4 Camera Signal Processing Unit 6 Image Processing Unit 7 Encoding / Decoding Unit 8, 108 Rearrangement / Quantization Value Adjustment Unit 11 CPU

Claims (9)

画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、
上記画像処理部の処理単位の領域毎に量子化値を調整すると共に、上記画像処理部の処理方向から上記符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更ステップと
を有する画像処理方法。
In an image processing method for encoding image data processed by an image processing unit in a predetermined encoding unit in an encoding unit,
An encoding step of performing conversion in the order of data output from the image processing unit, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient;
Rearrangement / quantization value change for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to the normal processing direction defined by the encoding And an image processing method.
上記並べ替え・量子化値変更ステップは、少なくとも1つの符号は可変長符号と量子化値とから新たな量子化値に対応する可変長符号へ直接置き換えを行うことで量子化値を変更する請求項1記載の画像処理方法。   In the rearrangement / quantization value changing step, the quantization value is changed by directly replacing at least one code from a variable length code and a quantization value to a variable length code corresponding to a new quantization value. Item 8. The image processing method according to Item 1. 上記係数データは、直流係数成分と交流係数成分とからなり、
上記符号化ステップは、上記直流係数成分を前値差分符号化する際に、上記正規の処理方向における前値との差分を符号化する請求項1記載の画像処理方法。
The coefficient data consists of a DC coefficient component and an AC coefficient component.
The image processing method according to claim 1, wherein the encoding step encodes a difference from the previous value in the normal processing direction when the DC coefficient component is encoded as a previous value difference.
上記直流係数成分の符号のみ可変長符号から直流係数成分値を求め、差分対象符号化単位の新たな量子化値による符号の復号値との差分を新たな量子化値で量子化、可変長符号化する請求項1記載の画像処理方法。   The DC coefficient component value is obtained from the variable length code only for the code of the DC coefficient component, and the difference from the decoded value of the code by the new quantization value of the difference target coding unit is quantized with the new quantization value, the variable length code. The image processing method according to claim 1. 上記正規の処理方向における前値を事前符号化によって求めると共に、事前符号化によって符号長を求め、上記符号長に基づいて量子化値の初期値を設定する請求項1記載の画像処理方法。   2. The image processing method according to claim 1, wherein the previous value in the normal processing direction is obtained by pre-encoding, the code length is obtained by pre-encoding, and an initial value of the quantized value is set based on the code length. 画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法をコンピュータによって実行させるプログラムにおいて、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、
上記画像処理部の処理単位の領域毎に量子化値を調整すると共に、上記画像処理部の処理方向から上記符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更ステップと
を有する画像処理方法のプログラム。
In a program for causing a computer to execute an image processing method for encoding image data processed by an image processing unit in a predetermined encoding unit in an encoding unit,
An encoding step of performing conversion in the order of data output from the image processing unit, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient;
Rearrangement / quantization value change for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to the normal processing direction defined by the encoding An image processing method program comprising steps.
画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化を行う画像処理装置において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化部と、
上記画像処理部の処理単位の領域毎に量子化値を調整すると共に、上記画像処理部の処理方向から上記符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更部と
を有する画像処理装置。
In an image processing apparatus that encodes image data processed by an image processing unit in a predetermined encoding unit in an encoding unit,
An encoding unit that performs conversion in the order of data output from the image processing unit, quantizes coefficient data generated by the conversion, and variable-length-encodes the quantized coefficient;
Rearrangement / quantization value change for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to the normal processing direction defined by the encoding An image processing apparatus.
撮像素子によって撮影された画像データに対して画像処理を行う画像処理部と、画像処理部によって処理した画像データを符号化部で所定の符号化単位で符号化する符号化部を有する撮像装置において、
画像処理部から出力されるデータ順で変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化部と、
上記画像処理部の処理単位の領域毎に量子化値を調整すると共に、上記画像処理部の処理方向から上記符号化で規定された正規の処理方向へ並べ替えを行う並べ替え・量子化値変更部と
を有する撮像装置。
In an imaging apparatus having an image processing unit that performs image processing on image data captured by an imaging device, and an encoding unit that encodes image data processed by the image processing unit in a predetermined encoding unit by an encoding unit ,
An encoding unit that performs conversion in the order of data output from the image processing unit, quantizes coefficient data generated by the conversion, and variable-length-encodes the quantized coefficient;
Rearrangement / quantization value change for adjusting the quantization value for each processing unit area of the image processing unit and rearranging from the processing direction of the image processing unit to the normal processing direction defined by the encoding An imaging device.
画像データを符号化部で所定の符号化単位で符号化を行う画像処理方法であって、
変換を行い、変換によって発生した係数データを量子化し、量子化係数を可変長符号化する符号化ステップと、量子化値変更ステップとを有する画像処理方法において、
上記量子化値変更ステップは、少なくとも1つの符号は可変長符号と量子化値とから新たな量子化値に対応する可変長符号へ直接置き換えを行うことで量子化値を変更する画像処理方法。
An image processing method for encoding image data in a predetermined encoding unit by an encoding unit,
In an image processing method having an encoding step for performing conversion, quantizing coefficient data generated by the conversion, and variable-length encoding the quantized coefficient, and a quantization value changing step,
The image processing method in which the quantization value changing step changes the quantization value by directly replacing at least one code from a variable length code and a quantization value to a variable length code corresponding to a new quantization value.
JP2007161497A 2007-06-19 2007-06-19 Image processor, image processing method and image processing program, and imaging device Pending JP2009004878A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007161497A JP2009004878A (en) 2007-06-19 2007-06-19 Image processor, image processing method and image processing program, and imaging device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007161497A JP2009004878A (en) 2007-06-19 2007-06-19 Image processor, image processing method and image processing program, and imaging device

Publications (1)

Publication Number Publication Date
JP2009004878A true JP2009004878A (en) 2009-01-08

Family

ID=40320823

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007161497A Pending JP2009004878A (en) 2007-06-19 2007-06-19 Image processor, image processing method and image processing program, and imaging device

Country Status (1)

Country Link
JP (1) JP2009004878A (en)

Similar Documents

Publication Publication Date Title
JP6626295B2 (en) Image encoding device, image processing device, image encoding method
KR101223983B1 (en) Bitrate reduction techniques for image transcoding
US8849021B2 (en) Image processing apparatus, method, and storage medium for high speed compression processing
JP4151684B2 (en) Encoding apparatus, encoding method, encoding program, and imaging apparatus
JP6512928B2 (en) Image coding apparatus, image processing apparatus, image coding method
TWI633779B (en) Video coding device, video decoding device, and the like
JP5158096B2 (en) Encoding data generation apparatus, encoding data generation method, decoding apparatus, and decoding method
JP6502739B2 (en) Image coding apparatus, image processing apparatus, image coding method
CN110087085B (en) Image processing apparatus
US8233729B2 (en) Method and apparatus for generating coded block pattern for highpass coefficients
JPH1175183A (en) Image signal processing method and device and storage medium
JP3952116B2 (en) Image compression apparatus and method
JP5199956B2 (en) Image decoding apparatus and control method thereof
JP2009077183A (en) Data compressor, data compression/extension system, and data compression method
JP2007019878A (en) Image coding apparatus and image coding method
JP3709106B2 (en) Image compression and decompression device
JP2009004878A (en) Image processor, image processing method and image processing program, and imaging device
JP2005269620A (en) Image compressing/expanding method, image compressing apparatus, image expanding apparatus
JP4926128B2 (en) Image processing apparatus, image reading apparatus, image forming apparatus, computer program, recording medium, and image processing method
TWI795480B (en) Image processing device for performing data decompression and image processing device for performing data compression
US20210352303A1 (en) Method for processing transform coefficients
JP2009038740A (en) Image encoding device
JP2009260747A (en) Image encoding device, and control method thereof
JPH089373A (en) Picture compression device
JP4262145B2 (en) Image processing apparatus and control method thereof