JP2009260746A - Image encoder, and control method thereof - Google Patents

Image encoder, and control method thereof Download PDF

Info

Publication number
JP2009260746A
JP2009260746A JP2008108293A JP2008108293A JP2009260746A JP 2009260746 A JP2009260746 A JP 2009260746A JP 2008108293 A JP2008108293 A JP 2008108293A JP 2008108293 A JP2008108293 A JP 2008108293A JP 2009260746 A JP2009260746 A JP 2009260746A
Authority
JP
Japan
Prior art keywords
bit
coefficient
boundary
encoding
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.)
Withdrawn
Application number
JP2008108293A
Other languages
Japanese (ja)
Inventor
Hiroshi Kajiwara
浩 梶原
Takeshi Yamazaki
健史 山崎
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 JP2008108293A priority Critical patent/JP2009260746A/en
Publication of JP2009260746A publication Critical patent/JP2009260746A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a technique for efficiently coding a coefficient after quantization in image encoding processing for performing frequency conversion and quantization with a pixel block as a unit. <P>SOLUTION: Image data is supplied to a boundary bit position decision section 116 through a block division section 102, a sequence transformation section 103, and a coefficient quantization section 104. The boundary position decision section 116 decides a boundary bit position B for separating each coefficient into upper and lower bit sections based on the distribution of the coefficient. A first coefficient encoding section 117 separates each coefficient into upper and lower bit sections according to the boundary bit position B to encode each of them. A redundancy determination section 118 determines redundancy in a plane at the boundary bit position B, and allows a block recoding section 122 to start encoding as a boundary bit position B-1, when the plane is redundant. An encoding selection section selects smaller data from among coding data generated by a block recoding section 122 and that generated by the first coefficient encoding section 117 for output. <P>COPYRIGHT: (C)2010,JPO&INPIT

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.

符号量が最小となる境界ビット位置を求めるためには、各係数データを異なる境界ビット位置で多数回重複して符号化処理を行う必要があり、特にソフトウェアによる符号化処理では時間がかかるという問題がある。また、他で生成された符号化データを受信して保持する場合などでは、必ずしも適切な位置で境界ビットが設定されるとは限らず、効率的な圧縮がなされていない場合がある。   In order to obtain the boundary bit position where the code amount is the smallest, it is necessary to perform the encoding process by overlapping each coefficient data many times at different boundary bit positions. Especially, the encoding process by software takes time. There is. Further, when receiving and holding encoded data generated elsewhere, the boundary bits are not always set at an appropriate position, and efficient compression may not be performed.

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

かかる課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置であって、
着目画素ブロックから得られた各係数について、最上位から最下位のビットに向かって最初に“1”となるビット位置から最下位ビットまでのビット数を有効ビット数として検出し、各有効ビット数の出現回数をカウントするカウント手段と、
該カウント手段でカウントした有効ビット数の出現回数の分布に基づき、境界ビット位置Bを決定する境界ビット位置決定手段と、
前記各係数を、前記境界ビット位置Bより上位の上位ビット部、前記境界ビット位置B以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第1の係数符号化手段と、
前記各係数の、前記境界ビット位置Bのビットプレーンに冗長性が多いか少ないかを、予め設定された閾値を用いて、判定する冗長性判定手段と、
該冗長性判定手段で冗長性が多いと判定された場合、前記各係数を、前記境界ビット位置B−1より上位の上位ビット部、前記境界ビット位置B−1以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第2の係数符号化手段と、
前記冗長性判定手段で冗長性が少ないと判定された場合には、前記第1の係数符号化手段で得られた符号化データを前記着目ブロックの符号化データとして選択して出力し、
前記冗長性判定手段で冗長性が多いと判定された場合には、前記第1の係数符号化手段で得られた符号化データの符号量と、前記第2の係数符号化手段で得られた符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目ブロックの符号化データとして選択して出力する選択手段とを備える。
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,
For each coefficient obtained from the pixel block of interest, the number of bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit is detected as the effective bit number, and each effective bit number Counting means for counting the number of occurrences of
Boundary bit position determining means for determining the boundary bit position B based on the distribution of the number of occurrences of the number of effective bits counted by the counting means;
The coefficients are separated into an upper bit part higher than the boundary bit position B and a lower bit part below the boundary bit position B, and the upper bit part of each coefficient is run-length encoded, and the lower bit A first coefficient encoding means for encoding a bit plane in units;
Redundancy determining means for determining whether the bit plane at the boundary bit position B of each coefficient has a large or small redundancy by using a preset threshold;
When the redundancy determining means determines that the redundancy is high, the coefficients are separated into an upper bit part higher than the boundary bit position B-1 and a lower bit part below the boundary bit position B-1. A second coefficient encoding means for performing run length encoding on the upper bit part of each coefficient and encoding the lower bit part on a bit plane basis;
If it is determined by the redundancy determining means that the redundancy is low, the encoded data obtained by the first coefficient encoding means is selected and output as the encoded data of the block of interest;
When the redundancy determining means determines that there is a lot of redundancy, the code amount of the encoded data obtained by the first coefficient encoding means and the second coefficient encoding means Selecting means for comparing the code amount of the encoded data and selecting and outputting the encoded data having a small code amount as the encoded data of the block of interest;

本発明によれば、画素ブロックを単位に周波数変換、量子化を行なう画像符号化処理において、量子化後の係数を、より効率の良く符号化することが可能になる。   According to the present invention, in an image encoding process that performs frequency conversion and quantization in units of pixel blocks, it is possible to encode the quantized coefficients more efficiently.

また、他の発明によれば、既存の符号化画像データを画質変化無しに、少なくともより高い圧縮率で再符号化することも可能になる。   In addition, according to another invention, it is possible to re-encode existing encoded image data at least at a higher compression rate without changing the image quality.

以下添付図面に従って本発明に係る実施形態を詳細に説明する。   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.

図2は、境界ビット位置決定部116のブロック構成図である。境界ビット位置決定部116は、有効ビット数判定部106、頻度テーブル生成部107、頻度テーブルバッファ108、境界ビット選択部109を備える。   FIG. 2 is a block configuration diagram of the boundary bit position determining unit 116. The boundary bit position determination unit 116 includes a valid bit number 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 number determination unit 106 sequentially reads each coefficient value Cn stored in the coefficient buffer 105 and in the target rectangular block, and detects the effective bit number B (Cn). The number of effective bits indicates a bit position where “1” appears first when a search is performed from the higher order to the lower order bits when the absolute value of the coefficient value Cn of interest 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) detected by 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 (count value) of the effective bits of all coefficient values in the block of interest obtained as described above is shown as a graph. FIG. 4 shows an example in which 0 to 7 exist as the number of effective bits, and the number of appearances 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)を求める。
Sb(b)=N(b) b=bmaxの場合
Sb(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.
Sb (b) = N (b) When b = bmax Sb (b) = N (b) + S (b + 1) When b ≠ bmax

上記は、逆に変数b=0、1、2、…、bmaxと更新する場合、合算関数Σを用いて次のように表わすこともできる。
Sb(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 Σ.
Sb (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)の値を調べ、予め設定された閾値Th1を超える最大整数bを探索する。そして、境界ビット選択部109は、得られたbを境界ビット位置Bとして出力する。なお、詳細は後述する説明から明らかになるが、S(1)が閾値Th1を超えない場合、着目矩形ブロック内の全係数についての分離処理は行われず、全てランレングス符号化されることになる。   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. A maximum integer b exceeding Th1 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 Th1, separation processing is not performed for all the coefficients in the target rectangular block, and all are run-length encoded. .

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

後述するが、後段の係数符号化部117における着目矩形ブロック内の各係数値の符号化処理においては、係数値を境界ビットBで上位と下位に分離し、上位ビット部に対してゼロの連続数の符号化、即ち、ランレングス符号化を適用する。従って、ここでの閾値Th1の役割は、係数値の上位ビット部が非ゼロの係数とゼロの係数値の比を調整するためのものであり、ランレングス符号化を有効に機能させることを狙いとして設定されるものであると言える。図5に示した例では、“5”が閾値Th1を超える最大の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 value Th1 here is for adjusting the ratio of the coefficient whose non-zero high-order bit part is 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 Th1, and “5” is output as the boundary bit position.

境界ビット位置決定部116が境界ビット位置Bを決定すると、その境界ビット位置Bを、後述する第1の係数符号化部117、及び、ブロック再符号化部122内の第2の係数符号化部119に出力する。   When the boundary bit position determination unit 116 determines the boundary bit position B, the boundary bit position B is converted into a first coefficient encoding unit 117 and a second coefficient encoding unit in the block re-encoding unit 122 described later. It outputs to 119.

第1の係数符号化部117は、係数バッファ105に格納される各係数値を、予め設定された順番に従って、読み出して符号化処理を行う。   The first 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に格納された係数値の読み出し(スキャン)は最大3回行われる。最初のスキャンは、既に説明した境界ビット位置決定部116による境界ビット位置Bの決定処理のためである。そして、2回目のスキャンは第1の係数符号化部117、3回目のスキャンはブロック再符号化部122が行なう。1回目のスキャンのスキャン順は、どのような順序でも構わない。一方、2回目、及び、3回目のスキャンは、符号化効率の観点からジグザグスキャン順とするが、必ずしもこれに限らない。詳細については後述するが、後段の第1の係数符号化部117、及び、ブロック再符号化部122内の第2の係数符号化部119において、係数の上位ビット部をゼロの連続数と非ゼロの係数値の組み合わせにより符号化する。この際にゼロの連続数が長くなるように考えたスキャン方法であれば良い。例えば、いくつかのスキャンパターンから適切な方法を選択するようにしても良い。また、過去に符号化したブロックにおける係数の分布を参照して係数のパワーの大きいものから小さいものへと並ぶように動的にスキャン順序を変えるなどしても構わない。   The coefficient values stored in the coefficient buffer 105 are read (scanned) up to three times. 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 performed by the first coefficient encoder 117, and the third scan is performed by the block re-encoder 122. The scan order of the first scan may be any order. On the other hand, the second and third scans are in a zigzag scan order from the viewpoint of encoding efficiency, but are not necessarily limited thereto. Although details will be described later, in the first coefficient encoding unit 117 and the second coefficient encoding unit 119 in the block re-encoding unit 122, the higher-order bit part of the coefficient is set as a zero consecutive number. Encode with a combination of zero coefficient values. At this time, any scanning 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.

先ず、第1の係数符号化部117について説明し、その後でブロック再符号化部122について説明する。   First, the first coefficient encoding unit 117 will be described, and then the block re-encoding unit 122 will be described.

図3は第1の係数符号化部117のブロック構成図である。第1の係数符号化部117は、上位/下位ビット分離部110、上位ビット符号化部111、下位ビット符号化部112、符号バッファ113から構成される。本実施形態の第1の係数符号化部117は、境界ビット位置決定部116から供給された境界ビット位置Bを用いて、係数バッファ105内の各係数値を符号化する。以下、具体的な例を説明する。   FIG. 3 is a block configuration diagram of the first coefficient encoding unit 117. The first coefficient encoding unit 117 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. The first coefficient encoding unit 117 according to the present embodiment encodes each coefficient value in the coefficient buffer 105 using the boundary bit position B supplied from the boundary bit position determining unit 116. A specific example will be described below.

上位/下位ビット分離部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)を示す。   For the coefficient value Cn of interest read out from the coefficient buffer 105, the upper / lower bit separation unit 110 includes an upper bit part higher than the boundary bit position B in the code absolute value expression, and a lower bit part below the boundary bit position B. 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へと引き渡されるものとする。   It is assumed that the sign representing the sign of the coefficient Cn is also passed to the lower bit coding unit 112 for the coefficient Cn whose value of the upper bit part Un excluding the sign bit is “0”.

図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.

以上が第1の係数符号化部の処理内容である。   The above is the processing content of the first coefficient encoding unit.

図1の説明に戻る。第1の係数符号化部117が、着目するブロックの符号化処理を完了すると、冗長性判定部118は、第1の係数符号化部117内の符号バッファ113の符号化データ中の、境界ビット位置Bのビットプレーンデータの冗長性の判定を行なう。この判定対象の境界ビット位置Bのビットプレーンデータは、下位ビット符号化部112で生成されたものである。   Returning to the description of FIG. When the first coefficient encoding unit 117 completes the encoding process for the block of interest, the redundancy determining unit 118 includes boundary bits in the encoded data of the code buffer 113 in the first coefficient encoding unit 117. The redundancy of the bit plane data at position B is determined. The bit plane data at the boundary bit position B to be determined is generated by the lower bit encoding unit 112.

本実施形態における冗長性判定部118は、境界ビット位置Bのビットプレーンの2値データを順番に見て、0から1へと変化する回数Ncを計数する。   The redundancy determination unit 118 in this embodiment counts the number of times Nc that changes from 0 to 1 by sequentially checking the binary data of the bit plane at the boundary bit position B.

簡単な例として、2進数列“0、0、1、1、0、0、0、1、0”を考える。この場合、2番目のビットから3番目のビットにかけて、値が0から1への変化しており、さらに、7番目のビットから8番目のビットにかえて値が0から1に変化している。従って、この例の場合、反転回数Ncは“2”となる。   As a simple example, consider the binary sequence “0, 0, 1, 1, 0, 0, 0, 1, 0”. In this case, the value changes from 0 to 1 from the second bit to the third bit, and the value changes from 0 to 1 instead of the seventh bit to the eighth bit. . Therefore, in this example, the number of inversions Nc is “2”.

冗長性判定部118は、この変化回数Ncと、予め設定された閾値Th2と比較し、Nc≧Th2であると判定した場合、着目する境界ビット位置Bのビットプレーンの冗長性は少ないと判定し、制御信号“0”をブロック再符号化部122、符号選択部121に出力する。また、Nc<Th2であると判定した場合、冗長性判定部118は、着目する境界ビット位置Bのビットプレーンの冗長性が多いと判定し、制御信号“1”をブロック再符号化部122、符号選択部121に出力する
符号選択部121は、冗長性判定部118からの制御信号が“0”であった場合、第1の係数符号化部117内の符号バッファ113に格納された符号化データを選択し、着目している矩形ブロックの符号化データとして符号列形成部114に出力する。このとき、符号選択部121は、境界ビット位置決定部116から通知された境界ビット位置Bも符号列形成部114に出力する。
The redundancy determining unit 118 compares the number of changes Nc with a preset threshold Th2 and determines that Nc ≧ Th2, and determines that the redundancy of the bit plane at the boundary bit position B of interest is small. The control signal “0” is output to the block re-encoding unit 122 and the code selection unit 121. If it is determined that Nc <Th2, the redundancy determining unit 118 determines that the bit plane at the target boundary bit position B has a high redundancy, and transmits the control signal “1” to the block re-encoding unit 122, When the control signal from the redundancy determination unit 118 is “0”, the code selection unit 121 outputs the code stored in the code buffer 113 in the first coefficient encoding unit 117. Data is selected and output to the code string forming unit 114 as encoded data of the rectangular block of interest. At this time, the code selection unit 121 also outputs the boundary bit position B notified from the boundary bit position determination unit 116 to the code string formation unit 114.

また、符号選択部121は、境界ビット位置決定部116で決定された境界ビット位置Bが“1”である場合には、無条件に第1の係数符号化部117で生成された符号化データを選択し、出力する。境界ビット位置Bが“1”である場合、各係数の全ビットが上位ビット部としてランレングス符号化されるためである。また、境界ビット位置B−1は存在しないからでもある。   Also, the code selection unit 121 unconditionally generates the encoded data generated by the first coefficient encoding unit 117 when the boundary bit position B determined by the boundary bit position determination unit 116 is “1”. Select and output. This is because when the boundary bit position B is “1”, all bits of each coefficient are run-length encoded as the upper bit part. This is also because the boundary bit position B-1 does not exist.

一方、符号選択部121は、境界ビット位置決定部116で決定された境界ビット位置Bが“1”より大きく、且つ、冗長性判定部118からの制御信号が“1”であった場合、後述するブロック再符号化部122内の符号量比較部120の判定結果を受信するまで、符号化データの選択、出力は行なわない。換言すれば、符号選択部121は、ブロック再符号化部122内の冗長性判定部118の制御信号を受信してから、後述する符号化データの選択、出力に係る処理を実行する。以下、ブロック再符号化部122について説明する。   On the other hand, when the boundary bit position B determined by the boundary bit position determination unit 116 is larger than “1” and the control signal from the redundancy determination unit 118 is “1”, the code selection unit 121 will be described later. The encoded data is not selected or output until the determination result of the code amount comparison unit 120 in the block re-encoding unit 122 is received. In other words, the code selection unit 121 receives a control signal from the redundancy determination unit 118 in the block re-encoding unit 122 and then performs processing related to selection and output of encoded data, which will be described later. Hereinafter, the block re-encoding unit 122 will be described.

ブロック再符号化部122は冗長性判定部118からの制御信号が“1”である場合に動作する。冗長性判定部118からの制御信号が“1”である場合、境界ビット位置Bのビットプレーンもランレングス符号化に利用できる可能性が高いからである。   The block re-encoding unit 122 operates when the control signal from the redundancy determining unit 118 is “1”. This is because when the control signal from the redundancy judgment unit 118 is “1”, the bit plane at the boundary bit position B is also likely to be used for run-length encoding.

ブロック再符号化部122は、第2の係数符号化部119、符号量比較部120から構成される。ここで、第2の係数符号化部119は第1の係数符号化部117と同じ内部構造を持つ。但し、第2の係数符号化部119が第1の係数符号化部117と異なる点は、境界ビット位置決定部116から出力される境界ビット位置Bを用いるのではなく、境界ビット位置B−1を用いて各係数を上位ビット部と下位ビット部に分離する点である。すなわち、第2の係数符号化部119は、各係数を境界ビット位置B−1より上位の上位ビット部と、境界ビット位置B−1以下の下位ビット部に分離し、それぞれを符号化する。従って、この第2の係数符号化部119は、かかる点を除いて、第1の係数符号化部と同じ処理を行なうので、その詳述は省略する。   The block re-encoding unit 122 includes a second coefficient encoding unit 119 and a code amount comparison unit 120. Here, the second coefficient encoding unit 119 has the same internal structure as the first coefficient encoding unit 117. However, the second coefficient encoding unit 119 is different from the first coefficient encoding unit 117 in that the boundary bit position B-1 output from the boundary bit position determining unit 116 is not used, but the boundary bit position B-1 Is used to separate each coefficient into an upper bit part and a lower bit part. That is, the second coefficient encoding unit 119 separates each coefficient into an upper bit part higher than the boundary bit position B-1 and a lower bit part below the boundary bit position B-1, and encodes each. Therefore, the second coefficient encoding unit 119 performs the same processing as the first coefficient encoding unit except for this point, and thus detailed description thereof is omitted.

符号量比較部120は、第2の係数符号化部119による符号化処理が終了すると、係第1の係数符号化部117の内部の符号バッファ113に格納される符号量CL1と、第2の係数符号化部119の内部の符号バッファに格納される符号量CL2を比較する。   When the encoding process by the second coefficient encoding unit 119 ends, the code amount comparison unit 120 includes the code amount CL1 stored in the code buffer 113 in the first coefficient encoding unit 117, and the second The code amount CL2 stored in the code buffer inside the coefficient encoding unit 119 is compared.

そして、符号量比較部120は、CL1≦CL2であると判定した場合には、制御信号“0”を符号選択部121に出力する。また、符号量比較部120は、CL1>CL2であると判定した場合には、制御信号“1”を符号選択部121に出力する。   If the code amount comparison unit 120 determines that CL1 ≦ CL2, the control signal “0” is output to the code selection unit 121. When the code amount comparison unit 120 determines that CL1> CL2, the control unit 120 outputs a control signal “1” to the code selection unit 121.

符号選択部121は、符号量比較部120からの制御信号が“0”であった場合、第1の係数符号化部117からの符号化データを選択し、符号列形成部114に出力する。このとき、符号選択部121は境界ビット位置Bを符号列形成部114に出力する。   When the control signal from the code amount comparison unit 120 is “0”, the code selection unit 121 selects the encoded data from the first coefficient encoding unit 117 and outputs it to the code string formation unit 114. At this time, the code selection unit 121 outputs the boundary bit position B to the code string formation unit 114.

また、符号選択部121は、符号量比較部120からの制御信号が“1”であった場合、第2の係数符号化部117からの符号化データを選択し、符号列形成部114に出力する。このとき、符号選択部121は境界ビット位置B−1を符号列形成部114に出力する。   Further, when the control signal from the code amount comparison unit 120 is “1”, the code selection unit 121 selects the encoded data from the second coefficient encoding unit 117 and outputs it to the code string formation unit 114. To do. At this time, the code selecting unit 121 outputs the boundary bit position B-1 to the code string forming unit 114.

符号系列形成部114は、符号選択部121から供給された、着目する矩形ブロックの符号化データを、符号化形成部114が内部に備えるバッファに格納しながら、所定の形式の符号化データを生成し、符号出力部115に出力する。符号出力部115は、符号化対象の画像データを入力する際に、出力先(例えばハードディスク装置)にファイルヘッダを生成し、それに後続して、符号列形成部114で生成された符号列を出力し、1個の符号化データファイルを生成することになる。   The code sequence forming unit 114 generates encoded data of a predetermined format while storing the encoded data of the rectangular block of interest supplied from the code selecting unit 121 in a buffer included in the encoding 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 one because it is an example of a monochrome image in the embodiment), the number of bits of each pixel, Various information necessary for decoding is added as a header. This header includes information on the boundary bit position B 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が実行する画像処理用のアプリケーションプログラムの処理手順を図9のフローチャートに従って説明する。基本的に、このプログラムは、図1に示す各構成要素に相当する関数を備えることになる。ただし、図1における係数バッファ105、頻度テーブルバッファ108、符号バッファ113等の各領域はRAM1402内に予め確保することになる。   The processing procedure of the image processing application program executed by the CPU 1401 will be described below with reference to the flowchart of FIG. Basically, this program includes functions corresponding to the components shown in FIG. However, areas such as 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).

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

まず、ステップ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.

図9の説明に戻る。上記のようにして、着目するブロックMB(i)の境界ビット位置Bが決定されると、処理はステップS205に進み、着目するブロックMB(i)の係数値を上位ビット部Unと下位ビット部Lnに分離し、それぞれ符号化を行う。これは第1の係数符号化部117の処理に相当する。符号化して得られた符号化データはRAM1402内に格納する。   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 first coefficient encoding unit 117. The encoded data obtained by encoding is stored in the RAM 1402.

ステップS209では、ビットプレーンBの冗長性を調べ、冗長性が多くあるか否かを判定する(冗長性判定部118の処理に相当)。境界ビット位置Bが“1”よりも大きく、且つ、冗長性が高いと判定される場合(ステップS209の判定がyes)には、処理をステップS210へ分岐する。また、境界ビット位置Bが“1”である、又は、冗長性が低いと判定された場合(ステップS209でno)、ステップS206へと処理を移す。   In step S209, the redundancy of the bit plane B is examined to determine whether there is much redundancy (corresponding to the processing of the redundancy determining unit 118). If it is determined that the boundary bit position B is greater than “1” and the redundancy is high (the determination in step S209 is yes), the process branches to step S210. If it is determined that the boundary bit position B is “1” or the redundancy is low (No in step S209), the process proceeds to step S206.

冗長性が高いと判定された場合、ステップS210では着目するブロックを境界ビット位置B−1でビット分離し、再度符号化処理を行なう(第2の係数符号化部119の処理に相当)。符号化して得られた符号化データはRAM1402に格納する。   If it is determined that the redundancy is high, in step S210, the block of interest is bit-separated at the boundary bit position B-1, and the encoding process is performed again (corresponding to the process of the second coefficient encoding unit 119). The encoded data obtained by encoding is stored in the RAM 1402.

続いて、ステップS211でステップS205で生成した符号化データと、ステップS210で生成した符号化データの符号量を比較し、符号量の小さい方を選択する(符号量の大きい方をRAM1402から削除する)。これは、符号量比較部120、および、符号選択部121の処理に相当する。   Subsequently, in step S211, the encoded data generated in step S205 is compared with the encoded data generated in step S210, and the smaller code quantity is selected (the larger code quantity is deleted from the RAM 1402). ). This corresponds to the processing of the code amount comparison unit 120 and the code selection unit 121.

ステップ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に進み、RAM1402に格納された全ブロックの符号化データから、最終的な符号化データを生成して、I/F1409を解して外部装置へと出力する(符号列形成部114、符号出力部115の処理に相当)。   On the other hand, when the processing is completed for all the blocks of the image, the process proceeds to step S208, where final encoded data is generated from the encoded data of all the blocks stored in the RAM 1402, and the I / F 1409 is solved. And output to an external device (corresponding to processing of the code string forming unit 114 and 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.

特に本変形例によれば、1つのブロックについて常に2回の符号化を行なうのではなく、1回めの符号化処理(ステップS205)で得られた下位ビットLn中の境界ビット位置Bのビットプレーンの冗長性の有無に従って、2回目の符号化処理(ステップS210)を行なうか否かを決定できるので、処理速度の面でも有利と言える。   In particular, according to this modification, the bit at the boundary bit position B in the lower bit Ln obtained by the first encoding process (step S205) is not always performed twice for one block. Since it can be determined whether or not to perform the second encoding process (step S210) according to the presence or absence of the redundancy of the plane, it can be said that it is advantageous also in terms of processing speed.

[第1の実施形態の更なる変形例]
第1の実施形態では、第1の係数符号化部117による符号化処理を行なった後、その符号化データ中の境界ビット位置Bの冗長性を冗長性判定部118が判定し、第2の係数符号化部119による境界ビット位置B−1に基づき符号化を行なうか否かを決定した。すなわち、第2の係数符号化部119の符号化処理を開始するタイミングは、第1の係数符号化部117の符号化処理が完了した後になる。
[Further Modification of First Embodiment]
In the first embodiment, after performing the encoding process by the first coefficient encoding unit 117, the redundancy determining unit 118 determines the redundancy of the boundary bit position B in the encoded data, and the second It was determined whether or not to perform encoding based on the boundary bit position B-1 by the coefficient encoding unit 119. That is, the timing for starting the encoding process of the second coefficient encoding unit 119 is after the encoding process of the first coefficient encoding unit 117 is completed.

しかしながら、境界ビット位置Bのビットプレーンは基本的に非圧縮であるので、第1の係数符号化部117による符号化する以前に判定できる。すなわち、第1の係数符号化部117による符号化処理と並行して、着目矩形ブロック内の全係数値Cnの境界ビット位置Bの冗長性を判定しても構わない。これを実現するには、図1における冗長性判定部118を、第1の係数符号化部117の下流に位置するのではなく、係数バッファ105をダイレクトにアクセスできるようにし、且つ、冗長性判定部118に境界ビット位置決定部116からの境界ビット位置Bが供給されるようにすれば良いであろう。   However, since the bit plane at the boundary bit position B is basically uncompressed, it can be determined before encoding by the first coefficient encoding unit 117. That is, in parallel with the encoding process by the first coefficient encoding unit 117, the redundancy of the boundary bit position B of all the coefficient values Cn in the target rectangular block may be determined. In order to realize this, the redundancy determination unit 118 in FIG. 1 is not located downstream of the first coefficient encoding unit 117, but the coefficient buffer 105 can be directly accessed, and the redundancy determination is performed. The boundary bit position B from the boundary bit position determination unit 116 may be supplied to the unit 118.

この結果、ブロック再符号化部122は、第1の係数符号化部117による符号化処理の終了を待たずに処理を開始できる。   As a result, the block re-encoding unit 122 can start the process without waiting for the end of the encoding process by the first coefficient encoding unit 117.

この変形例は、特にハードウェアで実現する場合に効果的であることは容易に理解できよう。   It can be easily understood that this modification is effective particularly when implemented by hardware.

[第2の実施形態]
上記第1の実施形態及びその変形例では、非符号化の画像データを入力し、圧縮符号化するものであった。他の装置で生成した符号化データが、必ずしも適切な境界ビット位置が設定されているとは限らない。そこで、本第2の実施形態では、他の装置で生成された符号化画像データを受信もしくは入力して、境界ビット設定が適切か否か、すなわち、同じ画質で更に圧縮率を高くすることが可能か否かを判定し、可能であれば再符号化を行う例について説明する。
[Second Embodiment]
In the first embodiment and its modification, unencoded image data is input and compression-encoded. Encoded data generated by another device does not necessarily have an appropriate boundary bit position set. Therefore, in the second embodiment, encoded image data generated by another device is received or input, and whether or not boundary bit settings are appropriate, that is, the compression rate is further increased with the same image quality. An example will be described in which it is determined whether or not it is possible, and if possible, re-encoding is performed.

なお、本第2の実施形態でも、対象の画像データは、説明を簡単にするためにモノクロ画像データとするが、RGB画像データや、CMYKカラー画像データに適用しても良い。また、画像は水平方向W画素、垂直方向H画素により構成されるものとする。   In the second embodiment, the target image data is monochrome image data for the sake of simplicity, 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.

図11に本第2の実施形態に係る画像符号化装置のブロック図を示す。以下、図11を参照して、第2の実施形態の処理について説明する。   FIG. 11 shows a block diagram of an image coding apparatus according to the second embodiment. Hereinafter, the processing of the second embodiment will be described with reference to FIG.

まず、符号化データ入力部1101から処理対象の符号化画像データが入力される。本実施形態で対象とする符号化データが図8に示すファイル構造となっているものとして説明する。但し、この段階では、境界ビット位置が適切であるかどうかは分からない。   First, encoded image data to be processed is input from the encoded data input unit 1101. The description will be made assuming that the encoded data targeted in this embodiment has the file structure shown in FIG. However, at this stage, it is not known whether the boundary bit position is appropriate.

符号化データ入力部1101から入力される符号化データは、一旦符号列バッファ1102に格納される。   The encoded data input from the encoded data input unit 1101 is temporarily stored in the code string buffer 1102.

符号化データ解析部1103は符号列バッファ1102に格納される符号化データのヘッダを解析し、復号に必要な情報を取得するとともに、その構造を解釈し、ブロックの順番に、符号化データを抽出し、符号バッファ1104に格納する。   The encoded data analysis unit 1103 analyzes the header of the encoded data stored in the code string buffer 1102, acquires information necessary for decoding, interprets the structure, and extracts the encoded data in block order. And stored in the code buffer 1104.

図12は、着目するブロックnについて符号化データ解析部1103により抽出され、符号バッファ1104に格納された符号化データの例を示している。符号化データ解析部1103は、ブロックnを符号バッファ1104に格納する際、ヘッダ部分よりそのブロックnの境界ビット位置Bを抽出し、その境界ビット位置Bを、係数再符号化部1111、冗長性判定部1105へと出力する。以降の説明は、ブロックnに対する処理であって、全ブロックについて行なわれることに注意されたい。   FIG. 12 shows an example of encoded data extracted by the encoded data analysis unit 1103 for the block n of interest and stored in the code buffer 1104. When storing the block n in the code buffer 1104, the encoded data analysis unit 1103 extracts the boundary bit position B of the block n from the header portion, and the boundary bit position B is extracted from the coefficient re-encoding unit 1111 and the redundancy. The data is output to the determination unit 1105. Note that the following description is processing for block n and is performed for all blocks.

冗長性判定部1105は、符号化データ解析部1103により着目するブロックの符号化データが符号バッファ1104に格納されたとき、冗長性の判定を行なう。   The redundancy determination unit 1105 determines redundancy when the encoded data of the block of interest is stored in the code buffer 1104 by the encoded data analysis unit 1103.

この冗長性の判定部1105の判定処理は、次の通りである。
i)着目ブロックの境界ビット位置Bが“0”であった場合、すなわち、着目ブロックの全係数値の全ビットがランレングス符号化されている場合、冗長性の判定部1105は制御信号“0”をブロック再符号化部1106、符号選択部1107に出力する。
ii)着目ブロックの境界ビット位置Bが“0”より大きい場合、冗長性の判定部1105は、境界ビット位置Bのビットプレーンデータについて冗長性の判定が行う。本第2の実施形態では、ビット位置Bのビットプレーンの2値データを順番に見て、直前の値を参照した1次のマルコフモデルエントロピを計測する。このエントロピが予め設定された閾値Th3より高い場合には冗長性は少ないと考え、閾値Th3以下の場合にはエントロピが低い場合には冗長性が多く残っていると判定する。冗長性の判定部1105は、冗長性が多いと判断される場合、ブロック再符号化部1106を動作させるための制御信号として“1”を出力する。冗長性が少ない場合には制御信号として“0”を出力する。従って、着目ブロックの境界ビット位置Bが“0”であった場合、ブロック再符号化部1106は動作しない。
The determination process of the redundancy determination unit 1105 is as follows.
i) When the boundary bit position B of the target block is “0”, that is, when all the bits of all the coefficient values of the target block are run-length encoded, the redundancy determining unit 1105 controls the control signal “0”. "Is output to the block re-encoding unit 1106 and the code selection unit 1107.
ii) When the boundary bit position B of the block of interest is greater than “0”, the redundancy determining unit 1105 determines the redundancy for the bit plane data at the boundary bit position B. In the second embodiment, the binary data of the bit plane at bit position B is viewed in order, and the first-order Markov model entropy referring to the immediately preceding value is measured. When this entropy is higher than the preset threshold Th3, it is considered that the redundancy is low. When the entropy is lower than the threshold Th3, it is determined that a lot of redundancy remains when the entropy is low. When it is determined that the redundancy is high, the redundancy determining unit 1105 outputs “1” as a control signal for operating the block re-encoding unit 1106. When the redundancy is low, “0” is output as the control signal. Accordingly, when the boundary bit position B of the target block is “0”, the block re-encoding unit 1106 does not operate.

ブロック再符号化部1106は冗長性判定部1105から出力される制御信号が“1”である場合にその動作を開始する。ブロック再符号化部1106は、係数復号部1109、係数バッファ1110、係数再符号化部1111、符号量比較部1112、及び、符号バッファ1113から構成される。   The block re-encoding unit 1106 starts its operation when the control signal output from the redundancy determining unit 1105 is “1”. The block re-encoding unit 1106 includes a coefficient decoding unit 1109, a coefficient buffer 1110, a coefficient re-encoding unit 1111, a code amount comparison unit 1112, and a code buffer 1113.

係数復号部1109は、符号バッファ1104に格納される上位ビット符号化データと下位ビット符号化データから、第1の実施形態で説明した係数符号化部116と対をなす手順で係数データを復号し、係数バッファ1110に格納する。   The coefficient decoding unit 1109 decodes the coefficient data from the upper bit encoded data and the lower bit encoded data stored in the code buffer 1104 in a procedure that makes a pair with the coefficient encoding unit 116 described in the first embodiment. And stored in the coefficient buffer 1110.

係数再符号化部1111は第1の実施形態における第2の係数符号化部119と同じである。すなわち、係数再符号化部1111は、符号化データ解析部1103から出力される境界ビット位置Bから“1”を引いた境界ビット位置B−1に従って、係数バッファ1110の各係数値を再度符号化処理を行う。係数再符号化部1111は、生成された符号化データを符号バッファ1113に出力する。   The coefficient re-encoding unit 1111 is the same as the second coefficient encoding unit 119 in the first embodiment. That is, the coefficient re-encoding unit 1111 re-encodes each coefficient value of the coefficient buffer 1110 according to the boundary bit position B-1 obtained by subtracting “1” from the boundary bit position B output from the encoded data analysis unit 1103. Process. The coefficient re-encoding unit 1111 outputs the generated encoded data to the code buffer 1113.

ここで符号バッファ1104に格納された着目ブロックの符号化データの符号量をCL1、符号バッファ1113に格納された着目ブロックの符号化データの符号量をCL2と定義する。   Here, the code amount of the encoded data of the block of interest stored in the code buffer 1104 is defined as CL1, and the code amount of the encoded data of the block of interest stored in the code buffer 1113 is defined as CL2.

符号バッファ1113に着目ブロックの符号化データが格納が格納されると、符号量比較部1112は、符号量CL1とCL2とを比較する。CL1≦CL2の場合、符号量比較部1112は制御信号“0”を符号選択部1107に出力する。一方、CL1>CL2の場合には符号量比較部1112は制御信号“1”を符号選択部1107に出力する。   When the encoded data of the block of interest is stored in the code buffer 1113, the code amount comparison unit 1112 compares the code amounts CL1 and CL2. In the case of CL1 ≦ CL2, the code amount comparison unit 1112 outputs the control signal “0” to the code selection unit 1107. On the other hand, when CL1> CL2, the code amount comparison unit 1112 outputs a control signal “1” to the code selection unit 1107.

符号選択部1107の処理は次の通りである。
i)冗長性判定部1105からの制御信号が“0”である場合:
符号選択部1107は符号バッファ1104の符号化データを選択し、符号列形成部114に出力する。
ii)冗長性判定部1105からの制御信号が“1”であり、且つ、符号量比較部1112からの制御信号“0”である場合:
符号選択部1107は符号バッファ1104の符号化データを選択し、符号列形成部114に出力する。
iii)冗長性判定部1105からの制御信号が“1”であり、且つ、符号量比較部1112からの制御信号“1”である場合:
符号選択部1107は符号バッファ1113の符号化データを選択し、符号列形成部114に出力する。
The processing of the code selection unit 1107 is as follows.
i) When the control signal from the redundancy judgment unit 1105 is “0”:
The code selection unit 1107 selects the encoded data in the code buffer 1104 and outputs it to the code string forming unit 114.
ii) When the control signal from the redundancy judgment unit 1105 is “1” and the control signal is “0” from the code amount comparison unit 1112:
The code selection unit 1107 selects the encoded data in the code buffer 1104 and outputs it to the code string forming unit 114.
iii) When the control signal from the redundancy judgment unit 1105 is “1” and the control signal is “1” from the code amount comparison unit 1112:
The code selection unit 1107 selects the encoded data in the code buffer 1113 and outputs it to the code string forming unit 114.

符号列形成部114は符号選択部1107から出力される符号化データを、適宜不図示の内部バッファに格納しながら、第1の実施形態と同様に符号列を形成する。符号列の構成は図8に示した入力符号列の構造と同じである。特に図示していないが、符号列形成部114へは符号化データ解析部1103により取得されるヘッダの情報等が引き渡されるものとする。但し、各ブロックの境界ビット位置は変更後のものが採用される。   The code string forming unit 114 forms a code string as in the first embodiment while appropriately storing the encoded data output from the code selecting unit 1107 in an internal buffer (not shown). The configuration of the code string is the same as the structure of the input code string shown in FIG. Although not particularly illustrated, it is assumed that header information acquired by the encoded data analysis unit 1103 is delivered to the code string formation unit 114. However, the changed boundary bit position of each block is adopted.

符号列形成部114から出力される符号列は符号出力部115から装置外部に出力される。   The code string output from the code string forming unit 114 is output from the code output unit 115 to the outside of the apparatus.

以上説明したように本第2の実施形態によれば、装置外部で上位、下位ビット分離を行って生成された符号化画像データを入力し、各ブロックの境界ビット位置が不適切である可能性があるか否かを判定し、その可能性がある場合に再符号化を行なうことが可能になる。また、再符号化前と再符号化後の画質は全く変わらず、且つ、少なくとも更に圧縮率の高い符号化データファイルを生成することが可能になる。また、境界ビット位置が適切であると判定したブロックについては再符号化を行なわないので、全ブロックを再符号化する場合よりも、高速に処理することも可能になる。   As described above, according to the second embodiment, encoded image data generated by separating the upper and lower bits outside the apparatus is input, and the boundary bit position of each block may be inappropriate. It is possible to perform re-encoding when it is determined whether or not there is a possibility. In addition, the image quality before and after re-encoding does not change at all, and it becomes possible to generate an encoded data file having a higher compression rate. In addition, since blocks that have been determined to have appropriate boundary bit positions are not re-encoded, processing can be performed at a higher speed than when all blocks are re-encoded.

なお、本第2の実施形態と同等の処理をコンピュータプログラムでもって実現できることは、先に説明した第1の実施形態の変形例から明らかであるので、その説明については省略する。   In addition, since it is clear from the modified example of 1st Embodiment demonstrated previously that it can implement | achieve the process equivalent to this 2nd Embodiment with a computer program, it abbreviate | omits about the description.

[第3の実施形態]
上記第1、第2の実施形態の画像処理装置では、境界ビット位置にあたる「ビットプレーン」の情報から境界ビットの設定が不適切である可能性があるか否かを判断したが、これ以外の情報に基づいて、境界ビット位置の不適切の可能性を判定することもできる。本第3の実施形態では、係数の有効ビット数の頻度分布に基づき、境界ビット位置の不適切の可能性の有無の判定を行なう例を説明する。
[Third Embodiment]
In the image processing apparatuses according to the first and second embodiments, it is determined from the information of the “bit plane” corresponding to the boundary bit position whether there is a possibility that the setting of the boundary bit is inappropriate. Based on the information, it is also possible to determine the possibility of inappropriate boundary bit positions. In the third embodiment, an example will be described in which it is determined whether there is a possibility that the boundary bit position is inappropriate based on the frequency distribution of the number of effective bits of the coefficient.

なお、本第3の実施形態でも、処理対象の画像データは、説明を簡単にするために多値のモノクロ画像データとするが、RGB画像データや、CMYKカラー画像データに適用しても良い。また、画像は水平方向W画素、垂直方向H画素により構成されるものとする。   In the third embodiment, the image data to be processed is multi-valued monochrome image data for the sake of simplicity, 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.

図14に、本第3の実施形態に係る画像符号化装置のブロック構成図を示す。第1、第2の実施形態で説明した図1、図11と共通するブロックについては同じ番号を付し、その説明について省略する。   FIG. 14 is a block diagram of an image encoding device according to the third embodiment. Blocks that are the same as those in FIGS. 1 and 11 described in the first and second embodiments are assigned the same numbers, and descriptions thereof are omitted.

以下、第2の実施形態と動作の異なる部分について説明する。   In the following, portions that differ in operation from the second embodiment will be described.

符号化データ入力部1101から入力される符号化データは一旦符号バッファ1102に格納される。符号化データ解析部1103は、符号バッファ1102に格納された符号化データのデータ構造を解析し、ブロック単位の符号化データを順番に抽出して、符号バッファ1104に格納すると共に、その符号化データの境界ビット位置B1を境界ビット比較部1401に出力する。   The encoded data input from the encoded data input unit 1101 is temporarily stored in the code buffer 1102. The encoded data analysis unit 1103 analyzes the data structure of the encoded data stored in the code buffer 1102, extracts the encoded data in units of blocks in order, stores the encoded data in the code buffer 1104, and the encoded data The boundary bit position B1 is output to the boundary bit comparison unit 1401.

係数復号部1109は、符号バッファ1104に格納される符号化データから着目するブロックの係数値を復号し、係数バッファ1110へ格納すると共に、境界ビット位置決定部境界ビット位置決定部116へと出力する。   The coefficient decoding unit 1109 decodes the coefficient value of the block of interest from the encoded data stored in the code buffer 1104, stores it in the coefficient buffer 1110, and outputs it to the boundary bit position determining unit boundary bit position determining unit 116. .

境界ビット位置決定部116は第1の実施形態で説明した通り、入力される着目ブロック内の係数Cnについて有効ビット数の分布を求め、境界ビット位置を決定する。ここでは符号化データ解析部1103から出力される境界ビット位置との区別を行うため、図14では、符号化データ解析部1103から出力される境界ビット位置をB1、境界ビット位置決定部116から出力される境界ビット位置をB2として表わしている。   As described in the first embodiment, the boundary bit position determination unit 116 obtains the distribution of the number of effective bits for the coefficient Cn in the input block of interest and determines the boundary bit position. Here, in order to distinguish from the boundary bit position output from the encoded data analysis unit 1103, in FIG. 14, the boundary bit position output from the encoded data analysis unit 1103 is B1, and the boundary bit position output from the boundary bit position determination unit 116 The boundary bit position to be performed is represented as B2.

境界ビット比較部1401はB1とB2を比較し、B1とB2が異なる場合にブロック再符号化部1402を動作させるための制御信号を出力する。B1とB2が異なる場合には境界ビット比較部1401は制御信号“1”を、B1=B2である場合には制御信号“0”を出力する。制御信号が“1”となる場合、境界ビット位置決定部116は境界ビット位置B2を、ブロック再符号化部1402内の係数再符号化部1111に出力する。   The boundary bit comparison unit 1401 compares B1 and B2, and outputs a control signal for operating the block re-encoding unit 1402 when B1 and B2 are different. The boundary bit comparison unit 1401 outputs a control signal “1” when B1 and B2 are different, and outputs a control signal “0” when B1 = B2. When the control signal is “1”, the boundary bit position determination unit 116 outputs the boundary bit position B2 to the coefficient re-encoding unit 1111 in the block re-encoding unit 1402.

境界ビット比較部1401から出力される制御信号が“1”である場合、ブロック再符号化部1402は係数バッファ1101に格納されるブロックの係数データを再符号化を開始する。再符号化の際、境界ビット位置は境界ビット比較部から出力されるB2を用いる。係数再符号化部1111は、第1の実施形態における第1の係数符号化部117と同様の処理を行ない、生成した符号化データを符号バッファ1113に格納する。   When the control signal output from the boundary bit comparison unit 1401 is “1”, the block re-encoding unit 1402 starts re-encoding the coefficient data of the block stored in the coefficient buffer 1101. At the time of re-encoding, B2 output from the boundary bit comparison unit is used as the boundary bit position. The coefficient re-encoding unit 1111 performs the same process as the first coefficient encoding unit 117 in the first embodiment, and stores the generated encoded data in the code buffer 1113.

符号量比較部1112は、符号バッファ1104に格納される符号化データの符号量CL1と、符号バッファ1113に格納された符号化データの符号量CL2とを比較し、比較結果を制御信号として符号選択部1107に出力する。この制御信号は、CL1≦CL2の場合には“0”、CL1>CL2の場合には“1”である。   The code amount comparison unit 1112 compares the code amount CL1 of the encoded data stored in the code buffer 1104 with the code amount CL2 of the encoded data stored in the code buffer 1113, and selects a code using the comparison result as a control signal. Output to the unit 1107. This control signal is “0” when CL1 ≦ CL2 and “1” when CL1> CL2.

符号選択部1107の処理は次の通りである。
i)境界ビット比較部1401からの制御信号が“0”の場合:
符号選択部1107は符号バッファ1104に格納された符号化データを選択し、符号列形成部114に出力する。
ii)境界ビット比較部1401からの制御信号が“1”であって、符号比較部1112からの制御信号が“0”である場合:
符号選択部1107は符号バッファ1104に格納された符号化データを選択し、符号列形成部114に出力する。
ii)境界ビット比較部1401からの制御信号が“1”であって、符号比較部1112からの制御信号が“1”である場合:
符号選択部1107は符号バッファ1113に格納された符号化データを選択し、符号列形成部114に出力する。
The processing of the code selection unit 1107 is as follows.
i) When the control signal from the boundary bit comparison unit 1401 is “0”:
The code selection unit 1107 selects the encoded data stored in the code buffer 1104 and outputs it to the code string forming unit 114.
ii) When the control signal from the boundary bit comparison unit 1401 is “1” and the control signal from the code comparison unit 1112 is “0”:
The code selection unit 1107 selects the encoded data stored in the code buffer 1104 and outputs it to the code string forming unit 114.
ii) When the control signal from the boundary bit comparison unit 1401 is “1” and the control signal from the code comparison unit 1112 is “1”:
The code selection unit 1107 selects the encoded data stored in the code buffer 1113 and outputs it to the code string formation unit 114.

符号列形成部114は符号選択部1107から出力される符号化データを、適宜不図示の内部バッファに格納しながら、第1の実施形態と同様に、出力用の符号列を形成する。符号列の構成は図8に示した入力符号列の構造と同じである。特に図示していないが、符号列形成部114へは、符号化データ解析部1103により取得されるヘッダの情報等が引き渡されるものとする。但し、各ブロックの境界ビット位置は変更後のものが採用される。   The code string forming unit 114 forms a code string for output in the same manner as in the first embodiment while appropriately storing the encoded data output from the code selecting unit 1107 in an internal buffer (not shown). The configuration of the code string is the same as the structure of the input code string shown in FIG. Although not particularly illustrated, it is assumed that header information acquired by the encoded data analyzing unit 1103 is delivered to the code string forming unit 114. However, the changed boundary bit position of each block is adopted.

以上説明したように本第3の実施形態によれば、復号した係数値の境界ビット位置と、本実施形態のアルゴリズムで決定した境界ビット位置とが不一致である場合にのみ、再符号化を行うことになり、再符号化にかかる負担の増大を抑制することができる。しかも、最終的に得られる符号化データは、オリジナルの符号化データのデータ量を超えることは無いことが約束される。   As described above, according to the third embodiment, re-encoding is performed only when the boundary bit position of the decoded coefficient value does not match the boundary bit position determined by the algorithm of the present embodiment. As a result, an increase in burden on re-encoding can be suppressed. In addition, it is promised that the finally obtained encoded data does not exceed the data amount of the original encoded data.

なお、本第3の実施形態に相当する処理をコンピュータプログラムでもって実現できることは、先に説明した第1の実施形態の変形例と同様、明らかである。   It is obvious that the processing corresponding to the third embodiment can be realized by a computer program, as in the modification of the first embodiment described above.

[その他の実施形態]
上記各実施形態では、上位ビット部の符号化に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 block block diagram of the boundary bit position determination part in 1st Embodiment. 第1の実施形態における第1の係数符号化部のブロック構成図である。It is a block block diagram of the 1st coefficient encoding part 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. 第1の実施形態の変形例における符号化処理手順を示すフローチャートである。It is a flowchart which shows the encoding process sequence in the modification of 1st Embodiment. 第1の実施形態における変形例の境界ビット位置決定の処理手順を示すフローチャートである。It is a flowchart which shows the process sequence of boundary bit position determination of the modification in 1st Embodiment. 第2の実施形態に係る画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus which concerns on 2nd Embodiment. 第2の実施形態における1ブロックの符号化データの構造を示す図である。It is a figure which shows the structure of the encoding data of 1 block in 2nd Embodiment. 第1の実施形態の変形例に係る情報処理装置のブロック構成図である。It is a block block diagram of the information processing apparatus which concerns on the modification of 1st Embodiment. 第3の実施形態に係る画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus which concerns on 3rd Embodiment.

Claims (12)

多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置であって、
着目画素ブロックから得られた各係数について、最上位から最下位のビットに向かって最初に“1”となるビット位置から最下位ビットまでのビット数を有効ビット数として検出し、各有効ビット数の出現回数をカウントするカウント手段と、
該カウント手段でカウントした有効ビット数の出現回数の分布に基づき、境界ビット位置Bを決定する境界ビット位置決定手段と、
前記各係数を、前記境界ビット位置Bより上位の上位ビット部、前記境界ビット位置B以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第1の係数符号化手段と、
前記各係数の、前記境界ビット位置Bのビットプレーンに冗長性が多いか少ないかを、予め設定された閾値を用いて、判定する冗長性判定手段と、
該冗長性判定手段で冗長性が多いと判定された場合、前記各係数を、前記境界ビット位置B−1より上位の上位ビット部、前記境界ビット位置B−1以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第2の係数符号化手段と、
前記冗長性判定手段で冗長性が少ないと判定された場合には、前記第1の係数符号化手段で得られた符号化データを前記着目ブロックの符号化データとして選択して出力し、
前記冗長性判定手段で冗長性が多いと判定された場合には、前記第1の係数符号化手段で得られた符号化データの符号量と、前記第2の係数符号化手段で得られた符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目ブロックの符号化データとして選択して出力する選択手段と
を備えることを特徴とする画像符号化装置。
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,
For each coefficient obtained from the pixel block of interest, the number of bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit is detected as the effective bit number, and each effective bit number Counting means for counting the number of occurrences of
Boundary bit position determining means for determining the boundary bit position B based on the distribution of the number of occurrences of the number of effective bits counted by the counting means;
The coefficients are separated into an upper bit part higher than the boundary bit position B and a lower bit part below the boundary bit position B, and the upper bit part of each coefficient is run-length encoded, and the lower bit A first coefficient encoding means for encoding a bit plane in units;
Redundancy determining means for determining whether the bit plane at the boundary bit position B of each coefficient has a large or small redundancy by using a preset threshold;
When the redundancy determining means determines that the redundancy is high, the coefficients are separated into an upper bit part higher than the boundary bit position B-1 and a lower bit part below the boundary bit position B-1. A second coefficient encoding means for performing run length encoding on the upper bit part of each coefficient and encoding the lower bit part on a bit plane basis;
If it is determined by the redundancy determining means that the redundancy is low, the encoded data obtained by the first coefficient encoding means is selected and output as the encoded data of the block of interest;
When the redundancy determining means determines that there is a lot of redundancy, the code amount of the encoded data obtained by the first coefficient encoding means and the second coefficient encoding means An image encoding apparatus comprising: a selection unit that compares a code amount of encoded data and selects and outputs encoded data with a small code amount as encoded data of the block of interest.
前記境界ビット位置決定手段は、
前記カウント手段でカウントした各有効ビット数が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を前記境界ビット位置Bとして決定することを特徴とする請求項1に記載の画像符号化装置。
The boundary bit position determining means includes
The number of occurrences of each valid bit number b counted by the counting means is defined as N (b), the maximum number of valid bits whose appearance number is 1 or more is defined as bmax, and the variable b = 0, 1, 2,. The summation function of
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to a preset threshold value Th,
S (bmax−b)> Th
The image encoding apparatus according to claim 1, wherein a maximum integer b that satisfies the following is obtained, and the maximum integer b is determined as the boundary bit position B.
画素ブロックを単位に周波数変換、量子化処理を行ない、量子化後の各係数を上位ビット部と下位ビット部に分離し、前記上位ビット部についてはランレングス符号化、前記下位ビット部についてはビットプレーンを単位に符号化した符号化画像データを再度符号化する画像符号化装置であって、
前記符号化画像データから、前記画素ブロック単位に符号化データを入力する入力手段と、
入力した符号化画像データを解析することで、着目画素ブロックにおける各係数の前記上位ビット部と下位ビット部への分離のための境界ビット位置Bを抽出手段と、
該抽出手段で抽出した境界ビット位置Bにおけるビットプレーンに冗長性が多いか少ないかを、予め設定された閾値を用いて、判定する冗長性判定手段と、
該冗長性判定手段で冗長性が多いと判定した場合、前記着目画素ブロックの各係数まで復号する係数復号手段と、
該係数復号手段で復号した各係数を、境界ビット位置Bから1を減じた境界ビット位置B−1に従って、上位ビット部と下位ビット部とに分離し、上位ビット部についてはランレングス符号化し、下位ビット部についてはビットプレーンを単位に符号化する係数符号化手段と、
前記冗長性判定手段で冗長性が少ないと判定された場合には、前記入力手段で入力した画素ブロックの符号化データを前記着目画素ブロックの符号化データとして選択して出力し、
前記冗長性判定手段で冗長性が多いと判定された場合には、前記係数符号化手段で得られた符号化データの符号量と、前記入力手段で入力した符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目画素ブロックの符号化データとして選択して出力する選択手段と
を備えることを特徴とする画像符号化装置。
Performs frequency conversion and quantization processing in units of pixel blocks, separates each quantized coefficient into an upper bit part and a lower bit part, run-length encoding for the upper bit part, and bit for the lower bit part An image encoding device that re-encodes encoded image data encoded in units of planes,
Input means for inputting encoded data in units of pixel blocks from the encoded image data;
By analyzing the input encoded image data, a boundary bit position B for separating each coefficient in the pixel block of interest into the upper bit part and the lower bit part is extracted;
Redundancy determining means for determining whether the bit plane at the boundary bit position B extracted by the extracting means has a large or small redundancy using a preset threshold;
A coefficient decoding unit that decodes up to each coefficient of the pixel block of interest when the redundancy determining unit determines that the redundancy is high;
Each coefficient decoded by the coefficient decoding means is separated into an upper bit part and a lower bit part according to a boundary bit position B-1 obtained by subtracting 1 from the boundary bit position B, and the upper bit part is run-length encoded. Coefficient encoding means for encoding the lower bit part in bit plane units,
If it is determined by the redundancy determining means that the redundancy is low, the encoded data of the pixel block input by the input means is selected and output as the encoded data of the target pixel block,
When the redundancy determining means determines that there is a lot of redundancy, the code amount of the encoded data obtained by the coefficient encoding means is compared with the code amount of the encoded data input by the input means. And selecting means for selecting and outputting encoded data with a small code amount as encoded data of the pixel block of interest.
画素ブロックを単位に周波数変換、量子化処理を行ない、量子化後の各係数を上位ビット部と下位ビット部に分離し、前記上位ビット部についてはランレングス符号化、前記下位ビット部についてはビットプレーンを単位に符号化した符号化画像データを再度符号化する画像符号化装置であって、
前記符号化画像データから、画素ブロック単位に符号化データを入力する入力手段と、
入力した符号化画像データを解析することで、着目画素ブロックにおける各係数の前記上位ビット部と下位ビット部への分離のための境界ビット位置B1を抽出手段と、
前記入力手段で入力した着目画素ブロックの符号化データに基づき、各係数まで復号する係数復号手段と、
該係数復号手段で復号して得られた各係数についての、最上位から最下位ビットに向かって最初に“1”となるビット位置から最下位ビットまでのビット数を有効ビット数として検出し、各有効ビット数の出現回数をカウントするカウント手段と、
該カウント手段でカウントした有効ビット数の出現回数の分布に基づき、境界ビット位置B2を決定する境界ビット位置決定手段と、
前記境界ビット位置B1と前記境界ビット位置B2とを比較する比較手段と、
該比較手段の比較結果が互いに異なることを示す場合、前記境界ビット位置B2に従って、前記係数復号手段で復号した各係数を上位ビット部と下位ビット部とに分離し、上位ビット部についてはランレングス符号化、下位ビット部についてビットプレーンを単位に符号化する係数符号化手段と、
前記比較手段の比較結果が互いに等しいことを示す場合には、前記入力手段で入力した画素ブロックの符号化データを前記着目画素ブロックの符号化データとして選択して出力し、
前記比較手段の比較結果が互いに異なることを示す場合には、前記係数符号化手段で得られた符号化データの符号量と、前記入力手段で入力した符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目画素ブロックの符号化データとして選択して出力する選択手段と
を備えることを特徴とする画像符号化装置。
Performs frequency conversion and quantization processing in units of pixel blocks, separates each quantized coefficient into an upper bit part and a lower bit part, run-length encoding for the upper bit part, and bit for the lower bit part An image encoding device that re-encodes encoded image data encoded in units of planes,
Input means for inputting encoded data in units of pixel blocks from the encoded image data;
By analyzing the input encoded image data, extraction means for extracting a boundary bit position B1 for separating the coefficients in the pixel block of interest into the upper bit part and the lower bit part;
Coefficient decoding means for decoding up to each coefficient based on the encoded data of the pixel block of interest input by the input means;
For each coefficient obtained by decoding by the coefficient decoding means, the number of bits from the bit position first becoming “1” from the most significant bit to the least significant bit to the least significant bit is detected as the effective bit number, Counting means for counting the number of occurrences of each effective bit number;
Boundary bit position determining means for determining the boundary bit position B2 based on the distribution of the number of occurrences of the number of effective bits counted by the counting means;
Comparing means for comparing the boundary bit position B1 and the boundary bit position B2;
When the comparison means indicate that the comparison results are different from each other, each coefficient decoded by the coefficient decoding means is separated into an upper bit part and a lower bit part according to the boundary bit position B2, and the run length of the upper bit part is separated. Coding, coefficient encoding means for encoding the lower bit part in bit plane units,
When the comparison results of the comparison means indicate that they are equal to each other, the encoded data of the pixel block input by the input means is selected and output as the encoded data of the target pixel block,
When indicating that the comparison results of the comparison means are different from each other, the code amount of the encoded data obtained by the coefficient encoding means is compared with the code amount of the encoded data input by the input means, An image encoding apparatus comprising: selection means for selecting and outputting encoded data with a small code amount as encoded data of the pixel block of interest.
前記境界ビット位置決定手段は、
前記カウント手段でカウントした各有効ビット数が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を前記境界ビット位置B2として決定することを特徴とする請求項4に記載の画像符号化装置。
The boundary bit position determining means includes
The number of occurrences of each valid bit number b counted by the counting means is defined as N (b), the maximum number of valid bits whose appearance number is 1 or more is defined as bmax, and the variable b = 0, 1, 2,. The summation function of
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to a preset threshold value Th,
S (bmax−b)> Th
The image encoding apparatus according to claim 4, wherein a maximum integer b that satisfies the following is obtained, and the maximum integer b is determined as the boundary bit position B <b> 2.
多値画像データから画素ブロックを単位に、周波数変換、量子化処理を行ない、当該量子化処理で得られた多値の各係数を符号化する画像符号化装置の制御方法であって、
着目画素ブロックから得られた各係数について、最上位から最下位のビットに向かって最初に“1”となるビット位置から最下位ビットまでのビット数を有効ビット数として検出し、各有効ビット数の出現回数をカウントするカウント工程と、
該カウント工程でカウントした有効ビット数の出現回数の分布に基づき、境界ビット位置Bを決定する境界ビット位置決定工程と、
前記各係数を、前記境界ビット位置Bより上位の上位ビット部、前記境界ビット位置B以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第1の係数符号化工程と、
前記各係数の、前記境界ビット位置Bのビットプレーンに冗長性が多いか少ないかを、予め設定された閾値を用いて、判定する冗長性判定工程と、
該冗長性判定工程で冗長性が多いと判定された場合、前記各係数を、前記境界ビット位置B−1より上位の上位ビット部、前記境界ビット位置B−1以下の下位ビット部とに分離し、前記各係数の前記上位ビット部についてはランレングス符号化し、前記下位ビット部についてはビットプレーンを単位に符号化する第2の係数符号化工程と、
前記冗長性判定工程で冗長性が少ないと判定された場合には、前記第1の係数符号化工程で得られた符号化データを前記着目ブロックの符号化データとして選択して出力し、
前記冗長性判定工程で冗長性が多いと判定された場合には、前記第1の係数符号化工程で得られた符号化データの符号量と、前記第2の係数符号化工程で得られた符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目ブロックの符号化データとして選択して出力する選択工程と
を備えることを特徴とする画像符号化装置の制御方法。
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,
For each coefficient obtained from the pixel block of interest, the number of bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit is detected as the effective bit number, and each effective bit number A counting process for counting the number of occurrences of
A boundary bit position determining step for determining the boundary bit position B based on the distribution of the number of occurrences of the number of effective bits counted in the counting step;
The coefficients are separated into an upper bit part higher than the boundary bit position B and a lower bit part below the boundary bit position B, and the upper bit part of each coefficient is run-length encoded, and the lower bit A first coefficient encoding step for encoding a bit plane in units;
A redundancy determination step of determining whether or not the bit plane at the boundary bit position B of each coefficient has a large or small redundancy by using a preset threshold;
When it is determined that the redundancy is high in the redundancy determination step, the coefficients are separated into an upper bit part higher than the boundary bit position B-1 and a lower bit part below the boundary bit position B-1. A second coefficient encoding step of performing run length encoding on the upper bit part of each coefficient and encoding the lower bit part on a bit plane basis;
If it is determined that the redundancy is low in the redundancy determination step, the encoded data obtained in the first coefficient encoding step is selected and output as the encoded data of the block of interest;
When it is determined that the redundancy is high in the redundancy determination step, the code amount of the encoded data obtained in the first coefficient encoding step and the code amount obtained in the second coefficient encoding step A control method for an image encoding device, comprising: a selection step of comparing a code amount of encoded data and selecting and outputting encoded data having a small code amount as encoded data of the block of interest.
前記境界ビット位置決定工程は、
前記カウント工程でカウントした各有効ビット数が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を前記境界ビット位置Bとして決定することを特徴とする請求項6に記載の画像符号化装置の制御方法。
The boundary bit position determining step includes:
The number of occurrences of each effective bit number b counted in the counting step is defined as N (b), the maximum number of effective bits with an appearance number of 1 or more is defined as bmax, and the variable b = 0, 1, 2,. The summation function of
S (bmax−b) = ΣN (bmax−i) (i = 0, 1,..., B)
In relation to a preset threshold value Th,
S (bmax−b)> Th
The control method for an image encoding device according to claim 6, wherein a maximum integer b that satisfies the following is obtained, and the maximum integer b is determined as the boundary bit position B.
画素ブロックを単位に周波数変換、量子化処理を行ない、量子化後の各係数を上位ビット部と下位ビット部に分離し、前記上位ビット部についてはランレングス符号化、前記下位ビット部についてはビットプレーンを単位に符号化した符号化画像データを再度符号化する画像符号化装置の制御方法であって、
前記符号化画像データから、前記画素ブロック単位に符号化データを入力する入力工程と、
入力した符号化画像データを解析することで、着目画素ブロックにおける各係数の前記上位ビット部と下位ビット部への分離のための境界ビット位置Bを抽出工程と、
該抽出工程で抽出した境界ビット位置Bにおけるビットプレーンに冗長性が多いか少ないかを、予め設定された閾値を用いて、判定する冗長性判定工程と、
該冗長性判定工程で冗長性が多いと判定した場合、前記着目画素ブロックの各係数まで復号する係数復号工程と、
該係数復号工程で復号した各係数を、境界ビット位置Bから1を減じた境界ビット位置B−1に従って、上位ビット部と下位ビット部とに分離し、上位ビット部についてはランレングス符号化し、下位ビット部についてはビットプレーンを単位に符号化する係数符号化工程と、
前記冗長性判定工程で冗長性が少ないと判定された場合には、前記入力工程で入力した画素ブロックの符号化データを前記着目画素ブロックの符号化データとして選択して出力し、
前記冗長性判定工程で冗長性が多いと判定された場合には、前記係数符号化工程で得られた符号化データの符号量と、前記入力工程で入力した符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目画素ブロックの符号化データとして選択して出力する選択工程と
を備えることを特徴とする画像符号化装置の制御方法。
Performs frequency conversion and quantization processing in units of pixel blocks, separates each quantized coefficient into an upper bit part and a lower bit part, run-length encoding for the upper bit part, and bit for the lower bit part A control method for an image encoding device that re-encodes encoded image data encoded in units of planes,
An input step of inputting encoded data in units of the pixel blocks from the encoded image data;
Analyzing the input encoded image data to extract a boundary bit position B for separating the coefficients in the pixel block of interest into the upper bit part and the lower bit part; and
A redundancy determination step of determining whether the bit plane at the boundary bit position B extracted in the extraction step has a high or low redundancy by using a preset threshold;
A coefficient decoding step of decoding up to each coefficient of the pixel block of interest when it is determined that the redundancy is high in the redundancy determination step;
Each coefficient decoded in the coefficient decoding step is separated into an upper bit part and a lower bit part according to a boundary bit position B-1 obtained by subtracting 1 from the boundary bit position B, and the upper bit part is run-length encoded. A coefficient encoding process for encoding the lower bit part in units of bit planes;
When it is determined that the redundancy is low in the redundancy determination step, the encoded data of the pixel block input in the input step is selected and output as the encoded data of the pixel block of interest.
When it is determined that the redundancy is high in the redundancy determination step, the code amount of the encoded data obtained in the coefficient encoding step is compared with the code amount of the encoded data input in the input step And a selection step of selecting and outputting encoded data with a small amount of code as encoded data of the pixel block of interest, and a control method for the image encoding apparatus.
画素ブロックを単位に周波数変換、量子化処理を行ない、量子化後の各係数を上位ビット部と下位ビット部に分離し、前記上位ビット部についてはランレングス符号化、前記下位ビット部についてはビットプレーンを単位に符号化した符号化画像データを再度符号化する画像符号化装置の制御方法であって、
前記符号化画像データから、画素ブロック単位に符号化データを入力する入力工程と、
入力した符号化画像データを解析することで、着目画素ブロックにおける各係数の前記上位ビット部と下位ビット部への分離のための境界ビット位置B1を抽出工程と、
前記入力工程で入力した着目画素ブロックの符号化データに基づき、各係数まで復号する係数復号工程と、
該係数復号工程で復号して得られた各係数についての、最上位から最下位ビットに向かって最初に“1”となるビット位置から最下位ビットまでのビット数を有効ビット数として検出し、各有効ビット数の出現回数をカウントするカウント工程と、
該カウント工程でカウントした有効ビット数の出現回数の分布に基づき、境界ビット位置B2を決定する境界ビット位置決定工程と、
前記境界ビット位置B1と前記境界ビット位置B2とを比較する比較工程と、
該比較工程の比較結果が互いに異なることを示す場合、前記境界ビット位置B2に従って、前記係数復号工程で復号した各係数を上位ビット部と下位ビット部とに分離し、上位ビット部についてはランレングス符号化、下位ビット部についてビットプレーンを単位に符号化する係数符号化工程と、
前記比較工程の比較結果が互いに等しいことを示す場合には、前記入力工程で入力した画素ブロックの符号化データを前記着目画素ブロックの符号化データとして選択して出力し、
前記比較工程の比較結果が互いに異なることを示す場合には、前記係数符号化工程で得られた符号化データの符号量と、前記入力工程で入力した符号化データの符号量とを比較し、符号量の少ない符号化データを前記着目画素ブロックの符号化データとして選択して出力する選択工程と
を備えることを特徴とする画像符号化装置の制御方法。
Performs frequency conversion and quantization processing in units of pixel blocks, separates each quantized coefficient into an upper bit part and a lower bit part, run-length encoding for the upper bit part, and bit for the lower bit part A control method for an image encoding device that re-encodes encoded image data encoded in units of planes,
An input step of inputting encoded data in units of pixel blocks from the encoded image data;
Analyzing the input encoded image data to extract a boundary bit position B1 for separating the coefficients in the pixel block of interest into the upper bit part and the lower bit part; and
A coefficient decoding step of decoding up to each coefficient based on the encoded data of the pixel block of interest input in the input step;
For each coefficient obtained by decoding in the coefficient decoding step, the number of bits from the bit position that first becomes “1” from the most significant bit to the least significant bit to the least significant bit is detected as the effective bit number, A counting step for counting the number of occurrences of each effective bit number;
A boundary bit position determining step for determining a boundary bit position B2 based on the distribution of the number of occurrences of the number of effective bits counted in the counting step;
A comparison step of comparing the boundary bit position B1 and the boundary bit position B2.
When the comparison results indicate that the comparison results are different from each other, each coefficient decoded in the coefficient decoding step is separated into an upper bit part and a lower bit part according to the boundary bit position B2, and the run length is set for the upper bit part. Coding, a coefficient coding process for coding the lower bit part in bit plane units,
When the comparison result of the comparison step indicates that they are equal to each other, the encoded data of the pixel block input in the input step is selected and output as the encoded data of the pixel block of interest,
When the comparison result of the comparison step indicates that they are different from each other, the code amount of the encoded data obtained in the coefficient encoding step is compared with the code amount of the encoded data input in the input step, And a selection step of selecting and outputting encoded data with a small amount of code as encoded data of the pixel block of interest, and a control method for the image encoding apparatus.
前記境界ビット位置決定工程は、
前記カウント工程でカウントした各有効ビット数がbの出現回数をN(b)と定義し、出現回数が1以上の最大の有効ビット数をbmaxと定義し、変数b=0、1、2…に対する次式の合算関数:
S(bmax−b)=ΣN(bmax−b) (i=0,1,…,b)
において、予め設定された閾値Thに対し、
S(bmax−b)>Th
を満たす最大整数bを求め、当該最大整数bを前記境界ビット位置B2として決定することを特徴とする請求項9に記載の画像符号化装置の制御方法。
The boundary bit position determining step includes:
The number of occurrences of each effective bit number b counted in the counting step is defined as N (b), the maximum number of effective bits with an appearance number of 1 or more is defined as bmax, and the variable b = 0, 1, 2,. The summation function of
S (bmax−b) = ΣN (bmax−b) (i = 0, 1,..., B)
In relation to a preset threshold value Th,
S (bmax−b)> Th
10. The control method for an image encoding device according to claim 9, wherein a maximum integer b that satisfies the above is obtained, and the maximum integer b is determined as the boundary bit position B2.
コンピュータに読み込ませ実行させることで、前記コンピュータを請求項1乃至5のいずれか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. 請求項11に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読の記憶媒体。   A computer-readable storage medium storing the computer program according to claim 11.
JP2008108293A 2008-04-17 2008-04-17 Image encoder, and control method thereof Withdrawn JP2009260746A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008108293A JP2009260746A (en) 2008-04-17 2008-04-17 Image encoder, and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008108293A JP2009260746A (en) 2008-04-17 2008-04-17 Image encoder, and control method thereof

Publications (1)

Publication Number Publication Date
JP2009260746A true JP2009260746A (en) 2009-11-05

Family

ID=41387582

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008108293A Withdrawn JP2009260746A (en) 2008-04-17 2008-04-17 Image encoder, and control method thereof

Country Status (1)

Country Link
JP (1) JP2009260746A (en)

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
JP4800571B2 (en) Apparatus and method for encoding digital images in a lossless manner
US6909811B1 (en) Image processing apparatus and method and storage medium storing steps realizing such method
US20060262982A1 (en) Image encoding apparatus and method, computer program, and computer-readable storage medium
JP4847398B2 (en) Image processing apparatus and method
US8031954B2 (en) Image encoding apparatus and control method thereof using prediction encoding and pixel classification
US20060210176A1 (en) Image encoding apparatus, image decoding apparatus, control method therefor, computer program, and computer-readable storage medium
US8452112B2 (en) Image encoding apparatus and method of controlling the same
RU2567988C2 (en) Encoder, method of encoding data, decoder, method of decoding data, system for transmitting data, method of transmitting data and programme product
JP2008042687A (en) Image processing apparatus and its control method, computer program and computer readable storage medium
JP4956304B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
US8041135B2 (en) Image encoding apparatus and control method thereof
US8111930B2 (en) Image encoding apparatus and decoding 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
JP2009260746A (en) Image encoder, and control method thereof
JP4944833B2 (en) Image coding apparatus and control method thereof
JP5086777B2 (en) Image encoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP4743884B2 (en) Image coding apparatus and control method thereof
JP2009260747A (en) Image encoding device, and control method thereof
JPH10150575A (en) System and method for processing image
JP4971881B2 (en) Image encoding apparatus, image decoding apparatus, and control method thereof
JP4795160B2 (en) Image processing apparatus, control method therefor, computer program, and computer-readable storage medium
JP4743883B2 (en) Image coding apparatus and control method thereof

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20110705