JP4944833B2 - Image coding apparatus and control method thereof - Google Patents

Image coding apparatus and control method thereof Download PDF

Info

Publication number
JP4944833B2
JP4944833B2 JP2008108292A JP2008108292A JP4944833B2 JP 4944833 B2 JP4944833 B2 JP 4944833B2 JP 2008108292 A JP2008108292 A JP 2008108292A JP 2008108292 A JP2008108292 A JP 2008108292A JP 4944833 B2 JP4944833 B2 JP 4944833B2
Authority
JP
Japan
Prior art keywords
bit
encoding
boundary
coefficient
encoded data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2008108292A
Other languages
Japanese (ja)
Other versions
JP2009260745A (en
JP2009260745A5 (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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2008108292A priority Critical patent/JP4944833B2/en
Publication of JP2009260745A publication Critical patent/JP2009260745A/en
Publication of JP2009260745A5 publication Critical patent/JP2009260745A5/ja
Application granted granted Critical
Publication of JP4944833B2 publication Critical patent/JP4944833B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Description

本発明は画像符号化技術、特に、画像データを周波数空間のデータへと変換し、得られた変換係数を符号化することで符号化画像データを生成する技術に関するものである。   The present invention relates to an image encoding technique, and more particularly to a technique for generating encoded image data by converting image data into frequency space data and encoding the obtained conversion coefficient.

従来、画像の符号化手法として、画像データを周波数空間のデータへと変換して符号化を行う変換符号化が用いられる。静止画符号化の国際標準方式として勧告されるJPEGは周波数空間への変換手法としてDCTを利用した変換符号化の代表例である。以下、JPEGの符号化処理過程を簡単に述べる。   Conventionally, as an image encoding method, transform encoding is used in which image data is converted into frequency space data and encoded. JPEG recommended as an international standard system for still image coding is a representative example of transform coding using DCT as a transform method to a frequency space. The JPEG encoding process will be briefly described below.

符号化対象の画像データは、矩形領域のブロックに分割され、各ブロックに離散コサイン変換が適用される。変換によって得られた係数を、所望の画質レベル、符号量に応じて量子化し、量子化後の変換係数をエントロピ符号化する。JPEG Baselineでは、係数のエントロピ符号化手法としてハフマン符号化を採用している。8×8=64個の周波数帯域のデータは1個のDC成分と、63個のAC成分に分けて符号化される。DC成分は直前のブロックとの差分値として符号化し、AC成分はゼロの連続数(ゼロラン)と非ゼロの係数値の組み合わせによりハフマン符号化を行う。   The image data to be encoded is divided into rectangular area blocks, and a discrete cosine transform is applied to each block. The coefficient obtained by the conversion is quantized according to a desired image quality level and code amount, and the quantized conversion coefficient is entropy encoded. JPEG Baseline employs Huffman coding as a coefficient entropy coding method. Data of 8 × 8 = 64 frequency bands are encoded by being divided into one DC component and 63 AC components. The DC component is encoded as a difference value from the immediately preceding block, and the AC component is Huffman encoded by a combination of a zero consecutive number (zero run) and a non-zero coefficient value.

JPEG Baselineに見られるように、ゼロの連続数を符号化する符号化手法において、符号化が効率的に行われるためには、0となる係数がある程度存在しなければならない。極端な例を挙げるならば、63個のAC係数の全てが非ゼロであるような場合には、ラン0と非ゼロ係数値を組み合わせて符号化することになり、効率的とは言えない。   As can be seen in JPEG Baseline, in an encoding method that encodes a continuous number of zeros, a coefficient that becomes 0 must exist to some extent in order to perform encoding efficiently. As an extreme example, when all 63 AC coefficients are non-zero, encoding is performed by combining run 0 and non-zero coefficient values, which is not efficient.

例えば、量子化ステップ値を小さく設定して、JPEG符号化を行う場合、符号化を効率的に機能させるために、各係数を上位ビット部と下位ビット部に分離して、上位ビット部に対してのみランレングス符号化を適用するといった手法が提案されている。   For example, when JPEG encoding is performed with a small quantization step value, each coefficient is separated into an upper bit part and a lower bit part to efficiently perform the encoding, A method has been proposed in which run-length coding is applied only.

このような従来技術を用いた画像処理装置、画像処理方法の一例が特許文献1に開示されている。
特開2000−13797号公報
An example of an image processing apparatus and an image processing method using such a conventional technique is disclosed in Patent Document 1.
JP 2000-13797 A

上述の上位ビット部、下位ビット部を分離する符号化においては、どのビット位置で係数を分離するかが圧縮性能を決定付ける重要な要因となる。境界ビット位置を低く設定した場合には、ゼロランの長さが短くなり、ランレングス符号化が有効に機能しない。一方で、境界ビット位置を高く設定しすぎた場合には、下位ビット部に冗長なデータが多く含まれ、下位ビット部の符号化性能が全体の性能を左右する。例えば、先に示した特許文献1では、下位ビット部を非圧縮としているが、このような場合には高い符号化性能を実現することができなくなる。   In the coding for separating the upper bit part and the lower bit part as described above, the bit position at which the coefficient is separated is an important factor that determines the compression performance. If the boundary bit position is set low, the length of the zero run is shortened and run-length encoding does not function effectively. On the other hand, if the boundary bit position is set too high, a lot of redundant data is included in the lower bit part, and the encoding performance of the lower bit part affects the overall performance. For example, in Patent Document 1 shown above, the lower bit part is not compressed, but in such a case, high encoding performance cannot be realized.

本願発明は、上述の問題点に鑑みてなされたものであり、画素ブロックを単位に周波数変換、量子化を行なう画像符号化処理において、量子化後の係数を、より効率良く符号化する技術を提供しようとするものである。   The present invention has been made in view of the above-described problems. In an image encoding process in which frequency conversion and quantization are performed in units of pixel blocks, a technique for more efficiently encoding coefficients after quantization. It is something to be offered.

かかる課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置であって、
前記各係数についての、最上位から最下位ビットに向かって最初に“1”となるビット位置から最下位ビットまでの有効ビット数を検出し、各有効ビット数の出現回数をカウントするカウント手段と、
有効ビット数Bの出現回数をN(B)と定義し、出現回数が1以上の最大の有効ビット数をbmaxと定義し、変数b=0、1、2…に対する次式の合算関数:
S(bmax−b)=ΣN(bmax−i) (i=0、1、…、b)
において、予め設定された閾値Thとの関係が、
S(bmax−b)>Th
を満たす最大整数bを求め、当該最大整数bに基づいて、境界ビット位置を決定する境界ビット位置決定手段と、
前記各係数値を、前記境界ビット位置決定手段で算出した境界ビット位置を境界にして、上位ビット部、下位ビット部とに分離する分離手段と、
該分離手段で分離した各係数の前記上位ビット部を符号化する上位ビット符号化手段と、
前記分離手段で分離した各係数の前記下位ビット部を符号化する下位ビット符号化手段と、
前記上位ビット符号化手段、前記下位ビット符号化手段それぞれで得られた符号化データから、着目画素ブロックの符号化データを生成し、出力する出力手段とを備える。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device that performs frequency conversion and quantization processing in units of pixel blocks from multivalued image data, and encodes each multivalued coefficient obtained by the quantization processing,
Counting means for detecting the number of effective bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit for each coefficient and counting the number of occurrences of each effective bit number; ,
The number of occurrences of the number of effective bits B is defined as N (B), the maximum number of effective bits with the number of occurrences of 1 or more is defined as bmax, and the summation function of the following equation for the variable b = 0, 1, 2,.
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to the preset threshold value Th,
S (bmax−b)> Th
Boundary bit position determination means for determining a boundary bit position based on the maximum integer b;
Separating means for separating the values of the respective coefficients into upper bit parts and lower bit parts with the boundary bit position calculated by the boundary bit position determining means as a boundary;
Upper bit encoding means for encoding the upper bit portion of each coefficient separated by the separation means;
Low-order bit encoding means for encoding the low-order bit part of each coefficient separated by the separation means;
Output means for generating and outputting encoded data of the pixel block of interest from encoded data obtained by the upper bit encoding means and the lower bit encoding means, respectively.

本発明によれば、画素ブロックを単位に周波数変換、量子化を行なう画像符号化処理において、量子化後の係数を、より効率良く符号化する技術を提供できる。   ADVANTAGE OF THE INVENTION According to this invention, the technique which encodes the coefficient after quantization more efficiently can be provided in the image coding process which performs frequency conversion and quantization per pixel block.

以下添付図面に従って本発明に係る実施形態を詳細に説明する。   Embodiments according to the present invention will be described below in detail with reference to the accompanying drawings.

[第1の実施形態]
図1は、実施形態における画像符号化装置のブロック構成図である。
[First Embodiment]
FIG. 1 is a block configuration diagram of an image encoding device according to the embodiment.

本実施形態の画像符号化装置は、符号化対象となる画像データを外部から入力し、画素ブロックを単位に周波数変換(DCT)等の系列変換、量子化を行なう。そして、着目画素ブロックから得られる、量子化後の各係数を上位ビット部と下位ビット部に分離して符号化するものである。なお、画像データの入力源は、イメージスキャナとするが、画像データをファイルとして格納している記憶媒体等であっても良く、その種類は問わない。   The image encoding apparatus according to the present embodiment receives image data to be encoded from the outside, and performs sequence conversion such as frequency conversion (DCT) and quantization for each pixel block. Then, each quantized coefficient obtained from the pixel block of interest is separated into an upper bit part and a lower bit part and encoded. The input source of the image data is an image scanner, but it may be a storage medium that stores image data as a file, and the type thereof is not limited.

符号化の対象となる画像データは輝度成分のみのモノクロ多値画像データとし、輝度成分は8ビット(0乃至255の256階調)として説明する。但し、これは実施形態の説明を簡単なものとするためであって、1画素が複数成分(例えば、RGBやCMYK)でも構わず、その色空間の種類は問わないし、1成分のビット数も8ビットに限らず、8ビットを超えるビット数でも構わない。また、更に、符号化対象の画像は水平方向W画素、垂直方向H画素により構成され、説明簡易化のため、W、Hは8の倍数であるとして説明する。   The image data to be encoded is assumed to be monochrome multivalued image data having only a luminance component, and the luminance component is assumed to be 8 bits (256 gradations from 0 to 255). However, this is to simplify the description of the embodiment, and one pixel may be a plurality of components (for example, RGB or CMYK), the type of the color space is not limited, and the number of bits of one component is also The number of bits is not limited to 8 bits and may be more than 8 bits. Furthermore, the image to be encoded is composed of horizontal W pixels and vertical H pixels. For simplicity of explanation, it is assumed that W and H are multiples of 8.

以下、図1における画像符号化装置における符号化処理を説明する。   Hereinafter, the encoding process in the image encoding apparatus in FIG. 1 will be described.

まず、画像入力部101から符号化対象となる画像データが順に入力される。画素データの入力順序はラスタースキャン順とする。1画素は8ビットで表現される0から255までの非負の整数値とする。画像の左上隅を座標(0,0)とし、水平右方向の画素位置x、垂直下方向の画素位置yにある画素の値をP(x,y)と表すこととする。例えば、位置(x、y)=(3,4)にある画素が、128という輝度値を持つ場合、P(3,4)=128と表現する。また、以下の説明では、位置(x、y)の“画素”を表現する場合にも“P(x,y)”という表現を用いることとする。   First, image data to be encoded is sequentially input from the image input unit 101. The input order of the pixel data is a raster scan order. One pixel is a non-negative integer value from 0 to 255 expressed by 8 bits. Let the upper left corner of the image be coordinates (0, 0), and let the value of the pixel at the pixel position x in the horizontal right direction and the pixel position y in the vertical down direction be represented by P (x, y). For example, when the pixel at the position (x, y) = (3,4) has a luminance value of 128, it is expressed as P (3,4) = 128. Further, in the following description, the expression “P (x, y)” is also used when expressing the “pixel” at the position (x, y).

ブロック分割部102は画像入力部101から入力される画素データを適宜不図示の内部バッファに格納し、8×8画素の大きさの矩形ブロックを単位として順番に出力する。画像の左上端のブロックを番号0とし、ラスタースキャンの順序で、昇順に識別番号を付与し、この順番で矩形ブロックデータを取り出して出力する。   The block dividing unit 102 appropriately stores pixel data input from the image input unit 101 in an internal buffer (not shown), and sequentially outputs the rectangular blocks having a size of 8 × 8 pixels as a unit. The block at the upper left corner of the image is numbered 0, identification numbers are given in ascending order in the raster scan order, and rectangular block data is extracted and output in this order.

系列変換部103では、ブロック分割部102から出力される矩形ブロックデータを周波数変換する。ここでは、系列変換処理として、JPEG(ISO/IEC 15444−1)で用いられる離散コサイン変換を適用し、DCT係数データへと変換する。本発明の別の実施形態では、ブロックの歪を軽減させるために、ブロックを重複させながら変換処理を行う、重複直交変換や重複双直交変換などを用いて周波数空間への変換を行うことができる。なお、JPEGの離散コサイン変換処理については、以下の国際標準勧告書等に記載されているので、ここでは説明を割愛する。
ITU-T Recommendation T.81 | ISO/IEC 10918-1:1994, Information technology - Digital compression and coding of continuous-tone still images: Requirements and guidelines.
なお、JPEGの場合と同様に、離散コサイン変換の適用に先立ち、中間値を減算するレベルシフト処理を行うものとする。本実施形態では、入力する符号化対象の画像データの各画素は、0乃至255の範囲の8ビットのデータとなっているので、画素値P(x,y)から128を減じる。
The series conversion unit 103 performs frequency conversion on the rectangular block data output from the block division unit 102. Here, the discrete cosine transform used in JPEG (ISO / IEC 15444-1) is applied as the series conversion process, and is converted into DCT coefficient data. In another embodiment of the present invention, in order to reduce the distortion of the block, the conversion to the frequency space can be performed using the overlapping orthogonal transformation, the overlapping bi-orthogonal transformation, or the like that performs the transformation process while overlapping the blocks. . Note that the JPEG discrete cosine transform processing is described in the following international standard recommendations and the like, and will not be described here.
ITU-T Recommendation T.81 | ISO / IEC 10918-1: 1994, Information technology-Digital compression and coding of continuous-tone still images: Requirements and guidelines.
As in the case of JPEG, level shift processing for subtracting the intermediate value is performed prior to the application of the discrete cosine transform. In this embodiment, since each pixel of the input image data to be encoded is 8-bit data in the range of 0 to 255, 128 is subtracted from the pixel value P (x, y).

係数量子化部104は系列変換部103により得られたDCT係数データを要求される画質レベルに応じて量子化処理を実行し、量子化後の各係数値(実施形態の場合には64個)を係数バッファ105へと格納する。なお、以降、特に量子化の有無を区別する必要がない場合、係数バッファ105に格納されている量子化された係数値を単に、係数値と記す。また、実施形態では、1個の係数値は、9ビット(うち1ビットは正負の符号)で表わされるものとして説明するが、精度を向上させるため10ビット以上であっても構わない。   The coefficient quantization unit 104 performs quantization processing on the DCT coefficient data obtained by the series conversion unit 103 according to the required image quality level, and each coefficient value after quantization (64 in the embodiment) Is stored in the coefficient buffer 105. Hereinafter, when it is not particularly necessary to distinguish the presence or absence of quantization, a quantized coefficient value stored in the coefficient buffer 105 is simply referred to as a coefficient value. In the embodiment, one coefficient value is described as being represented by 9 bits (of which 1 bit is a positive or negative sign), but may be 10 bits or more in order to improve accuracy.

係数バッファ105は1矩形ブロック分の係数値(実施形態の場合には64個)を格納する。   The coefficient buffer 105 stores coefficient values for one rectangular block (64 in the case of the embodiment).

境界ビット位置決定部116は、係数バッファ105に格納される1矩形ブロック分の各係数値について、後述する有効ビット数の分布を調べ、後段の係数符号化部117で用いる境界ビット位置Bを決定する。   The boundary bit position determination unit 116 examines the distribution of the number of effective bits, which will be described later, for each coefficient value for one rectangular block stored in the coefficient buffer 105, and determines the boundary bit position B used in the subsequent coefficient encoding unit 117. To do.

境界ビット位置決定部116は、有効ビット判定部106、頻度テーブル生成部107、頻度テーブルバッファ108、境界ビット選択部109を備える。   The boundary bit position determination unit 116 includes a valid bit determination unit 106, a frequency table generation unit 107, a frequency table buffer 108, and a boundary bit selection unit 109.

有効ビット判定部106は係数バッファ105に格納される、着目する矩形ブロック内の各係数値Cnを順番に読み出し、その有効ビット数B(Cn)を求める。有効ビット数とは係数値Cnの絶対値を自然2進数表記した場合に、上位から下位ビットに探索した際に最初に“1”が出現するビット位置を示す。例えば、着目する係数値Cnが“−5”である場合、その絶対値“5”について自然2進表記すると、“0…0101”となる。最上位の“1”は下位から3桁目であるので、B(5)=3となる。言い換えれば、絶対値が“5”の係数値の有効なビット数は、最下位ビットから3ビットであると言うことができる。なお、Cn=0である場合、“1”のビットは存在しないので、有効ビット数B(Cn)は0となる。要するに、有効ビット数B(Cn)は、係数の絶対値|Cn|に対して|Cn|<2Pの条件を満たす最小の正の整数値Pであると言える。 The effective bit determination unit 106 sequentially reads each coefficient value Cn in the target rectangular block stored in the coefficient buffer 105, and obtains the effective bit number B (Cn). The number of effective bits indicates a bit position where “1” first appears when searching from the upper bit to the lower bit when the absolute value of the coefficient value Cn is expressed in a natural binary number. For example, when the coefficient value Cn of interest is “−5”, the natural value of the absolute value “5” is “0... 0101”. Since the most significant “1” is the third digit from the lower order, B (5) = 3. In other words, it can be said that the effective number of bits of the coefficient value having the absolute value “5” is 3 bits from the least significant bit. When Cn = 0, there is no “1” bit, so the number of effective bits B (Cn) is zero. In short, it can be said that the effective bit number B (Cn) is the smallest positive integer value P that satisfies the condition | Cn | <2 P with respect to the absolute value | Cn | of the coefficient.

頻度テーブル生成部107は有効ビット数判定部106から出力されるB(Cn)について、頻度テーブルバッファ108に保持する発生頻度テーブルを更新する。頻度テーブルバッファ108は、有効ビット数0乃至8それぞれの出現頻度N(0)乃至N(8)を格納する容量を有する。頻度テーブルバッファ108は、1つの矩形ブロックの頻度を求める際に、“0”で初期化されるものとする。そして、有効ビット判定部106が着目係数値Cnの有効ビット数B(Cn)を決定した場合、頻度テーブル生成部107は頻度テーブルバッファ108内のN(B(Cn))を“1”だけ増加させる。つまり、頻度テーブル生成部107は、有効ビット判定部106によって1つの係数値の有効ビットを判定する度に、頻度テーブルバッファ108を更新する。   The frequency table generation unit 107 updates the occurrence frequency table held in the frequency table buffer 108 for B (Cn) output from the valid bit number determination unit 106. The frequency table buffer 108 has a capacity for storing the appearance frequencies N (0) to N (8) of the valid bit numbers 0 to 8, respectively. The frequency table buffer 108 is initialized with “0” when the frequency of one rectangular block is obtained. When the effective bit determination unit 106 determines the number of effective bits B (Cn) of the target coefficient value Cn, the frequency table generation unit 107 increases N (B (Cn)) in the frequency table buffer 108 by “1”. Let That is, the frequency table generation unit 107 updates the frequency table buffer 108 every time the valid bit determination unit 106 determines a valid bit of one coefficient value.

図4は、上記のようにして求めた、着目ブロック内の全係数値の有効ビットの出現頻度をグラフにして示した例を示している。図4では、有効ビット数が0乃至7が存在し、有効ビット数8の出現回数は0回であった例を示している。   FIG. 4 shows an example in which the appearance frequency of the effective bits of all the coefficient values in the block of interest obtained as described above is shown as a graph. FIG. 4 shows an example in which there are 0 to 7 effective bits and the number of occurrences of 8 effective bits is 0.

さて、着目する矩形ブロックのすべての係数値について、有効ビット数の判定、頻度テーブルの更新処理が行われると、境界ビット選択部109は、着目矩形ブロックにおける境界ビットBの選択を行なう。具体的には、次の通りである。   When the effective bit number determination and the frequency table update processing are performed for all coefficient values of the target rectangular block, the boundary bit selection unit 109 selects the boundary bit B in the target rectangular block. Specifically, it is as follows.

境界ビット選択部109は、まず、頻度テーブルバッファ108に格納される各有効ビット数の出現回数N(b)(bは有効ビット数を表す任意の整数値)を、有効ビット数の最大値から最小値に向けて累積加算することで、図5のような累積頻度のテーブルS(b)へと変換を行う。着目する矩形ブロックにおいて、出現回数が1以上の有効ビット数の最大値をbmax(図4の場合にはbmax=7)とするとき、境界ビット選択部109は、変数b=bmax,bmax−1,bmax−2…と更新して、次式で示される累積頻度テーブルS(b)を求める。
S(b)=N(b) b=bmaxの場合
S(b)=N(b)+S(b+1) b≠bmaxの場合
The boundary bit selection unit 109 first calculates the number N (b) of occurrences of each effective bit number stored in the frequency table buffer 108 (b is an arbitrary integer value indicating the effective bit number) from the maximum value of the effective bit number. By performing cumulative addition toward the minimum value, conversion is made into a table S (b) of cumulative frequency as shown in FIG. In the rectangular block of interest, when the maximum value of the number of effective bits having an appearance count of 1 or more is bmax (bmax = 7 in the case of FIG. 4), the boundary bit selector 109 sets the variables b = bmax, bmax−1. , Bmax-2..., And a cumulative frequency table S (b) represented by the following equation is obtained.
S (b) = N (b) When b = bmax S (b) = N (b) + S (b + 1) When b ≠ bmax

上記は、逆に変数b=0、1、2、…、bmaxと更新する場合、合算関数Σを用いて次のように表わすこともできる。
S(bmax−b)=ΣN(bmax−i) (i=0,1,…,b)
Conversely, when the variable b = 0, 1, 2,..., Bmax is updated, it can be expressed as follows using the summation function Σ.
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)

累積頻度テーブルS(b)は、要するに、b≠0の場合、絶対値が2^b以上となる係数値の個数を表すことを示している。また、S(0)は着目矩形ブロック内の全係数値の個数に等しい。   In short, the cumulative frequency table S (b) indicates that when b ≠ 0, the cumulative frequency table S (b) represents the number of coefficient values whose absolute value is 2 ^ b or more. S (0) is equal to the number of all coefficient values in the target rectangular block.

累積頻度テーブルS(b)を得た後、境界ビット選択部109は、有効ビット数の最大値から最小値に向けて、すなわち、降順にS(b)の値を調べ、予め設定された閾値Thを超える最大整数bを探索する。そして、境界ビット選択部109は、得られたbを境界ビット位置Bとして出力する。なお、詳細は後述する説明から明らかになるが、S(1)が閾値Thを超えない場合、着目矩形ブロック内の全係数についての分離処理は行われず、全てランレングス符号化されることになる。   After obtaining the cumulative frequency table S (b), the boundary bit selection unit 109 checks the value of S (b) from the maximum value to the minimum value of the number of effective bits, that is, in descending order, and sets a preset threshold value. The maximum integer b exceeding Th is searched. Then, the boundary bit selection unit 109 outputs the obtained b as the boundary bit position B. Although details will become clear from the description to be described later, when S (1) does not exceed the threshold value Th, all the coefficients in the target rectangular block are not separated, and all are run-length encoded. .

ここで閾値Thは係数値の総数(実施形態の場合、矩形ブロックは8×8画素のサイズなので、係数値の総数は64個)に対して、所定の比率となるように設定する。この閾値Thはユーザが適宜設定もしくは選択可能にすることができるものとするが、統計的に見ると、この閾値Thは矩形ブロック内の全係数の個数の1/4乃至1/3が適当である。例えば、比率1/3を採用するなら、閾値Thは“21”(≒64/3)である。   Here, the threshold Th is set to be a predetermined ratio with respect to the total number of coefficient values (in the case of the embodiment, the total number of coefficient values is 64 because the rectangular block has a size of 8 × 8 pixels). This threshold value Th can be set or selectable by the user as appropriate, but from a statistical viewpoint, this threshold value Th is suitably ¼ to 3 of the total number of coefficients in the rectangular block. is there. For example, if the ratio 1/3 is adopted, the threshold Th is “21” (≈64 / 3).

後述するが、後段の係数符号化部117における着目矩形ブロック内の各係数値の符号化処理においては、係数値を境界ビットBで上位と下位に分離し、上位ビット部に対してゼロの連続数の符号化、即ち、ランレングス符号化を適用する。従って、ここでの閾値Thの役割は、係数値の上位ビット部が非ゼロの係数とゼロの係数値の比を調整するためのものであり、ランレングス符号化を有効に機能させることを狙いとして設定されるものであると言える。図5に示した例では、“5”が閾値Thを超える最大のbにあたり、境界ビット位置として“5”が出力される。   As will be described later, in the encoding process of each coefficient value in the target rectangular block in the later-stage coefficient encoding unit 117, the coefficient value is separated into upper and lower by the boundary bit B, and zero is continuous with respect to the upper bit. Apply number coding, ie run-length coding. Therefore, the role of the threshold Th here is for adjusting the ratio of the coefficient value in which the higher-order bit part of the coefficient value is non-zero and the coefficient value of zero, and aims to make run-length encoding function effectively. It can be said that it is set as. In the example shown in FIG. 5, “5” corresponds to the maximum b exceeding the threshold Th, and “5” is output as the boundary bit position.

境界ビット位置決定部116により境界ビット位置Bが決定されると、係数符号化部117は、係数バッファ105に格納される各係数値を、予め設定された順番に従って、読み出して符号化処理を行う。   When the boundary bit position determination unit 116 determines the boundary bit position B, the coefficient encoding unit 117 reads out each coefficient value stored in the coefficient buffer 105 in accordance with a preset order and performs an encoding process. .

つまり、係数バッファ105に格納された係数値の読み出し(スキャン)は2度行われる。最初のスキャンは、既に説明した境界ビット位置決定部116による境界ビット位置Bの決定処理のためである。そして、2回目のスキャンでは、以下に説明する、係数符号化部117による係数値の符号化処理のためである。   That is, the coefficient value stored in the coefficient buffer 105 is read (scanned) twice. The first scan is for the boundary bit position B determination process by the boundary bit position determination unit 116 already described. The second scan is for coefficient value encoding processing by the coefficient encoding unit 117 described below.

本実施形態においては、1回目のスキャンのスキャン順は、どのような順序でも構わない。一方、2回めの係数符号化部117によるスキャンは、符号化効率の観点からジグザグスキャン順とするが、必ずしもこれに限らない。詳細については後述するが、後段の係数符号化部117において、係数の上位ビット部をゼロの連続数と非ゼロの係数値の組み合わせにより符号化する。この際にゼロの連続数が長くなるように考えたスキャン方法であれば良く、例えば、いくつかのスキャンパターンから適切な方法を選択するようにしても良い。また、過去に符号化したブロックにおける係数の分布を参照して係数のパワーの大きいものから小さいものへと並ぶように動的にスキャン順序を変えるなどしても構わない。   In the present embodiment, the scan order of the first scan may be any order. On the other hand, the second scan performed by the coefficient encoding unit 117 is in a zigzag scan order from the viewpoint of encoding efficiency, but is not necessarily limited thereto. Although details will be described later, the coefficient encoding unit 117 in the subsequent stage encodes the higher-order bit part of the coefficient by a combination of the number of consecutive zeros and a non-zero coefficient value. At this time, any scan method may be used as long as the number of consecutive zeros is increased. For example, an appropriate method may be selected from several scan patterns. In addition, the scan order may be dynamically changed so that the coefficients are arranged in order from the largest to the smallest with reference to the coefficient distribution in the previously encoded block.

本実施形態における係数符号化部117は、上位/下位ビット分離部110、上位ビット符号化部111、下位ビット符号化部112、符号バッファ113から構成される。   The coefficient encoding unit 117 in this embodiment includes an upper / lower bit separation unit 110, an upper bit encoding unit 111, a lower bit encoding unit 112, and a code buffer 113.

上位/下位ビット分離部110は、係数バッファ105から読出した着目する係数値Cnについて、その符号絶対値表現における下位Bビットを取り除いて得られる上位ビット部と、境界ビット位置以下の下位Bビット部とに分離する。但し、正負の符号ビットは処理対象外とする。より具体的には、境界ビット選択部109は、着目係数値Cnの、上位ビット部Un(=Cn>>B)と、下位ビット部Ln(=|Cn|&((1<<B)−1))を求める。ここでY>>Xは、値YをXビットだけ下位方向にシフトすることを示し、Y<<Xは値YをXビットだけ上位方向にシフトすることを示している。また、|Y|は値Yの絶対値を、X&Yは値Xと値Yとのビット単位の論理積(AND)を示す。   The upper / lower bit separation unit 110 removes the lower B bits in the code absolute value representation of the target coefficient value Cn read from the coefficient buffer 105, and the lower B bit part below the boundary bit position. And to separate. However, positive and negative sign bits are not processed. More specifically, the boundary bit selection unit 109 includes the upper bit part Un (= Cn >> B) and the lower bit part Ln (= | Cn | & ((1 << B) −) of the coefficient value Cn of interest. 1)). Here, Y >> X indicates that the value Y is shifted in the lower direction by X bits, and Y << X indicates that the value Y is shifted in the upper direction by X bits. | Y | represents the absolute value of the value Y, and X & Y represents the logical product (AND) of the value X and the value Y in bit units.

上位/下位ビット分離部110は、着目係数値Cnの上記ビット部Unを上位ビット符号化部111に出力し、下位ビット部Lnを下位ビット符号化部112へと出力する。   The upper / lower bit separation unit 110 outputs the bit part Un of the target coefficient value Cn to the upper bit encoding unit 111 and outputs the lower bit part Ln to the lower bit encoding unit 112.

なお、上位ビット部Unの値が“0”である係数Cnについては、係数Cnの正負を表す符号も下位ビット符号化部112へと引き渡されるものとする。   For the coefficient Cn having the value of the upper bit part Un of “0”, the sign representing the sign of the coefficient Cn is also passed to the lower bit encoding part 112.

図6に、係数値Cnの一例として“−41、−7、28、−1、…”が入力され、境界ビット位置B=4で上位ビット部Unと下位ビット部Lnに分離した例を示す。   FIG. 6 shows an example in which “−41, −7, 28, −1,...” Is input as an example of the coefficient value Cn, and the upper bit part Un and the lower bit part Ln are separated at the boundary bit position B = 4. .

図示の場合、上位/下位ビット分離部110は、正負符号の1ビットを含む64個の上位ビット部Unを上位ビット符号化部111に出力する。   In the case illustrated, the upper / lower bit separation unit 110 outputs 64 upper bit units Un including one bit of the positive / negative code to the upper bit encoding unit 111.

上位ビット符号化部111は、入力される上位ビット部Unの正負符号ビットを除外した4ビットで表わされる値が“0”の場合、ここではその正負符号ビットの符号化を行なわない。上位ビット部Unにおいて、正負符号ビットを除外した4ビットで表わされる値が“0”となるのは、図6の場合係数値Cn=“−7”、“−1”である。また、上位ビット部Unの正負符号ビットを除く、4ビットで表わされる値が非“0”の場合、その正負符号ビットを含む上位ビット部Unがそのままランレングス符号化対象となる。   When the value represented by 4 bits excluding the sign bit of the input upper bit part Un is “0”, the upper bit coding unit 111 does not code the sign bit here. In the upper bit part Un, the value represented by 4 bits excluding the sign bit is “0” in the case of FIG. 6 in the coefficient values Cn = “− 7” and “−1”. When the value represented by 4 bits excluding the sign bit of the upper bit part Un is non- “0”, the upper bit part Un including the sign bit is directly subjected to run length encoding.

従って、図6の場合、上位ビット符号化部111は、10進数表記の多値データ“−2”、“0”、“1”、“0”…の順に、ランレングス符号化を行なうことになる。この結果、上位ビット部が“0”となる確率が高くなり、符号化効率が高めることができる。   Therefore, in the case of FIG. 6, the upper bit encoding unit 111 performs run-length encoding in the order of multi-value data “−2”, “0”, “1”, “0”. Become. As a result, the probability that the upper bit part is “0” is increased, and the encoding efficiency can be increased.

なお、1つの矩形ブロックからは、1個のDC係数と、63個のAC係数が得られる。そして、実施形態における上位ビット符号化部111の符号化はJPEGのBaselineでのDC,AC係数の符号化と同じ方法を用いる。すなわち、着目矩形ブロックのDC係数の上位ビット部Unを符号化する場合には、直前のブロック(既に符号化済みのブロックでもある)のDC係数の上位ビット部Unを予測値として用いる。そして、着目ブロックの上位ビット部Unと予測値との差分を算出し、その差分に基づきハフマン符号化を行う。そして、AC係数の上位ビット部Unについては、ゼロの連続数と非ゼロの係数を組み合わせてハフマン符号化を行う。ブロックの最後がゼロの連続で終わる場合にはEOB(End Of Block)を表す特殊符号を用いる点についてもJPEG Baselineと同様である。   Note that one DC coefficient and 63 AC coefficients are obtained from one rectangular block. The upper bit encoding unit 111 in the embodiment uses the same method as the encoding of DC and AC coefficients in JPEG Baseline. That is, when the upper bit part Un of the DC coefficient of the rectangular block of interest is encoded, the upper bit part Un of the DC coefficient of the immediately preceding block (which is also an already encoded block) is used as a predicted value. Then, the difference between the upper bit part Un of the block of interest and the predicted value is calculated, and Huffman coding is performed based on the difference. Then, the Huffman coding is performed on the upper bit part Un of the AC coefficient by combining the number of consecutive zeros and the non-zero coefficient. Similar to JPEG Baseline, a special code representing EOB (End Of Block) is used when the end of the block ends with a sequence of zeros.

一方、上位/下位ビット分離部110は、着目矩形ブロックの64個の下位ビット部Lnを下位ビット符号化部112に出力する。ただし、先に説明したように、上位/下位ビット分離部110は、上位ビット部Unの正負符号ビットを除く4ビットの値が“0”である係数Cnについては、その正負符号ビットを下位ビット部Lnに付加して下位ビット符号化部112に出力する。   On the other hand, the upper / lower bit separation unit 110 outputs the 64 lower bit parts Ln of the target rectangular block to the lower bit encoding unit 112. However, as described above, the upper / lower bit separation unit 110, for the coefficient Cn whose 4-bit value except the sign bit of the upper bit part Un is “0”, converts the sign bit to the lower bit. It is added to the part Ln and output to the lower bit encoding part 112.

正負符号ビットを除く上位ビット部Unの値が“0”となるのは、図6の例では、係数値“−7”と、“−1”である。そこで、正負符号ビットの付加位置は、下位ビット部Lnの上位から下位に向かって最初に“1”が出現する位置とする。図6の場合には、斜線で示される位置が正負ビットを挿入する位置になる。   In the example of FIG. 6, the coefficient values “−7” and “−1” indicate that the value of the upper bit part Un excluding the sign bit is “0”. Therefore, the addition position of the plus / minus sign bit is set to a position where “1” first appears from the high order to the low order of the low order bit part Ln. In the case of FIG. 6, the position indicated by the diagonal lines is the position where the positive and negative bits are inserted.

下位ビット符号化部112は上位/下位ビット分離部110から出力された下位ビット部Lnの符号化を行う。上位ビット部Unに対し、下位ビット部Lnは一般に圧縮しにくいデータであるので、本実施形態の下位ビット符号化部112では下位ビット部を非圧縮で出力する(但し、圧縮性能を追求する場合には算術符号などを適用しても良い)。非圧縮であるので、基本的には入力データがそのまま符号化データとなるが、画質への影響度に応じてビットデータが配置されるように、言い換えれば、復号装置がプログレッシブ再生できるようにするため、ビットプレーン順に並び替えて出力する。   The lower bit encoding unit 112 encodes the lower bit part Ln output from the upper / lower bit separation unit 110. Since the lower bit portion Ln is generally hard-to-compress data with respect to the upper bit portion Un, the lower bit encoding portion 112 of the present embodiment outputs the lower bit portion without compression (however, in the case of pursuing compression performance) Arithmetic codes etc. may be applied). Since the data is not compressed, the input data is basically encoded data as it is, but the bit data is arranged according to the degree of influence on the image quality, in other words, the decoding apparatus can perform progressive reproduction. Therefore, the data are rearranged in the order of bit planes and output.

図6の場合、下位ビット符号化部112は、入力した下位ビット部Lnを不図示の内部バッファに格納し、各下位ビット部Lnの最上位のビット桁(B番目の桁)で構成されるビットプレーンを出力する。この処理を最下位のビット桁(1番目の桁)まで繰り返す。   In the case of FIG. 6, the lower bit encoding unit 112 stores the input lower bit unit Ln in an internal buffer (not shown), and is configured with the most significant bit digit (Bth digit) of each lower bit unit Ln. Output a bit plane. This process is repeated up to the least significant bit digit (first digit).

図6に示した係数値列“−41、−7、28、−1、…”の場合(境界ビット位置B=4)における、下位ビット符号化部112が出力するデータの例を、図7に示す。   An example of data output by the lower bit encoding unit 112 in the case of the coefficient value sequence “−41, −7, 28, −1,...” (Boundary bit position B = 4) illustrated in FIG. Shown in

下位ビット部Lnの最初に出力されるプレーン(同一ビット位置のビット情報)はB桁のビットプレーン“1010…”となる。この中の“1”に対応するのは、係数値“−41”、“28”である。係数値“−41”、“28”の符号ビットを除く上位ビット部Unが表わす値は非0であるので、正負符号ビットは挿入されない。   The plane (bit information at the same bit position) output at the beginning of the lower bit part Ln is a B-digit bit plane “1010...”. The coefficient values “−41” and “28” correspond to “1”. Since the value represented by the upper bit part Un excluding the sign bits of the coefficient values “−41” and “28” is non-zero, the positive / negative sign bit is not inserted.

次のB−1桁のビットプレーンに着目すると、係数値“−7”を表わす最初の“1”のビットが出現する(図6参照)。また、係数値“−7”の正負符号ビットを除く上位ビット部Unの値は“0”となる。それ故、図示の如く、係数値“−7”を表わす最初の“1”に後続する位置に、正負の符号ビットを挿入する。以下、B−2桁のビットプレーン、B−3桁のビットプレーンを出力していく。B−3桁のビットプレーンでは、係数値“−1”を表わす最初の“1”が出現するので、それに後続して正負符号ビットが挿入される。   Focusing on the next bit plane of B-1 digits, the first “1” bit representing the coefficient value “−7” appears (see FIG. 6). Further, the value of the upper bit part Un excluding the sign bit of the coefficient value “−7” is “0”. Therefore, as shown in the figure, positive and negative sign bits are inserted at positions following the first “1” representing the coefficient value “−7”. Hereinafter, the B-2 digit bit plane and the B-3 digit bit plane are output. In the B-3 digit bit plane, since the first “1” representing the coefficient value “−1” appears, the sign bit is inserted subsequently.

符号化バッファ113には、上位ビット符号化部111、下位ビット符号化部112から出力される矩形ブロックを単位とする符号化データが格納される。   The encoding buffer 113 stores encoded data in units of rectangular blocks output from the upper bit encoding unit 111 and the lower bit encoding unit 112.

符号列形成部114は符号バッファ113に格納される、着目する矩形ブロックの符号化データを読み出し、符号化形成部114が内部に備えるバッファに格納しながら、所定の形式の符号化データを生成し、符号出力部115に出力する。符号出力部115は、符号化対象の画像データを入力する際に、出力先(例えばハードディスク装置)にファイルヘッダを生成し、それに後続して、符号列形成部114で生成された符号列を出力し、1個の符号化データファイルを生成することになる。   The code string forming unit 114 reads the encoded data of the target rectangular block stored in the code buffer 113 and generates encoded data in a predetermined format while storing the encoded data in a buffer included in the code forming unit 114. And output to the code output unit 115. The code output unit 115 generates a file header at an output destination (for example, a hard disk device) when inputting image data to be encoded, and then outputs the code sequence generated by the code sequence forming unit 114. Thus, one encoded data file is generated.

図8に本実施形態の画像符号化装置から出力される符号化データファイルの構造を示す。ファイルヘッダ符号列には画像の水平方向画素数、垂直方向画素数や、色成分の数(実施形態でモノクロ画像の例であるので色成分の数は1つ)、各画素のビット数など、復号に必要な各種情報がヘッダとして付与される。このヘッダには全ての矩形ブロックについての境界ビットBの情報が含まれる。従って、復号装置はこのヘッダを解析すれば、各ブロックの境界ビット位置を得ることができる。ファイルヘッダの後に、画像の全矩形ブロックについて上位ビット部Unの符号化データが配置され、その後に、下位ビット符号化データが並ぶ。図中、Nはブロックの総数を表し、Lは全ブロックについて探索した境界ビット位置Bの最大値を表す。上位ビット符号化データは、矩形ブロックを単位とするラスタースキャンの順番で、各矩形ブロックの上位ビット部符号化データを連結して構成される。下位ビット符号化データは各矩形ブロックの下位ビット部符号化データをビットプレーン順に配置して構成される。ビットプレーンiはラスタースキャンの順番で各ブロックのビットプレーンiのデータを集めて構成されるが、境界ビットB<iとなるブロックからのデータは含まれないため、必ずしもすべてのブロックからデータが集められるわけではない。   FIG. 8 shows the structure of an encoded data file output from the image encoding apparatus of this embodiment. In the file header code string, the number of pixels in the horizontal direction of the image, the number of pixels in the vertical direction, the number of color components (the number of color components is 1 because it is an example of a monochrome image in the embodiment), the number of bits of each pixel, etc. Various information necessary for decoding is added as a header. This header includes boundary bit B information for all rectangular blocks. Therefore, the decoding apparatus can obtain the boundary bit position of each block by analyzing this header. After the file header, the encoded data of the upper bit part Un is arranged for all rectangular blocks of the image, and then the lower bit encoded data is arranged. In the figure, N represents the total number of blocks, and L represents the maximum value of the boundary bit position B searched for all blocks. The higher-order bit encoded data is configured by concatenating the higher-order bit portion encoded data of each rectangular block in the order of raster scan in units of rectangular blocks. The low-order bit encoded data is configured by arranging the low-order bit part encoded data of each rectangular block in the order of bit planes. The bit plane i is configured by collecting the data of the bit plane i of each block in the raster scan order, but does not include the data from the block where the boundary bit B <i, and therefore the data is not necessarily collected from all the blocks. It is not done.

図8に示した符号の構造は、あくまでもその一例であり、境界ビット位置の情報と、少なくとも一部の上位ビット符号化データが含まれるものであれば良い。また、図8は、複数のブロックで構成されるマクロブロック、又は、そのマクロブロックを複数包含するタイルのデータ構造としても構わない。   The code structure shown in FIG. 8 is merely an example, and any code may be used as long as it includes boundary bit position information and at least a part of higher-order bit encoded data. Further, FIG. 8 may be a macro block composed of a plurality of blocks or a data structure of a tile including a plurality of macro blocks.

本実施形態の画像符号化装置で生成した符号化データは、上位ビット部を境界ビット位置Bで表されるビット数分上位にシフトして、必要な画質レベルに応じて下位ビット部を復元し、符号化と逆の過程で復号することにより、再生できる。   The encoded data generated by the image encoding apparatus of the present embodiment shifts the upper bit part to the upper part by the number of bits represented by the boundary bit position B, and restores the lower bit part according to the required image quality level. It can be reproduced by decoding in the reverse process of encoding.

以上のように、本実施形態の画像符号化装置では、複数の画素で構成される画素ブロック(実施形態では8×8画素のサイズ)で、系列変換、量子化した後の係数の有効ビット数についての頻度分布を求める。そして、上位ビット部Unが非ゼロとなる個数が矩形ブロック全体の係数の数に対して所定の比率となる、境界ビットを求めた。これを用いて係数を上位ビット部と下位ビット部とに分離し、上位ビット部に対してゼロの連続数と非ゼロの係数を組み合わせた符号化を行った。これにより、ランレングス符号化を有効に機能させることができ、符号化の効率を向上することができる。   As described above, in the image coding apparatus according to the present embodiment, the effective bit number of the coefficient after series conversion and quantization in a pixel block (8 × 8 pixel size in the embodiment) composed of a plurality of pixels. Find the frequency distribution for. Then, boundary bits were obtained in which the number of non-zero upper bit portions Un is a predetermined ratio with respect to the number of coefficients of the entire rectangular block. Using this, the coefficient was separated into an upper bit part and a lower bit part, and the upper bit part was encoded by combining a continuous number of zeros and a non-zero coefficient. Thereby, run-length encoding can be made to function effectively and encoding efficiency can be improved.

[第1の実施形態の変形例]
上記第1の実施形態と同等の処理を、コンピュータプログラムによって実現する例を第1の実施形態の変形例として以下に説明する。
[Modification of First Embodiment]
An example in which processing equivalent to that in the first embodiment is realized by a computer program will be described below as a modification of the first embodiment.

図13は、本変形例における情報処理装置(例えばパーソナルコンピュータ)のブロック構成図である。   FIG. 13 is a block configuration diagram of an information processing apparatus (for example, a personal computer) in the present modification.

図中、1401はCPUで、RAM1402やROM1403に記憶されているプログラムやデータを用いて本装置全体の制御を行うと共に、後述する画像符号化処理、復号処理を実行する。1402はRAMで、外部記憶装置1407や記憶媒体ドライブ1408、若しくはI/F1409を介して外部装置からダウンロードされたプログラムやデータを記憶する為のエリアを備える。また、RAM1402は、CPU1401が各種の処理を実行する際に使用するワークエリアも備える。1403はROMで、ブートプログラムや本装置の設定プログラムやデータを格納する。1404、1405は夫々キーボード、マウスで、CPU1401に対して各種の指示を入力することができる。   In the figure, reference numeral 1401 denotes a CPU which controls the entire apparatus using programs and data stored in a RAM 1402 and a ROM 1403 and executes image encoding processing and decoding processing described later. A RAM 1402 includes an area for storing programs and data downloaded from the external device via the external storage device 1407, the storage medium drive 1408, or the I / F 1409. The RAM 1402 also includes a work area used when the CPU 1401 executes various processes. Reference numeral 1403 denotes a ROM which stores a boot program, a setting program for the apparatus, and data. Reference numerals 1404 and 1405 denote a keyboard and a mouse, respectively. Various instructions can be input to the CPU 1401.

1406は表示装置で、CRTや液晶画面などにより構成されており、画像や文字などの情報を表示することができる。1407はハードディスクドライブ装置等の大容量の外部記憶装置である。この外部記憶装置1407には、OS(オペレーティングシステム)や後述する画像符号化、復号処理の為のプログラム、符号化対象の画像データ、復号対象画像の符号化データなどがファイルとして保存されている。また、CPU1401は、これらのプログラムやデータをRAM1402上の所定のエリアにロードし、実行することになる。   A display device 1406 includes a CRT, a liquid crystal screen, and the like, and can display information such as images and characters. Reference numeral 1407 denotes a large-capacity external storage device such as a hard disk drive device. The external storage device 1407 stores an OS (operating system), a program for image encoding and decoding processing described later, image data to be encoded, encoded data of an image to be decoded, and the like as files. The CPU 1401 loads these programs and data into a predetermined area on the RAM 1402 and executes them.

1408は記憶媒体ドライブで、CD−ROMやDVD−ROMなどの記憶媒体に記録されたプログラムやデータを読み出してRAM1402や外部記憶装置1407に出力するものである。なお、この記憶媒体に後述する画像符号化、復号処理の為のプログラム、符号化対象の画像データ、復号対象の画像の符号化データなどを記録しておいても良い。この場合、記憶媒体ドライブ1408は、CPU1401による制御によって、これらのプログラムやデータをRAM1402上の所定のエリアにロードする。   A storage medium drive 1408 reads programs and data recorded on a storage medium such as a CD-ROM or DVD-ROM and outputs them to the RAM 1402 or the external storage device 1407. In addition, a program for image encoding and decoding processing described later, image data to be encoded, encoded data of an image to be decoded, and the like may be recorded on the storage medium. In this case, the storage medium drive 1408 loads these programs and data into a predetermined area on the RAM 1402 under the control of the CPU 1401.

1409はI/Fで、このI/F1409によって外部装置を本装置に接続し、本装置と外部装置との間でデータ通信を可能にするものである。例えは符号化対象の画像データや、復号対象の画像の符号化データなどを本装置のRAM1402や外部記憶装置1407、あるいは記憶媒体ドライブ1408に入力することもできる。1410は上述の各部を繋ぐバスである。   Reference numeral 1409 denotes an I / F, which connects an external device to the present apparatus through the I / F 1409 and enables data communication between the present apparatus and the external apparatus. For example, image data to be encoded, encoded data of an image to be decoded, and the like can be input to the RAM 1402, the external storage device 1407, or the storage medium drive 1408 of this apparatus. A bus 1410 connects the above-described units.

上記構成において、本装置の電源がONになると、CPU1401はROM1403のブートプログラムに従って、外部記憶装置1407からOSをRAM1402にロードする。この結果、キーボード1404、マウス1405の入力が可能となり、表示装置1406にGUIを表示することが可能になる。ユーザが、キーボード1404やマウス1405を操作し、外部記憶装置1407に格納された画像符号化処理用アプリケーションプログラムの起動の指示を行なうと、CPU1401はそのプログラムをRAM1402にロードし、実行する。これにより、本装置が画像符号化装置として機能することになる。   In the above configuration, when the power of this apparatus is turned on, the CPU 1401 loads the OS from the external storage device 1407 to the RAM 1402 in accordance with the boot program stored in the ROM 1403. As a result, the keyboard 1404 and the mouse 1405 can be input, and the GUI can be displayed on the display device 1406. When the user operates the keyboard 1404 or the mouse 1405 to give an instruction to start an application program for image encoding processing stored in the external storage device 1407, the CPU 1401 loads the program into the RAM 1402 and executes it. As a result, the present apparatus functions as an image encoding apparatus.

以下、CPU1401が実行する画像処理用のアプリケーションプログラムの処理手順を図2のフローチャートに従って説明する。基本的に、このプログラムは、図1に示す各構成要素に相当する関数を備えることになる。ただし、図1における係数バッファ105、頻度テーブルバッファ108、符号バッファ113の各領域はRAM1402内に予め確保することになる。   Hereinafter, the processing procedure of the application program for image processing executed by the CPU 1401 will be described with reference to the flowchart of FIG. Basically, this program includes functions corresponding to the components shown in FIG. However, the areas of the coefficient buffer 105, the frequency table buffer 108, and the code buffer 113 in FIG. 1 are secured in the RAM 1402 in advance.

まず、ステップS200において、符号化を開始する前の初期化処理が行われる。ここでは、処理する画素ブロックの番号を保持する変数iを0に初期化する。   First, in step S200, initialization processing before starting encoding is performed. Here, a variable i holding the number of the pixel block to be processed is initialized to 0.

次に、ステップS201においてI/F1409によって接続される外部装置から符号化対象の画像データを順次入力し、RAM1402に格納しながら、i番目のブロックデータを形成する(画像入力部101、ブロック分割部101の処理に相当)。このとき、画像データのヘッダを参照することで、その画像に含まれる画素ブロックの総数を算出しておく。   Next, in step S201, image data to be encoded is sequentially input from an external device connected by the I / F 1409, and the i-th block data is formed while being stored in the RAM 1402 (image input unit 101, block dividing unit). 101 equivalent). At this time, the total number of pixel blocks included in the image is calculated by referring to the header of the image data.

次に、ステップS202において、着目する画素ブロックMB(i)について離散コサイン変換等の系列変換処理を施し、対応するDCT係数データ(ブロック係数値)をRAM1402内に格納する(系列変換部103の処理に相当)。   Next, in step S202, the target pixel block MB (i) is subjected to series conversion processing such as discrete cosine transformation, and the corresponding DCT coefficient data (block coefficient value) is stored in the RAM 1402 (processing of the series conversion unit 103). Equivalent).

続いて、ステップS203で、DCT係数データの量子化を行い、RAM1402内に係数値として格納する(係数量子化部104の処理に相当)。   Subsequently, in step S203, the DCT coefficient data is quantized and stored as a coefficient value in the RAM 1402 (corresponding to the process of the coefficient quantization unit 104).

次に、ステップS204において、着目するブロックMB(i)の各係数値を参照し、その境界ビット位置Bを求める(境界ビット位置決定部116の処理に相当)。   Next, in step S204, the boundary bit position B is obtained by referring to each coefficient value of the target block MB (i) (corresponding to the processing of the boundary bit position determination unit 116).

図3にステップS204における境界ビット位置Bの決定について、処理フローを示す。   FIG. 3 shows a processing flow for determining the boundary bit position B in step S204.

以下、図3を用いて着目するブロックMB(i)の係数値の境界ビット位置Bを決定する処理の流れについて説明する。   Hereinafter, the flow of processing for determining the boundary bit position B of the coefficient value of the target block MB (i) will be described with reference to FIG.

まず、ステップS301で、頻度テーブルの初期化と、着目するブロックMB(i)の内部の係数を識別する番号nの初期化を行う。具体的には、全ての有効ビット数について出現回数を0に初期設定し、係数番号nに0を設定する。   First, in step S301, the frequency table and the number n for identifying the coefficient inside the block MB (i) of interest are initialized. Specifically, the number of appearances is initially set to 0 for all effective bits, and 0 is set to the coefficient number n.

次に、ステップS302において、番号nで表される係数CnをRAM1402から取得する。   Next, in step S302, the coefficient Cn represented by the number n is acquired from the RAM 1402.

続くステップS303では、着目する係数Cnについて有効ビット数B(Cn)を求める(有効ビット数判定部106の処理に相当)。   In the subsequent step S303, the effective bit number B (Cn) is obtained for the coefficient Cn of interest (corresponding to the processing of the effective bit number determination unit 106).

ステップS304ではステップS303で得た有効ビット数B(Cn)について、対応する頻度テーブルN(B(Cn))の値をインクリメントして更新する(頻度テーブル生成部107の処理に相当)。   In step S304, the number of valid bits B (Cn) obtained in step S303 is updated by incrementing the value of the corresponding frequency table N (B (Cn)) (corresponding to the processing of the frequency table generating unit 107).

ステップS305では着目する係数Cnがブロックの最後の係数であるか否かを判定し、最後の係数である場合(yes)にはステップS307へと処理を移し、そうでない場合(no)にはステップS306に移る。なお、画素ブロックのサイズが8×8画素のサイズとしているので、係数Cnがブロックの最後の係数であるか否かは変数nと“64”とを比較すれば判定できる。   In step S305, it is determined whether or not the coefficient Cn of interest is the last coefficient of the block. If it is the last coefficient (yes), the process proceeds to step S307. If not (no), the process proceeds to step S307. The process moves to S306. Since the size of the pixel block is 8 × 8 pixels, whether the coefficient Cn is the last coefficient of the block can be determined by comparing the variable n with “64”.

係数Cnがブロック内の最後の係数でない場合、次の係数へと処理の対象を移すために、ステップS306でnの値をインクリメントして更新する。ステップS306の後は、ステップS302に戻り、新たに着目する係数Cnについて処理を行う。   If the coefficient Cn is not the last coefficient in the block, the value of n is incremented and updated in step S306 in order to move the processing target to the next coefficient. After step S306, the process returns to step S302, and the process is performed for the coefficient Cn to be newly focused.

一方、ステップS305の判定において、Cnがブロックの最後の係数であった場合、ステップS307では頻度テーブルN(b)(bは有効ビット数を表す任意の整数)から累積頻度テーブルS(b)へと変換を行う。これは境界ビット選択部109の処理の一部に相当する。   On the other hand, if it is determined in step S305 that Cn is the last coefficient of the block, in step S307, the frequency table N (b) (b is an arbitrary integer representing the number of effective bits) is changed to the cumulative frequency table S (b). And convert. This corresponds to part of the processing of the boundary bit selection unit 109.

次に、ステップS308でステップS307で生成した累積頻度テーブルS(b)のbについて、有効ビットの最大値から最小値に向かう順に探索し、境界ビット位置Bとして選択する(境界ビット選択部109の処理の一部に相当)。   Next, in step S308, b in the cumulative frequency table S (b) generated in step S307 is searched in order from the maximum value of the effective bits to the minimum value, and is selected as the boundary bit position B (of the boundary bit selection unit 109). Equivalent to part of the process).

以上の処理により、着目するブロックMB(i)の境界ビット位置Bが決定される。   With the above processing, the boundary bit position B of the block MB (i) of interest is determined.

図2の説明に戻る。上記のようにして、着目するブロックMB(i)の境界ビット位置Bが決定されると、処理はステップS205に進み、着目するブロックMB(i)の係数値を上位ビット部Unと下位ビット部Lnに分離し、それぞれ符号化を行う。これは係数符号化部117の処理に相当する。   Returning to the description of FIG. When the boundary bit position B of the block MB (i) of interest is determined as described above, the process proceeds to step S205, and the coefficient value of the block of interest MB (i) is converted to the upper bit portion Un and the lower bit portion. Separate into Ln and perform encoding respectively. This corresponds to the processing of the coefficient encoding unit 117.

ステップS206では、処理したブロックが画像の最後のブロックか否かを判定し、最後のブロックである場合にはステップS208へと処理を移し、そうでない場合にはステップS207へと処理を移す。   In step S206, it is determined whether or not the processed block is the last block of the image. If it is the last block, the process proceeds to step S208, and if not, the process proceeds to step S207.

ステップS207では、処理対象のブロックを次のブロックへと移すため、変数iに1を加えて更新し、次のブロックについてステップS201から符号化処理を継続する。   In step S207, in order to move the block to be processed to the next block, the variable i is updated by adding 1, and the encoding process is continued from step S201 for the next block.

一方、画像の全てのブロックについて処理が終了した場合、処理はステップS208に進み、最終的な符号化データを生成して、I/F1409を解して外部装置へと出力する(符号列形成部114、符号出力部115の処理に相当)。   On the other hand, when the processing has been completed for all the blocks of the image, the process proceeds to step S208, where final encoded data is generated, and the I / F 1409 is solved and output to the external device (code string forming unit). 114, corresponding to the processing of the code output unit 115).

以上説明したように本変形例によっても、第1の実施形態と同様の作用効果を奏することが可能となるのは明らかであろう。すなわち、複数の画素で構成されるブロックを単位に、量子化後の係数値の有効ビット数の頻度分布を求め、上位ビット部が非ゼロとなる係数が所望の比率となる適切な境界ビット位置を決定する。この結果、符号化の効率を向上することができる。   As described above, it will be apparent that the present modification can also provide the same operational effects as those of the first embodiment. In other words, the frequency distribution of the number of effective bits of the coefficient value after quantization is obtained in units of blocks composed of a plurality of pixels, and appropriate boundary bit positions at which the coefficients whose non-zero upper bit part is non-zero have a desired ratio To decide. As a result, encoding efficiency can be improved.

[第2の実施形態]
上記第1の実施形態及びその変形例では、ブロック毎に、量子化後の係数値の上位ビット部がゼロとなる係数の個数が、所定の比率に近くなるように、境界ビットを設定して符号化を行った。しかしながら、この境界ビット位置の選択はある程度の効率は期待できるが、必ずしも最小符号量となることを約束するものとは言えない。なぜなら、複数の非0の上位ビット部Unが連続して位置するのではなく、離散した位置にある場合、ランレングス符号化の効率を上げることができないからである。
[Second Embodiment]
In the first embodiment and the modification thereof, boundary bits are set for each block so that the number of coefficients for which the upper bit part of the coefficient value after quantization is zero is close to a predetermined ratio. Encoding was performed. However, although this boundary bit position selection can be expected to have a certain degree of efficiency, it cannot always be said that the minimum code amount is promised. This is because the efficiency of run-length encoding cannot be increased when the plurality of non-zero higher-order bit portions Un are not continuously located but at discrete positions.

そこで、本第2の実施形態では、境界ビット決定部から出力される境界ビット位置Bと、その近傍の境界ビット位置B−1で、符号化処理を行ない、符号量の少ない方を選択する例について説明する。   Therefore, in the second embodiment, an example in which encoding processing is performed at the boundary bit position B output from the boundary bit determination unit and the boundary bit position B-1 in the vicinity thereof and the one with the smaller code amount is selected. Will be described.

なお、本第2の実施形態でも、符号化対象の画像データは、説明を簡単にするためにモノクロ画像データとするが、RGB画像データや、CMYKカラー画像データに適用しても良い。また、画像は水平方向W画素、垂直方向H画素により構成されるものとする。また、処理単位の矩形ブロックのサイズも8×8画素サイズであるものとして説明する。

本第2の実施形態に係る画像符号化装置のブロック図を図9に示す。図9と図1との違いは、図1における係数符号化部117が図9の係数符号化部900で置き換わった点であり、これ以外は同じであるので同参照番号を付した。従って、図1と同じ参照番号を付した要素についてはその説明は省略する。
In the second embodiment, the image data to be encoded is monochrome image data for simplicity of explanation, but may be applied to RGB image data or CMYK color image data. The image is assumed to be composed of horizontal W pixels and vertical H pixels. Further, the description will be made assuming that the size of the rectangular block in the processing unit is also 8 × 8 pixel size.

FIG. 9 shows a block diagram of an image encoding apparatus according to the second embodiment. The difference between FIG. 9 and FIG. 1 is that the coefficient encoding unit 117 in FIG. 1 is replaced with the coefficient encoding unit 900 in FIG. Therefore, the description of the elements having the same reference numerals as those in FIG. 1 is omitted.

係数符号化部900は、上位ビット/下位ビット分離部901と、2つの上位ビット符号化部902、903と、下位ビット符号化部904、符号バッファ907、及び、符号選択部906を有する。第1の実施形態で説明した係数符号化部117と同じく、係数符号化部900は、境界ビット位置決定部116からの境界ビット位置Bと、係数バッファ105からの矩形ブロックの係数データCnとを入力する。   The coefficient encoding unit 900 includes an upper bit / lower bit separation unit 901, two upper bit encoding units 902 and 903, a lower bit encoding unit 904, a code buffer 907, and a code selection unit 906. Similar to the coefficient encoding unit 117 described in the first embodiment, the coefficient encoding unit 900 uses the boundary bit position B from the boundary bit position determination unit 116 and the coefficient data Cn of the rectangular block from the coefficient buffer 105. input.

上位/下位ビット分離部901では、着目する係数データCnについて、その符号絶対値表現における下位Bビットを取り除いて得られる第1の上位ビット部と、下位B−1ビットを取り除いて得られる第2の上位ビット部と、下位Bビット部とに分離する。   In the upper / lower bit separation unit 901, for the coefficient data Cn of interest, the first upper bit part obtained by removing the lower B bits in the code absolute value expression, and the second obtained by removing the lower B-1 bits. Are divided into an upper bit portion and a lower B bit portion.

以下の説明では、第1の上位ビット部をU1n、第2の上位ビット部をU2nと表すとする。U1n,U2n,Lnを式で示せば次の通りである。
U1n=Cn>>B
U2n=Cn>>(B−1)
Ln =|Cn|&((1<<B)−1)
In the following description, it is assumed that the first upper bit part is represented as U1n and the second upper bit part is represented as U2n. U1n, U2n, and Ln can be represented by equations as follows.
U1n = Cn >> B
U2n = Cn >> (B-1)
Ln = | Cn | & ((1 << B) -1)

上位/下位ビット分離部901は、第1の上位ビット部U1nを上位ビット符号化部902に出力し、第2の上位ビット部U2nを上位ビット符号化部903に出力する。また、上位/下位ビット分離部901は、下位ビット部Lnを下位ビット符号化部904へと出力する。なお、正負符号ビットを除く上位ビット部U1nで表わされる値が0である係数Cnについては、係数Cnの正負を表す符号を下位ビット符号化部904へと引き渡されるものとする。この原理は第1の実施形態と同じである。   The upper / lower bit separation unit 901 outputs the first upper bit unit U1n to the upper bit encoding unit 902, and outputs the second upper bit unit U2n to the upper bit encoding unit 903. Also, the upper / lower bit separation unit 901 outputs the lower bit part Ln to the lower bit encoding unit 904. For the coefficient Cn whose value represented by the upper bit part U1n excluding the positive / negative sign bits is 0, a sign indicating the sign of the coefficient Cn is passed to the lower bit encoding unit 904. This principle is the same as in the first embodiment.

上位ビット符号化部902は、着目矩形ブロック内の64個の第1の上位ビット部U1nを入力し、符号化を行なう。また、上位ビット符号化部903は、着目矩形ブロック内の64個の第2の上位ビット部U2nを入力し、符号化を行なう。これら2つの符号化部は、第1の実施形態における上位ビット符号化部111と同じく、JPEG BaselineにおけるDC、AC係数の符号化と同じ方法を用いるものとする。   The upper bit encoding unit 902 inputs the 64 first upper bit units U1n in the target rectangular block and performs encoding. Also, the upper bit encoding unit 903 inputs 64 second upper bit units U2n in the target rectangular block and performs encoding. These two encoding units are assumed to use the same method as the encoding of DC and AC coefficients in JPEG Baseline, like the high-order bit encoding unit 111 in the first embodiment.

上位ビット符号化部902からは第1の上位ビット部U1nの符号化データが符号バッファ905に出力される。また、上位ビット符号化部903からは第2の上位ビット部U2nの符号化データが符号バッファ905に出力される。   The encoded data of the first upper bit unit U1n is output from the upper bit encoding unit 902 to the code buffer 905. Also, the upper bit encoding section 903 outputs the encoded data of the second upper bit section U2n to the code buffer 905.

一方、下位ビット符号化部904は第1の実施形態における下位ビット符号化部112と同様にして、上位/下位ビット分離部901の出力する係数の下位ビット部Lnの符号化を行い、ビットプレーン順に並べられた下位ビット符号化データが符号バッファ905に出力される。   On the other hand, the lower bit encoding unit 904 encodes the lower bit part Ln of the coefficient output from the upper / lower bit separation unit 901 in the same manner as the lower bit encoding unit 112 in the first embodiment, The lower bit encoded data arranged in order is output to the code buffer 905.

上記のようにして、着目している矩形ブロックの全係数値の符号化処理を終えると、符号選択部908は、符号バッファ905に格納される第1の上位ビット部U1nの符号化データ、第2の上位ビット部U2nの符号化データ、下位ビット部Lnの符号化データの符号量に基づき、境界ビット位置をBとするか、B−1とするかを決定する。そして、決定した境界ビット位置に基づき、出力すべき符号化データを取り出す。   When the encoding process of all the coefficient values of the target rectangular block is completed as described above, the code selection unit 908 stores the encoded data of the first upper bit unit U1n stored in the code buffer 905, the first Whether the boundary bit position is set to B or B-1 is determined based on the encoded data of the encoded data of the second upper bit part U2n and the encoded data of the lower bit part Ln. Then, based on the determined boundary bit position, encoded data to be output is extracted.

今、第1の上位ビット部U1nの符号化データの符号量をCa、第2の上位ビット部U2nの符号化データの符号量をCb、下位ビット部Lnの符号化データの符号量をCcと定義する。また、下位ビット部Lnの符号化データから、B桁のビットプレーンの符号化データを除いた符号化データの符号量をCdと定義する。   Now, the code amount of the encoded data of the first upper bit portion U1n is Ca, the code amount of the encoded data of the second upper bit portion U2n is Cb, and the code amount of the encoded data of the lower bit portion Ln is Cc. Define. Further, the code amount of the encoded data obtained by excluding the encoded data of the B-digit bit plane from the encoded data of the lower bit part Ln is defined as Cd.

従って、“Ca+Cc”は、境界ビット位置をBとした場合の着目している矩形ブロックの符号量を意味する。また、“Cb+Cd”は、境界ビット位置をB−1とした場合の着目している矩形ブロックの符号量を意味することになるのは明らかであろう。   Therefore, “Ca + Cc” means the code amount of the rectangular block of interest when the boundary bit position is B. It is clear that “Cb + Cd” means the code amount of the rectangular block of interest when the boundary bit position is B-1.

それ故、符号選択部908は、“Ca+Cc”と“Cb+Cd”とを比較する。この比較結果に応じて、符号選択部908は次の処理を実行する。
・Ca+Cc≦Cb+Cdの場合:
符号選択部906は、符号バッファ905内に格納された第1の上位ビット部U1nの符号化データと、下位ビット部Lnの符号化データを選択し、符号列形成部114に出力する。また、このとき、符号選択部906は、境界ビット位置がBであることを示す信号を符号列形成部114に出力する。
・Ca+Cc>Cb+Cdの場合:
符号選択部906は、符号バッファ905内に格納された第2の上位ビット部U2nの符号化データと、下位ビット部Lnの符号化データからB桁のビットプレーンの符号化データを除く符号化データを選択し、符号列形成部114に出力する。また、このとき、符号選択部906は、境界ビット位置がB−1であることを示す信号を符号列形成部114に出力する。
Therefore, the code selection unit 908 compares “Ca + Cc” with “Cb + Cd”. In accordance with the comparison result, the code selection unit 908 executes the following processing.
When Ca + Cc ≦ Cb + Cd:
The code selection unit 906 selects the encoded data of the first upper bit part U1n and the encoded data of the lower bit part Ln stored in the code buffer 905, and outputs them to the code string forming unit 114. At this time, the code selecting unit 906 outputs a signal indicating that the boundary bit position is B to the code string forming unit 114.
・ When Ca + Cc> Cb + Cd:
The code selection unit 906 stores the encoded data of the second upper bit part U2n stored in the code buffer 905, and the encoded data excluding the encoded data of the B-digit bit plane from the encoded data of the lower bit part Ln. Is output to the code string forming unit 114. At this time, the code selecting unit 906 outputs a signal indicating that the boundary bit position is B-1 to the code string forming unit 114.

以上説明したように本第2の実施形態によれば、境界ビット位置Bとその近傍に当たるB−1を用いて上位ビット部の符号化を行い、ブロックの符号量の小さくなる方を選択する。これにより、少なくとも第1の実施形態と比較して、より高い圧縮率の符号化データを生成することが可能になる。   As described above, according to the second embodiment, the upper bit part is encoded using the boundary bit position B and B-1 corresponding to the boundary bit position B, and the one with the smaller code amount of the block is selected. This makes it possible to generate encoded data with a higher compression rate than at least the first embodiment.

なお、本第2の実施形態では、境界ビット位置BとB−1の2つの方法での符号化データ量を比較する例を説明したが、B+1、B、B−1の3つの方法で符号化データを比較し、最小の符号化データを選択するようにしても構わない。この3つの方法を利用する場合では、B+1を境界ビット位置として、下位ビット部を下位ビット符号化部で符号化すればよい。境界ビット位置B、B−1の場合の下位ビット部の符号化データは、下位ビット符号化部で得られた符号化データの中から選択できるからである。別な表現を用いるのであれば、B”=B+1とした場合、B”、B”−1、B”−2について符号化データ量を比較することとも等価であるから、かかる点は容易に理解できよう。   In the second embodiment, the example of comparing the encoded data amounts by the two methods of the boundary bit positions B and B-1 has been described. However, the encoding is performed by the three methods of B + 1, B, and B-1. The encoded data may be compared and the minimum encoded data may be selected. When these three methods are used, B + 1 may be used as a boundary bit position, and the lower bit part may be encoded by the lower bit encoding part. This is because the encoded data of the lower bit portion in the case of the boundary bit positions B and B-1 can be selected from the encoded data obtained by the lower bit encoding portion. If another expression is used, when B ″ = B + 1, it is equivalent to comparing the encoded data amounts for B ″, B ″ −1, and B ″ −2, so this point can be easily understood. I can do it.

<第2の実施形態の変形例>
上記第2の実施形態の処理についても、第1の実施形態の変形例と同様にコンピュータプログラムで実現することができる。装置構成は、第1の実施形態の変形例と同じ図13の構成で構わない。また、処理のフローについても図2に示した第1の実施形態の変形例と基本的に同じである。相違点は、ステップS205におけるブロックMB(i)の符号化において、上述の係数符号化部909の処理に相当する符号化処理が行われることのみであるため、ここでの詳述は不要であろう。
<Modification of Second Embodiment>
The processing of the second embodiment can also be realized by a computer program as in the modification of the first embodiment. The apparatus configuration may be the same as that shown in FIG. 13 as the modification of the first embodiment. The processing flow is basically the same as that of the modification of the first embodiment shown in FIG. The only difference is that the encoding process corresponding to the process of the coefficient encoding unit 909 described above is performed in the encoding of the block MB (i) in step S205, and thus detailed description is unnecessary here. Let's go.

以上説明したように、本変形例によっても、第2の実施形態と同様の作用効果を奏することが可能となるのは明らかである。即ち、境界ビット位置Bとその近傍に当たるB−1を用いて上位ビット部の符号化を行い、ブロックの符号量の小さくなる方を選択する。これにより、より最適に近い境界ビット位置の選択が可能となり、符号量を削減することができる。   As described above, it is apparent that the present modification can achieve the same operational effects as those of the second embodiment. That is, the upper bit part is encoded using the boundary bit position B and B-1 corresponding to the boundary bit position B, and the one with the smaller code amount of the block is selected. As a result, it is possible to select a boundary bit position that is closer to the optimum, and the amount of code can be reduced.

[第3の実施形態]
上記第1、第2の実施形態の画像符号化装置では、上位ビット部の符号化に用いるランレングス符号化が有効に機能するように、係数の有効ビット数の分布から上位ビット部のゼロ係数が所定の比率となる境界ビットBを選択した。しかしながら、先に説明したように、ゼロ係数が同数の場合でも、非ゼロ係数が固まっているか、分散しているかによっても符号化の効率は異なってくるため、第2の実施形態による符号化データが最も効率が良いことを約束するものではない。そこで、本第3の実施形態では、単に比率から導かれる閾値のみを用いるのではなく、ゼロ係数、非ゼロ係数の分布状況を考慮して境界ビット位置を決定する例を説明する。すなわち、本第3の実施形態では、非ゼロ係数が固まっているのか、分散しているのか検出し、非ゼロラン長(ラン長がゼロでない)の数を計数して境界ビットBの決定に用いる実装形態を説明する。
[Third Embodiment]
In the image coding apparatuses according to the first and second embodiments, the zero coefficient of the upper bit part is calculated from the distribution of the effective bit number of the coefficient so that the run-length coding used for the encoding of the upper bit part functions effectively. Boundary bit B having a predetermined ratio is selected. However, as described above, even when the number of zero coefficients is the same, the encoding efficiency varies depending on whether the non-zero coefficients are solid or distributed, and thus the encoded data according to the second embodiment. Does not promise to be the most efficient. Thus, in the third embodiment, an example will be described in which the boundary bit position is determined in consideration of the distribution of zero coefficients and non-zero coefficients, instead of using only the threshold value derived from the ratio. That is, in the third embodiment, it is detected whether the non-zero coefficients are solid or distributed, and the number of non-zero run lengths (run length is not zero) is counted and used to determine the boundary bit B. A mounting form will be described.

なお、本第3の実施形態でも、符号化対象の画像データは、説明を簡単にするためにモノクロ画像データとするが、RGB画像データや、CMYKカラー画像データに適用しても良い。また、画像は水平方向W画素、垂直方向H画素により構成され、いずれも8の整数倍であるものとして説明する。   In the third embodiment, the image data to be encoded is monochrome image data for simplicity of description, but may be applied to RGB image data or CMYK color image data. In addition, the image will be described as having W pixels in the horizontal direction and H pixels in the vertical direction, both of which are integer multiples of 8.

本第3の実施形態に係る画像符号化装置のブロック構成図を図10に示す。図10と図1との違いは、図1における境界ビット位置決定部116が、図9の境界ビット位置決定部1000に置き換わった点である。また、境界ビット位置決定部1000における有効ビット数判定部106、頻度テーブル生成部107、及び、頻度テーブル108についても、図1と同じであるので、その説明については詳述しない。   FIG. 10 shows a block configuration diagram of an image encoding device according to the third embodiment. The difference between FIG. 10 and FIG. 1 is that the boundary bit position determination unit 116 in FIG. 1 is replaced with the boundary bit position determination unit 1000 in FIG. The valid bit number determination unit 106, the frequency table generation unit 107, and the frequency table 108 in the boundary bit position determination unit 1000 are also the same as those in FIG.

以下、本第3の実施形態との差異部分である、境界ビット位置決定部1000の処理について説明する。なお、本第3の実施形態における有効ビット数判定部106、及び、上位/下位ビット分離部110は、係数バッファ105から係数値Cnを読取る順番(スキャン順)は同じ順であるとして説明する。   Hereinafter, processing of the boundary bit position determination unit 1000, which is a difference from the third embodiment, will be described. Note that the effective bit number determination unit 106 and the upper / lower bit separation unit 110 in the third embodiment will be described assuming that the order in which the coefficient values Cn are read from the coefficient buffer 105 (scan order) is the same order.

図10の境界ビット位置決定部1000は、図1における境界ビット位置決定部116に、非ゼロランカウンタ更新部1001、非ゼロランカウンタ1002を追加した構成となっている。非ゼロランカウンタ1002は、図11に示すように、各ビット位置を境界ビットとした場合の非ゼロランの数を保持する。ビット位置bの非ゼロラン数をNZ(b)と記す。ブロックの読み込み開始時に、全てのbについて非ゼロラン数NZ(b)を0に設定する。   The boundary bit position determination unit 1000 in FIG. 10 has a configuration in which a non-zero run counter update unit 1001 and a non-zero run counter 1002 are added to the boundary bit position determination unit 116 in FIG. As shown in FIG. 11, the non-zero run counter 1002 holds the number of non-zero runs when each bit position is a boundary bit. The number of non-zero runs at bit position b is denoted as NZ (b). At the start of reading the block, the non-zero run number NZ (b) is set to 0 for all b.

入力される着目係数Cnに対して、有効ビット数判定部106により、有効ビット数B(Cn)が求められると、頻度テーブル生成部107により頻度テーブルバッファ108に格納される頻度テーブルの更新処理が行われる。   When the effective bit number determination unit 106 obtains the effective bit number B (Cn) for the input coefficient of interest Cn, the frequency table generation unit 107 performs update processing of the frequency table stored in the frequency table buffer 108. Done.

一方、有効ビット数B(Cn)は非ゼロランカウンタ更新部1001にも供給される。非ゼロランカウンタ更新部1001は、直前の係数Cnに対する有効ビット数B(Cn−1)が保持している。そして、B(Cn)>B(Cn−1)である場合、B(Cn−1)≦b<B(Cn)となるbについて、非ゼロランカウンタ1002に保持するNZ(b)を“1”だけインクリメントして更新する。   On the other hand, the effective bit number B (Cn) is also supplied to the non-zero run counter update unit 1001. The non-zero run counter update unit 1001 holds the number of effective bits B (Cn−1) for the immediately preceding coefficient Cn. When B (Cn)> B (Cn−1), NZ (b) held in the non-zero run counter 1002 is set to “1” for b satisfying B (Cn−1) ≦ b <B (Cn). "Increment only and update.

例えば、図12に示す係数値Cn−1とCnの場合を考える。境界ビット位置Bを0−3に設定した場合、どちらの上位ビットも非ゼロであり、Cnの上位ビット部は長さゼロのゼロランの後の非ゼロ係数として符号化される。一方、境界ビット位置Bを4、または、5に設定した場合、Cn−1の上位ビットはゼロとなるが、Cnの上位ビットはゼロとならないため、Cnは非ゼロのラン長のゼロランの後に続く非ゼロ係数として符号化される。よってビットb=4、5について非ゼロラン数NZ(b)をインクリメントする。境界ビット位置Bを6以上に設定した場合にはCn−1もCnも上位ビットはゼロとなるため、変更しない。   For example, consider the case of coefficient values Cn-1 and Cn shown in FIG. When the boundary bit position B is set to 0-3, both upper bits are non-zero, and the upper bit part of Cn is encoded as a non-zero coefficient after a zero-length zero run. On the other hand, when the boundary bit position B is set to 4 or 5, the upper bits of Cn-1 are zero, but the upper bits of Cn are not zero, so Cn is after a zero run with a non-zero run length. It is encoded as a subsequent non-zero coefficient. Therefore, the non-zero run number NZ (b) is incremented for bits b = 4 and 5. When the boundary bit position B is set to 6 or more, the upper bits of both Cn-1 and Cn are zero and are not changed.

上記処理を着目するブロックについて行うことにより、各ビットを境界ビットとした場合の非ゼロラン数のカウントを行う。   By performing the above processing on the block of interest, the number of non-zero runs when each bit is a boundary bit is counted.

境界ビット選択部1003は、まず、第1の実施形態で説明した境界ビット選択部109と同様にして、頻度テーブルから累積頻度テーブルへと変換を行い、上位ビット部の非ゼロ係数の出現回数と所望の比率で表わされる閾値とを比較することで、暫定境界ビット位置B’を決定し、この段階では係数符号化部117に供給しない(第1の実施形態では、この段階で得られた境界ビット位置が係数符号化部117に供給されていた)。   The boundary bit selection unit 1003 first converts from the frequency table to the cumulative frequency table in the same manner as the boundary bit selection unit 109 described in the first embodiment, and the number of occurrences of non-zero coefficients in the upper bit part The provisional boundary bit position B ′ is determined by comparing with a threshold value represented by a desired ratio, and is not supplied to the coefficient encoding unit 117 at this stage (in the first embodiment, the boundary obtained at this stage) The bit position was supplied to the coefficient encoding unit 117).

境界ビット選択部1003は、暫定境界ビット位置B’を用いて、非ゼロランカウンタ1002を参照してNZ(B’)を得る。そして、境界ビット選択部1003は、得られたNZ(B’)と予め設定された閾値Th2、Th3とを比較する。ここで閾値Th3、Th2の関係は、Th3<Th2の関係にあるものとする。   The boundary bit selection unit 1003 obtains NZ (B ′) by referring to the non-zero run counter 1002 using the provisional boundary bit position B ′. Then, the boundary bit selection unit 1003 compares the obtained NZ (B ′) with preset threshold values Th2 and Th3. Here, it is assumed that the relationship between the threshold values Th3 and Th2 is a relationship of Th3 <Th2.

もし、NZ(B’)>Th2であったとすると、境界ビット位置B’を境界ビットとした場合に非ゼロとなる係数が分散している状態あることを示している。言い換えれば、これ以上境界ビットを下位方向に設定してしまうと、効率的なランレングス符号化ができないことを意味する。よって、NZ(B’)>Th2である場合、境界ビット選択部1003はB’+1を、最終的な境界ビット位置Bとして係数符号化部117に供給する。   If NZ (B ′)> Th2, it is indicated that there is a state in which non-zero coefficients are dispersed when the boundary bit position B ′ is a boundary bit. In other words, if more boundary bits are set in the lower direction, it means that efficient run-length encoding cannot be performed. Therefore, when NZ (B ′)> Th2, the boundary bit selection unit 1003 supplies B ′ + 1 to the coefficient encoding unit 117 as the final boundary bit position B.

また、NZ(B’)<Th3であったとすると、暫定境界ビット位置B’を境界ビットとした場合に非ゼロとなる係数が密集(連続)している状態あることを示している。言い換えれば、更に境界ビット位置を下位ビット方向に変更したとしても、効率的なランレングス符号化が期待できることを意味する。よって、NZ(B’)<Th3である場合、境界ビット選択部1003はB’−1を、最終的な境界ビット位置Bとして係数符号化部117に供給する。   Further, assuming that NZ (B ′) <Th3, the coefficients that are non-zero when the temporary boundary bit position B ′ is a boundary bit are dense (continuous). In other words, even if the boundary bit position is further changed in the lower bit direction, it means that efficient run-length encoding can be expected. Therefore, when NZ (B ′) <Th3, the boundary bit selection unit 1003 supplies B′−1 to the coefficient encoding unit 117 as the final boundary bit position B.

また、Th3≦NZ(B’)≦Th2の関係にあるとき、境界ビット選択部1003は暫定境界ビット位置B’を、最終的な境界ビット位置Bとして係数符号化部117に供給する。   When the relationship Th3 ≦ NZ (B ′) ≦ Th2 is satisfied, the boundary bit selection unit 1003 supplies the provisional boundary bit position B ′ to the coefficient encoding unit 117 as the final boundary bit position B.

以上説明したように本第3の実施形態によれば、境界ビットの候補位置において、上位ビット部のゼロ、非ゼロの係数の分布状況を判別し、境界ビットを選択することで、ランレングス符号化を更に効率的に機能させることができる。   As described above, according to the third embodiment, the run-length code is obtained by determining the distribution status of zero and non-zero coefficients in the upper bit part at the boundary bit candidate position and selecting the boundary bit. Can be made to function more efficiently.

<第3の実施形態の変形例>
上記第3の実施形態の処理についても、第1、第2の実施形態の処理と同様にコンピュータプログラムで実現することができる。装置構成は、第1の実施形態の変形例と同じ図13の構成で構わない。また、処理のフローについても図2に示した第1の実施形態の変形例と基本的に同じである。相違点は、ステップS204における境界ビット決定と、ステップS205におけるブロックMB(i)の符号化の内部処理のみである。すなわち、上述の通り、ステップS204においては境界ビット位置決定部1004に相当する処理が行われ、ステップS205においては、第2の実施形態で説明した係数符号化部909に相当する符号化処理が行われる。
<Modification of Third Embodiment>
The processing of the third embodiment can also be realized by a computer program as in the processing of the first and second embodiments. The apparatus configuration may be the same as that shown in FIG. 13 as the modification of the first embodiment. The processing flow is basically the same as that of the modification of the first embodiment shown in FIG. The only difference is the boundary bit determination in step S204 and the internal processing of encoding block MB (i) in step S205. That is, as described above, in step S204, processing corresponding to the boundary bit position determination unit 1004 is performed, and in step S205, encoding processing corresponding to the coefficient encoding unit 909 described in the second embodiment is performed. Is called.

従って、本変形例によっても、第3の実施形態と同様の作用効果を奏することが可能となるのは明らかであろう。即ち、暫定境界ビット位置において、上位ビット部のゼロ、非ゼロの係数の分布状況を判別し、暫定境界ビット位置を調整することで、ランレングス符号化を効率的に機能させることができる。   Therefore, it will be apparent that the present modification can also achieve the same operational effects as the third embodiment. That is, run length coding can be efficiently functioned by determining the distribution of the zero and non-zero coefficients in the upper bit part at the temporary boundary bit position and adjusting the temporary boundary bit position.

[その他の実施形態]
上記各実施形態では、上位ビット部の符号化にJPEG Baselineと同様の手法を用いる例について示した。しかしながら、ゼロと非ゼロの情報の伝達にランレングス符号化を用いたものであればこれに限らず、各種の変形が可能であることは容易に理解できよう。また、上述の実施形態では8×8画素をブロックとして境界ビット位置を決定したが、JPEGにおけるMCUのように8×8ブロックのいくつかの集まりで最小符号化単位を構成し、それぞれに境界ビットを設定するようにしても良い。あるいは、画像をあらかじめタイルに分割し、各タイル毎に境界ビット位置を決定するようにしても構わない。
[Other Embodiments]
In each of the above embodiments, an example in which a method similar to JPEG Baseline is used for encoding the upper bit part has been described. However, it is easy to understand that various modifications are possible as long as run-length coding is used to transmit zero and non-zero information. In the above-described embodiment, the boundary bit position is determined using 8 × 8 pixels as a block. However, a minimum coding unit is configured by several groups of 8 × 8 blocks, such as MCU in JPEG, and each of which has a boundary bit. May be set. Alternatively, the image may be divided into tiles in advance, and the boundary bit position may be determined for each tile.

また、実施形態では、モノクロ画像データの符号化を例に説明したが、画像の色空間は、RGB、CMYK、Lab、YCrCbなど様々なタイプの画像データに適用可能であるのは明らかであるので、色成分の数や色空間の種類によって本発明が限定されるものではない。   In the embodiments, encoding of monochrome image data has been described as an example. However, it is apparent that the color space of an image can be applied to various types of image data such as RGB, CMYK, Lab, and YCrCb. The present invention is not limited by the number of color components and the type of color space.

また、通常、コンピュータプログラムは、CD−ROM等のコンピュータ可読記憶媒体に格納されていて、それをコンピュータの読取り装置(CD−ROMドライブ)にセットし、システムにコピーもしくはインストールすることで実行可能になる。従って、このようなコンピュータ可読記憶媒体も本発明の範疇に入ることも明らかである。   Further, the computer program is usually stored in a computer-readable storage medium such as a CD-ROM, and can be executed by setting it in a computer reader (CD-ROM drive) and copying or installing it in the system. Become. Therefore, it is obvious that such a computer-readable storage medium falls within the scope of the present invention.

第1の実施形態に係る画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus which concerns on 1st Embodiment. 第1の実施形態における変形例の符号化処理手順を示すフローチャートである。It is a flowchart which shows the encoding process procedure of the modification in 1st Embodiment. 第1の実施形態における変形例の境界ビット位置決定の処理手順を示すフローチャートである。It is a flowchart which shows the process sequence of boundary bit position determination of the modification in 1st Embodiment. 頻度テーブルの例を示す図である。It is a figure which shows the example of a frequency table. 累積頻度テーブルの例を示す図である。It is a figure which shows the example of a cumulative frequency table. 係数のビット分離の概略を示す図である。It is a figure which shows the outline of the bit separation of a coefficient. 下位ビット符号化データの例を示す図である。It is a figure which shows the example of low-order bit encoding data. 第1の実施形態において生成する符号化データファイルのデータ構造を示す図である。It is a figure which shows the data structure of the encoding data file produced | generated in 1st Embodiment. 第2の実施形態に係る画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus which concerns on 2nd Embodiment. 第3の実施形態に係る画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus which concerns on 3rd Embodiment. 非ゼロランカウンタ1002に保持されるカウンタの概略を示す図である。5 is a diagram showing an outline of a counter held in a non-zero run counter 1002. FIG. 係数Cnと直前の係数Cn−1の例を示す図である。It is a figure which shows the example of the coefficient Cn and the coefficient Cn-1 immediately before. 第1の実施形態の変形例に係る情報処理装置のブロック構成図である。It is a block block diagram of the information processing apparatus which concerns on the modification of 1st Embodiment.

Claims (7)

多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置であって、
前記各係数についての、最上位から最下位ビットに向かって最初に“1”となるビット位置から最下位ビットまでの有効ビット数を検出し、各有効ビット数の出現回数をカウントするカウント手段と、
有効ビット数Bの出現回数をN(B)と定義し、出現回数が1以上の最大の有効ビット数をbmaxと定義し、変数b=0、1、2…に対する次式の合算関数:
S(bmax−b)=ΣN(bmax−i) (i=0、1、…、b)
において、予め設定された閾値Thとの関係が、
S(bmax−b)>Th
を満たす最大整数bを求め、当該最大整数bに基づいて、境界ビット位置を決定する境界ビット位置決定手段と、
前記各係数値を、前記境界ビット位置決定手段で算出した境界ビット位置を境界にして、上位ビット部、下位ビット部とに分離する分離手段と、
該分離手段で分離した各係数の前記上位ビット部を符号化する上位ビット符号化手段と、
前記分離手段で分離した各係数の前記下位ビット部を符号化する下位ビット符号化手段と、
前記上位ビット符号化手段、前記下位ビット符号化手段それぞれで得られた符号化データから、着目画素ブロックの符号化データを生成し、出力する出力手段と
を備えることを特徴とする画像符号化装置。
An image encoding device that performs frequency conversion and quantization processing in units of pixel blocks from multivalued image data, and encodes each multivalued coefficient obtained by the quantization processing,
Counting means for detecting the number of effective bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit for each coefficient and counting the number of occurrences of each effective bit number; ,
The number of occurrences of the number of effective bits B is defined as N (B), the maximum number of effective bits with the number of occurrences of 1 or more is defined as bmax, and the summation function of the following equation for the variable b = 0, 1, 2,.
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to the preset threshold value Th,
S (bmax−b)> Th
Boundary bit position determination means for determining a boundary bit position based on the maximum integer b;
Separating means for separating the values of the respective coefficients into upper bit parts and lower bit parts with the boundary bit position calculated by the boundary bit position determining means as a boundary;
Upper bit encoding means for encoding the upper bit portion of each coefficient separated by the separation means;
Low-order bit encoding means for encoding the low-order bit part of each coefficient separated by the separation means;
An image encoding device comprising: output means for generating and outputting encoded data of a pixel block of interest from encoded data obtained by the upper bit encoding means and the lower bit encoding means, respectively. .
前記上位ビット符号化手段は、ゼロの連続数と非ゼロの値の組み合せを符号化するランレングス符号化手段であって、
前記下位ビット符号化手段は、各係数の前記下位ビット部の同一ビット位置のビット情報を連結したビットプレーンに変換し、出力する手段である
ことを特徴とする請求項1に記載の画像符号化装置。
The upper bit encoding means is a run-length encoding means for encoding a combination of a continuous number of zeros and a non-zero value,
The image coding according to claim 1, wherein the lower bit encoding means is means for converting and outputting bit information at the same bit position of the lower bit part of each coefficient to a concatenated bit plane. apparatus.
前記分離手段は、前記境界ビット位置決定手段で算出した境界ビット位置より上位の第1の上位ビット部と、前記境界ビット位置−1より上位の第2の上位ビット部と、前記境界ビット位置以下の下位ビット部とに分離し、
前記上位ビット符号化手段は、前記第1の上位ビット部、前記第2の上位ビット部をそれぞれ符号化し、
前記出力手段は、
前記第1の上位ビット部の符号量をCa、前記第2の上位ビット部の符号量をCb、前記下位ビット部の符号量をCc、そして、前記下位ビット部の符号化データから、前記境界ビット位置のビットプレーンの符号化データを除いた符号化データの符号量をCdと定義したとき、
Ca+Cc≦Cb+Cdの場合、前記上位ビット符号化手段で得られた前記第1の上位ビット部の符号化データと前記下位ビット符号化手段で得られた符号化データを前記着目画素ブロックの符号化データとして出力し、
Ca+Cc>Cb+Cdの場合、前記下位ビット符号化手段で得られた符号化データから前記境界ビット位置のビットプレーンの符号化データを除外した符号化データと、前記上位ビット符号化手段で得られた前記第2の上位ビット部の符号化データとを、前記着目画素ブロックの符号化データとして出力することを特徴とする請求項2に記載の画像符号化装置。
The separating means includes a first upper bit part higher than the boundary bit position calculated by the boundary bit position determining means, a second upper bit part higher than the boundary bit position-1, and the boundary bit position below Separated from the lower bit part of
The upper bit encoding means encodes the first upper bit part and the second upper bit part,
The output means includes
The code amount of the first upper bit part is Ca, the code amount of the second upper bit part is Cb, the code amount of the lower bit part is Cc, and the encoded data of the lower bit part is used as the boundary. When the code amount of the encoded data excluding the encoded data of the bit plane at the bit position is defined as Cd,
When Ca + Cc ≦ Cb + Cd, the encoded data of the first higher-order bit part obtained by the higher-order bit encoding means and the encoded data obtained by the lower-order bit encoding means are encoded data of the pixel block of interest. Output as
In the case of Ca + Cc> Cb + Cd, the encoded data obtained by excluding the encoded data of the bit plane at the boundary bit position from the encoded data obtained by the lower bit encoding means, and the above obtained by the upper bit encoding means The image encoding device according to claim 2, wherein the encoded data of the second upper bit part is output as encoded data of the pixel block of interest.
更に、前記着目ブロック内の各係数に基づき、各ビット位置を境界ビット位置とした場合の各係数の上位ビット部の非ゼロランの数を計数する計数手段と、
前記境界ビット位置決定手段で算出された境界ビット位置の前記非ゼロランの数と予め設定された閾値とを比較し、当該比較結果に基づき、前記境界ビット位置決定手段で算出された境界ビット位置を調整する調整手段と
を備えることを特徴とする請求項1又は2に記載の画像符号化装置。
And counting means for counting the number of non-zero runs in the upper bit part of each coefficient when each bit position is a boundary bit position based on each coefficient in the block of interest;
The number of non-zero runs of the boundary bit position calculated by the boundary bit position determining means is compared with a preset threshold value, and based on the comparison result, the boundary bit position calculated by the boundary bit position determining means The image encoding apparatus according to claim 1, further comprising: an adjusting unit that adjusts.
多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置の制御方法であって、
前記各係数についての、最上位から最下位ビットに向かって最初に“1”となるビット位置から最下位ビットまでの有効ビット数を検出し、各有効ビット数の出現回数をカウントするカウント工程と、
有効ビット数Bの出現回数をN(B)と定義し、出現回数が1以上の最大の有効ビット数をbmaxと定義し、変数b=0、1、2…に対する次式の合算関数:
S(bmax−b)=ΣN(bmax−i) (i=0,1,…,b)
において、予め設定された閾値Thとの関係が、
S(bmax−b)>Th
を満たす最大整数bを求め、当該最大整数bに基づいて、境界ビット位置を決定する境界ビット位置決定工程と、
前記各係数値を、前記境界ビット位置決定工程で算出した境界ビット位置を境界にして、上位ビット部、下位ビット部とに分離する分離工程と、
該分離工程で分離した各係数の前記上位ビット部を符号化する上位ビット符号化工程と、
前記分離工程で分離した各係数の前記下位ビット部を符号化する下位ビット符号化工程と、
前記上位ビット符号化工程、前記下位ビット符号化工程それぞれで得られた符号化データから、着目画素ブロックの符号化データを生成し、出力する出力工程と
有することを特徴とする画像符号化装置の制御方法。
A control method for an image encoding device that performs frequency conversion and quantization processing in units of pixel blocks from multi-value image data, and encodes each multi-value coefficient obtained by the quantization processing,
A counting step of detecting the number of effective bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit for each coefficient, and counting the number of occurrences of each effective bit number; ,
The number of occurrences of the number of effective bits B is defined as N (B), the maximum number of effective bits with the number of occurrences of 1 or more is defined as bmax, and the summation function of the following equation for the variable b = 0, 1, 2,.
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to the preset threshold value Th,
S (bmax−b)> Th
A boundary bit position determination step for determining a boundary bit position based on the maximum integer b;
A separation step of separating the value of each coefficient into an upper bit part and a lower bit part with the boundary bit position calculated in the boundary bit position determination step as a boundary;
An upper bit encoding step for encoding the upper bit portion of each coefficient separated in the separation step;
A lower bit encoding step for encoding the lower bit portion of each coefficient separated in the separation step;
The upper bit encoding step, wherein the lower bit encoding step the coded data obtained for each to generate encoded data of the pixel of interest block, the image coding apparatus and an outputting step of outputting Control method.
コンピュータに読み込ませ実行させることで、前記コンピュータを請求項1乃至4のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。   A computer program that causes a computer to function as the image encoding device according to claim 1 by being read and executed by a computer. 請求項6に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読の記憶媒体。   A computer-readable storage medium storing the computer program according to claim 6.
JP2008108292A 2008-04-17 2008-04-17 Image coding apparatus and control method thereof Expired - Fee Related JP4944833B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008108292A JP4944833B2 (en) 2008-04-17 2008-04-17 Image coding apparatus and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008108292A JP4944833B2 (en) 2008-04-17 2008-04-17 Image coding apparatus and control method thereof

Publications (3)

Publication Number Publication Date
JP2009260745A JP2009260745A (en) 2009-11-05
JP2009260745A5 JP2009260745A5 (en) 2011-05-06
JP4944833B2 true JP4944833B2 (en) 2012-06-06

Family

ID=41387581

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008108292A Expired - Fee Related JP4944833B2 (en) 2008-04-17 2008-04-17 Image coding apparatus and control method thereof

Country Status (1)

Country Link
JP (1) JP4944833B2 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003333339A (en) * 2002-05-13 2003-11-21 Sony Corp Image encoding apparatus and image encoding method
JP4131970B2 (en) * 2005-03-28 2008-08-13 富士フイルム株式会社 Data compression apparatus and data compression program

Also Published As

Publication number Publication date
JP2009260745A (en) 2009-11-05

Similar Documents

Publication Publication Date Title
JP4979655B2 (en) Image coding apparatus and control method thereof
JP4418762B2 (en) Image encoding apparatus, image decoding apparatus, control method thereof, computer program, and computer-readable storage medium
US6711295B2 (en) Encoding apparatus and method, and storage medium
EP2128822B1 (en) Index-based pixel block processing
US6909811B1 (en) Image processing apparatus and method and storage medium storing steps realizing such method
JP4795161B2 (en) Image processing apparatus, control method therefor, computer program, and computer-readable storage medium
US20060262982A1 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP4365957B2 (en) Image processing method and apparatus and storage medium
US9183643B2 (en) Apparatus and method for generating typical colors for image coding
JP4847398B2 (en) Image processing apparatus and method
US8031954B2 (en) Image encoding apparatus and control method thereof using prediction encoding and pixel classification
JP2000069292A (en) Image processing unit, its method and storage medium
JP2000115770A (en) Coder and its method
JP4956304B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
US8041135B2 (en) Image encoding apparatus and control method thereof
JP5101962B2 (en) Image coding apparatus, control method therefor, and computer program
JP2008042683A (en) Image processing apparatus and its control method, computer program and computer readable storage medium
JP4944833B2 (en) Image coding apparatus and control method thereof
JP5086777B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
US8463057B2 (en) Image encoding apparatus and control method therefor
JP4743884B2 (en) Image coding apparatus and control method thereof
JP2009260747A (en) Image encoding device, and control method thereof
JP4971881B2 (en) Image encoding apparatus, image decoding apparatus, and control method thereof
JP2009260746A (en) Image encoder, and control method thereof
JP4131969B2 (en) Data compression apparatus and data compression program

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110322

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110322

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120130

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120203

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120302

R151 Written notification of patent or utility model registration

Ref document number: 4944833

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

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

Free format text: PAYMENT UNTIL: 20150309

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees