JP4911053B2 - Image data quantization apparatus, image data quantization method, and image data quantization program - Google Patents

Image data quantization apparatus, image data quantization method, and image data quantization program Download PDF

Info

Publication number
JP4911053B2
JP4911053B2 JP2008020991A JP2008020991A JP4911053B2 JP 4911053 B2 JP4911053 B2 JP 4911053B2 JP 2008020991 A JP2008020991 A JP 2008020991A JP 2008020991 A JP2008020991 A JP 2008020991A JP 4911053 B2 JP4911053 B2 JP 4911053B2
Authority
JP
Japan
Prior art keywords
range
quantization
image data
dead zone
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2008020991A
Other languages
Japanese (ja)
Other versions
JP2009182809A (en
Inventor
巡 高田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2008020991A priority Critical patent/JP4911053B2/en
Publication of JP2009182809A publication Critical patent/JP2009182809A/en
Application granted granted Critical
Publication of JP4911053B2 publication Critical patent/JP4911053B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、符号化の対象となる画像データを量子化する画像データ量子化装置、画像データ量子化方法および画像データ量子化プログラムに関する。   The present invention relates to an image data quantization apparatus, an image data quantization method, and an image data quantization program for quantizing image data to be encoded.

画像データを符号化する画像処理方法の一例として以下のような方法が挙げられる。   An example of an image processing method for encoding image data includes the following method.

まず、画像データに対してウェーブレット変換を行う。そして、ウェーブレット変換の結果得られる係数(ウェーブレット係数)を量子化し、量子化後の各値の発生頻度を示す頻度表を生成する。   First, wavelet transform is performed on image data. Then, the coefficient (wavelet coefficient) obtained as a result of the wavelet transform is quantized to generate a frequency table indicating the frequency of occurrence of each value after quantization.

続いて、その頻度表に応じてハフマンテーブルを生成し、量子化後の各値をハフマンテーブルに従ってハフマン符号に変換する。   Subsequently, a Huffman table is generated according to the frequency table, and each value after quantization is converted into a Huffman code according to the Huffman table.

以上のような処理によって、画像データを符号化することができる。   Image data can be encoded by the processing as described above.

また、特許文献1には、符号データの量を目標符号量以下に抑える画像処理装置が記載されている。特許文献1に記載の画像処理装置は、量子化およびデータの符号化を行い、符号化処理を進行しながら符号化データの量をカウントする。そして、符号化処理の途中で符号化データのデータ量が設定された上限値をオーバーする場合、量子化ステップを変更して符号化処理を再開し、既に符号化されたデータについても、再符号化を行う。   Patent Document 1 describes an image processing apparatus that suppresses the amount of code data to a target code amount or less. The image processing apparatus described in Patent Literature 1 performs quantization and data encoding, and counts the amount of encoded data while the encoding process proceeds. If the data amount of the encoded data exceeds the set upper limit value in the middle of the encoding process, the quantization process is changed and the encoding process is resumed. To do.

特開2004−320479号公報(段落0044,0045、図3)Japanese Patent Laying-Open No. 2004-320479 (paragraphs 0044 and 0045, FIG. 3)

画像データを符号化する画像処理では、符号データの符号量を目標符号量以下にする必要がある。特許文献1に記載の画像処理装置においても、符号データの量を目標符号量以下に抑えるため、量子化ステップを変更し、既に符号化した処理を再符号化する。ただし、符号化処理を進行している途中で、既に符号化した符号化データについても量子化からやり直すと、処理負荷が大きくなってしまう。   In image processing for encoding image data, the code amount of the code data needs to be equal to or less than the target code amount. Also in the image processing apparatus described in Patent Document 1, in order to keep the amount of code data below the target code amount, the quantization step is changed and the already encoded process is re-encoded. However, if encoded data that has already been encoded is re-executed from quantization while the encoding process is in progress, the processing load will increase.

また、符号化の際にハフマンテーブル等のような、符号化前のデータと符号とを対応付けた符号テーブルを生成する場合がある。符号テーブルを生成するには、符号化の対象となるデータの発生頻度を求めておく必要がある。再量子化を行うと、符号化の対象となるデータが変化するので、再量子化後のデータの発生頻度を求め直さなければならない。   In addition, there is a case where a code table such as a Huffman table or the like in which data before encoding is associated with a code is generated at the time of encoding. In order to generate a code table, it is necessary to obtain the frequency of occurrence of data to be encoded. When requantization is performed, the data to be encoded changes, so the frequency of occurrence of data after requantization must be obtained again.

そこで、本発明は、画像処理において符号化の対象となるデータを再量子化する場合に、再量子化されたデータの発生頻度を容易に求めることができる画像データ量子化装置、画像データ量子化方法および画像データ量子化プログラムを提供することを目的とする。   Therefore, the present invention provides an image data quantization apparatus, an image data quantization, and an image data quantization device that can easily determine the frequency of occurrence of requantized data when data to be encoded in image processing is requantized. It is an object to provide a method and an image data quantization program.

本発明の画像データ量子化装置は、符号化の対象となる画像データを量子化する画像データ量子化装置であって、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化手段と、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化手段と、hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化手段と、前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化手段とを備えることを特徴とする。   The image data quantization apparatus of the present invention is an image data quantization apparatus that quantizes image data to be encoded, and quantizes the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0 A first quantizing unit that delimits a range in which an absolute value exceeds a predetermined dead zone for each predetermined quantization step, and quantizes a value of image data belonging to the delimited range to a median value of the range Quantization means of 2, h is an integer greater than or equal to 0, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is defined as a new dead zone, and the absolute value is A new range is defined by combining the first requantization means for quantizing the value of the image data that is equal to or less than the new dead zone to 0 and the range determined by the predetermined quantization step, and the absolute value is the new value If the value of the image data exceeding the dead zone belongs to a new range above characterized in that it comprises a second re-quantizing means for quantizing the values of the image data to the central value of the new range above.

また、本発明の画像データ量子化方法は、符号化の対象となる画像データを量子化する画像データ量子化方法であって、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化処理を行い、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化処理を行い、hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化処理を行い、前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化処理を行うことを特徴とする。   The image data quantization method of the present invention is an image data quantization method for quantizing image data to be encoded, and sets the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0. A first quantization process for quantizing is performed, a range in which the absolute value exceeds a predetermined dead zone is divided for each predetermined quantization step, and a value of image data belonging to the divided range is quantized to a median value of the range. Second quantization processing is performed, h is an integer greater than or equal to 0, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is set as a new dead zone, A first requantization process for quantizing the value of image data whose absolute value is equal to or less than the new dead zone to 0 is performed, and a new range is determined by combining ranges determined by the predetermined quantization step When a value of image data whose absolute value exceeds the new dead zone belongs to the new range, a second requantization process is performed to quantize the value of the image data to a median value of the new range. It is characterized by.

また、本発明の画像データ量子化プログラムは、符号化の対象となる画像データを量子化するコンピュータに搭載される画像データ量子化プログラムであって、前記コンピュータに、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化処理、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化処理、hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化処理、および前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化処理を実行させることを特徴とする。   The image data quantization program of the present invention is an image data quantization program mounted on a computer that quantizes image data to be encoded, and the computer has an absolute value equal to or less than a predetermined dead zone. A first quantization process for quantizing the value of image data to 0, a range in which the absolute value exceeds a predetermined dead zone is divided for each predetermined quantization step, and values of image data belonging to the divided range are A second quantization process for quantizing to the median of the range, where h is an integer greater than or equal to 0, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is a new value A first re-quantization process in which a value of image data whose absolute value is less than or equal to the new dead zone is quantized to 0, and the predetermined quantization step; When a new range is defined by combining the ranges determined in this way, and the value of image data whose absolute value exceeds the new dead zone belongs to the new range, the value of the image data is quantized to the median value of the new range. The second re-quantization processing to be performed is executed.

本発明によれば、画像処理において符号化の対象となるデータを再量子化する場合に、再量子化されたデータの発生頻度を容易に求めることができる。   According to the present invention, when data to be encoded is requantized in image processing, the frequency of occurrence of requantized data can be easily obtained.

以下、本発明の実施形態を図面を参照して説明する。
なお、以下の説明では、符号化の対象となる画像データを量子化する本発明の画像データ量子化装置が、画像データを符号化する画像処理装置に適用されている場合を例にする。そして、本発明の画像データ量子化装置を画像処理装置と称して説明する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
In the following description, an example in which the image data quantization apparatus of the present invention that quantizes image data to be encoded is applied to an image processing apparatus that encodes image data will be described. The image data quantization apparatus of the present invention will be described as an image processing apparatus.

図1は、本発明の画像処理装置(画像データ量子化装置)の例を示すブロック図である。なお、以下では、画像処理装置が画像データをハフマン符号に変換する場合を例にして説明する。本発明の画像処理装置1は、ウェーブレット変換部2と、中間符号生成部3と、第1の判定部4と、第2の判定部5と、再量子化部6と、符号化部7とを備える。   FIG. 1 is a block diagram showing an example of an image processing apparatus (image data quantization apparatus) according to the present invention. In the following, a case where the image processing apparatus converts image data into a Huffman code will be described as an example. The image processing apparatus 1 of the present invention includes a wavelet transform unit 2, an intermediate code generation unit 3, a first determination unit 4, a second determination unit 5, a requantization unit 6, and an encoding unit 7. Is provided.

ウェーブレット変換部2には、符号化の対象となる画像データが入力される。ウェーブレット変換部2は、その画像データに対して、所定の分解レベル数までウェーブレット変換を行う。この「所定の分解レベル数」を“N”と記す。また、図面中において、分解レベル数をRlevelと記す場合がある。図2は、ウェーブレット変換を模式的に示す説明図である。ウェーブレット変換部2は、入力された画像データ100に対してウェーブレット変換する。1回のウェーブレット変換により得られる係数の種類には、LL成分、LH成分、HL成分、HH成分があり、ウェーブレット変換部2は、LL成分に対して、再帰的にウェーブレット変換を行う。以下、LH成分、HL成分、HH成分をまとめてxxと記す。また、分解レベル数がkのときのLL成分、xx成分を、それぞれ「kLL成分」、「kxx成分」と記す。図2では、分解レベル数1のxx成分(1xx)と、分解レベル数2のLL成分(2LL)およびxx成分(2xx)とを示している。また、図2では、分解レベル数“2”までのウェーブレット変換を例示しているが、ウェーブレット変換部2がウェーブレット変換を行うときの分解レベル数は2に限定されず、3以上の分解レベル数までウェーブレット変換を行ってもよい。以下の説明では、ウェーブレット変換後の係数(ウェーブレット係数)がYUV形式で表され、Y,U,Vの各値を有するようにウェーブレット変換を行う場合を例にして説明する。   The wavelet transform unit 2 receives image data to be encoded. The wavelet transform unit 2 performs wavelet transform on the image data up to a predetermined number of decomposition levels. This “predetermined number of decomposition levels” is denoted as “N”. In the drawings, the number of decomposition levels may be written as Rlevel. FIG. 2 is an explanatory diagram schematically showing the wavelet transform. The wavelet transform unit 2 performs wavelet transform on the input image data 100. The types of coefficients obtained by one wavelet transform include LL component, LH component, HL component, and HH component, and the wavelet transform unit 2 recursively performs wavelet transform on the LL component. Hereinafter, the LH component, the HL component, and the HH component are collectively referred to as xx. Further, the LL component and the xx component when the number of decomposition levels is k are referred to as “kLL component” and “kxx component”, respectively. FIG. 2 shows an xx component (1xx) having a decomposition level number 1, an LL component (2LL) and an xx component (2xx) having a decomposition level number 2. 2 illustrates wavelet transformation up to the number of decomposition levels “2”. However, the number of decomposition levels when the wavelet transform unit 2 performs wavelet transformation is not limited to 2, and the number of decomposition levels is 3 or more. Wavelet transformation may be performed up to. In the following description, an example will be described in which wavelet transformation is performed so that coefficients after wavelet transformation (wavelet coefficients) are expressed in YUV format and have Y, U, and V values.

中間符号生成部3は、ウェーブレット変換によって得られた係数に対して所定の量子化ステップで量子化を行った値であるかまたはウェーブレット変換によって得られた係数自体である中間データ(以下、中間符号と記す。)を生成する。ここでは、ウェーブレット変換よって得られた係数に対して量子化を行った結果を中間符号とする場合を例にして説明する。よって、本例では、中間符号生成部3は、ウェーブレット係数に含まれるY,U,Vの値をそれぞれ所定の量子化ステップで量子化し、その量子化の結果を中間符号とする。以下、量子化ステップをQステップと記す。   The intermediate code generation unit 3 is intermediate data (hereinafter referred to as intermediate code) that is a value obtained by quantizing a coefficient obtained by the wavelet transform in a predetermined quantization step or a coefficient itself obtained by the wavelet transform. .) Is generated. Here, a case where the result obtained by quantizing the coefficient obtained by the wavelet transform is an intermediate code will be described as an example. Therefore, in this example, the intermediate code generation unit 3 quantizes the values of Y, U, and V included in the wavelet coefficients in predetermined quantization steps, and sets the quantization result as an intermediate code. Hereinafter, the quantization step is referred to as Q step.

中間符号生成部3による中間符号生成処理についてより詳しく説明する。1xx成分、2xx成分等の中間符号生成対象の成分毎に、中間符号生成時の所定のQステップおよびデッドゾーンが定められている。中間符号生成部3は、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する。例えば、1xx成分に含まれるあるYの絶対値がデッドゾーン以下であれば、そのYを0に量子化する。また、中間符号生成部3は、絶対値が所定のデッドゾーンを越える範囲を、所定のQステップ毎に区切る。そして、それらの各範囲に属する画像データの値を、その範囲の中央値に量子化する。例えば、デッドゾーンおよびQステップがいずれも2であるとする。この場合、絶対値が2を越える範囲(すなわち、−2未満の範囲および2より大きい範囲)を、Qステップである2毎に区切り、“−4〜−2”、“2〜4”、“4〜6”等の範囲を定める。そして、1xx成分に含まれるあるYが“2〜4”等の範囲に属していれば、Yの値をその範囲の中央値に量子化する。ここでは、1xx成分に含まれるYを例示したが、U,Vの量子化も同様に行う。また、1xx成分以外の成分に関する量子化処理も同様である。   The intermediate code generation processing by the intermediate code generation unit 3 will be described in more detail. Predetermined Q steps and dead zones at the time of intermediate code generation are determined for each intermediate code generation target component such as a 1xx component and a 2xx component. The intermediate code generation unit 3 quantizes the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0. For example, if the absolute value of a certain Y included in the 1xx component is equal to or less than the dead zone, the Y is quantized to 0. Further, the intermediate code generation unit 3 divides a range in which the absolute value exceeds a predetermined dead zone every predetermined Q steps. Then, the values of the image data belonging to each of these ranges are quantized to the median value of the ranges. For example, it is assumed that the dead zone and the Q step are both 2. In this case, a range in which the absolute value exceeds 2 (that is, a range of less than −2 and a range of greater than 2) is divided into two Q steps, “−4 to −2”, “2 to 4”, “ Define a range such as 4-6 ″. If a certain Y included in the 1xx component belongs to a range such as “2 to 4”, the value of Y is quantized to the median value of the range. Here, Y included in the 1xx component is illustrated, but U and V quantization is performed in the same manner. The same applies to the quantization processing for components other than the 1xx component.

また、中間符号生成部3は、連長解析を行った結果を中間符号の中に含めてもよい。すなわち、連長解析の結果も中間符号(中間データ)としてよい。連長解析は、同一のデータが連続して並んでいる場合にその連続数をカウントする処理である。連長解析の態様として、量子化後のY,U,Vの値がいずれも0である画素が連続する場合、その連続数をカウントする態様がある。あるいは、量子化後のY,U,Vの組み合わせが同一となる画素が連続する場合、その連続数をカウントしてもよい。図3は、ウェーブレット係数から生成した中間符号を模式的に示す説明図である。図3では連長解析によりカウントした連続数を“len”と表している。中間符号生成部3は、例えば、2LL成分、2xx成分、1xx成分に含まれるY,U,Vを上述の様に量子化し、2LL中間符号、2xx中間符号、1xx中間符号等を生成する。また、量子化後のY,U,Vに対して連長解析を行い、その結果(カウントした連続数“len”)を中間符号に含めてもよい。以下、中間符号にlenを含める場合を例にして説明する。   The intermediate code generation unit 3 may include the result of the run length analysis in the intermediate code. That is, the result of the run length analysis may also be an intermediate code (intermediate data). The run length analysis is a process of counting the number of consecutive data when the same data is continuously arranged. As an aspect of the run length analysis, there is an aspect in which the number of consecutive pixels is counted when pixels whose Y, U, and V values after quantization are all 0 are consecutive. Alternatively, when pixels having the same combination of Y, U, and V after quantization are continuous, the number of consecutive pixels may be counted. FIG. 3 is an explanatory diagram schematically showing an intermediate code generated from wavelet coefficients. In FIG. 3, the continuous number counted by the run length analysis is expressed as “len”. For example, the intermediate code generation unit 3 quantizes Y, U, and V included in the 2LL component, the 2xx component, and the 1xx component as described above, and generates a 2LL intermediate code, a 2xx intermediate code, a 1xx intermediate code, and the like. Alternatively, the run length analysis may be performed on the quantized Y, U, and V, and the result (the counted number of consecutive “len”) may be included in the intermediate code. Hereinafter, a case where len is included in the intermediate code will be described as an example.

また、符号化データから得られる画像の最高画質を規定する分解レベル数(mとする。)が画像処理装置に設定されている。ここで、mは1以上N以下の整数である。中間符号生成部3は、分解レベル数m〜NのLL成分、および分解レベル数1〜Nのxx成分を対象にして、中間符号を生成する。換言すれば、(m)LL成分、(m+1)LL成分、・・・、NLL成分、および1xx成分、2xx成分、・・・、Nxx成分を対象にして中間符号を生成する。 In addition, the number of decomposition levels (m i ) that defines the highest image quality of an image obtained from encoded data is set in the image processing apparatus. Here, mi is an integer of 1 or more and N or less. The intermediate code generation unit 3 generates an intermediate code for the LL component having the decomposition level number m i to N and the xx component having the decomposition level number 1 to N. In other words, an intermediate code is generated for (m i ) LL component, (m i +1) LL component,..., NLL component, 1xx component, 2xx component,.

第1の判定部4は、定められた範囲の分解レベル数の中間データのうちxx成分(すなわちLL成分以外の成分)を符号化するか否かを判定する処理を行う。   The first determination unit 4 performs a process of determining whether or not to encode the xx component (that is, the component other than the LL component) in the intermediate data of the number of decomposition levels in a predetermined range.

第1の判定部4は、この判定を行うために、中間符号の生成対象となる上記の各成分(分解レベル数m〜NのLL成分、および分解レベル数1〜Nのxx成分)毎に、量子化に用いる個々の範囲における中間符号の発生頻度(発生数)をカウントする。具体的には、第1の判定部4は、絶対値が所定のデッドゾーン以下となる範囲で量子化されたデータの発生頻度をY,U,V毎にカウントする。また、絶対値がそのデッドゾーンを越える範囲を所定のQステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をY,U,V毎にカウントする。 The first determination unit 4, in order to make this determination, (xx components of the LL component of the decomposition level number m i to N, and the division level number 1 to N) generates subject to the above respective components of the intermediate code for each In addition, the frequency (number of occurrences) of intermediate codes in each range used for quantization is counted. Specifically, the first determination unit 4 counts the occurrence frequency of data quantized in a range where the absolute value is equal to or less than a predetermined dead zone for each of Y, U, and V. Further, the frequency of occurrence of data quantized for each range obtained by dividing the range in which the absolute value exceeds the dead zone for each predetermined Q step is counted for each of Y, U, and V.

図4は、各範囲において量子化されたデータの発生頻度をカウントした結果を示す情報(以下、頻度表と記す。)の例を示す説明図である。図4では、2LL中間符号のY,Uの頻度表の例を示している。図4に示す各頻度表の左側の列は、量子化された結果を示し、右側の列は、その値に量子化されたデータ(図4の例ではYまたはU)の発生頻度を表している。すなわち、図4に例示する2LL中間符号のYの例では、絶対値がデッドゾーン以下の範囲に属し0に量子化されたYのデータが230個あり、255を中央値とする範囲に属し255に量子化されたYのデータが44個あることを示している。   FIG. 4 is an explanatory diagram showing an example of information (hereinafter referred to as a frequency table) indicating the result of counting the frequency of occurrence of quantized data in each range. FIG. 4 shows an example of the frequency table of Y and U of the 2LL intermediate code. The left column of each frequency table shown in FIG. 4 shows the quantized result, and the right column shows the occurrence frequency of data quantized to that value (Y or U in the example of FIG. 4). Yes. That is, in the example of Y of the 2LL intermediate code illustrated in FIG. 4, there are 230 pieces of Y data whose absolute value belongs to the range below the dead zone and is quantized to 0, and belongs to the range whose central value is 255. Indicates that there are 44 Y data quantized.

第1の判定部4は、各頻度表からハフマンテーブルを生成する。図5は、ハフマンテーブルの例を示す説明図である。図5では、2LL中間符号のYについてのハフマンテーブルを例示している。第1の判定部4は、2LL中間符号のYの頻度表から、図5に例示するようなハフマンテーブルを生成する。また、同様に、他の頻度表からもそれぞれハフマンテーブルを生成する。図5に示すように、ハフマンテーブルは、量子化された各値(図5に示す例では、0〜255)と、その値から変換される符号とを含む。第1の判定部4は、量子化された値と符号が一対一に対応し、かつ、発生頻度が大きい値ほど符号のビット長が短くなるように符号を定め、量子化後の値と符号とを対応付けたハフマンテーブルを生成する。ハフマン符号を生成することで、量子化された各データの値(図4に示す例では0〜255)毎のハフマン符号のビット長が定まる。第1の判定部4は、各ハフマン符号毎に、ハフマン符号のビット長と、対応する発生頻度との積を求め、その総和を計算する。また、中間符号にlenが含まれる場合、各lenを符号化したときのビット長(例えばガンマ符号化したときのビット長)も、上記の総和に加算する。第1の判定部4は、1xx成分から(N−1)xx成分までの各xx成分および(N−1)LL成分に関して、これらの総和を求める。その総計が、目標符号量よりも大きい場合、第1の判定部4は、定められた範囲の各分解レベル数を大きい順に選択し、選択した分解レベル数の中間データのxx成分を符号化した時のデータ量を推定し、その推定されたデータ量に応じて、その中間データのxx成分を符号化するか否かを判定する。この判定の動作フローについては、図7および図8を用いて後述する。   The first determination unit 4 generates a Huffman table from each frequency table. FIG. 5 is an explanatory diagram illustrating an example of a Huffman table. FIG. 5 illustrates a Huffman table for Y of the 2LL intermediate code. The first determination unit 4 generates a Huffman table as illustrated in FIG. 5 from the Y frequency table of the 2LL intermediate code. Similarly, Huffman tables are also generated from other frequency tables. As illustrated in FIG. 5, the Huffman table includes each quantized value (0 to 255 in the example illustrated in FIG. 5) and a code converted from the value. The first determination unit 4 determines the code so that the quantized value and the code correspond one-to-one and the bit frequency of the code becomes shorter as the occurrence frequency increases, and the quantized value and the code To generate a Huffman table. By generating the Huffman code, the bit length of the Huffman code for each quantized data value (0 to 255 in the example shown in FIG. 4) is determined. For each Huffman code, the first determination unit 4 obtains the product of the bit length of the Huffman code and the corresponding occurrence frequency, and calculates the sum. If the len is included in the intermediate code, the bit length when each len is encoded (for example, the bit length when gamma-coded) is also added to the above sum. The first determination unit 4 calculates the sum of these xx components from the 1xx component to the (N-1) xx component and the (N-1) LL component. When the total is larger than the target code amount, the first determination unit 4 selects the number of decomposition levels in a predetermined range in descending order, and encodes the xx component of the intermediate data of the selected number of decomposition levels. The time data amount is estimated, and it is determined whether or not to encode the xx component of the intermediate data according to the estimated data amount. The operation flow of this determination will be described later with reference to FIGS.

第2の判定部5は、上記の定められた範囲の分解レベル数よりも小さい各分解レベル数の中間符号のxx成分(LL成分以外の成分)に対して、再量子化を行うか否かを判断する。再量子化を行うか否かの判断対象となる分解レベル数の最大値をmとする。この場合、上述の定められた範囲の分解レベル数は、m+1〜Nの範囲の分解レベル数である。 The second determination unit 5 determines whether or not to re-quantize the xx component (component other than the LL component) of the intermediate code of each decomposition level number smaller than the number of decomposition levels in the predetermined range. Judging. Let m q be the maximum value of the number of decomposition levels for which it is determined whether or not to perform requantization. In this case, the number of decomposition levels in the above defined range is the number of decomposition levels in the range of m q +1 to N.

再量子化部6は、第2の判定部5が再量子化を行うと判定した場合、定められた範囲の分解レベル数(すなわちm+1〜N)よりも小さい各分解レベル数(1〜m)の中間符号のうちxx成分を再量子化する。 When the second determination unit 5 determines that the requantization unit 6 performs the requantization, the requantization unit 6 determines each decomposition level number (1 to 1) smaller than the number of decomposition levels in a predetermined range (that is, m q +1 to N) The xx component of the intermediate code of m q ) is requantized.

符号化部7は、中間符号および再量子化部6によって中間符号から再量子化された値をハフマン符号に符号化する。また、中間符号にlen(連長解析でカウントされた連続数)が含まれている場合、そのlenも符号化する。この場合、符号化部7は、例えば、lenをガンマ符号に符号化すればよい。lenを2進数で表したときのビット長をlとすると、符号化部7は、その2進数のビットの先頭に“l−1”個の0を付加することで、lenをガンマ符号に変換する。符号化部7が中間符号または再量子化の結果をハフマン符号に変換し、lenを例えばガンマ符号に変換することにより、入力された画像データが符号化されることになる。   The encoding unit 7 encodes the value requantized from the intermediate code by the intermediate code and the requantization unit 6 into a Huffman code. Further, when len (continuous number counted by continuous length analysis) is included in the intermediate code, the len is also encoded. In this case, the encoding unit 7 may encode len into a gamma code, for example. If the bit length when len is expressed in binary number is l, the encoding unit 7 converts len to gamma code by adding “l−1” 0s to the head of the binary bit. To do. The encoding unit 7 converts the intermediate code or the re-quantization result into a Huffman code, and converts len into, for example, a gamma code, whereby the input image data is encoded.

図6は、ハフマン符号化の結果の例を模式的に示す説明図である。図6では、2LL成分、2xx成分および1xx成分について符号化を行った場合を例示している。符号化前のデータにY,U,Vだけでなくlenも含まれる場合、Y,U,V,lenそれぞれの符号化データが2LL成分等の符号化結果に含まれる。   FIG. 6 is an explanatory diagram schematically illustrating an example of the result of Huffman coding. FIG. 6 illustrates a case where encoding is performed on the 2LL component, the 2xx component, and the 1xx component. When the data before encoding includes len as well as Y, U, and V, the encoded data of Y, U, V, and len are included in the encoding result of the 2LL component or the like.

ウェーブレット変換部2、中間符号生成部3、第1の判定部4、第2の判定部5、再量子化部6、符号化部7は、例えば、プログラムに従って動作するCPUによって実現される。   The wavelet transform unit 2, the intermediate code generation unit 3, the first determination unit 4, the second determination unit 5, the requantization unit 6, and the encoding unit 7 are realized by, for example, a CPU that operates according to a program.

次に、動作について説明する。図7および図8は、本発明の処理経過の一例を示すフローチャートである。なお、フローチャート中に記載した「出力」とは、「符号化処理」を表している。   Next, the operation will be described. 7 and 8 are flowcharts showing an example of the processing progress of the present invention. Note that “output” described in the flowchart represents “encoding processing”.

まず、ウェーブレット変換部2が、入力された画像データに対して、分解レベル数Nまでウェーブレット変換を行う。   First, the wavelet transform unit 2 performs wavelet transform on the input image data up to the decomposition level number N.

そして、中間符号生成部3は、分解レベル数m〜NのLL成分、および分解レベル数1〜Nのxx成分を対象にして中間符号を生成する。すなわち、中間符号生成部3は、それらの成分に含まれるY,U,Vを、成分の種類に応じて定められるデッドゾーンおよびQステップに応じて量子化する。既に説明したように、中間符号生成部3は、絶対値が所定のデッドゾーン以下であるY,U,Vを0に量子化する。また、絶対値が所定のデッドゾーンを越える範囲をQステップ毎に区切り、各範囲に属するY,U,Vをその範囲の中央値に量子化する。また、例えば、Y,U,Vの組み合わせが同一となる画素が連続する場合、その連続数(len)をカウントする。中間符号生成部3は、このY,U,Vの量子化結果およびlenを中間符号として、画像処理装置が備える記憶装置(図示せず。)に記憶させる。 Then, the intermediate code generation unit 3 generates an intermediate code with respect to the LL component having the decomposition level number m i to N and the xx component having the decomposition level number 1 to N. That is, the intermediate code generation unit 3 quantizes Y, U, and V included in these components according to a dead zone and a Q step that are determined according to the type of component. As already described, the intermediate code generation unit 3 quantizes Y, U, and V whose absolute values are equal to or less than a predetermined dead zone to zero. Further, a range where the absolute value exceeds a predetermined dead zone is divided every Q steps, and Y, U, and V belonging to each range are quantized to a median value of the range. Further, for example, when pixels having the same combination of Y, U, and V are consecutive, the number of consecutive (len) is counted. The intermediate code generation unit 3 stores the Y, U, and V quantization results and len as intermediate codes in a storage device (not shown) included in the image processing apparatus.

また、第1の判定部4は、中間符号を生成した分解レベル数m〜NのLL成分、および分解レベル数1〜Nのxx成分の中間符号を対象として、Y,U,Vそれぞれの頻度表を生成し、画像処理装置が備える記憶装置(図示せず。)に記憶させる。第1の判定部4は、各成分に含まれるY,U,V毎に、デッドゾーンおよびQステップによって定まる各範囲での発生頻度をカウントすることによって頻度表を生成すればよい(以上、ステップS1)。 In addition, the first determination unit 4 targets each of Y, U, and V for the intermediate code of the decomposition level number m i to N that generated the intermediate code and the intermediate code of the decomposition level number 1 to N of the xx component. A frequency table is generated and stored in a storage device (not shown) included in the image processing apparatus. The first determination unit 4 may generate the frequency table by counting the occurrence frequency in each range determined by the dead zone and the Q step for each of Y, U, and V included in each component (the above step). S1).

次に、第1の判定部4は、m(符号化データから得られる画像の最高画質を規定する分解レベル数)を変数mに代入する(ステップS2)。ステップS2で設定されるmは、ステップS3〜S7の制御に用いられる。 Next, the first determination unit 4 substitutes m i (the number of decomposition levels that defines the highest image quality of the image obtained from the encoded data) into the variable m (step S2). M set in step S2 is used for the control in steps S3 to S7.

ステップS2の後、第1の判定部4は、m<Nとなっているか否かを判定する(ステップS3)。変数mがN未満であれば(ステップS3のY)、第1の判定部4は、分解レベル数mのLL成分(mLL成分)および分解レベル数1〜mのxx成分(1xx〜mxx成分)の中間符号を符号化したときの符号量を推定する。このとき、第1の判定部4は、これらの各成分のY,U,Vそれぞれの頻度表からハフマンテーブル(図5参照)を生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算する。さらに、本例では、lenが中間符号に含まれているので、中間符号に含まれる各lenを符号(例えばガンマ符号)に変換したときの符号量もその総和に加算する。第1の判定部4は、各成分毎にこの総和を求め、それらの合計を計算する(ステップS4)。この合計値は、mLL成分および1xx〜mxx成分の中間符号を符号化したときの推定符号量である。なお、推定符号量とは、中間符号を符号化した後のデータ量として推定される値である。   After step S2, the first determination unit 4 determines whether m <N is satisfied (step S3). If the variable m is less than N (Y in step S3), the first determination unit 4 determines the LL component (mLL component) with the decomposition level number m and the xx component (1xx to mxx component) with the decomposition level number 1 to m. The code amount when the intermediate code is encoded is estimated. At this time, the first determination unit 4 generates a Huffman table (see FIG. 5) from the frequency tables of Y, U, and V of these components, and for each Huffman code, the bit length of the Huffman code, Multiply the corresponding occurrence frequency of Y, U, or V, and calculate the sum of the multiplication results. Furthermore, in this example, since len is included in the intermediate code, the code amount when each len included in the intermediate code is converted into a code (for example, a gamma code) is also added to the sum. The 1st determination part 4 calculates | requires this sum for every component, and calculates those sum total (step S4). This total value is an estimated code amount when the intermediate code of the mLL component and the 1xx to mxx components is encoded. The estimated code amount is a value estimated as the data amount after encoding the intermediate code.

続いて、第1の判定部4は、その推定符号量が目標符号量より大きいか否かを判定する(ステップS5)。目標符号量は、画像データを符号化したときの符号量の最大許容値を表し、ステップS5,S13,S19において閾値として用いられる。なお、目標符号量は、画像処理装置自身が画像データの通信等の状況に応じて画像処理装置1が適宜設定してもよい。あるいは目標符号量が外部から入力されてもよい。   Subsequently, the first determination unit 4 determines whether or not the estimated code amount is larger than the target code amount (step S5). The target code amount represents a maximum allowable value of the code amount when image data is encoded, and is used as a threshold value in steps S5, S13, and S19. Note that the target code amount may be appropriately set by the image processing apparatus 1 according to the situation such as communication of image data by the image processing apparatus itself. Alternatively, the target code amount may be input from the outside.

推定符号量が目標符号量以下である場合(ステップS5のN)、ステップS9に移行する。ステップS9において、符号化部7は、mLLの中間符号をハフマン符号に変換する。符号化部7は、ステップS4で生成したmLL成分のY,U,Vに対応するハフマンテーブルを用いて、mLL中間符号のY,U,Vを、対応するハフマン符号に変換すればよい(ステップS9)。さらに、符号化部7は、mxx、(m−1)xx、・・・、1xxの各成分の中間符号もハフマン符号に変換する(ステップS10)。mxxから1xxまでの各中間符号のY,U,Vについても、ステップS4で生成したハフマンテーブルを用いて、対応するハフマン符号に変換すればよい。また、符号化部7は、ステップS9,S10において、各中間符号中のlenを例えばガンマ符号に符号化する。   When the estimated code amount is less than or equal to the target code amount (N in step S5), the process proceeds to step S9. In step S9, the encoding unit 7 converts the MLL intermediate code into a Huffman code. The encoding unit 7 may convert the YL, U, and V of the mLL intermediate code into corresponding Huffman codes using the Huffman table corresponding to Y, U, and V of the mLL component generated in step S4 (step S4). S9). Further, the encoding unit 7 also converts intermediate codes of components mxx, (m−1) xx,..., 1xx into Huffman codes (step S10). The intermediate codes Y, U, and V from mxx to 1xx may be converted into corresponding Huffman codes using the Huffman table generated in step S4. The encoding unit 7 encodes len in each intermediate code into, for example, a gamma code in steps S9 and S10.

推定符号量が目標符号量よりも大きい場合(ステップS5のY)、第1の判定部4は、変数mの値を1インクリメントし(ステップS7)、ステップS3以降の処理を繰り返す。変数mを1インクリメントして再度ステップS3からステップS4に移行した場合、以前のステップS4で符号量を求めた成分については再度、符号量を求め直す必要はなく、インクリメント後のmが示すmLL成分およびmxx成分を求めて、mLL成分および1xx〜mxx成分の総符号量を推定すればよい。   When the estimated code amount is larger than the target code amount (Y in Step S5), the first determination unit 4 increments the value of the variable m by 1 (Step S7), and repeats the processes after Step S3. When the variable m is incremented by 1 and the process proceeds from step S3 to step S4 again, it is not necessary to obtain the code amount again for the component for which the code amount has been obtained in the previous step S4, and the mLL component indicated by m after the increment And the mxx component are obtained, and the total code amount of the mLL component and the 1xx to mxx components may be estimated.

また、ステップS3において、m=Nであると判定した場合(ステップS3のN)、再量子化処理(ステップS8)を行う。図8に示すステップS11以降の処理は、このステップS8の再量子化処理を表している。すなわち、ステップS3でm=Nであるならば、ステップS11(図8参照)に移行する。   If it is determined in step S3 that m = N (N in step S3), requantization processing (step S8) is performed. The process after step S11 shown in FIG. 8 represents the requantization process of step S8. That is, if m = N in step S3, the process proceeds to step S11 (see FIG. 8).

ステップS11に移行したということは、分解レベル数“N−1”の中間符号のLL成分および分解レベル数1から“N−1”までの中間符号のxx成分を符号化したときの符号推定量が目標符号量よりも大きい。このとき、第1の判定部4は、符号化部7にNLL成分を符号化させる(ステップS11)。符号化部7は、NLL中間符号のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、そのY,U,Vをそれぞれ対応するハフマン符号に変換する。また、符号化部7は、NLL中間符号に含まれる各lenを、例えばガンマ符号に符号化する。   The transition to step S11 means that the code estimation amount when the LL component of the intermediate code of the decomposition level number “N−1” and the xx component of the intermediate code from the decomposition level number 1 to “N−1” is encoded. Is larger than the target code amount. At this time, the first determination unit 4 causes the encoding unit 7 to encode the NLL component (step S11). The encoding unit 7 generates a Huffman table from the frequency tables of Y, U, and V of the NLL intermediate code, and converts the Y, U, and V into corresponding Huffman codes. The encoding unit 7 encodes each len included in the NLL intermediate code into, for example, a gamma code.

次に、第1の判定部4は、Nを変数mに代入する(ステップS12)。ステップS12で設定されるmは、ステップS13〜S21の制御に用いられる。   Next, the 1st determination part 4 substitutes N to the variable m (step S12). M set in step S12 is used for the control in steps S13 to S21.

ステップS12の後、第1の判定部4は、m≦mとなっているか否かを判定する(ステップS13)。m≦mが成立していなければ(ステップS13のN)、変数mが示す分解レベル数のxx成分(すなわち、mxx成分)の符号量を推定する(ステップS14)。ステップS14では、mxx成分のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算する。そして、各lenを符号化したときのビット長もその総和に加算すればよい。なお、ステップS4で、mxx成分の推定符号量を計算済であるならば、その推定符号量を参照してもよい。 After step S12, the first determination unit 4 determines whether m ≦ m q is satisfied (step S13). If m ≦ m q does not hold (N in step S13), the code amount of the xx component (that is, the mxx component) of the number of decomposition levels indicated by the variable m is estimated (step S14). In step S14, a Huffman table is generated from the frequency tables of Y, U, and V of the mxx component, and for each Huffman code, the bit length of the Huffman code is multiplied by the occurrence frequency of the corresponding Y, U, or V, The sum of the multiplication results is calculated. The bit length when each len is encoded may be added to the sum. If the estimated code amount of the mxx component has been calculated in step S4, the estimated code amount may be referred to.

続いて、第1の判定部4は、ステップS14で求めた符号推定量と、既に符号化した符号データのデータ量との合計が、目標符号量よりも大きくなっているか否かを判定する(ステップS15)。その合計が目標符号量よりも大きければ(ステップS15のY)、処理を終了する。また、その合計が目標符号量以下であれば(ステップS15のN)、符号化部7にそのmxx成分を符号化させる(ステップS16)。符号化部7は、ステップS14で符号量推定に用いたmxx成分のY,U,Vに対応するハフマンテーブルを用いて、mxx成分のY,U,Vを対応するハフマン符号に変換する。また、符号化部7は、mxx成分中のlenを例えばガンマ符号に符号化する。   Subsequently, the first determination unit 4 determines whether or not the sum of the code estimation amount obtained in step S14 and the data amount of already encoded code data is larger than the target code amount ( Step S15). If the sum is larger than the target code amount (Y in step S15), the process is terminated. If the total is equal to or less than the target code amount (N in step S15), the encoding unit 7 encodes the mxx component (step S16). The encoding unit 7 converts Y, U, and V of mxx components into corresponding Huffman codes using the Huffman table corresponding to Y, U, and V of mxx components used for code amount estimation in step S14. The encoding unit 7 encodes len in the mxx component into, for example, a gamma code.

続いて、第1の判定部4は、変数mの値を1減算し(ステップS17)、ステップS13以降の処理を繰り返す。ステップS13からステップS17のループ処理を繰り返すことで、第1の判定部4は、ステップS14に移行する毎に、定められた範囲の分解レベル数(すなわちm+1〜N)を、大きい順に選択し、そのxx成分の符号量を推定することになる。 Subsequently, the first determination unit 4 subtracts 1 from the value of the variable m (step S17), and repeats the processing after step S13. By repeating the loop processing from step S13 to step S17, the first determination unit 4 selects the number of decomposition levels in a predetermined range (that is, m q +1 to N) in descending order every time the process proceeds to step S14. Then, the code amount of the xx component is estimated.

また、ステップS17で変数mの値を1減算した結果、ステップS13においてm≦mであると判定したならば(ステップS13のY)、ステップS18に移行する。したがって、ステップS18以降では、mの値はmとなっている。 If it is determined in step S17 that the value of the variable m is subtracted by 1 and m ≦ mq is determined in step S13 (Y in step S13), the process proceeds to step S18. Therefore, after step S18, the value of m is mq .

ステップS18では、第2の判定部8は、ステップS18移行時のmが示す分解レベル数のxx成分(すなわちmxx成分)から、1xx成分までの各xx成分の中間符号を符号化したときの符号量を推定する。最初にステップS18に移行した場合(すなわち、まだステップS20の再量子化を行っていない場合)には、mxx〜1xxの各成分の中間符号を符号化したときの符号量を推定する。また、ステップS20の再量子化処理後にステップS18に移行した場合には、再量子化後のmxx〜1xxの各成分の中間符号の符号量を推定する。   In step S18, the second determination unit 8 encodes the intermediate code of each xx component from the xx component (that is, the mxx component) of the decomposition level number indicated by m at the time of transition to step S18 to the 1xx component. Estimate the amount. When the process first proceeds to step S18 (that is, when the requantization of step S20 has not been performed yet), the code amount when the intermediate code of each component of mxx to 1xx is encoded is estimated. When the process proceeds to step S18 after the requantization process in step S20, the code amount of the intermediate code of each component of mxx to 1xx after the requantization is estimated.

各成分の中間符号の符号量を推定する場合には、各成分のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算し、さらに、各lenを符号化したときのビット長もその総和に加算すればよい。   When estimating the code amount of the intermediate code of each component, a Huffman table is generated from the frequency tables of Y, U, and V of each component, and for each Huffman code, the bit length of the Huffman code and the corresponding Y , U or V occurrence frequency, the sum of the multiplication results is calculated, and the bit length when each len is encoded may be added to the sum.

なお、ステップS20の再量子化では、再量子化後のY,U,Vの頻度表も作成する。ステップS20からステップS18に移行した場合、その頻度表を用いてハフマンテーブルを生成すればよい。   In the requantization in step S20, a frequency table of Y, U, and V after requantization is also created. When the process proceeds from step S20 to step S18, a Huffman table may be generated using the frequency table.

ステップS18の後、第2の判定部8は、ステップS18で求めたmxx〜1xxを符号化したときの符号量および、既に符号化した符号データのデータ量との合計が、目標符号量よりも大きくなっているか否かを判定する(ステップS19)。   After step S18, the second determination unit 8 determines that the sum of the code amount obtained by encoding mxx to 1xx obtained in step S18 and the data amount of the already encoded code data is larger than the target code amount. It is determined whether or not it is larger (step S19).

その合計が目標符号量よりも大きいならば、第2の判定部8は再量子化を行うと判定し、ステップS20に移行する(ステップS19のY)。   If the sum is larger than the target code amount, the second determination unit 8 determines to perform re-quantization, and proceeds to step S20 (Y in step S19).

また、その合計が目標符号量以下であるならば、第2の判定部8は再量子化を行わないと判定し、ステップS21に移行する(ステップS19のN)。   If the total is equal to or less than the target code amount, the second determination unit 8 determines not to re-quantize, and proceeds to step S21 (N in step S19).

ステップS21では、符号化部7は、ステップS18での符号量推定に用いたハフマンテーブルを用いて、mxx成分から1xx成分のY,U,Vを、対応するハフマン符号に変換する。また、符号化部7は、各成分中のlenを例えばガンマ符号に符号化する。   In step S21, the encoding unit 7 converts Yxx, Uxx, and 1xx components from mxx components into corresponding Huffman codes using the Huffman table used for code amount estimation in step S18. The encoding unit 7 encodes len in each component into, for example, a gamma code.

また、ステップS20では、再量子化部6は、1xx中間符号からmxx中間符号までのY,U,Vを再量子化する。ステップS18以降におけるmはmであるので、1xx中間符号からmxx中間符号までのY,U,Vを再量子化する。 In step S20, the requantization unit 6 requantizes Y, U, and V from the 1xx intermediate code to the mxx intermediate code. Since m in step S18 and thereafter is m q , Y, U, and V from the 1xx intermediate code to the m q xx intermediate code are requantized.

ステップS20において、再量子化部6は、1xxからmxxまでの各成分毎に、新たなデッドゾーンを定める。このとき、再量子化部6は、hを0以上の整数とし、ステップS1で中間符号を生成したときに用いたデッドゾーンおよびQステップをそれぞれdz,qsとすると、dz+h・qsを新たなデッドゾーンに定める。そして、再量子化部6は、絶対値がその新たなデッドゾーン以下である中間符号(Y,U,V)の値を0に再量子化する。 In step S20, the requantization unit 6 determines a new dead zone for each component from 1xx to m q xx. At this time, the re-quantization unit 6 sets dz + h · qs as a new dead, assuming that h is an integer equal to or larger than 0 and the dead zone and Q step used when the intermediate code is generated in step S1 are dz and qs, respectively. Set in the zone. Then, the requantization unit 6 requantizes the value of the intermediate code (Y, U, V) whose absolute value is equal to or less than the new dead zone to 0.

また、再量子化部6は、1xx〜mxxまでの各成分毎に、新たなQステップを定める。このとき、再量子化部6は、nを0以上の整数とすると、上記のqsを用いて、qs・(2n+1)を新たなQステップに定めることが好ましい。そして、絶対値が上記の新たなデッドゾーンを越える範囲を新たなQステップ(qs・(2n+1))毎に区切り、範囲を定める。そして、各範囲に属する1xx〜mxxまでの各成分の中間符号(Y,U,V)を、その範囲の中央値に量子化する。新たなQステップをqs・(2n+1)とすることが好ましい理由は、そのようにQステップを定めることで、新たに定める範囲の中央値が、ステップS1で量子化するときに用いた範囲の中央値と一致するので、符号化データの画質劣化を防止することができるためである。Qステップをqs・(2n+1)として定めた新たな範囲は、ステップS1量子化するときに用いた範囲を組み合わせた範囲となっている。 Further, the requantization unit 6 determines a new Q step for each component from 1xx to m q xx. At this time, it is preferable that the requantization unit 6 determines qs · (2n + 1) as a new Q step using the above qs, where n is an integer of 0 or more. Then, the range in which the absolute value exceeds the new dead zone is divided for each new Q step (qs · (2n + 1)) to determine the range. Then, the intermediate codes (Y, U, V) of each component from 1xx to m q xx belonging to each range are quantized to the median value of the range. The reason why it is preferable to set the new Q step to qs · (2n + 1) is that the Q value is determined in this way, so that the median value of the newly determined range is the center of the range used when quantizing in step S1. This is because the image quality of the encoded data can be prevented from deteriorating because it matches the value. The new range in which the Q step is defined as qs · (2n + 1) is a range obtained by combining the ranges used when the step S1 is quantized.

ただし、ステップS1で中間符号を導出する際のQステップが1である場合には、ステップS20では、任意の値(ただし、1以上の整数)を新たなQステップとしてよい。ステップS1におけるQステップが1であるならば、新たに定めるQステップの値によらず、新たに定める範囲の中央値が、ステップS1で量子化するときに用いた範囲の中央値と一致するためである。   However, if the Q step for deriving the intermediate code in step S1 is 1, an arbitrary value (however, an integer of 1 or more) may be set as a new Q step in step S20. If the Q step in step S1 is 1, the median value of the newly defined range matches the median value of the range used when quantizing in step S1, regardless of the value of the newly defined Q step. It is.

また、ステップS20において、第2の判定部5は、中間符号を再量子化して得た新たなY,U,Vの頻度表をそれぞれ生成する。再量子化に用いた範囲は、絶対値がデッドゾーン以下の範囲と、その範囲以外を新たなQステップで区切って定めた個々の範囲である。これらの範囲はいずれも、ステップS1で中間符号を生成するときに用いた範囲を組み合わせたものであり、ステップS1での量子化に用いた範囲に対応する。そして、ステップS1における各範囲(例えば、0に量子化する範囲、1に量子化する範囲等)における頻度表は既にステップS1で導出されている。従って、第2の判定部5は、ステップS20での量子化のために定めた個々の範囲に対応する、ステップS1で用いた各範囲を特定し、その各範囲における発生頻度の和を、新たな範囲における発生頻度とすればよい。このように発生頻度を定めることにより、新たな範囲で量子化されたY,U,Vの発生頻度をカウントし直さなくて済む。   In step S20, the second determination unit 5 generates new Y, U, and V frequency tables obtained by requantizing the intermediate code. The ranges used for requantization are individual ranges determined by dividing an absolute value of the dead zone or less by a new Q step. Each of these ranges is a combination of the ranges used when generating the intermediate code in step S1, and corresponds to the range used for quantization in step S1. Then, the frequency table in each range (for example, a range to be quantized to 0, a range to be quantized to 1, etc.) in step S1 has already been derived in step S1. Therefore, the second determination unit 5 identifies each range used in step S1 corresponding to each range defined for quantization in step S20, and newly calculates the sum of the occurrence frequencies in each range. The occurrence frequency may be within a certain range. By determining the occurrence frequency in this way, it is not necessary to recount the occurrence frequencies of Y, U, and V quantized in a new range.

図9は、ステップS20における頻度表導出を模式的に示す説明図である。図9に示す上段のヒストグラムは、ステップS1で中間符号生成のための量子化において、各範囲の中央値に量子化されたデータ(例えばYとする。)の発生頻度を示している。また、図9に示す下段のヒストグラムは、ステップS20の再量子化において、各範囲の中央値に量子化されたデータの発生頻度を示している。また、図9において、A〜IおよびS〜Uは、量子化後の中央値の例示である。ステップS20の再量子化処理で、再量子化部6が、新たなQステップおよびデッドゾーンから範囲を区切った結果、A,B,Cそれぞれを中央値とする3つの範囲を組み合わせて、Sを中央値とする一つの範囲を定め、その範囲に属するデータ(Y)を中央値Sに量子化したとする。この場合、第2の判定部5は、図9の上段のヒストグラムのように表される頻度表において、値Aに量子化したデータ数、値Bに量子化したデータ数、および値Cに量子化したデータ数の和を計算し、その3つの範囲に対応する新たな範囲(Sを中央値とする範囲)に属し値Sに量子化したデータの発生頻度を計算すればよい。他の範囲における発生頻度も同様に計算すればよい。このように再量子化後の発生頻度を計算することにより、各範囲におけるデータの発生頻度をカウントし直さなくて済むので、処理を高速化することができる。   FIG. 9 is an explanatory diagram schematically showing frequency table derivation in step S20. The upper histogram shown in FIG. 9 indicates the frequency of occurrence of data quantized to the median value of each range (for example, Y) in the quantization for generating the intermediate code in step S1. Further, the lower histogram shown in FIG. 9 indicates the frequency of occurrence of data quantized to the median value of each range in the requantization in step S20. In FIG. 9, A to I and S to U are examples of median values after quantization. In the requantization process of step S20, as a result of the requantization unit 6 dividing the range from the new Q step and the dead zone, three ranges having A, B, and C as median values are combined, and S is It is assumed that one range as the median value is defined and data (Y) belonging to the range is quantized to the median value S. In this case, the second determination unit 5 determines the number of data quantized to the value A, the number of data quantized to the value B, and the quantum to the value C in the frequency table represented as the upper histogram in FIG. The sum of the number of converted data may be calculated, and the frequency of occurrence of data that belongs to a new range (a range with S as the median) corresponding to the three ranges and is quantized to the value S may be calculated. The occurrence frequency in other ranges may be calculated similarly. By calculating the occurrence frequency after requantization in this way, it is not necessary to recount the occurrence frequency of data in each range, so that the processing can be speeded up.

他の範囲におけるデータの発生頻度も同様である。なお、上記のように、新たなデッドゾーンをdz+h・qsとし、新たなQステップをqs・(2n+1)とすれば、新たな範囲における中央値は、中間符号生成時の量子化における中央値と等しくなる。例えば、図9に示す例では、S=B,T=E,U=Hとなる。   The same applies to the occurrence frequency of data in other ranges. As described above, if the new dead zone is dz + h · qs and the new Q step is qs · (2n + 1), the median in the new range is the median in the quantization at the time of intermediate code generation. Will be equal. For example, in the example shown in FIG. 9, S = B, T = E, and U = H.

上記のステップS20の後、ステップS18以降の処理を繰り返す。第2の判定部5は、ステップS20で頻度表を新たに生成している。第2の判定部5は、その後のステップS18ではその頻度表を用いて、ステップS20で量子化された値の符号を示すハフマンテーブルを生成する。このとき、第2の判定部5は、ステップS1における量子化後の各値(すなわち、ステップS1で生成された各中間符号)を、それぞれ新たな頻度表から生成したハフマンテーブル内の新たな符号に対応づければよい。   After the above step S20, the processes after step S18 are repeated. The second determination unit 5 newly generates a frequency table in step S20. In the subsequent step S18, the second determination unit 5 uses the frequency table to generate a Huffman table indicating the sign of the value quantized in step S20. At this time, the second determination unit 5 uses each value after quantization in step S1 (that is, each intermediate code generated in step S1) as a new code in the Huffman table generated from each new frequency table. Should be associated with.

図10は、中間符号の値と再量子化後に導出した符号との対応付けを示す説明図である。例えば、図10に例示する再量子化前の中間符号−1,0,1を、0に再量子化したとする。この場合、第2の判定部5は、再量子化後の0等の各値の頻度表からハフマンテーブルを導出する。このハフマンテーブルでは、中間符号0に対応する符号が0であったとする。すると、第2の判定部5は、元の中間符号−1,0,1それぞれに、新たな符号0を対応付ける。例えば、元の中間符号−1,0,1に応じた各符号“100”,“0”,“101”をそれぞれ新たな符号“0”に置換する。このように処理することにより、元の中間符号−1,1からも、0と同じ符号を参照することができる。そして、中間符号を書き換えることなく、再量子化後の値に応じたハフマン符号を生成することができる。   FIG. 10 is an explanatory diagram showing the association between the value of the intermediate code and the code derived after requantization. For example, it is assumed that the intermediate code −1, 0, 1 before re-quantization illustrated in FIG. 10 is re-quantized to 0. In this case, the second determination unit 5 derives a Huffman table from the frequency table of each value such as 0 after requantization. In this Huffman table, it is assumed that the code corresponding to the intermediate code 0 is 0. Then, the second determination unit 5 associates a new code 0 with each of the original intermediate codes −1, 0, 1. For example, each code “100”, “0”, “101” corresponding to the original intermediate code-1, 0, 1 is replaced with a new code “0”. By processing in this way, the same code as 0 can be referred to from the original intermediate codes -1,1. Then, a Huffman code corresponding to the value after requantization can be generated without rewriting the intermediate code.

再量子化処理を行うことにより、ハフマン符号のビット数を減少させることができる。よって、ステップS18〜S20のループ処理を繰り返すことで、符号化後の総符号量を減少させることができる。そして、推定される総符号量が目標符号量以下となったときに、ステップS21に移行して符号化処理を行えばよい。   By performing the requantization process, the number of bits of the Huffman code can be reduced. Therefore, the total code amount after encoding can be reduced by repeating the loop processing of steps S18 to S20. Then, when the estimated total code amount becomes equal to or less than the target code amount, the process proceeds to step S21 and the encoding process may be performed.

また、ステップS20の再量子化処理でデッドゾーンの値を大きくした結果、全ての中間符号(Y,U,V)を一つの値(0)に量子化する場合がある。この場合、符号化部7は、ステップS21において、符号化処理を禁止してもよい。すなわち、再量子化によって、全ての中間符号が0に量子化された場合、符号化部7は、再量子化後のY,U,Vの値をハフマン符号に変換することなく処理を終了してよい。また、lenを符号化する処理も実行しなくてよい。このように、全てのY,U,Vがいずれも0に量子化される場合には、符号化処理を行わないことによって、処理量を削減することができる。   In addition, as a result of increasing the dead zone value in the requantization process in step S20, all intermediate codes (Y, U, V) may be quantized to one value (0). In this case, the encoding unit 7 may prohibit the encoding process in step S21. That is, when all intermediate codes are quantized to 0 by requantization, the encoding unit 7 terminates the process without converting the Y, U, and V values after requantization into Huffman codes. It's okay. Also, the process of encoding len need not be executed. As described above, when all of Y, U, and V are quantized to 0, the processing amount can be reduced by not performing the encoding process.

本発明によれば、定められた範囲の分解レベル数(m+1〜N)について、第1の判定部4がxx成分の符号化を行うと判定したときに、そのxx成分を符号化しておく。そして、その分解レベル数よりも低い分解レベル数(1〜m)を符号化したときの符号量に応じて、その分解レベル数(1〜m)の中間符号を再量子化する。よって、ウェーブレット変換によって得た各分解レベル数の一部について再量子化をするので、処理負荷を抑制しながら、符号量が目標符号量以下になるように制御することができる。 According to the present invention, when the first determination unit 4 determines to encode the xx component for the number of decomposition levels (m q +1 to N) in a predetermined range, the xx component is encoded. deep. Then, the intermediate code of the decomposition level number (1 to m q ) is requantized according to the code amount when the decomposition level number (1 to m q ) lower than the decomposition level number is encoded. Therefore, since re-quantization is performed for a part of the number of decomposition levels obtained by the wavelet transform, it is possible to control the code amount to be equal to or less than the target code amount while suppressing the processing load.

また、再量子化処理では、中間符号を導出する際に用いるデッドゾーンおよびQステップから定まる範囲を組み合わせた範囲を定め、その新たな各範囲内の値を範囲の中央値に量子化する。このように、新たな範囲を、中間符号導出時の範囲を組み合わせた範囲として求めるので、新たな頻度表を求める際に、中間符号導出時にカウントした結果の和を求めればよい(図9参照)。よって、処理負荷を抑制し、また、処理を高速化することができる。   In the requantization process, a range obtained by combining the dead zone used when deriving the intermediate code and the range determined from the Q step is determined, and the value in each new range is quantized to the median value of the range. In this way, since the new range is obtained as a range that combines the range at the time of deriving the intermediate code, when obtaining a new frequency table, the sum of the results counted at the time of deriving the intermediate code may be obtained (see FIG. 9). . Therefore, the processing load can be suppressed and the processing speed can be increased.

また、再量子化処理におけるQステップを、qs・(2n+1)と定めることで、再量子化後の値を中間符号の値と一致させることができ、符号化データの画質劣化を防止することができる。   In addition, by defining the Q step in the requantization process as qs · (2n + 1), the value after requantization can be made to match the value of the intermediate code, and deterioration of the image quality of the encoded data can be prevented. it can.

また、図7および図8に示す処理において、目標符号量が更新されてもよい。その場合においても、更新後の目標符号量を閾値として処理を行うことにより、符号化後のデータ量が更新後の目標符号量以下になるように制御することができる。   Further, in the processing shown in FIGS. 7 and 8, the target code amount may be updated. Even in such a case, by performing processing using the updated target code amount as a threshold, it is possible to control the encoded data amount to be equal to or less than the updated target code amount.

以上の説明では、ウェーブレット変換部2がウェーブレット変換を行う分解レベル数をNとし、再量子化を行うか否かの判断対象となる分解レベル数の最大値をmとして説明した。以下、N=3、m=2である場合を例にして、本発明の動作を説明する。図11および図12は、N=3、m=2である場合の処理経過の一例を示すフローチャートである。なお、以下に示す例は、m=2である場合に相当するが、N=3、m=2、m=2の場合、ステップ3〜S7(図7参照)のループ処理に相当する処理は1回行えばよく、以下に示す例では、変数mにmを代入する処理(ステップS2に相当する処理)等は行わなくよい。 In the above description, the number of decomposition levels at which the wavelet transform unit 2 performs wavelet transform is N, and the maximum value of the number of decomposition levels to be determined whether requantization is performed is described as m q . Hereinafter, the operation of the present invention will be described using the case where N = 3 and m q = 2 as an example. FIG. 11 and FIG. 12 are flowcharts showing an example of processing progress when N = 3 and m q = 2. The example shown below corresponds to the case where m i = 2, but corresponds to the loop process of steps 3 to S7 (see FIG. 7) when N = 3, m q = 2 and m i = 2. process of may be carried out once, in the example shown below, the process of substituting m i to the variable m (process equivalent to step S2) such good without.

まず、ウェーブレット変換部2が、入力された画像データに対して、分解レベル数3までウェーブレット変換を行う。   First, the wavelet transform unit 2 performs wavelet transform on the input image data up to the decomposition level number 3.

そして、中間符号生成部3は、分解レベル数2,3のLL成分(2LL成分、3LL成分)、および分解レベル数1〜3のxx成分(1xx成分、2xx成分、3xx成分)を対象にして中間符号を生成する。すなわち、中間符号生成部3は、それらの成分に含まれるY,U,Vを、成分の種類に応じて定められるデッドゾーンおよびQステップに応じて量子化する。図13は、デッドゾーンおよびQステップの例を示す説明図である。また、図13に示すデッドゾーン1およびQステップ1は2xx成分用のデッドゾーンとQステップの例である。また、デッドゾーン2およびQステップ2は1xx成分用のデッドゾーンとQステップの例である。図13に示す量子化粒度は、量子化の程度を示し、量子化粒度の値が大きいほど、デッドゾーンおよびQステップは大きくなる。本例では、画像処理装置は、図13に例示する各量子化粒度のデッドゾーンおよびQステップを保持しているものとする。最初に中間符号を生成するときには、最小の量子化粒度“0”のデッドゾーンおよびQステップの組み合わせで量子化を行う。デッドゾーンおよびQステップに応じてY,U,Vを量子化する動作はステップS1と同様である。また、例えば、Y,U,Vの組み合わせが同一となる画素が連続する場合、中間符号生成部3は、その連続数(len)をカウントし、lenを中間符号に含める。   Then, the intermediate code generation unit 3 targets the LL components (2LL component, 3LL component) having the decomposition levels 2 and 3 and the xx components (1xx component, 2xx component, 3xx component) having 1 to 3 decomposition levels. An intermediate code is generated. That is, the intermediate code generation unit 3 quantizes Y, U, and V included in these components according to a dead zone and a Q step that are determined according to the type of component. FIG. 13 is an explanatory diagram illustrating an example of a dead zone and a Q step. Further, dead zone 1 and Q step 1 shown in FIG. 13 are examples of the dead zone and Q step for 2xx components. Dead zone 2 and Q step 2 are examples of the dead zone and Q step for 1xx components. The quantization granularity shown in FIG. 13 indicates the degree of quantization, and the larger the quantization granularity value, the larger the dead zone and Q step. In this example, it is assumed that the image processing apparatus holds the dead zone and the Q step of each quantization granularity exemplified in FIG. When an intermediate code is first generated, quantization is performed with a combination of a dead zone having a minimum quantization granularity “0” and a Q step. The operation of quantizing Y, U, and V according to the dead zone and the Q step is the same as that in step S1. For example, when pixels having the same combination of Y, U, and V are consecutive, the intermediate code generation unit 3 counts the number of consecutive (len) and includes len in the intermediate code.

なお、量子化粒度が1以上のデッドゾーンおよびQステップは、再量子化処理の際に用いられる。   A dead zone having a quantization granularity of 1 or more and a Q step are used in the requantization process.

また、第1の判定部4は、中間符号を生成した分解レベル数2,3のLL成分、および分解レベル数1〜3のxx成分の中間符号を対象として、Y,U,Vそれぞれの頻度表を生成する(以上、ステップS31)。   In addition, the first determination unit 4 uses the frequency of Y, U, and V for the LL component with the decomposition level number 2 and 3 and the intermediate code with the xx component with the decomposition level number 1 to 3 for generating the intermediate code. A table is generated (step S31).

分解レベル数2と3では、分解レベル数2の方がブロック歪みが少なく、グラデーションの画質がやや良好となる。よって、分解レベル数2の符号量が目標符号量以下である場合には、分解レベル数2の中間符号だけで符号化を行えるように、ステップS31では、上記のように分解レベル数2,3それぞれのLL成分の中間符号および頻度表を生成しておく。なお、分解レベル数1では、分解レベル数2での符号化よりもさらに画質を向上させることができるが、圧縮効率が低く、頻度表および中間符号のためのメモリ容量も圧迫するので、1LL中間符号およびその頻度表は作成しない。   With the decomposition level numbers 2 and 3, the decomposition level number 2 has less block distortion, and the gradation image quality is slightly better. Therefore, when the code amount of the decomposition level number 2 is equal to or less than the target code amount, in step S31, as described above, the decomposition level numbers 2, 3 are set so that the encoding can be performed only with the intermediate code of the decomposition level number 2. An intermediate code and a frequency table for each LL component are generated in advance. Although the image quality can be further improved with the decomposition level number 1 compared with the encoding with the decomposition level number 2, the compression efficiency is low, and the memory capacity for the frequency table and the intermediate code is also reduced. The code and its frequency table are not created.

ステップS31の後、第1の判定部4は、分解レベル数2のLL成分(2LL成分)および分解レベル数1,2のxx成分(1xx成分、2xx成分)の中間符号を符号化したときの符号量を推定する(ステップS32)。第1の判定部4は、これらの各成分のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算する。さらに、中間符号に含まれるlenを符号(例えばガンマ符号)に変換したときの符号量もその総和に加算する。第1の判定部4は、2LL、2xx、1xxの各成分毎にこの総和を求め、それらの合計を計算すればよい。この合計値は、2LL成分、2xx成分および1xx成分の中間符号を符号化したときの推定符号量である。   After step S31, the first determination unit 4 encodes the intermediate code of the decomposition level number 2 LL component (2LL component) and the decomposition level number 1 and 2 xx components (1xx component, 2xx component). The code amount is estimated (step S32). The first determination unit 4 generates a Huffman table from the frequency tables of Y, U, and V of these components, and for each Huffman code, the bit length of the Huffman code and the corresponding Y, U, or V Multiply the occurrence frequency and calculate the sum of the multiplication results. Further, the code amount when len included in the intermediate code is converted into a code (for example, a gamma code) is also added to the sum. The 1st determination part 4 should just calculate this sum for every component of 2LL, 2xx, and 1xx, and should just calculate those sum total. This total value is an estimated code amount when the intermediate code of the 2LL component, the 2xx component, and the 1xx component is encoded.

続いて、第1の判定部4は、その推定符号量が目標符号量より大きいか否かを判定する(ステップS33)。目標符号量は、ステップS33,S43,S46で閾値として用いられる。   Subsequently, the first determination unit 4 determines whether or not the estimated code amount is larger than the target code amount (step S33). The target code amount is used as a threshold value in steps S33, S43, and S46.

推定符号量が目標符号量以下である場合(ステップS33のN)、ステップS34に移行する。ステップS34において、符号化部7は、2LLの中間符号をハフマン符号に変換する。すなわち、ステップS32で生成した2LL成分のY,U,Vに対応するハフマンテーブルを用いて、2LL中間符号のY,U,Vを、対応するハフマン符号に変換すればよい(ステップS34)。さらに、符号化部7は、2xx中間符号および1xx中間符号もハフマン符号に変換する(ステップS35)。2xx中間符号および1xx中間符号についても、ステップS32で生成したハフマンテーブルを用いて、対応するハフマン符号に変換すればよい。また、符号化部7は、ステップS34,S35において、各中間符号中のlenを例えばガンマ符号に符号化する。   When the estimated code amount is equal to or less than the target code amount (N in step S33), the process proceeds to step S34. In step S34, the encoding unit 7 converts the 2LL intermediate code into a Huffman code. That is, using the Huffman table corresponding to Y, U, and V of the 2LL component generated in step S32, the YLL, U, and V of the 2LL intermediate code may be converted into corresponding Huffman codes (step S34). Furthermore, the encoding unit 7 also converts the 2xx intermediate code and the 1xx intermediate code into Huffman codes (step S35). The 2xx intermediate code and the 1xx intermediate code may be converted into corresponding Huffman codes using the Huffman table generated in step S32. The encoding unit 7 encodes len in each intermediate code into, for example, a gamma code in steps S34 and S35.

推定符号量が目標符号量よりも大きい場合(ステップS33のY)、再量子化処理(ステップS36)を行う。図12に示すステップS41以降の処理は、このステップS36の再量子化処理を表している。すなわち、推定符号量が目標符号量よりも大きいならば、ステップS41(図12参照)に移行する。   If the estimated code amount is larger than the target code amount (Y in step S33), requantization processing (step S36) is performed. The process after step S41 shown in FIG. 12 represents the requantization process of step S36. That is, if the estimated code amount is larger than the target code amount, the process proceeds to step S41 (see FIG. 12).

本例ではN=3であり、ステップS41に移行したということは、分解レベル数“N−1”の中間符号のLL成分(2LL)、および分解レベル数1から“N−1”までの中間符号のxx成分(1xx,2xx)を符号化したときの符号推定量が目標符号量よりも大きい。このとき、第1の推定部4は、符号化部7にNLL成分(すなわち3LL)成分を符号化させる(ステップS41)。符号化部7は、3LL中間符号のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、そのY,U,Vをそれぞれ対応するハフマン符号に変換する。また、3LL中間符号に含まれる各lenを、例えばガンマ符号に符号化する。   In this example, N = 3, and the process proceeds to step S41. This means that the LL component (2LL) of the intermediate code with the decomposition level number “N−1” and the intermediate between the decomposition level number 1 and “N−1”. The code estimation amount when the xx component (1xx, 2xx) of the code is encoded is larger than the target code amount. At this time, the first estimation unit 4 causes the encoding unit 7 to encode the NLL component (that is, 3LL) component (step S41). The encoding unit 7 generates a Huffman table from the frequency tables of Y, U, and V of the 3LL intermediate code, and converts the Y, U, and V into corresponding Huffman codes. Further, each len included in the 3LL intermediate code is encoded into, for example, a gamma code.

次に、第1の判定部4は、3xx中間符号を符号化したときの符号量を推定する(ステップS42)。ステップS42では、3xx中間符号のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の和を計算する。そして、各lenを符号化したときのビット長もその総和に加算し、その結果を推定符号量とすればよい。   Next, the first determination unit 4 estimates a code amount when the 3xx intermediate code is encoded (step S42). In step S42, a Huffman table is generated from the frequency tables of Y, U, and V of the 3xx intermediate code, and for each Huffman code, the bit length of the Huffman code is multiplied by the corresponding Y, U, or V occurrence frequency. , The sum of the multiplication results is calculated. Then, the bit length when each len is encoded may be added to the sum, and the result may be used as the estimated code amount.

第1の判定部4は、ステップS42で求めた3xx中間符号を符号化したときの推定符号量と、ステップS41で既に符号化した符号データのデータ量との合計が、目標符号量よりも大きくなっているか否かを判定する(ステップS43)。その合計が目標符号量よりも大きければ(ステップS43のY)、処理を終了する。また、その合計が目標符号量以下であれば(ステップS43のN)、符号化部7に3xx成分を符号化させる(ステップS44)。符号化部7は、ステップS42で生成したハフマンテーブルを用いて、3xx成分のY,U,Vを対応するハフマン符号に変換する。また、3xx成分中のlenを例えばガンマ符号に変換する。   The first determination unit 4 is configured such that the sum of the estimated code amount when the 3xx intermediate code obtained in step S42 is encoded and the data amount of the encoded data already encoded in step S41 is larger than the target code amount. It is determined whether or not (step S43). If the sum is larger than the target code amount (Y in step S43), the process is terminated. If the total is equal to or less than the target code amount (N in step S43), the encoding unit 7 is made to encode the 3xx component (step S44). The encoding unit 7 converts the Y, U, and V of the 3xx component into corresponding Huffman codes using the Huffman table generated in step S42. Also, len in the 3xx component is converted into a gamma code, for example.

続いて、第2の判定部8は、分解レベル数1〜m(本例では2)までの各xx中間符号を符号化したときの符号量を推定する(ステップS45)。最初にステップS45に移行した場合(すなわち、まだステップS47の再量子化を行っていない場合)には、ステップS1で生成した2xx中間符号および1xx中間符号を符号化したときの符号量を推定する。また、ステップS47の再量子化処理後にステップS45に移行した場合には、再量子化後の2xx中間符号および1xx中間符号を符号化したときの符号量を推定する。第2の判定部8は、2xx中間符号および1xx中間符号のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算し、さらに、各lenを符号化したときのビット長もその総和に加算すればよい。 Subsequently, the second determination unit 8 estimates a code amount when each xx intermediate code having a decomposition level number of 1 to m q (2 in this example) is encoded (step S45). When the process proceeds to step S45 for the first time (that is, when the requantization in step S47 has not been performed yet), the code amount when the 2xx intermediate code and the 1xx intermediate code generated in step S1 are encoded is estimated. . If the process proceeds to step S45 after the requantization process in step S47, the code amount when the 2xx intermediate code and the 1xx intermediate code after requantization are encoded is estimated. The second determination unit 8 generates a Huffman table from the frequency tables of Y, U, and V of the 2xx intermediate code and the 1xx intermediate code, and for each Huffman code, the bit length of the Huffman code and the corresponding Y, U Alternatively, the frequency of V may be multiplied to calculate the sum of the multiplication results, and the bit length when each len is encoded may be added to the sum.

ステップ45の後、第2のは判定部8は、ステップS45で推定した符号量と、ステップS41,S44で既に符号化した符号データのデータ量との合計が目標符号量よりも大きくなっているか否かを判定する(ステップS46)。   After step 45, the second determining unit 8 determines whether the sum of the code amount estimated in step S45 and the data amount of the code data already encoded in steps S41 and S44 is larger than the target code amount. It is determined whether or not (step S46).

その合計が目標符号量よりも大きければ、第2の判定部8は再量子化を行うと判定し、ステップS47に移行する(ステップS46のY)。   If the sum is larger than the target code amount, the second determination unit 8 determines to perform re-quantization, and proceeds to step S47 (Y in step S46).

また、その合計が目標符号量以下であれば、第2の判定部8は、再量子化を行わないと判定し、ステップS48に移行する(ステップS46のN)。   If the total is equal to or less than the target code amount, the second determination unit 8 determines not to re-quantize, and proceeds to step S48 (N in step S46).

ステップS48では、符号化部7は、ステップS45での符号量推定時に生成したハフマンテーブルを用いて、2xx成分から1xx成分のY,U,Vを、対応するハフマン符号に変換する。また、各成分中のlenを例えばガンマ符号に符号化する。   In step S48, the encoding unit 7 converts Yxx, Uxx, and 1xx components from 2xx components to corresponding Huffman codes using the Huffman table generated at the time of code amount estimation in step S45. Also, len in each component is encoded into, for example, a gamma code.

また、ステップS47では、再量子化部6は、1xx中間符号から2xx中間符号までのY,U,Vを再量子化する。再量子化部6は、1xxから2xxまでの各成分毎に、新たなデッドゾーンおよびQステップを定める。このとき、再量子化部6は、図13に例示する量子化粒度のうち、量子化粒度1以上のデッドゾーンおよびQステップを選択すればよい。すなわち、ステップS31で用いた量子化粒度「0」よりも粒度の粗いデッドゾーンおよびQステップの組み合わせを選択すればよい。   In step S47, the requantization unit 6 requantizes Y, U, and V from the 1xx intermediate code to the 2xx intermediate code. The requantization unit 6 determines a new dead zone and Q step for each component from 1xx to 2xx. At this time, the re-quantization unit 6 may select a dead zone and a Q step having a quantization granularity of 1 or more among the quantization granularities illustrated in FIG. That is, a combination of a dead zone and a Q step having a coarser grain size than the quantized grain size “0” used in step S31 may be selected.

図13に例示する各デッドゾーン1および各デッドゾーン2は、dz+h・qsとなるという条件を満たすように定められている。例えば、2xx成分用のデッドゾーン1およびQステップ1に関しては、dz=0、qs=1であり(量子化粒度0参照)、各粒度のデッドゾーン1は、0+h・1となっている。   Each dead zone 1 and each dead zone 2 illustrated in FIG. 13 is determined so as to satisfy the condition of dz + h · qs. For example, regarding dead zone 1 and Q step 1 for 2xx components, dz = 0 and qs = 1 (see quantization granularity 0), and dead zone 1 of each granularity is 0 + h · 1.

また、図13に示すQステップ2は、qs・(2n+1)となるという条件を満たすように定められている。1xx成分用のQステップ2に関してはqs=2であり(量子化粒度0参照)、各粒度のQステップは、2(2n+1)となっている。このように、qs・(2n+1)となるようにQステップを定めれば、再量子化後の値は再量子化前の中間符号からずれないので、好ましい。   Further, Q step 2 shown in FIG. 13 is determined so as to satisfy the condition that qs · (2n + 1). Regarding Q step 2 for the 1xx component, qs = 2 (see quantized granularity 0), and the Q step for each granularity is 2 (2n + 1). Thus, it is preferable to set the Q step so as to be qs · (2n + 1) because the value after requantization does not deviate from the intermediate code before requantization.

一方、図13に示すQステップ1に関しては、qs=1である(量子化粒度0参照)。よって、Qステップ1に関しては、qs・(2n+1)となっていなくてもよい。例えば、量子化粒度1,2のQステップ1の値は“2”であるが、この値はqsの奇数倍になっていない。   On the other hand, for Q step 1 shown in FIG. 13, qs = 1 (see quantization granularity 0). Therefore, regarding Q step 1, qs · (2n + 1) may not be satisfied. For example, the value of Q step 1 of the quantization granularities 1 and 2 is “2”, but this value is not an odd multiple of qs.

再量子化部6は、新たに選択したデッドゾーンを用いて、絶対値がそのデッドゾーン以下である中間符号(Y,U,V)の値を0に再量子化する。また、絶対値がその値を越える範囲を新たなQステップ毎に区切り、その範囲に属する中間符号(Y,U,V)をその範囲の中央値に量子化する。この処理を、2xx中間符号、1xx中間符号それぞれに対して行う。   The re-quantization unit 6 re-quantizes the value of the intermediate code (Y, U, V) whose absolute value is equal to or less than the dead zone to 0 using the newly selected dead zone. Further, a range in which the absolute value exceeds the value is divided for each new Q step, and the intermediate code (Y, U, V) belonging to the range is quantized to the median value of the range. This process is performed for each 2xx intermediate code and 1xx intermediate code.

また、ステップS47において、第2の判定部5は、中間符号を再量子化して得た新たなY,U,Vの頻度表をそれぞれ生成する。図9を参照して説明したように、第2の判定部5は、再量子化の際に新たに定めた範囲に対応する、中間符号生成時に用いた範囲を特定する。そして、その範囲における発生頻度の和を、新たな範囲における発生頻度とすればよい。発生頻度をカウントし直さずに、既に求めた値の加算だけで発生頻度を導出できるので、処理を高速化することができる。   In step S47, the second determination unit 5 generates new Y, U, and V frequency tables obtained by requantizing the intermediate code. As described with reference to FIG. 9, the second determination unit 5 identifies the range used when generating the intermediate code corresponding to the range newly determined at the time of requantization. Then, the sum of the occurrence frequencies in the range may be set as the occurrence frequency in the new range. Since the occurrence frequency can be derived only by adding the already obtained values without counting the occurrence frequency again, the processing can be speeded up.

ステップS47の後、ステップS45以降の処理を繰り返す。第2の判定部5は、ステップS47で頻度表を新たに生成している。第2の判定部5は、その後のステップS45では、その頻度表を用いて、ステップS47で量子化された値の符号を示すハフマンテーブルを生成する。このとき、図10を参照して説明したように、第2の判定部5は、ステップS31における量子化後の各値(すなわち、ステップS31で生成された各中間符号)を、それぞれ新たな頻度表から生成したハフマンテーブル内の新たな符号に対応づければよい。この結果、中間符号を書き換えることなく、量子化後の値に応じたハフマン符号を生成することができる。   After step S47, the processing after step S45 is repeated. The second determination unit 5 newly generates a frequency table in step S47. In the subsequent step S45, the second determination unit 5 uses the frequency table to generate a Huffman table indicating the sign of the value quantized in step S47. At this time, as described with reference to FIG. 10, the second determination unit 5 sets each value after quantization in step S31 (that is, each intermediate code generated in step S31) to a new frequency. What is necessary is just to match | combine with the new code | symbol in the Huffman table produced | generated from the table | surface. As a result, a Huffman code corresponding to the value after quantization can be generated without rewriting the intermediate code.

なお、ステップS47では、量子化粒度を定めるが、例えば、2分探索により量子化粒度を定めてもよい。例えば、最初にステップS47に移行したときには、量子化粒度7を選択して再量子化を行い、その後のステップS46で推定符号量が目標符号量よりも大きい場合には、量子化粒度11を選択していくようにしてもよい。また、この場合、量子化粒度7を選択後のステップS46で推定符号量が目標符号量以下であると判定した場合であっても、ステップS47に移行して量子化粒度3を選択する。このように2分探索によって、推定符号量が目標符号量に収まる範囲で、最も粒度の小さい(すなわち最も画質が高くなる)デッドゾーンおよびQステップを選択してステップS48に移行してもよい。あるいは、ステップS47に移行する毎に、量子化粒度を昇順に選択してもよい。なお、図7および図8で示した動作においても、再量子化処理において2分探索によってQステップおよびデッドゾーンを定めてもよい。あるいは、再量子化処理を行うときに、既に選択したQステップ以上のQステップや、既に選択したデッドゾーン以上のデッドゾーンを新たに定めてもよい。   In step S47, the quantization granularity is determined. For example, the quantization granularity may be determined by binary search. For example, when the process proceeds to step S47 for the first time, the quantization granularity 7 is selected and requantization is performed. When the estimated code amount is larger than the target code amount in the subsequent step S46, the quantization granularity 11 is selected. You may make it do. In this case, even if it is determined in step S46 after the quantization granularity 7 is selected that the estimated code amount is equal to or less than the target code amount, the process proceeds to step S47 and the quantization granularity 3 is selected. As described above, the binary search may select the dead zone and Q step having the smallest granularity (that is, the highest image quality) within the range in which the estimated code amount falls within the target code amount, and the process may proceed to step S48. Alternatively, every time the process proceeds to step S47, the quantization granularity may be selected in ascending order. In the operations shown in FIGS. 7 and 8, the Q step and the dead zone may be determined by binary search in the requantization process. Alternatively, when performing the re-quantization process, a Q step equal to or higher than the already selected Q step or a dead zone equal to or higher than the already selected dead zone may be newly determined.

また、量子化粒度を高くすると、全ての中間符号(Y,U,V)を一つの値(0)に量子化する場合がある。この場合、符号化部7は、ステップS48において、符号化処理を禁止してもよい。すなわち、ハフマン符号への変換を行わなくてもよい。   If the quantization granularity is increased, all intermediate codes (Y, U, V) may be quantized to one value (0). In this case, the encoding unit 7 may prohibit the encoding process in step S48. That is, the conversion to the Huffman code may not be performed.

例えば、Y,U,Vの絶対値が128以下であるとする。量子化粒度14にした場合、デッドゾーン2およびQステップ2はいずれも128となるので、1xx中間符号のY,U,Vは全部0に量子化される。このとき、符号化部7は、ステップS48において、1xx中間符号のY,U,Vの符号化を行わなくてよい。また、1xx中間符号のlenの符号化も行わなくてよい。   For example, assume that the absolute values of Y, U, and V are 128 or less. When the quantization granularity is set to 14, dead zone 2 and Q step 2 are both 128, so Y, U, and V of the 1xx intermediate code are all quantized to 0. At this time, the encoding unit 7 may not perform Y, U, and V encoding of the 1xx intermediate code in step S48. Also, the encoding of len of the 1xx intermediate code need not be performed.

同様に、量子化粒度を15にした場合、デッドゾーン1、Qステップ1、デッドゾーン2およびQステップ2はいずれも128となる。よって、2xx中間符号および1xx中間符号のY,U,Vは全部0に量子化される。このとき、符号化部7は、ステップS48において、2xx中間符号および1xx中間符号のY,U,Vの符号化を行わなくてよい。また、lenの符号化も行わなくてよい。   Similarly, when the quantization granularity is set to 15, dead zone 1, Q step 1, dead zone 2 and Q step 2 are all 128. Therefore, Y, U, and V of the 2xx intermediate code and the 1xx intermediate code are all quantized to 0. At this time, the encoding unit 7 may not perform Y, U, and V encoding of the 2xx intermediate code and the 1xx intermediate code in step S48. Also, the encoding of len does not have to be performed.

図11および図12に示す動作において、ステップS42,S43を行わず、ステップS41の後、ステップS44に移行してもよい。この場合、ステップS33で推定符号量が目標符号量よりも大きいと判定するということは、3xx符号を符号化すると判定することを意味する。   In the operations shown in FIGS. 11 and 12, steps S42 and S43 may not be performed, and the process may proceed to step S44 after step S41. In this case, determining that the estimated code amount is larger than the target code amount in step S33 means determining to encode the 3xx code.

次に、N=3、m=2である場合の他の動作例について説明する。図14は、N=3、m=2である場合の他の処理経過の例を示すフローチャートである。以下、1xx成分等の各成分の中間符号の作成、頻度表の作成、符号化したときの符号量推定、および符号化は、既に説明した動作と同様であるので、詳細な説明は省略する。 Next, another example of operation when N = 3 and m q = 2 is described. FIG. 14 is a flowchart illustrating another example of processing progress when N = 3 and m q = 2. Hereinafter, the creation of the intermediate code of each component such as the 1xx component, the creation of the frequency table, the estimation of the amount of code when encoded, and the encoding are the same as the operations already described, and detailed description thereof will be omitted.

まず、ウェーブレット変換部2が、入力された画像データに対して、分解レベル数3までウェーブレット変換を行う。   First, the wavelet transform unit 2 performs wavelet transform on the input image data up to the decomposition level number 3.

そして、中間符号生成部3は、1xx成分の中間符号を生成する。また、第1の判定部41は、1xx中間符号の頻度表を生成する(ステップS41)。   Then, the intermediate code generation unit 3 generates an intermediate code of 1xx component. The first determination unit 41 generates a frequency table of 1xx intermediate codes (step S41).

次に、中間符号生成部3は、3LL成分の中間符号を生成する。また、第1の判定部41は、3LL中間符号の頻度表を生成する(ステップS42)。   Next, the intermediate code generation unit 3 generates an intermediate code of 3LL components. In addition, the first determination unit 41 generates a frequency table of 3LL intermediate codes (step S42).

次に、符号化部7は、3LL中間符号を符号化する(ステップS43)。符号化部7は、3LL中間符号を符号化するためのハフマンテーブルを3LL中間符号の頻度表から導出し、符号化を行えばよい。あるいは、ステップS42で、第1の判定部41が頻度表から3LL中間符号用のハフマンテーブルを生成しておいてもよい。   Next, the encoding unit 7 encodes the 3LL intermediate code (step S43). The encoding unit 7 may derive the Huffman table for encoding the 3LL intermediate code from the frequency table of the 3LL intermediate code and perform the encoding. Alternatively, in step S42, the first determination unit 41 may generate a Huffman table for 3LL intermediate code from the frequency table.

次に、中間符号生成部3は、3xx成分の中間符号を生成する。また、第1の判定部41は、3xx中間符号の頻度表を生成する(ステップS44)。さらに、第1の判定部41は、3xx中間符号を符号化したときの符号量を推定する(ステップS45)。   Next, the intermediate code generation unit 3 generates an intermediate code of 3xx components. The first determination unit 41 generates a frequency table of 3xx intermediate codes (step S44). Furthermore, the first determination unit 41 estimates a code amount when the 3xx intermediate code is encoded (step S45).

続いて、第1の判定部41は、ステップS45で推定した符号量と、既にステップS43の符号化によって得た符号データのデータ量との合計が、目標符号量よりも大きいか否かを判定し(ステップS46)、目標符号量よりも大きければ処理を終了する。この場合、3LL成分の符号化のみを行って処理を終了することになる。   Subsequently, the first determination unit 41 determines whether or not the sum of the code amount estimated in step S45 and the data amount of the code data already obtained by the encoding in step S43 is larger than the target code amount. If it is larger than the target code amount, the process is terminated. In this case, only the 3LL component is encoded and the process is terminated.

一方、推定符号量と、ステップS43で得た符号データのデータ量との合計が、目標符号量以下である場合(ステップS46のN)、第1の判定部41は、符号化部7に3xx中間符号を符号化させる(ステップS47)。   On the other hand, when the sum of the estimated code amount and the data amount of the code data obtained in step S43 is equal to or less than the target code amount (N in step S46), the first determination unit 41 sends 3xx to the encoding unit 7. The intermediate code is encoded (step S47).

次に、中間符号生成部3は、2xx成分の中間符号を生成する。また、第2の判定部5は、2xx中間符号の頻度表を生成する(ステップS48)。   Next, the intermediate code generation unit 3 generates an intermediate code of 2xx components. The second determination unit 5 generates a frequency table of 2xx intermediate codes (step S48).

その後、再量子化部6は、2xx中間符号を再量子化し、第2の判定部5は、再量子化後の2xx中間符号の頻度表を生成する(ステップS49)。この頻度表は、ステップS48で作成した頻度表を用いて作成すればよい。すなわち、ステップ49での量子化のために定めた個々の範囲に対応する、ステップS48で用いた各範囲を特定し、その各範囲における発生頻度の和を、新たな範囲における発生頻度とすればよい。   Then, the requantization unit 6 requantizes the 2xx intermediate code, and the second determination unit 5 generates a frequency table of the 2xx intermediate code after requantization (step S49). This frequency table may be created using the frequency table created in step S48. That is, if each range used in step S48 corresponding to each range defined for quantization in step 49 is specified, the sum of the occurrence frequencies in each range is set as the occurrence frequency in the new range. Good.

また、再量子化部6は、1xx中間符号を再量子化し、第2の判定部5は、再量子化後の1xx中間符号の頻度表を生成する(ステップS50)。ステップS49の場合と同様に、既にステップS41で作成済みの頻度表を用いて、再量子化後の中間符号の頻度表を生成する。   The requantization unit 6 requantizes the 1xx intermediate code, and the second determination unit 5 generates a frequency table of the 1xx intermediate code after requantization (step S50). Similarly to the case of step S49, the frequency table of the intermediate code after requantization is generated using the frequency table that has already been created in step S41.

次に、第2の判定部5は、再量子化後の2xx中間符号をハフマン符号に符号化したときの符号量を推定する(ステップS51)。また、同様に、再量子化後の1xx中間符号をハフマン符号に符号化したときの符号量を推定する(ステップS52)。そして、第2の判定部5は、既に符号化した3LL成分および3xx成分の符号データのデータ量と、ステップS51,S52で求めた推定符号量の合計が目標符号量よりも大きくなっているか否かを判定する(ステップS53)。   Next, the second determination unit 5 estimates a code amount when the 2xx intermediate code after requantization is encoded into a Huffman code (step S51). Similarly, the code amount when the 1xx intermediate code after requantization is encoded into a Huffman code is estimated (step S52). Then, the second determination unit 5 determines whether the sum of the already encoded 3LL component and 3xx component code data and the estimated code amount obtained in steps S51 and S52 is larger than the target code amount. Is determined (step S53).

その合計が目標符号量よりも大きくなっていれば(ステップS53のY)、ステップS49以降の処理を繰り返す。また、その合計が目標符号量以下であれば(ステップS53のN)、符号化部7は、再量子化後の2xx中間符号および1xx中間符号をそれぞれハフマン符号に符号化する(ステップS54,S55)。   If the sum is larger than the target code amount (Y in step S53), the processes in and after step S49 are repeated. If the total is equal to or less than the target code amount (N in step S53), the encoding unit 7 encodes the re-quantized 2xx intermediate code and 1xx intermediate code into Huffman codes (steps S54 and S55). ).

なお、ステップS48の後、ステップS51に移行し、最初にステップS51,S52に移行した場合には、再量子化前の中間符号を符号化したときの符号データのデータ量を推定してもよい。その後、ステップS53の判定結果に応じて、ステップS49以降の処理を繰り返してもよい。   After step S48, the process proceeds to step S51. When the process first proceeds to steps S51 and S52, the data amount of the code data when the intermediate code before re-quantization is encoded may be estimated. . Thereafter, the processing after step S49 may be repeated according to the determination result of step S53.

以上の実施形態では、中間符号を符号化したときの符号量推定の際、lenをガンマ符号に符号化したときの符号量も計算する。lenをガンマ符号に符号化したときの符号量は、lenをガンマ符号に変換して求めてもよい。あるいは、lenを符号化したときの符号量の総和(連長符号の総和)Lを、以下に示す式(1)で近似的に求めてもよい。   In the above embodiment, when estimating the code amount when the intermediate code is encoded, the code amount when len is encoded into the gamma code is also calculated. The code amount when len is encoded into a gamma code may be obtained by converting len into a gamma code. Alternatively, the total amount of codes (total length of run length codes) L when len is encoded may be obtained approximately by the following equation (1).

Figure 0004911053
Figure 0004911053

式(1)において、bは、符号化したlenがとり得る最長のビット数である。bは、例えば31ビット等のように予め定められている。また、Pは、係数(Y,U,V)とlen値の組の個数である。式(1)は、連長が指数分布に従って発生すると想定した近似式である。   In equation (1), b is the longest number of bits that the encoded len can take. For example, b is predetermined as 31 bits or the like. P is the number of sets of coefficients (Y, U, V) and len values. Expression (1) is an approximate expression assuming that the run length occurs according to the exponential distribution.

また、上記の実施形態では、中間符号を生成したときや、中間符号を再量子化したときに頻度表を生成し、頻度表からハフマンテーブルを生成する場合を説明したが、予めハフマンテーブルを用意していてもよい。すなわち、中間符号を符号化するときに用いるハフマンテーブルや、再量子化後の中間符号を符号化するときに用いるハフマンテーブルを予め保持しておき、そのハフマンテーブルを使って符号量の推定や符号化を行ってもよい。再量子化後の中間符号を符号化するときに用いるハフマンテーブルは、再量子化処理の回数によって異なるので、各回の再量子化毎に個別に保持しておけばよい。予めハフマンテーブルを保持しておく場合、実際のデータ(Y,U,V)の発生頻度に合致したハフマンテーブルとはならない可能性が高いが、符号量の推定や符号化処理に用いることができる。   In the above embodiment, the case where the frequency table is generated when the intermediate code is generated or the intermediate code is requantized and the Huffman table is generated from the frequency table has been described. However, the Huffman table is prepared in advance. You may do it. That is, the Huffman table used when encoding the intermediate code and the Huffman table used when encoding the re-quantized intermediate code are stored in advance, and the code amount is estimated and encoded using the Huffman table. May also be performed. Since the Huffman table used when encoding the re-quantized intermediate code differs depending on the number of re-quantization processes, it may be held individually for each re-quantization. When a Huffman table is held in advance, it is highly possible that the Huffman table does not match the actual data (Y, U, V) occurrence frequency, but it can be used for code amount estimation and encoding processing. .

また、上記の実施形態では、符号化の方式がハフマン符号化である場合を例に説明したが、他の方式で符号化を行ってもよい。例えば、中間符号(Y,U,V)を算術符号化してもよい。Y,U,Vを算術符号化する場合には、符号化したときのデータ量を以下のように推定すればよい。すなわち、あるデータの発生確率をPとすると、そのデータを算術符号化したときの符号量を−LogPビットとして計算すればよい。このように、データを算術符号化する場合であっても、符号化後の符号量を推定可能であり、算術符号化を本発明に適用してもよい。 In the above embodiment, the case where the encoding method is Huffman encoding has been described as an example. However, encoding may be performed by other methods. For example, the intermediate code (Y, U, V) may be arithmetically encoded. When Y, U, and V are arithmetically encoded, the data amount when encoded may be estimated as follows. That is, assuming that the probability of occurrence of certain data is P, the code amount when the data is arithmetically encoded may be calculated as -Log 2 P bits. Thus, even when data is arithmetically encoded, the amount of code after encoding can be estimated, and arithmetic encoding may be applied to the present invention.

また、上記の各実施形態では、中間データを生成するときに(例えば、ステップS1やステップS31において)、ウェーブレット変換によって得られた係数に対して量子化を行った結果を中間符号とする場合を例にして説明したが、ウェーブレット変換によって得られた係数(ウェーブレット係数)自体を中間符号としてもよい。具体的には、予め決められた分解レベル数以上の成分に関しては、ウェーブレット係数自体を中間データとしてもよい。例えば、分解レベル数Nまでウェーブレット変換を行った場合、分解レベル数“N−T”以上N以下のウェーブレット係数をそのまま中間符号とし、分解レベル数“N−T”未満のウェーブレット係数についてはステップS1,S31で説明したようにウェーブレット係数を量子化した結果を中間符号としてもよい。ウェーブレット係数をそのまま中間符号とする分解レベル数“N−T”〜“T”は、符号化後のデータに要求される画質や圧縮率に応じて予め決めておけばよい。また、LL成分についてはウェーブレット係数をそのまま中間符号とし、xx成分についてはウェーブレット係数をステップS1,S31で説明したように量子化したデータを中間符号としてもよい。   In each of the above embodiments, when intermediate data is generated (for example, in step S1 or step S31), the result obtained by quantizing the coefficient obtained by the wavelet transform is an intermediate code. Although described as an example, a coefficient (wavelet coefficient) obtained by wavelet transform itself may be used as an intermediate code. Specifically, the wavelet coefficient itself may be used as intermediate data for a component having a predetermined number of decomposition levels or more. For example, when the wavelet transform is performed up to the decomposition level number N, the wavelet coefficients having the decomposition level number “N−T” or more and N or less are used as intermediate codes, and the wavelet coefficients less than the decomposition level number “N−T” are processed in step S1. As described in S31, the result of quantizing the wavelet coefficients may be used as the intermediate code. The number of decomposition levels “N−T” to “T” using wavelet coefficients as intermediate codes as they are may be determined in advance according to the image quality and compression rate required for the encoded data. The wavelet coefficient may be used as an intermediate code for the LL component, and the data obtained by quantizing the wavelet coefficient as described in steps S1 and S31 may be used as the intermediate code for the xx component.

次に、本発明の概要について説明する。図15は、本発明の概要を示すブロック図である。図15に示すように、本発明の画像データ量子化装置70は、第1の量子化手段71と、第2の量子化手段72と、第1の再量子化手段73と、第2の再量子化手段74とを備える。   Next, the outline of the present invention will be described. FIG. 15 is a block diagram showing an outline of the present invention. As shown in FIG. 15, the image data quantization apparatus 70 of the present invention includes a first quantization means 71, a second quantization means 72, a first requantization means 73, and a second requantization means. Quantization means 74.

第1の量子化手段71(例えば、ステップS1やステップS31でデッドゾーンの範囲に関する量子化を行う中間符号生成部3)は、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する。   The first quantizing unit 71 (for example, the intermediate code generating unit 3 that performs quantization related to the dead zone range in step S1 or step S31) sets the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0. Quantize.

また、第2の量子化手段72(例えば、ステップS1やステップS31でQステップ毎に区切った範囲に関する量子化を行う中間符号生成部3)は、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値をその範囲の中央値に量子化する。   Also, the second quantization means 72 (for example, the intermediate code generation unit 3 that performs quantization related to the range divided for each Q step in step S1 or step S31) determines a range in which the absolute value exceeds a predetermined dead zone. Each quantization step is divided, and the value of the image data belonging to the divided range is quantized to the median value of the range.

また、第1の再量子化手段73(例えば、ステップS20やステップS47でデッドゾーンの範囲に関する量子化を行う再量子化部6)は、hを0以上の整数とし、所定のデッドゾーンをdzとし、所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値がその新たなデッドゾーン以下である画像データの値を0に量子化する。   The first requantization unit 73 (for example, the requantization unit 6 that performs quantization related to the dead zone range in step S20 or step S47) sets h to an integer of 0 or more, and sets a predetermined dead zone to dz. Assuming that the predetermined quantization step is qs, dz + h · qs is set as a new dead zone, and the value of image data whose absolute value is equal to or smaller than the new dead zone is quantized to zero.

また、第2の再量子化手段74(例えば、ステップS20やステップS47でQステップ毎に区切った範囲に関する量子化を行う再量子化部6)は、所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が新たなデッドゾーンを越える画像データの値がその新たな範囲に属する場合、画像データの値をその新たな範囲の中央値に量子化する。   In addition, the second requantization means 74 (for example, the requantization unit 6 that performs quantization related to the range divided for each Q step in step S20 or step S47) combines ranges determined by predetermined quantization steps. When a new range is defined and the value of the image data whose absolute value exceeds the new dead zone belongs to the new range, the value of the image data is quantized to the median value of the new range.

また、絶対値が所定のデッドゾーン以下の範囲で量子化されたデータの発生頻度をカウントするとともに、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をカウントする頻度情報導出手段(例えば、ステップS1やステップS31で頻度表を生成する第1の判定部4)と、頻度情報導出手段がカウントした各範囲における量子化されたデータの発生頻度を加算することによって、絶対値が新たなデッドゾーン以下の範囲で量子化されたデータの発生頻度と、第2の再量子化手段74が定めた個々の新たな範囲における量子化されたデータの発生頻度とを導出する頻度情報再導出手段(例えば、ステップS20やステップS47で再量子化後のデータの頻度表を生成する第2の判定部5)とを備える構成であってもよい。   In addition, the frequency of occurrence of data quantized in a range where the absolute value is less than or equal to the predetermined dead zone is counted, and each range obtained by dividing the range in which the absolute value exceeds the predetermined dead zone for each predetermined quantization step. Frequency information deriving means (for example, the first determination unit 4 that generates a frequency table in step S1 or step S31) for counting the frequency of occurrence of the data quantized in step 1, and the quantum in each range counted by the frequency information deriving means By adding the frequency of occurrence of the quantized data, the frequency of occurrence of data quantized in a range where the absolute value is equal to or less than the new dead zone, and each new range determined by the second requantization means 74 Frequency information re-derivation means for deriving the occurrence frequency of quantized data in (for example, generating a frequency table of data after re-quantization in step S20 and step S47) The second determination unit 5) and may be configured to include a to.

第2の再量子化手段74が、nを0以上の整数とすると、絶対値が新たなデッドゾーンを越える範囲をqs・(2n+1)毎に区切ることによって新たな範囲を定める構成であってもよい。   Even if the second requantization means 74 has a configuration in which a new range is defined by dividing a range where the absolute value exceeds a new dead zone by qs · (2n + 1), where n is an integer greater than or equal to 0. Good.

また、qs=1であり、第2の再量子化手段が、絶対値が新たなデッドゾーンを越える範囲を任意の値で区切ることで新たな範囲を定める構成であってもよい。   Alternatively, qs = 1, and the second requantization unit may define a new range by dividing a range where the absolute value exceeds the new dead zone by an arbitrary value.

頻度情報再導出手段が導出した各範囲における量子化されたデータの発生頻度を用いて、第1の再量子化手段および第2の再量子化手段による各量子化後の値毎の符号を示す符号テーブルを生成し、第1の量子化手段および第2の量子化手段による各量子化後の値を、その値が属する範囲に対応する符号に対応付ける符号テーブル生成手段(例えば、ステップS20の後のステップS18で中間符号と新たに生成したハフマンテーブル内の符号とを対応付ける第2の判定部5)を備える構成であってもよい。   A code for each value after each quantization by the first requantization unit and the second requantization unit is shown using the frequency of occurrence of quantized data in each range derived by the frequency information rederivation unit A code table is generated, and the value after each quantization by the first quantization means and the second quantization means is associated with a code corresponding to the range to which the value belongs (for example, after step S20) The configuration may include a second determination unit 5) that associates the intermediate code with the code in the Huffman table newly generated in step S18.

本発明は、画像データを符号化する画像処理装置に好適に適用され、特に、符号化の対象データを再量子化することがあり、また、例えばハフマンテーブル等の符号テーブルを導出して符号化を行う画像処理装置に好適に適用される。   The present invention is preferably applied to an image processing apparatus that encodes image data. In particular, the data to be encoded may be requantized, and encoding is performed by deriving a code table such as a Huffman table, for example. It is suitably applied to an image processing apparatus that performs the above.

本発明の画像処理装置の例を示すブロック図である。It is a block diagram which shows the example of the image processing apparatus of this invention. ウェーブレット変換を模式的に示す説明図である。It is explanatory drawing which shows a wavelet transformation typically. ウェーブレット係数から生成した中間符号を模式的に示す説明図である。It is explanatory drawing which shows typically the intermediate code produced | generated from the wavelet coefficient. 頻度表の例を示す説明図である。It is explanatory drawing which shows the example of a frequency table. ハフマンテーブルの例を示す説明図である。It is explanatory drawing which shows the example of a Huffman table. ハフマン符号化の結果の例を模式的に示す説明図である。It is explanatory drawing which shows the example of the result of a Huffman encoding typically. 本発明の処理経過の一例を示すフローチャートである。It is a flowchart which shows an example of the process progress of this invention. 本発明の処理経過の一例を示すフローチャートである。It is a flowchart which shows an example of the process progress of this invention. 頻度表導出を模式的に示す説明図である。It is explanatory drawing which shows frequency table derivation typically. 中間符号の値と再量子化後に導出した符号との対応付けを示す説明図である。It is explanatory drawing which shows matching with the code | cord | chord derived after the value of the intermediate code and requantization. N=3、m=2である場合の処理経過の一例を示すフローチャートである。It is a flowchart which shows an example of a process progress in case N = 3 and mq = 2. N=3、m=2である場合の処理経過の一例を示すフローチャートである。It is a flowchart which shows an example of a process progress in case N = 3 and mq = 2. デッドゾーンおよびQステップの例を示す説明図である。It is explanatory drawing which shows the example of a dead zone and Q step. N=3、m=2である場合の他の処理経過の例を示すフローチャートである。It is a flowchart which shows the example of other process progress when N = 3 and mq = 2. 本発明の概要を示すブロック図である。It is a block diagram which shows the outline | summary of this invention.

符号の説明Explanation of symbols

1 画像処理装置(画像データ量子化装置)
2 ウェーブレット変換部
3 中間符号生成部
4 第1の判定部
5 第2の判定部
6 再量子化部
7 符号化部
71 第1の量子化手段
72 第2の量子化手段
73 第1の再量子化手段
74 第2の再量子化手段
1 Image processing device (image data quantization device)
2 wavelet transform unit 3 intermediate code generation unit 4 first determination unit 5 second determination unit 6 requantization unit 7 encoding unit 71 first quantization unit 72 second quantization unit 73 first requantization 74 Second requantization means

Claims (9)

符号化の対象となる画像データを量子化する画像データ量子化装置であって、
絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化手段と、
絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化手段と、
hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化手段と、
前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化手段とを備える
ことを特徴とする画像データ量子化装置。
An image data quantization apparatus for quantizing image data to be encoded,
First quantization means for quantizing the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0;
A second quantizing unit that delimits a range in which the absolute value exceeds a predetermined dead zone for each predetermined quantization step, and quantizes a value of image data belonging to the delimited range to a median value of the range;
When h is an integer of 0 or more, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is set as a new dead zone, and the absolute value is equal to or less than the new dead zone. First requantization means for quantizing the value of the image data to 0;
A new range is defined by combining ranges determined by the predetermined quantization step, and when the value of image data whose absolute value exceeds the new dead zone belongs to the new range, the value of the image data is changed to the new range. An image data quantization apparatus comprising: a second requantization unit that quantizes the median value of the range.
絶対値が前記所定のデッドゾーン以下の範囲で量子化されたデータの発生頻度をカウントするとともに、絶対値が前記所定のデッドゾーンを越える範囲を前記所定の量子化ステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をカウントする頻度情報導出手段と、
前記頻度情報導出手段がカウントした各範囲における量子化されたデータの発生頻度を加算することによって、絶対値が新たなデッドゾーン以下の範囲で量子化されたデータの発生頻度と、前記第2の再量子化手段が定めた個々の新たな範囲における量子化されたデータの発生頻度とを導出する頻度情報再導出手段とを備える
請求項1に記載の画像データ量子化装置。
An individual range obtained by counting the frequency of occurrence of quantized data in a range where the absolute value is less than or equal to the predetermined dead zone and dividing a range in which the absolute value exceeds the predetermined dead zone for each predetermined quantization step Frequency information deriving means for counting the frequency of occurrence of quantized data for each;
By adding the frequency of occurrence of quantized data in each range counted by the frequency information deriving means, the frequency of occurrence of data quantized in a range where the absolute value is less than or equal to a new dead zone, and the second The image data quantization apparatus according to claim 1, further comprising frequency information re-derivation means for deriving a frequency of occurrence of quantized data in each new range determined by the re-quantization means.
前記第2の再量子化手段は、nを0以上の整数とすると、絶対値が前記新たなデッドゾーンを越える範囲をqs・(2n+1)毎に区切ることによって前記新たな範囲を定める
請求項1または請求項2に記載の画像データ量子化装置。
The second re-quantization means determines the new range by dividing a range in which an absolute value exceeds the new dead zone by qs · (2n + 1), where n is an integer of 0 or more. Or the image data quantization apparatus of Claim 2.
qs=1であり、
前記第2の再量子化手段は、絶対値が前記新たなデッドゾーンを越える範囲を任意の値で区切ることで前記新たな範囲を定める
請求項1または請求項2に記載の画像データ量子化装置。
qs = 1,
3. The image data quantization apparatus according to claim 1, wherein the second requantization unit determines the new range by dividing a range in which an absolute value exceeds the new dead zone by an arbitrary value. .
前記頻度情報再導出手段が導出した各範囲における量子化されたデータの発生頻度を用いて、前記第1の再量子化手段および前記第2の再量子化手段による各量子化後の値毎の符号を示す符号テーブルを生成し、前記第1の量子化手段および前記第2の量子化手段による各量子化後の値を、当該値が属する範囲に対応する符号に対応付ける符号テーブル生成手段を備える
請求項2から請求項4のうちのいずれか1項に記載の画像データ量子化装置。
Using the frequency of occurrence of quantized data in each range derived by the frequency information re-derivation means, for each value after each quantization by the first re-quantization means and the second re-quantization means Code table generating means for generating a code table indicating codes and associating each quantized value by the first quantizing means and the second quantizing means with a code corresponding to a range to which the value belongs is provided. The image data quantization apparatus of any one of Claims 2-4.
符号化の対象となる画像データを量子化する画像データ量子化方法であって、
絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化処理を行い、
絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化処理を行い、
hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化処理を行い、
前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化処理を行う
ことを特徴とする画像データ量子化方法。
An image data quantization method for quantizing image data to be encoded,
Performing a first quantization process for quantizing the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0;
Performing a second quantization process that delimits a range where the absolute value exceeds a predetermined dead zone for each predetermined quantization step, and quantizes the value of the image data belonging to the delimited range to the median value of the range;
When h is an integer of 0 or more, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is set as a new dead zone, and the absolute value is equal to or less than the new dead zone. Performing a first requantization process that quantizes the value of the image data to 0;
A new range is defined by combining ranges determined by the predetermined quantization step, and when the value of image data whose absolute value exceeds the new dead zone belongs to the new range, the value of the image data is changed to the new range. A second re-quantization process for quantizing to a median value of the range is performed.
絶対値が前記所定のデッドゾーン以下の範囲で量子化されたデータの発生頻度をカウントするとともに、絶対値が前記所定のデッドゾーンを越える範囲を前記所定の量子化ステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をカウントする頻度情報導出処理を行い、
前記頻度情報導出処理でカウントした各範囲における量子化されたデータの発生頻度を加算することによって、絶対値が新たなデッドゾーン以下の範囲で量子化されたデータの発生頻度と、前記第2の再量子化処理で定めた個々の新たな範囲における量子化されたデータの発生頻度とを導出する頻度情報再導出処理を行う
請求項6に記載の画像データ量子化方法。
An individual range obtained by counting the frequency of occurrence of quantized data in a range where the absolute value is less than or equal to the predetermined dead zone and dividing a range in which the absolute value exceeds the predetermined dead zone for each predetermined quantization step Perform frequency information derivation processing that counts the frequency of occurrence of quantized data every time,
By adding the frequency of occurrence of quantized data in each range counted in the frequency information derivation process, the frequency of occurrence of data quantized in a range where the absolute value is equal to or less than a new dead zone, and the second The image data quantization method according to claim 6, wherein a frequency information re-derivation process for deriving a frequency of occurrence of quantized data in each new range determined by the re-quantization process is performed.
符号化の対象となる画像データを量子化するコンピュータに搭載される画像データ量子化プログラムであって、
前記コンピュータに、
絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する第1の量子化処理、
絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値を当該範囲の中央値に量子化する第2の量子化処理、
hを0以上の整数とし、前記所定のデッドゾーンをdzとし、前記所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値が前記新たなデッドゾーン以下である画像データの値を0に量子化する第1の再量子化処理、および
前記所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が前記新たなデッドゾーンを越える画像データの値が前記新たな範囲に属する場合、前記画像データの値を前記新たな範囲の中央値に量子化する第2の再量子化処理
を実行させるための画像データ量子化プログラム。
An image data quantization program mounted on a computer for quantizing image data to be encoded,
In the computer,
A first quantization process for quantizing the value of image data whose absolute value is equal to or less than a predetermined dead zone to 0;
A second quantization process for dividing a range in which the absolute value exceeds a predetermined dead zone for each predetermined quantization step, and quantizing a value of image data belonging to the divided range to a median value of the range;
When h is an integer of 0 or more, the predetermined dead zone is dz, and the predetermined quantization step is qs, dz + h · qs is set as a new dead zone, and the absolute value is equal to or less than the new dead zone. A first re-quantization process for quantizing the value of the image data to 0 and a new range combining the range determined by the predetermined quantization step are determined, and the absolute value of the image data exceeding the new dead zone is determined. An image data quantization program for executing a second requantization process for quantizing the value of the image data into a median value of the new range when the value belongs to the new range.
前記コンピュータに、
絶対値が前記所定のデッドゾーン以下の範囲で量子化されたデータの発生頻度をカウントするとともに、絶対値が前記所定のデッドゾーンを越える範囲を前記所定の量子化ステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をカウントする頻度情報導出処理、および、
前記頻度情報導出処理でカウントした各範囲における量子化されたデータの発生頻度を加算することによって、絶対値が新たなデッドゾーン以下の範囲で量子化されたデータの発生頻度と、前記第2の再量子化処理で定めた個々の新たな範囲における量子化されたデータの発生頻度とを導出する頻度情報再導出処理
を実行させる請求項8に記載の画像データ量子化プログラム。
In the computer,
An individual range obtained by counting the frequency of occurrence of quantized data in a range where the absolute value is less than or equal to the predetermined dead zone and dividing a range in which the absolute value exceeds the predetermined dead zone for each predetermined quantization step Frequency information derivation processing that counts the frequency of occurrence of quantized data, and
By adding the frequency of occurrence of quantized data in each range counted in the frequency information derivation process, the frequency of occurrence of data quantized in a range where the absolute value is equal to or less than a new dead zone, and the second 9. The image data quantization program according to claim 8, wherein a frequency information re-derivation process for deriving a frequency of occurrence of quantized data in each new range determined by the re-quantization process is executed.
JP2008020991A 2008-01-31 2008-01-31 Image data quantization apparatus, image data quantization method, and image data quantization program Active JP4911053B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008020991A JP4911053B2 (en) 2008-01-31 2008-01-31 Image data quantization apparatus, image data quantization method, and image data quantization program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008020991A JP4911053B2 (en) 2008-01-31 2008-01-31 Image data quantization apparatus, image data quantization method, and image data quantization program

Publications (2)

Publication Number Publication Date
JP2009182809A JP2009182809A (en) 2009-08-13
JP4911053B2 true JP4911053B2 (en) 2012-04-04

Family

ID=41036401

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008020991A Active JP4911053B2 (en) 2008-01-31 2008-01-31 Image data quantization apparatus, image data quantization method, and image data quantization program

Country Status (1)

Country Link
JP (1) JP4911053B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012129949A (en) * 2010-12-17 2012-07-05 Toshiba Corp Image encoding method and device, and image decoding method and device
US10356405B2 (en) * 2013-11-04 2019-07-16 Integrated Device Technology, Inc. Methods and apparatuses for multi-pass adaptive quantization

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4273996B2 (en) * 2004-02-23 2009-06-03 ソニー株式会社 Image encoding apparatus and method, and image decoding apparatus and method

Also Published As

Publication number Publication date
JP2009182809A (en) 2009-08-13

Similar Documents

Publication Publication Date Title
Wu An algorithmic study on lossless image compression
JP2940304B2 (en) High efficiency coding apparatus, high efficiency coding method, and decoding apparatus for high efficiency coding apparatus
US9781449B2 (en) Rate distortion optimization in image and video encoding
EP2262266A2 (en) Apparatus and method for video encoding and decoding
US20140064612A1 (en) Apparatus and a method for coding an image
JP6681383B2 (en) Encoder, decoder and method
US20050243930A1 (en) Video encoding method and apparatus
JP2006222555A (en) Coding apparatus and coding method
CN101002477A (en) System and method for compression of mixed graphic and video sources
US20110052052A1 (en) Image compression apparatus and computer-readable recording medium recorded with image compression program
US8811735B2 (en) System and method for scalar quantization error reduction
JP4911053B2 (en) Image data quantization apparatus, image data quantization method, and image data quantization program
US8433151B2 (en) Image coding apparatus, image coding method and computer readable medium storing program
JPH10336654A (en) Image encoder
JP3161697B2 (en) Encoding device, decoding device, encoding / decoding device, and methods thereof
JP6431556B2 (en) Method and apparatus for compressing and decompressing binary data
JP4911052B2 (en) Image processing apparatus, image processing method, and image processing program
EP2273776A1 (en) Image data compression apparatus, decompression apparatus, compression method, decompression method, and program
US8422807B2 (en) Encoder and image conversion apparatus
JP5157490B2 (en) Target code amount calculation device, target code amount calculation method, and target code amount calculation program
JP2002368625A (en) Encoding quantity predicting device, encoding selection device, encoder, and encoding method
Bartrina-Rapesta et al. A novel rate-control for predictive image coding with constant quality
US9020289B2 (en) Image processing apparatus and image processing method for compressing image data by combining spatial frequency conversion, quantization, and entropy coding
KR101089725B1 (en) Method of designing threshold filter for lossless image compression, apparatus and method for lossless image compression using the filter
JP2005151312A (en) Image coding and decoding device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20101208

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20111215

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20111220

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120102

R150 Certificate of patent or registration of utility model

Ref document number: 4911053

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20150127

Year of fee payment: 3