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 PDFInfo
- 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
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に記載の画像処理装置は、量子化およびデータの符号化を行い、符号化処理を進行しながら符号化データの量をカウントする。そして、符号化処理の途中で符号化データのデータ量が設定された上限値をオーバーする場合、量子化ステップを変更して符号化処理を再開し、既に符号化されたデータについても、再符号化を行う。
画像データを符号化する画像処理では、符号データの符号量を目標符号量以下にする必要がある。特許文献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
また、符号化の際にハフマンテーブル等のような、符号化前のデータと符号とを対応付けた符号テーブルを生成する場合がある。符号テーブルを生成するには、符号化の対象となるデータの発生頻度を求めておく必要がある。再量子化を行うと、符号化の対象となるデータが変化するので、再量子化後のデータの発生頻度を求め直さなければならない。 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
ウェーブレット変換部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
中間符号生成部3は、ウェーブレット変換によって得られた係数に対して所定の量子化ステップで量子化を行った値であるかまたはウェーブレット変換によって得られた係数自体である中間データ(以下、中間符号と記す。)を生成する。ここでは、ウェーブレット変換よって得られた係数に対して量子化を行った結果を中間符号とする場合を例にして説明する。よって、本例では、中間符号生成部3は、ウェーブレット係数に含まれるY,U,Vの値をそれぞれ所定の量子化ステップで量子化し、その量子化の結果を中間符号とする。以下、量子化ステップをQステップと記す。
The intermediate
中間符号生成部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
また、中間符号生成部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
また、符号化データから得られる画像の最高画質を規定する分解レベル数(miとする。)が画像処理装置に設定されている。ここで、miは1以上N以下の整数である。中間符号生成部3は、分解レベル数mi〜NのLL成分、および分解レベル数1〜Nのxx成分を対象にして、中間符号を生成する。換言すれば、(mi)LL成分、(mi+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
第1の判定部4は、定められた範囲の分解レベル数の中間データのうちxx成分(すなわちLL成分以外の成分)を符号化するか否かを判定する処理を行う。
The
第1の判定部4は、この判定を行うために、中間符号の生成対象となる上記の各成分(分解レベル数mi〜NのLL成分、および分解レベル数1〜Nのxx成分)毎に、量子化に用いる個々の範囲における中間符号の発生頻度(発生数)をカウントする。具体的には、第1の判定部4は、絶対値が所定のデッドゾーン以下となる範囲で量子化されたデータの発生頻度をY,U,V毎にカウントする。また、絶対値がそのデッドゾーンを越える範囲を所定のQステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をY,U,V毎にカウントする。
The
図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
第2の判定部5は、上記の定められた範囲の分解レベル数よりも小さい各分解レベル数の中間符号のxx成分(LL成分以外の成分)に対して、再量子化を行うか否かを判断する。再量子化を行うか否かの判断対象となる分解レベル数の最大値をmqとする。この場合、上述の定められた範囲の分解レベル数は、mq+1〜Nの範囲の分解レベル数である。
The
再量子化部6は、第2の判定部5が再量子化を行うと判定した場合、定められた範囲の分解レベル数(すなわちmq+1〜N)よりも小さい各分解レベル数(1〜mq)の中間符号のうちxx成分を再量子化する。
When the
符号化部7は、中間符号および再量子化部6によって中間符号から再量子化された値をハフマン符号に符号化する。また、中間符号にlen(連長解析でカウントされた連続数)が含まれている場合、そのlenも符号化する。この場合、符号化部7は、例えば、lenをガンマ符号に符号化すればよい。lenを2進数で表したときのビット長をlとすると、符号化部7は、その2進数のビットの先頭に“l−1”個の0を付加することで、lenをガンマ符号に変換する。符号化部7が中間符号または再量子化の結果をハフマン符号に変換し、lenを例えばガンマ符号に変換することにより、入力された画像データが符号化されることになる。
The
図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
次に、動作について説明する。図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
そして、中間符号生成部3は、分解レベル数mi〜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
また、第1の判定部4は、中間符号を生成した分解レベル数mi〜NのLL成分、および分解レベル数1〜Nのxx成分の中間符号を対象として、Y,U,Vそれぞれの頻度表を生成し、画像処理装置が備える記憶装置(図示せず。)に記憶させる。第1の判定部4は、各成分に含まれるY,U,V毎に、デッドゾーンおよびQステップによって定まる各範囲での発生頻度をカウントすることによって頻度表を生成すればよい(以上、ステップS1)。
In addition, the
次に、第1の判定部4は、mi(符号化データから得られる画像の最高画質を規定する分解レベル数)を変数mに代入する(ステップS2)。ステップS2で設定されるmは、ステップS3〜S7の制御に用いられる。
Next, the
ステップ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
続いて、第1の判定部4は、その推定符号量が目標符号量より大きいか否かを判定する(ステップS5)。目標符号量は、画像データを符号化したときの符号量の最大許容値を表し、ステップS5,S13,S19において閾値として用いられる。なお、目標符号量は、画像処理装置自身が画像データの通信等の状況に応じて画像処理装置1が適宜設定してもよい。あるいは目標符号量が外部から入力されてもよい。
Subsequently, the
推定符号量が目標符号量以下である場合(ステップ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
推定符号量が目標符号量よりも大きい場合(ステップ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
また、ステップ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
次に、第1の判定部4は、Nを変数mに代入する(ステップS12)。ステップS12で設定されるmは、ステップS13〜S21の制御に用いられる。
Next, the
ステップS12の後、第1の判定部4は、m≦mqとなっているか否かを判定する(ステップS13)。m≦mqが成立していなければ(ステップS13のN)、変数mが示す分解レベル数のxx成分(すなわち、mxx成分)の符号量を推定する(ステップS14)。ステップS14では、mxx成分のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の総和を計算する。そして、各lenを符号化したときのビット長もその総和に加算すればよい。なお、ステップS4で、mxx成分の推定符号量を計算済であるならば、その推定符号量を参照してもよい。
After step S12, the
続いて、第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
続いて、第1の判定部4は、変数mの値を1減算し(ステップS17)、ステップS13以降の処理を繰り返す。ステップS13からステップS17のループ処理を繰り返すことで、第1の判定部4は、ステップS14に移行する毎に、定められた範囲の分解レベル数(すなわちmq+1〜N)を、大きい順に選択し、そのxx成分の符号量を推定することになる。
Subsequently, the
また、ステップS17で変数mの値を1減算した結果、ステップS13においてm≦mqであると判定したならば(ステップS13のY)、ステップS18に移行する。したがって、ステップS18以降では、mの値はmqとなっている。 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
各成分の中間符号の符号量を推定する場合には、各成分の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
その合計が目標符号量よりも大きいならば、第2の判定部8は再量子化を行うと判定し、ステップS20に移行する(ステップS19のY)。
If the sum is larger than the target code amount, the
また、その合計が目標符号量以下であるならば、第2の判定部8は再量子化を行わないと判定し、ステップS21に移行する(ステップS19のN)。
If the total is equal to or less than the target code amount, the
ステップS21では、符号化部7は、ステップS18での符号量推定に用いたハフマンテーブルを用いて、mxx成分から1xx成分のY,U,Vを、対応するハフマン符号に変換する。また、符号化部7は、各成分中のlenを例えばガンマ符号に符号化する。
In step S21, the
また、ステップS20では、再量子化部6は、1xx中間符号からmxx中間符号までのY,U,Vを再量子化する。ステップS18以降におけるmはmqであるので、1xx中間符号からmqxx中間符号までのY,U,Vを再量子化する。
In step S20, the
ステップS20において、再量子化部6は、1xxからmqxxまでの各成分毎に、新たなデッドゾーンを定める。このとき、再量子化部6は、hを0以上の整数とし、ステップS1で中間符号を生成したときに用いたデッドゾーンおよびQステップをそれぞれdz,qsとすると、dz+h・qsを新たなデッドゾーンに定める。そして、再量子化部6は、絶対値がその新たなデッドゾーン以下である中間符号(Y,U,V)の値を0に再量子化する。
In step S20, the
また、再量子化部6は、1xx〜mqxxまでの各成分毎に、新たなQステップを定める。このとき、再量子化部6は、nを0以上の整数とすると、上記のqsを用いて、qs・(2n+1)を新たなQステップに定めることが好ましい。そして、絶対値が上記の新たなデッドゾーンを越える範囲を新たなQステップ(qs・(2n+1))毎に区切り、範囲を定める。そして、各範囲に属する1xx〜mqxxまでの各成分の中間符号(Y,U,V)を、その範囲の中央値に量子化する。新たなQステップをqs・(2n+1)とすることが好ましい理由は、そのようにQステップを定めることで、新たに定める範囲の中央値が、ステップS1で量子化するときに用いた範囲の中央値と一致するので、符号化データの画質劣化を防止することができるためである。Qステップをqs・(2n+1)として定めた新たな範囲は、ステップS1量子化するときに用いた範囲を組み合わせた範囲となっている。
Further, the
ただし、ステップ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
図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
他の範囲におけるデータの発生頻度も同様である。なお、上記のように、新たなデッドゾーンを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
図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
再量子化処理を行うことにより、ハフマン符号のビット数を減少させることができる。よって、ステップ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
本発明によれば、定められた範囲の分解レベル数(mq+1〜N)について、第1の判定部4がxx成分の符号化を行うと判定したときに、そのxx成分を符号化しておく。そして、その分解レベル数よりも低い分解レベル数(1〜mq)を符号化したときの符号量に応じて、その分解レベル数(1〜mq)の中間符号を再量子化する。よって、ウェーブレット変換によって得た各分解レベル数の一部について再量子化をするので、処理負荷を抑制しながら、符号量が目標符号量以下になるように制御することができる。
According to the present invention, when the
また、再量子化処理では、中間符号を導出する際に用いるデッドゾーンおよび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とし、再量子化を行うか否かの判断対象となる分解レベル数の最大値をmqとして説明した。以下、N=3、mq=2である場合を例にして、本発明の動作を説明する。図11および図12は、N=3、mq=2である場合の処理経過の一例を示すフローチャートである。なお、以下に示す例は、mi=2である場合に相当するが、N=3、mq=2、mi=2の場合、ステップ3〜S7(図7参照)のループ処理に相当する処理は1回行えばよく、以下に示す例では、変数mにmiを代入する処理(ステップS2に相当する処理)等は行わなくよい。
In the above description, the number of decomposition levels at which the
まず、ウェーブレット変換部2が、入力された画像データに対して、分解レベル数3までウェーブレット変換を行う。
First, the
そして、中間符号生成部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
なお、量子化粒度が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
分解レベル数2と3では、分解レベル数2の方がブロック歪みが少なく、グラデーションの画質がやや良好となる。よって、分解レベル数2の符号量が目標符号量以下である場合には、分解レベル数2の中間符号だけで符号化を行えるように、ステップS31では、上記のように分解レベル数2,3それぞれのLL成分の中間符号および頻度表を生成しておく。なお、分解レベル数1では、分解レベル数2での符号化よりもさらに画質を向上させることができるが、圧縮効率が低く、頻度表および中間符号のためのメモリ容量も圧迫するので、1LL中間符号およびその頻度表は作成しない。
With the
ステップ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
続いて、第1の判定部4は、その推定符号量が目標符号量より大きいか否かを判定する(ステップS33)。目標符号量は、ステップS33,S43,S46で閾値として用いられる。
Subsequently, the
推定符号量が目標符号量以下である場合(ステップ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
推定符号量が目標符号量よりも大きい場合(ステップ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
次に、第1の判定部4は、3xx中間符号を符号化したときの符号量を推定する(ステップS42)。ステップS42では、3xx中間符号のY,U,Vそれぞれの頻度表からハフマンテーブルを生成し、各ハフマン符号毎に、ハフマン符号のビット長と、対応するY,UまたはVの発生頻度とを乗じ、その乗算結果の和を計算する。そして、各lenを符号化したときのビット長もその総和に加算し、その結果を推定符号量とすればよい。
Next, the
第1の判定部4は、ステップS42で求めた3xx中間符号を符号化したときの推定符号量と、ステップS41で既に符号化した符号データのデータ量との合計が、目標符号量よりも大きくなっているか否かを判定する(ステップS43)。その合計が目標符号量よりも大きければ(ステップS43のY)、処理を終了する。また、その合計が目標符号量以下であれば(ステップS43のN)、符号化部7に3xx成分を符号化させる(ステップS44)。符号化部7は、ステップS42で生成したハフマンテーブルを用いて、3xx成分のY,U,Vを対応するハフマン符号に変換する。また、3xx成分中のlenを例えばガンマ符号に変換する。
The
続いて、第2の判定部8は、分解レベル数1〜mq(本例では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
ステップ45の後、第2のは判定部8は、ステップS45で推定した符号量と、ステップS41,S44で既に符号化した符号データのデータ量との合計が目標符号量よりも大きくなっているか否かを判定する(ステップS46)。
After step 45, the second determining
その合計が目標符号量よりも大きければ、第2の判定部8は再量子化を行うと判定し、ステップS47に移行する(ステップS46のY)。
If the sum is larger than the target code amount, the
また、その合計が目標符号量以下であれば、第2の判定部8は、再量子化を行わないと判定し、ステップS48に移行する(ステップS46のN)。
If the total is equal to or less than the target code amount, the
ステップS48では、符号化部7は、ステップS45での符号量推定時に生成したハフマンテーブルを用いて、2xx成分から1xx成分のY,U,Vを、対応するハフマン符号に変換する。また、各成分中のlenを例えばガンマ符号に符号化する。
In step S48, the
また、ステップS47では、再量子化部6は、1xx中間符号から2xx中間符号までのY,U,Vを再量子化する。再量子化部6は、1xxから2xxまでの各成分毎に、新たなデッドゾーンおよびQステップを定める。このとき、再量子化部6は、図13に例示する量子化粒度のうち、量子化粒度1以上のデッドゾーンおよびQステップを選択すればよい。すなわち、ステップS31で用いた量子化粒度「0」よりも粒度の粗いデッドゾーンおよびQステップの組み合わせを選択すればよい。
In step S47, the
図13に例示する各デッドゾーン1および各デッドゾーン2は、dz+h・qsとなるという条件を満たすように定められている。例えば、2xx成分用のデッドゾーン1およびQステップ1に関しては、dz=0、qs=1であり(量子化粒度0参照)、各粒度のデッドゾーン1は、0+h・1となっている。
Each
また、図13に示すQステップ2は、qs・(2n+1)となるという条件を満たすように定められている。1xx成分用のQステップ2に関してはqs=2であり(量子化粒度0参照)、各粒度のQステップは、2(2n+1)となっている。このように、qs・(2n+1)となるようにQステップを定めれば、再量子化後の値は再量子化前の中間符号からずれないので、好ましい。
Further,
一方、図13に示すQステップ1に関しては、qs=1である(量子化粒度0参照)。よって、Qステップ1に関しては、qs・(2n+1)となっていなくてもよい。例えば、量子化粒度1,2のQステップ1の値は“2”であるが、この値はqsの奇数倍になっていない。
On the other hand, for
再量子化部6は、新たに選択したデッドゾーンを用いて、絶対値がそのデッドゾーン以下である中間符号(Y,U,V)の値を0に再量子化する。また、絶対値がその値を越える範囲を新たなQステップ毎に区切り、その範囲に属する中間符号(Y,U,V)をその範囲の中央値に量子化する。この処理を、2xx中間符号、1xx中間符号それぞれに対して行う。
The
また、ステップS47において、第2の判定部5は、中間符号を再量子化して得た新たなY,U,Vの頻度表をそれぞれ生成する。図9を参照して説明したように、第2の判定部5は、再量子化の際に新たに定めた範囲に対応する、中間符号生成時に用いた範囲を特定する。そして、その範囲における発生頻度の和を、新たな範囲における発生頻度とすればよい。発生頻度をカウントし直さずに、既に求めた値の加算だけで発生頻度を導出できるので、処理を高速化することができる。
In step S47, the
ステップ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
なお、ステップ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
また、量子化粒度を高くすると、全ての中間符号(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
例えば、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,
同様に、量子化粒度を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,
図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、mq=2である場合の他の動作例について説明する。図14は、N=3、mq=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
そして、中間符号生成部3は、1xx成分の中間符号を生成する。また、第1の判定部41は、1xx中間符号の頻度表を生成する(ステップS41)。
Then, the intermediate
次に、中間符号生成部3は、3LL成分の中間符号を生成する。また、第1の判定部41は、3LL中間符号の頻度表を生成する(ステップS42)。
Next, the intermediate
次に、符号化部7は、3LL中間符号を符号化する(ステップS43)。符号化部7は、3LL中間符号を符号化するためのハフマンテーブルを3LL中間符号の頻度表から導出し、符号化を行えばよい。あるいは、ステップS42で、第1の判定部41が頻度表から3LL中間符号用のハフマンテーブルを生成しておいてもよい。
Next, the
次に、中間符号生成部3は、3xx成分の中間符号を生成する。また、第1の判定部41は、3xx中間符号の頻度表を生成する(ステップS44)。さらに、第1の判定部41は、3xx中間符号を符号化したときの符号量を推定する(ステップS45)。
Next, the intermediate
続いて、第1の判定部41は、ステップS45で推定した符号量と、既にステップS43の符号化によって得た符号データのデータ量との合計が、目標符号量よりも大きいか否かを判定し(ステップS46)、目標符号量よりも大きければ処理を終了する。この場合、3LL成分の符号化のみを行って処理を終了することになる。
Subsequently, the
一方、推定符号量と、ステップ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
次に、中間符号生成部3は、2xx成分の中間符号を生成する。また、第2の判定部5は、2xx中間符号の頻度表を生成する(ステップS48)。
Next, the intermediate
その後、再量子化部6は、2xx中間符号を再量子化し、第2の判定部5は、再量子化後の2xx中間符号の頻度表を生成する(ステップS49)。この頻度表は、ステップS48で作成した頻度表を用いて作成すればよい。すなわち、ステップ49での量子化のために定めた個々の範囲に対応する、ステップS48で用いた各範囲を特定し、その各範囲における発生頻度の和を、新たな範囲における発生頻度とすればよい。
Then, the
また、再量子化部6は、1xx中間符号を再量子化し、第2の判定部5は、再量子化後の1xx中間符号の頻度表を生成する(ステップS50)。ステップS49の場合と同様に、既にステップS41で作成済みの頻度表を用いて、再量子化後の中間符号の頻度表を生成する。
The
次に、第2の判定部5は、再量子化後の2xx中間符号をハフマン符号に符号化したときの符号量を推定する(ステップS51)。また、同様に、再量子化後の1xx中間符号をハフマン符号に符号化したときの符号量を推定する(ステップS52)。そして、第2の判定部5は、既に符号化した3LL成分および3xx成分の符号データのデータ量と、ステップS51,S52で求めた推定符号量の合計が目標符号量よりも大きくなっているか否かを判定する(ステップS53)。
Next, the
その合計が目標符号量よりも大きくなっていれば(ステップ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
なお、ステップ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).
式(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とすると、そのデータを算術符号化したときの符号量を−Log2Pビットとして計算すればよい。このように、データを算術符号化する場合であっても、符号化後の符号量を推定可能であり、算術符号化を本発明に適用してもよい。 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
第1の量子化手段71(例えば、ステップS1やステップS31でデッドゾーンの範囲に関する量子化を行う中間符号生成部3)は、絶対値が所定のデッドゾーン以下である画像データの値を0に量子化する。
The first quantizing unit 71 (for example, the intermediate
また、第2の量子化手段72(例えば、ステップS1やステップS31でQステップ毎に区切った範囲に関する量子化を行う中間符号生成部3)は、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切り、区切られた範囲に属する画像データの値をその範囲の中央値に量子化する。
Also, the second quantization means 72 (for example, the intermediate
また、第1の再量子化手段73(例えば、ステップS20やステップS47でデッドゾーンの範囲に関する量子化を行う再量子化部6)は、hを0以上の整数とし、所定のデッドゾーンをdzとし、所定の量子化ステップをqsとすると、dz+h・qsを新たなデッドゾーンに定め、絶対値がその新たなデッドゾーン以下である画像データの値を0に量子化する。
The first requantization unit 73 (for example, the
また、第2の再量子化手段74(例えば、ステップS20やステップS47でQステップ毎に区切った範囲に関する量子化を行う再量子化部6)は、所定の量子化ステップによって定まる範囲を組み合わせた新たな範囲を定め、絶対値が新たなデッドゾーンを越える画像データの値がその新たな範囲に属する場合、画像データの値をその新たな範囲の中央値に量子化する。
In addition, the second requantization means 74 (for example, the
また、絶対値が所定のデッドゾーン以下の範囲で量子化されたデータの発生頻度をカウントするとともに、絶対値が所定のデッドゾーンを越える範囲を所定の量子化ステップ毎に区切った個々の範囲毎で量子化されたデータの発生頻度をカウントする頻度情報導出手段(例えば、ステップ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
第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.
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
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.
請求項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.
前記第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. .
請求項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.
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)
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)
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 |
-
2008
- 2008-01-31 JP JP2008020991A patent/JP4911053B2/en active Active
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 |