JP4978934B2 - Image compression apparatus and program - Google Patents
Image compression apparatus and program Download PDFInfo
- Publication number
- JP4978934B2 JP4978934B2 JP2008127894A JP2008127894A JP4978934B2 JP 4978934 B2 JP4978934 B2 JP 4978934B2 JP 2008127894 A JP2008127894 A JP 2008127894A JP 2008127894 A JP2008127894 A JP 2008127894A JP 4978934 B2 JP4978934 B2 JP 4978934B2
- Authority
- JP
- Japan
- Prior art keywords
- code amount
- compression rate
- compression
- compressed
- tile
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Description
画像データを圧縮するための画像圧縮装置及びプログラムに関するものである。 The present invention relates to an image compression apparatus and a program for compressing image data.
近年、デジタル機器の発展に伴って、画像データ等の様々な圧縮方式が提案されているが、圧縮方式の1つとしてJPEG(Joint Photographic Experts Group)2000が知られている。JPEG2000は画像の圧縮・展開の方法を規定したもので、JPEGを発展させたものである。JPEG2000は、特許文献1に記載されているように、画像データを複数のタイルに分割し、タイル毎にウェーブレット変換、量子化、エントロピー符号化等の処理を施して符号化データを生成する。
このようなJPEG2000の場合、任意の圧縮率を設定しても、実際にはその設定された圧縮率より高い圧縮率(少ない符号量)で圧縮が行われている場合があった。例えば20%の圧縮率を設定したとしても、あるタイルは18%で圧縮されていたり、別のタイルは17%で圧縮されていたりする場合があった。この場合、20%と18%の差である2%分の符号量は有効に使われなかった符号量であり、例えばこの2%分の符号量を他のタイルで使用すれば、画質が格段に向上する場合も考えられる。 In the case of such JPEG 2000, even if an arbitrary compression rate is set, there is a case where the compression is actually performed at a higher compression rate (small code amount) than the set compression rate. For example, even if a compression rate of 20% is set, a certain tile may be compressed by 18%, and another tile may be compressed by 17%. In this case, the code amount of 2%, which is the difference between 20% and 18%, is the code amount that was not used effectively. For example, if the code amount of 2% is used in other tiles, the image quality is remarkably high. In some cases, it may be improved.
本発明は、上記の問題を解決するためになされたもので、使われなかった符号量を有効利用することによって、設定された圧縮率で圧縮したときに得られる圧縮データの符号量を保ちつつ画質を向上させる画像圧縮装置及びプログラムを提供することを目的とするものである。 The present invention has been made in order to solve the above-described problem, and by effectively using a code amount that has not been used, while maintaining the code amount of compressed data obtained when compression is performed at a set compression rate. An object of the present invention is to provide an image compression apparatus and program for improving image quality.
本発明の請求項1に記載の発明の画像圧縮装置は、画像を複数のタイルに分割する分割手段と、設定された圧縮率を含む予め定められた範囲の複数の圧縮率で前記各タイルの圧縮を行う圧縮手段と、前記複数の圧縮率で圧縮された各タイルの符号量を算出する符号量算出手段と、前記複数の圧縮率で圧縮された各タイルの画質への影響度を算出する影響度算出手段と、前記設定された圧縮率で圧縮された各タイルの符号量の合計を算出する合計符号量算出手段と、前記設定された圧縮率で前記画像を圧縮したときに得られる圧縮データの符号量である目標符号量を算出する目標符号量算出手段と、前記目標符号量から前記合計符号量を引いた符号量差を算出する符号量差算出手段と、前記符号量差が予め定められた数より大きい場合、前記設定された圧縮率で圧縮されたタイルのうち前記影響度が最も高いタイルから前記設定された圧縮率より一段低い圧縮率を前記設定された圧縮率として更新する圧縮率調整手段と、を備えたことを特徴としている。 An image compression apparatus according to a first aspect of the present invention includes a dividing unit that divides an image into a plurality of tiles, and a plurality of compression rates within a predetermined range including a set compression rate. A compression unit that performs compression; a code amount calculation unit that calculates a code amount of each tile compressed at the plurality of compression rates; and an influence degree on an image quality of each tile compressed at the plurality of compression rates. Influence degree calculating means, total code amount calculating means for calculating the total code amount of each tile compressed at the set compression rate, and compression obtained when the image is compressed at the set compression rate A target code amount calculating unit that calculates a target code amount that is a code amount of data; a code amount difference calculating unit that calculates a code amount difference obtained by subtracting the total code amount from the target code amount; and If it is greater than the set number, Compression rate adjusting means for updating, as the set compression rate, a compression rate that is one step lower than the set compression rate from the tile having the highest influence degree among the tiles compressed at the set compression rate. It is characterized by.
また、本発明の請求項5に記載の発明のプログラムは、コンピュータを、画像を複数のタイルに分割する分割手段、設定された圧縮率を含む予め定められた範囲の複数の圧縮率で前記各タイルの圧縮を行う圧縮手段、前記複数の圧縮率で圧縮された各タイルの符号量を算出する符号量算出手段、前記複数の圧縮率で圧縮された各タイルの画質への影響度を算出する影響度算出手段、前記設定された圧縮率で圧縮された各タイルの符号量の合計を算出する合計符号量算出手段、前記設定された圧縮率で前記画像を圧縮したときに得られる圧縮データの符号量である目標符号量を算出する目標符号量算出手段、前記目標符号量から前記合計符号量を引いた符号量差を算出する符号量差算出手段、前記符号量差が予め定められた数より大きい場合、前記設定された圧縮率で圧縮されたタイルのうち前記影響度が最も高いタイルから前記設定された圧縮率より一段低い圧縮率を前記設定された圧縮率として更新する圧縮率調整手段、として機能させることを特徴としている。 According to a fifth aspect of the present invention, there is provided a program according to a fifth aspect of the present invention, wherein each of the computers is divided into a plurality of compression ratios in a predetermined range including a dividing unit that divides an image into a plurality of tiles and a set compression ratio. Compression means for compressing tiles, code amount calculation means for calculating the code amount of each tile compressed at the plurality of compression rates, and the degree of influence on image quality of each tile compressed at the plurality of compression rates Influence degree calculating means, total code amount calculating means for calculating the total code amount of each tile compressed at the set compression rate, compression data obtained when the image is compressed at the set compression rate Target code amount calculating means for calculating a target code amount that is a code amount; code amount difference calculating means for calculating a code amount difference obtained by subtracting the total code amount from the target code amount; and a predetermined number of the code amount difference If greater than It functions as a compression rate adjustment unit that updates a compression rate that is one step lower than the set compression rate as the set compression rate from the tile that has the highest degree of influence among the tiles compressed at the set compression rate. It is characterized by that.
これらの構成によれば、各タイルを設定された圧縮率を含む複数の圧縮率で圧縮し、設定された圧縮率で圧縮したタイルの符号量を積算した合計符号量から画像データを設定された圧縮率で圧縮したときに得られる圧縮データの理論上の符号量である目標符号量を引いた符号量差を、影響度の高いタイルの圧縮率を1つ低い圧縮率にするために使用することにより、合計符号量を目標符号量に抑えつつ、画質を向上させることができる。 According to these configurations, the image data is set from the total code amount obtained by compressing each tile with a plurality of compression rates including the set compression rate and integrating the code amounts of the tiles compressed at the set compression rate. The difference in code amount minus the target code amount, which is the theoretical code amount of the compressed data obtained when compression is performed at the compression rate, is used to reduce the compression rate of the high-impact tile to one lower compression rate. Thus, it is possible to improve the image quality while suppressing the total code amount to the target code amount.
また、請求項2に記載の発明は、請求項1に記載の画像圧縮装置であって、前記圧縮率調整手段は、前記設定された圧縮率で圧縮されたタイルから前記影響度が最も高いタイルを検出し、検出したタイルを前記設定された圧縮率で圧縮したときの符号量と前記設定された圧縮率より一段低い圧縮率で圧縮したときの符号量との差を求め、当該差が前記符号量差以下であるとき、前記設定された圧縮率より一段低い圧縮率を前記設定された圧縮率として更新して前記符号量差から当該差を差し引くものであり、前記圧縮率調整手段が前記設定された圧縮率を更新して前記符号量差から前記差を差し引く処理を、前記符号量差が前記予め定められた数以下になるまで、又は予め定められた回数繰り返し行わせる制御を行う繰り返し制御手段と、を備えたことを特徴としている。
The invention according to
この構成によれば、圧縮データの合計符号量を目標符号量に抑えつつ、画質を向上させることができる。 According to this configuration, it is possible to improve the image quality while suppressing the total code amount of the compressed data to the target code amount.
また、請求項3に記載の発明は、請求項1又は2に記載の画像圧縮装置であって、主走査方向に配列する前記タイルを一つのバンドとして区分する区分手段を更に備え、前記合計符号量算出手段、前記目標符号量算出手段、前記符号量差算出手段及び前記圧縮率調整手段は、バンド毎に各処理を行うことを特徴としている。
The invention according to
この構成によれば、符号量差の配分処理をバンド単位で行うことによって、処理作業に必要なメモリ容量の増加を抑えることができる。 According to this configuration, by performing the code amount difference distribution processing in units of bands, it is possible to suppress an increase in memory capacity necessary for processing work.
また、請求項4に記載の発明は、請求項3に記載の画像圧縮装置であって、前記繰り返し制御手段による制御によって前記圧縮率調整手段が前記処理を予め定められた回数まで繰り返し行った後の前記符号量差が前記予め定められた数より大きい場合、前記圧縮率調整手段は異なるバンドのタイルに対して圧縮率調整を行う際に前記符号量差を前記目標符号量に加算することを特徴としている。 According to a fourth aspect of the present invention, there is provided the image compression apparatus according to the third aspect, wherein the compression rate adjusting unit repeatedly performs the process up to a predetermined number of times under the control of the repetitive control unit. When the code amount difference is larger than the predetermined number, the compression rate adjusting means adds the code amount difference to the target code amount when adjusting the compression rate for tiles of different bands. It is a feature.
この構成によれば、あるバンドの符号量差の配分処理で余った符号量を他のバンドで使うことにより、余った符号量を有効に使って画質向上を図ることができる。 According to this configuration, it is possible to improve the image quality by effectively using the surplus code amount by using the surplus code amount in another band by using the code amount difference distribution process of a certain band.
この発明によれば、各タイルを設定された圧縮率を含む複数の圧縮率で圧縮し、設定された圧縮率で圧縮したタイルの符号量を積算した合計符号量から画像データを設定された圧縮率で圧縮したときに得られる圧縮データの理論上の符号量である目標符号量を引いた符号量差を、影響度の高いタイルの圧縮率を1つ低い圧縮率にするために使用することにより、合計符号量を目標符号量に抑えつつ、画質を向上させることができる。 According to this invention, each tile is compressed at a plurality of compression ratios including a set compression ratio, and image data is set from the total code amount obtained by integrating the code amounts of tiles compressed at the set compression rate. The difference in code amount minus the target code amount, which is the theoretical code amount of the compressed data obtained when compression is performed at a rate, is used to reduce the compression rate of tiles with high impact to one lower compression rate. Thus, it is possible to improve the image quality while suppressing the total code amount to the target code amount.
本発明における画像圧縮装置及びプログラムの実施の形態について図面を参照して説明する。図1は、本実施の形態における画像圧縮装置1の電気的構成を示すブロック図である。尚、画像圧縮装置1は、パーソナルコンピュータ(パソコン)やワークステーション、携帯情報端末等の情報処理装置で実現され、図1のブロック図は画像圧縮装置1がこれらの情報処理装置によって実現された場合を例に図示している。この他、コピー機やスキャナ等の画像読取装置や、デジタルカメラやデジタルビデオカメラ、デジタルカメラを搭載した携帯電話等の撮像装置に組み込まれて用いられてもよい。
Embodiments of an image compression apparatus and a program according to the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing an electrical configuration of an
図1に示すように、画像圧縮装置1は制御部11、記憶部12、入力操作部13、表示部14、I/F部15、ネットワークI/F部16、画像圧縮部17及びRAM18等を備えて構成される。制御部11は、CPU(Central Processing Unit:中央処理装置)等によって構成され、入力された指示信号等に応じて記憶部12に記憶されたプログラムを読み出して処理を実行し、各機能部への指示信号の出力、データ転送等を行って画像圧縮装置1を統括的に制御する。
As shown in FIG. 1, the
記憶部12は、画像圧縮装置1の備える種々の機能を実現するためのプログラムやデータ等を記憶する。本実施の形態では、記憶部12は画像圧縮プログラム121を記憶する。画像圧縮プログラム121は、I/F部15又はネットワークI/F部16が入力した画像データをJPEG2000方式で圧縮して符号化データを生成するためのプログラムである。
The
入力操作部13は、各種操作ボタンやマウス等のポインティングデバイスを備え、ユーザによって操作がなされると、操作信号を制御部11へ出力する。またユーザは入力操作部13を介して圧縮率の設定を行う。表示部14は、液晶ディスプレイ等の表示画面であり、入力操作部13から入力された内容に応じた表示を行ったり、制御部11による処理内容や処理結果を表示したりする。
The
I/F部15はIEEE1394やUSB等のインターフェイスであり、外部装置と直接データの送受信を行うことができる。ネットワークI/F部16は、LANボード等の通信モジュールから構成され、ネットワークI/F部16と接続されたネットワーク(不図示)を介して外部装置と種々のデータの送受信を行う。
The I /
画像圧縮部17は、記憶部12に記憶された画像圧縮プログラム121を実行することによって、I/F部15やネットワークI/F部16を介して入力された画像データをJPEG2000方式で圧縮して符号化データを生成する。RAM(Random Access Memory)18は、制御部11が実行するための制御プログラムや処理を実行する際のデータ等を一時的に保存する。また、画像圧縮部17が画像圧縮プログラム121に従って処理を実行する際に生成される符号化データや圧縮率調整データ等を一時的に保存する。
The
図2は、本実施の形態におけるJPEG2000方式による画像圧縮の流れを示す図である。まず画像圧縮部17は、入力された画像データの表色系を例えばRGB方式からYCbCr方式へコンポーネント変換して(色空間変換21)、表色系が変換された画像データを図3に示すように複数のタイルに分割する(タイル分割22)。ここで、画像圧縮部17は主走査方向に配列したタイルを1つのバンドとして区分し、離散ウェーブレット変換23から圧縮率調整26(又は符号ストリーム27)までの処理をバンド毎に行う。図3を用いて説明すると、タイルA〜E、タイルF〜K、タイルL〜Q、タイルR〜Vをそれぞれ1つのバンドとして区分し、バンド別に離散ウェーブレット変換23以下の処理を行う。従って、以下で説明する処理は全てバンド単位で行われるものとして説明する。
FIG. 2 is a diagram showing a flow of image compression according to the JPEG2000 system in the present embodiment. First, the
図2に戻り、画像圧縮部17は1つのバンドの各タイルに対して離散ウェーブレット変換を施して係数データを出力する(ウェーブレット変換23)。図4は、離散ウェーブレット変換について示した模式図である。図4(a)のタイル画像(0LL)に対して、離散ウェーブレット変換を施し、図4(b)に示すようにサブバンド1LL、1HL、1LH及び1HHに分解する。続いて、低周波成分1LLに対して離散ウェーブレット変換を施し、図4(c)に示すようにサブバンド2LL、2HL、2LH及び2HHに分解する。尚、図4では2レベル変換について図示しているが、離散ウェーブレット変換の回数は特に制限されるものではない。
Returning to FIG. 2, the
次に、画像圧縮部17は離散ウェーブレット変換された係数データに対して線形量子化を行う(量子化24)。ここで、画像圧縮部17は任意に設定された圧縮率(以下「設定圧縮率」という)を含む予め定められた範囲にある複数の圧縮率に従って量子化を行う。例えば、設定圧縮率が20%である場合は、18%、19%、20%、21%及び22%等の5つの圧縮率に従って量子化を行う。尚、圧縮率の数はこの限りではないが、画像圧縮処理の際に用いるメモリ(本実施の形態ではRAM18)の容量に応じて圧縮率の数を適宜調整することが望ましい。
Next, the
そして、画像圧縮部17は、各圧縮率で量子化された量子化データに対してエントロピー符号化を行う(エントロピー符号化25)。ここで、エントロピー符号化25の処理手順について説明する。図5は、エントロピー符号化の流れを示す図である。画像圧縮部17は、まず各サブバンドの係数をプレシンクトと呼ばれる領域に分割する(プレシンクト分割251)。図6はプレシンクト分割を模式的に示した図である。図6において、51の部分は元の画像において同領域の部分を周波数変換したものであり、これらの部分は同じプレシンクトに属しているという。
Then, the
次に、画像圧縮部17はプレシンクトをコードブロックという更に小さな領域に分割する(コードブロック分割252)。図7はコードブロック分割を模式的に示した図である。このコードブロック単位がエントロピー符号化を行う際の基本単位となる。
Next, the
そして、画像圧縮部17は各コードブロックについて線形量子化された離散ウェーブレット変換の変換係数をビット毎に展開する(ビットプレーン分割253)。図8はビットプレーン分割を模式的に示した図である。図8において、61はあるコードブロックにおける線形量子化された離散ウェーブレット変換の係数データを例示したものである。62は、係数データ61の符号を表すビット列であり、値0は正値、値1は負値を意味する。63は係数データ61の絶対値をMSB(Most Significant Bit)からLSB(Least Significant Bit)に2値展開したビットプレーンである。
Then, the
例えば、値が+12の係数データ64は正値であるため、対応する符号ビット65は‘0’である。また、+12の絶対値の2進数表現は(1100)であるため、ビットプレーンに対応する箇所66a、66b、66c及び66dの値はそれぞれ‘1’、‘1’、‘0’、‘0’となる。同様に、値が−6の係数データ67は負値であるため、対応する符号ビット68は‘1’である。また、−6の絶対値の2進数表現は(0110)であるため、ビットプレーンの対応する箇所69a、69b、69c及び69dの値はそれぞれ‘0’、‘1’、‘1’、‘0’となる。MSB側で全て0であるビットプレーンをゼロビットプレーンといい、データは保存されない一方、コードブロック毎に後述のゼロビットプレーン枚数がカウントされる。
For example, since the
続いて、画像圧縮部17は、ビットプレーンを更にsignificance propagationパスと、magnitude refinementパスと、cleanupパスに分割する(コーディングパスへの分割254)。図9はコーディングパスへの分割を模式的に示した図である。図9に示すように、各ビットプレーン71a〜71d(以下、これらをまとめて「ビットプレーン71」という)は、コーディングパスへの分割により次のように分割される。つまり、それぞれsignificance propagationパス72b〜72d(以下、これらをまとめて「significance propagationパス72」という)、magnitude refinementパス73b〜73d(以下、これらをまとめて「magnitude refinementパス73」という)、cleanupパス74b〜74dに分割される。ただし、最上位ビット(MSB側)のビットプレーン71aはcleanupパス74aにのみ対応させる。以下、cleanupパス74a〜74dをまとめて「cleanupパス74」という。
Subsequently, the
各ビットプレーン71及び各コーディングパス72〜74は、全て縦横方向の座標長によるサイズが等しい。また、各コーディングパス72〜74にはビット値が定義された位置と定義されていない位置とが存在する。図9において、例えば76や77のように、ビット値が定義された位置には網掛け(斜線)が施されている。そして、コーディングパス72〜74(例えば、コーディングパス72b〜74b)の網掛け部分に定義されたビット値は、分割前のビットプレーン71(例えば、ビットプレーン71b)上の対応する位置におけるビット値と等しい。ビットプレーンをコーディングパスに分割する処理については、各文献により周知のものであるため説明を省略する。
Each
最後に画像圧縮部17は、コーディングパス分割後のデータを算術符号化する(二値算術符号化255)。以上のようにしてエントロピー符号化25を行った後、画像圧縮部17は圧縮率の調整を行う(圧縮率調整26)。JPEG2000は圧縮率を任意に設定できるが、設定圧縮率で画像データの圧縮を行うと、従来は設定圧縮率より高い圧縮率で圧縮が行われていた。例えば設定圧縮率が20%であった場合、あるタイルは18%で圧縮されていたり、別のタイルは17%で圧縮されていたりする場合があった。この場合、20%と18%の差である2%分の符号量は有効に使われなかった符号量であり、例えばこの2%分の符号量を他のタイルで使用すれば、画質が格段に向上する場合も考えられる。そこで、この圧縮率調整26において、各タイルの圧縮率の調整を行って、使われなかった符号量を他のタイルに配分する処理を行う。圧縮率調整の処理手順の詳細は後述する。
Finally, the
圧縮率調整が終わった後、画像圧縮部17はファイルにデータを書き込むための符号ストリームの形成を行う(符号ストリーム27)。この符号ストリーム処理については、各文献により周知のものであるため説明を省略する。
After the compression rate adjustment is completed, the
図10及び11は、画像圧縮部17が画像圧縮プログラム121に従って実行される画像圧縮処理の流れを示したフローチャートである。まず画像圧縮部17は画像データの色空間変換、タイル分割を行い、分割されたタイルをバンド別に区分する(ステップS11)。そして、画像圧縮部17は変数n(nは1以上の整数)に1を代入し(ステップS12)、n番目のバンドに対して離散ウェーブレット変換、量子化、エントロピー符号化を行う(ステップS13)。ここで、画像圧縮部17は設定圧縮率を含んだ予め定められた範囲の複数の圧縮率で量子化を行い、複数の圧縮率で圧縮された各タイルの符号化データをRAM18に格納する。
10 and 11 are flowcharts showing the flow of the image compression processing executed by the
次に、画像圧縮部17は各タイルの符号量と画質への影響度(以下、単に「影響度」という)を算出して圧縮率調整用データを作成し、この圧縮率調整用データをRAM18に格納する(ステップS14、S15)。図12は圧縮率調整用データの一例を示した図である。図12に示すように、画像圧縮部17は各タイルの各圧縮率毎に符号量と影響度を算出する。
Next, the
影響度の算出方法の一例を説明する。例えば、図9に示すようにコーディングパスへの分割が行われたとする。画像処理部17はMSBからLSBのビットプレーンに対して上位ビットほど重み付け係数を高く設定する。例えばMSBからLSBのビットプレーンに8、4、2、1の重み付け係数を設定し、significance propagationパス、magnitude refinementパス、cleanupパスにもそれぞれ所定の重み付け係数を設定する。そして画像処理部17は、コーディングパスの‘1’の数とビットプレーンの重み付け係数とコーディングパスの重み付け係数を掛け合わせた数値をビット位置毎に算出して積算して1つのコードブロックにおける影響度を算出する。この影響度を全てのコードブロックに渡って算出し、算出された影響度を積算することによってタイルの影響度とする。
An example of how to calculate the influence level will be described. For example, assume that division into coding passes is performed as shown in FIG. The
つまり、図9を用いて説明すると、画像圧縮部17はコードブロック61の影響度を、
影響度=(cleanupパス74aの‘1’の数×重み付け係数(8)×cleanupパスの重み付け係数)
+{(significance propagationパス72bの‘1’の数×重み付け係数(4)×significance propagationパスの重み付け係数)+(magnitude refinementパス73bの‘1’の数×重み付け係数(4)×magnitude refinementパスの重み付け係数)+(cleanupパス74bの‘1’の数×重み付け係数(4)×cleanupパスの重み付け係数)}
+{(significance propagationパス72cの‘1’の数×重み付け係数(2)×significance propagationパスの重み付け係数)+(magnitude refinementパス73cの‘1’の数×重み付け係数(2)×magnitude refinementパスの重み付け係数)+(cleanupパス74cの‘1’の数×重み付け係数(2)×cleanupパスの重み付け係数)}
+{(significance propagationパス72dの‘1’の数×重み付け係数(1)×significance propagationパスの重み付け係数)+(magnitude refinementパス73dの‘1’の数×重み付け係数(1)×magnitude refinementパスの重み付け係数)+(cleanupパス74dの‘1’の数×重み付け係数(1)×cleanupパスの重み付け係数)}
の式を用いて算出する。この計算を全てのコードブロックに渡って行う。
That is, with reference to FIG. 9, the
Influence = (number of “1” s in
+ {(Number of '1's of the
+ {(Number of '1's of the
+ {(Number of '1's of the
This is calculated using the following formula. This calculation is performed over all code blocks.
図10に戻る。次に画像圧縮部17は、設定圧縮率で圧縮された各タイルの符号量を積算して合計符号量を算出する(ステップS16)。例えば設定圧縮率が20%である場合、図12に示すタイルA〜Eの圧縮率20%のときの符号量を積算した「12432」を合計符号量とする。続いて、画像圧縮部17は画像データを設定圧縮率で圧縮したときに得られる圧縮データの理論上の符号量を算出し、バンドの数で割った符号量を目標符号量として設定する(ステップS17)。
Returning to FIG. Next, the
更に画像圧縮部17は、目標符号量から合計符号量を引いた値である符号量差を算出する(ステップS18)。例えば、求められた合計符号量は「12432」であり、目標符号量が15000である場合、符号量差は「2568」となる。この「2568」は、圧縮データとして使用してもよい符号量であるにも関わらず、有効に使われなかった符号量である。従って、以下の処理において、有効に使われなかった符号量を影響度の高いタイルから順次配分する。
Further, the
まず、画像圧縮部17は設定圧縮率を仮の圧縮率に設定する。現段階では圧縮率20%を仮の圧縮率として設定する。そして変数mに1を代入する(ステップS19)。この変数mは符号量差の配分処理の繰り返し回数を示すものである。
First, the
符号量差が1以上である場合(ステップS20;NO)、画像圧縮部17はバンド内における仮の圧縮率で圧縮されたタイルの中から最も影響度の高いタイルを検出する。図12においては、仮の圧縮率(20%)で圧縮されたタイルの中で最も影響度の高いタイルはタイルDである。そして画像圧縮部17は検出されたタイル(例えばタイルD)のフラグを‘1’とする(ステップS21)。このフラグはタイル毎に設定されており、画像処理部17が有するワークメモリ(不図示)に記憶されている。
When the code amount difference is 1 or more (step S20; NO), the
そして、画像圧縮部17は検出されたタイルについて、
a=仮の圧縮率で圧縮されたときの符号量
b=仮の圧縮率より1つ低い圧縮率で圧縮されたとき符号量
とし、変数a、bに該当する符号量を代入する(ステップS22)。例えば、ステップ21でタイルDが検出された場合、a=1293、b=2723となる。
And the
a = code amount when compressed at a temporary compression rate b = code amount when compressed at a compression rate one lower than the temporary compression rate, and substituting the code amounts corresponding to the variables a and b (step S22) ). For example, when tile D is detected in
続いて、画像圧縮部17は、仮の圧縮率より1つ低い圧縮率で圧縮されたとき符号量から仮の圧縮率で圧縮されたときの符号量を差し引いたb−aの値が符号量差以下であるか否かを判別する(ステップS23)。つまり、a=1293、b=2723の場合、b−a=1430であり、この値はステップS18で求めた符号量差「2568」より小さい。従って、画像圧縮部17は、タイルDにおいて仮の圧縮率より1つ低い圧縮率を仮の圧縮率に設定する。つまり、圧縮率21%を仮の圧縮率として設定する。そして、符号量差からb−aの値を引いた値を符号量差として更新する(ステップS24)。従って、符号量差=2568−(2723−1293)=1138となる。
Subsequently, the
そして、画像圧縮部17はフラグをリセットし、変数mに1加算する(ステップS25)。変数mが64でない場合(ステップS28;NO)、画像圧縮部17はステップS20へ処理を移行する。以上説明したようにステップS20及びS21の処理を行うと、図12において仮の圧縮率で圧縮されたタイルの中で最も影響度の高いタイルとして検出されるタイルはタイルAとなる。そしてa=645、b=1024であり(ステップS22)、b−a=379となるため、符合量差=1138より小さい(ステップS23;YES)。従って、画像圧縮部17はタイルAの仮の圧縮率を21%とし、符号量差を1138−379=759に更新する(ステップS24)。
Then, the
そして、画像圧縮部17はフラグをリセットし、変数mに1加算する(ステップS25)。変数mは64でないため(ステップS28;NO)、画像処理部17は再びステップS20へ処理を移行する。ここでステップS21において仮の圧縮率で圧縮されたタイルの中で最も影響度の高いタイルとして検出されるタイルはタイルAとなる。そしてa=1024、b=2612であり(ステップS22)、b−a=1588である。このb−aの値は符号量差759より大きい(ステップS23;NO)。つまり、ここでタイルAの仮の圧縮率を1つ下げると、合計符号量が目標符号量を超えてしまうことになる。従って、タイルA以外のタイルの中から(つまり、フラグの立っていないタイルの中から)影響度の最も高いタイルを検出する。
Then, the
即ち、フラグの立っていないタイルがある場合(ステップS26;YES)、画像圧縮部17はフラグの立っていないタイルから影響度が最も高いタイルを検出し、そのタイルのフラグを立てる(ステップS27)。図12の場合、仮の圧縮率で圧縮されたタイルAを除くタイルの中で最も影響度の高いタイルはタイルEである。そして画像圧縮部17はステップS22へ処理を移行する。タイルEの場合、a=567、b=1045であり、b−a=478であるため、符号量差756より小さい(ステップS23;YES)。従って、画像圧縮部17はタイルEの仮の圧縮率を21%とし、符号量差を756−478=278に更新する。
That is, when there is a tile with no flag set (step S26; YES), the
ステップS26において、フラグの立っていないタイルがない場合は(ステップS26;NO)、仮の圧縮率で圧縮された全てのタイルにおいて圧縮率を1つ下げると目標符号量を超えてしまうことを意味する。従って、画像圧縮部17は各タイルへの符号量差の配分を終了し、ステップS29へ処理を移行する。
If there is no tile with no flag set in step S26 (step S26; NO), it means that the target code amount will be exceeded if the compression rate is lowered by 1 for all tiles compressed at the temporary compression rate. To do. Accordingly, the
以上の処理を、符号量が0以下になるまで、又は64回(変数mが64になるまで)繰り返し行う。尚、この繰り返し回数の条件は上記の限らず、適宜変更可能である。そして符号量が0以下となった(ステップS20;YES)、変数mが64となった場合(ステップS28;YES)、画像圧縮部17は各タイルの現段階における仮の圧縮率を正式な圧縮率として設定する(ステップS29)。
The above processing is repeated until the code amount becomes 0 or less or 64 times (until the variable m becomes 64). The condition for the number of repetitions is not limited to the above, and can be changed as appropriate. When the code amount becomes 0 or less (step S20; YES) and the variable m becomes 64 (step S28; YES), the
n番目のバンドが最後のバンドでない場合(ステップS30;NO)、画像圧縮部17は変数nに1を加算し(ステップS31)、ステップS13へ処理を移行する。ここで、既に符号量差の配分処理が終了したバンドについて、正式な圧縮率以外の圧縮率で圧縮された各タイルの符号化データや圧縮率調整データをRAM18から削除することによって、RAM18における作業領域を広げることができる。また、この段階において、符号量差が0(又は予め定められた数)より大きい場合、この符号量差をステップS17において次に算出される目標符号量に加算する。このように、あるバンドの配分処理で余った符号量を他のバンドで使うことにより、余った符号量を有効に使って画質向上を図ることができる。
If the nth band is not the last band (step S30; NO), the
n番目のバンドが最後のバンドである場合(ステップS30;YES)、画像圧縮部17は符号ストリームを形成して(ステップS32)処理を終了する。
If the n-th band is the last band (step S30; YES), the
以上、説明したように、各タイルを設定圧縮率を含む複数の圧縮率で圧縮し、設定圧縮率で圧縮したタイルの符号量を積算した合計符号量から画像データを設定圧縮率で圧縮したときに得られる圧縮データの理論上の符号量である目標符号量を引いた符号量差を、条件に合致した影響度の高いタイルに割り当てることにより、合計符号量を目標符号量に抑えつつ、画質を向上させることができる。更に、このような符号量差の配分処理をバンド単位で行うことによって、処理作業に必要なメモリ容量の増加を抑えることができる。 As described above, when each tile is compressed at a plurality of compression rates including the set compression rate, and the image data is compressed at the set compression rate from the total code amount obtained by integrating the code amounts of tiles compressed at the set compression rate By assigning the code amount difference obtained by subtracting the target code amount, which is the theoretical code amount of the compressed data obtained to the above, to tiles with high impact that meet the conditions, the total code amount is suppressed to the target code amount and the image quality is reduced. Can be improved. Furthermore, by performing such code amount difference distribution processing in units of bands, it is possible to suppress an increase in memory capacity required for processing operations.
尚、本発明は上記実施の形態の構成に限られず種々の変形が可能である。例えば、上記実施の形態では、分割されたタイルをバンドに区分し、バンド毎に符号量差の配分処理を行った。これは各タイルにおいて複数の圧縮率で圧縮された符号化データを生成する必要があり、これらの符号化データを格納するRAM18の使用領域を最小限に抑えるためである。しかし、RAM18に十分なメモリ容量がある場合には、バンド毎に符号量差の配分処理を行う必要はない。つまり、画像圧縮部17は設定圧縮率で圧縮された全てのタイルから影響度の最も高いタイルを検出し、条件に合致したら1つ低い圧縮率に仮の圧縮率を更新する。この処理を符号量差が予め定められた数以下になるまで、又は予め定められた回数だけタイル全体に渡って行う。
The present invention is not limited to the configuration of the above embodiment, and various modifications can be made. For example, in the above embodiment, the divided tiles are divided into bands, and the code amount difference distribution process is performed for each band. This is because it is necessary to generate encoded data compressed at a plurality of compression rates in each tile, and to minimize the use area of the
1 画像圧縮装置
11 制御部
12 記憶部
121 画像圧縮プログラム
13 入力操作部
14 表示部
15 I/F部
16 ネットワークI/F部
17 画像圧縮部
18 RAM
DESCRIPTION OF
Claims (5)
ユーザによって設定された圧縮率を含む予め定められた範囲の複数の圧縮率で前記各タイルの圧縮を行う圧縮手段と、
前記複数の圧縮率で圧縮された各タイルの符号量を算出する符号量算出手段と、
前記複数の圧縮率で圧縮された各タイルの画質への影響度を算出する影響度算出手段と、
前記設定された圧縮率で圧縮された各タイルの符号量の合計を算出する合計符号量算出手段と、
前記設定された圧縮率で前記画像を圧縮したときに得られる圧縮データの符号量である目標符号量を算出する目標符号量算出手段と、
前記目標符号量から前記合計符号量を引いた符号量差を算出する符号量差算出手段と、
前記符号量差が予め定められた数より大きい場合、前記設定された圧縮率で圧縮されたタイルのうち前記影響度が最も高いタイルから前記設定された圧縮率より一段低い圧縮率を前記設定された圧縮率として更新する圧縮率調整手段と、
を備えた画像圧縮装置。 A dividing means for dividing the image into a plurality of tiles;
Compression means for compressing each tile at a plurality of compression ratios in a predetermined range including a compression ratio set by a user;
Code amount calculation means for calculating the code amount of each tile compressed at the plurality of compression rates;
An influence degree calculating means for calculating an influence degree on the image quality of each tile compressed at the plurality of compression ratios;
A total code amount calculating means for calculating a total code amount of each tile compressed at the set compression rate;
Target code amount calculating means for calculating a target code amount that is a code amount of compressed data obtained when the image is compressed at the set compression rate;
Code amount difference calculating means for calculating a code amount difference obtained by subtracting the total code amount from the target code amount;
If the code amount difference is larger than a predetermined number, the compression rate that is one step lower than the set compression rate is set from the tile having the highest influence level among the tiles compressed at the set compression rate. A compression rate adjusting means for updating the compressed compression rate;
An image compression apparatus comprising:
前記圧縮率調整手段が前記設定された圧縮率を更新して前記符号量差から前記差を差し引く処理を、前記符号量差が前記予め定められた数以下になるまで、又は予め定められた回数繰り返し行わせる制御を行う繰り返し制御手段と、
を備えた請求項1に記載の画像圧縮装置。 The compression rate adjusting means detects a tile having the highest influence level from tiles compressed at the set compression rate, and the code amount when the detected tile is compressed at the set compression rate and the setting A difference from the code amount when compressed at a compression rate that is one step lower than the set compression rate is obtained, and when the difference is equal to or less than the code amount difference, a compression rate that is one step lower than the set compression rate is set. Update the compression rate and subtract the difference from the code amount difference.
The compression rate adjustment means updates the set compression rate and subtracts the difference from the code amount difference until the code amount difference is equal to or less than the predetermined number, or a predetermined number of times. Repetitive control means for performing repetitive control;
The image compression apparatus according to claim 1, further comprising:
前記合計符号量算出手段、前記目標符号量算出手段、前記符号量差算出手段及び前記圧縮率調整手段は、バンド毎に各処理を行うことを特徴とする請求項1又は2に記載の画像圧縮装置。 Further comprising sorting means for sorting the tiles arranged in the main scanning direction as one band;
3. The image compression according to claim 1, wherein the total code amount calculating unit, the target code amount calculating unit, the code amount difference calculating unit, and the compression rate adjusting unit perform each process for each band. apparatus.
画像を複数のタイルに分割する分割手段、
設定された圧縮率を含む予め定められた範囲の複数の圧縮率で前記各タイルの圧縮を行う圧縮手段、
前記複数の圧縮率で圧縮された各タイルの符号量を算出する符号量算出手段、
前記複数の圧縮率で圧縮された各タイルの画質への影響度を算出する影響度算出手段、
前記設定された圧縮率で圧縮された各タイルの符号量の合計を算出する合計符号量算出手段、
前記設定された圧縮率で前記画像を圧縮したときに得られる圧縮データの符号量である目標符号量を算出する目標符号量算出手段、
前記目標符号量から前記合計符号量を引いた符号量差を算出する符号量差算出手段、
前記符号量差が予め定められた数より大きい場合、前記設定された圧縮率で圧縮されたタイルのうち前記影響度が最も高いタイルから前記設定された圧縮率より一段低い圧縮率を前記設定された圧縮率として更新する圧縮率調整手段、
として機能させるためのプログラム。 Computer
A dividing means for dividing an image into a plurality of tiles;
Compression means for compressing each tile at a plurality of compression rates within a predetermined range including a set compression rate;
Code amount calculation means for calculating the code amount of each tile compressed at the plurality of compression rates;
An influence degree calculating means for calculating an influence degree on the image quality of each tile compressed at the plurality of compression ratios;
A total code amount calculating means for calculating the total code amount of each tile compressed at the set compression rate;
Target code amount calculating means for calculating a target code amount that is a code amount of compressed data obtained when the image is compressed at the set compression rate;
Code amount difference calculating means for calculating a code amount difference obtained by subtracting the total code amount from the target code amount;
If the code amount difference is larger than a predetermined number, the compression rate that is one step lower than the set compression rate is set from the tile having the highest influence level among the tiles compressed at the set compression rate. Compression rate adjusting means for updating as a compressed compression rate,
Program to function as.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008127894A JP4978934B2 (en) | 2008-05-15 | 2008-05-15 | Image compression apparatus and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008127894A JP4978934B2 (en) | 2008-05-15 | 2008-05-15 | Image compression apparatus and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009278390A JP2009278390A (en) | 2009-11-26 |
JP4978934B2 true JP4978934B2 (en) | 2012-07-18 |
Family
ID=41443397
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008127894A Expired - Fee Related JP4978934B2 (en) | 2008-05-15 | 2008-05-15 | Image compression apparatus and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4978934B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112565834B (en) * | 2021-02-24 | 2021-05-11 | 北京创世云科技股份有限公司 | Method and device for controlling output data and electronic equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10136365A (en) * | 1996-10-31 | 1998-05-22 | Sanyo Electric Co Ltd | Image data coder |
JP2002185966A (en) * | 2000-12-15 | 2002-06-28 | Matsushita Electric Ind Co Ltd | Video encoder |
JP2003032680A (en) * | 2001-07-18 | 2003-01-31 | Canon Inc | Image coded, image coding method, program code of the same image coder, and memory medium of the same image coder |
JP2004297696A (en) * | 2003-03-28 | 2004-10-21 | Matsushita Electric Ind Co Ltd | Video signal encoder |
JP2004328406A (en) * | 2003-04-24 | 2004-11-18 | Matsushita Electric Ind Co Ltd | Code amount controlling method and coder |
-
2008
- 2008-05-15 JP JP2008127894A patent/JP4978934B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2009278390A (en) | 2009-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5114462B2 (en) | Image compression apparatus and image compression program | |
KR101320534B1 (en) | Encoding device and method, composite device and method, and transmission system | |
US9414068B2 (en) | Image processing apparatus and method | |
JP2006229538A (en) | Image processing system, image processing method, and program therefor | |
CN113068037B (en) | Method, apparatus, device, and medium for sample adaptive compensation | |
JP2002176650A (en) | Image encoder, electronic camera, and recording medium for image encoding program | |
CN102271251B (en) | Lossless image compression method | |
JP4978934B2 (en) | Image compression apparatus and program | |
JP2020102704A (en) | Image encoding device, control method of the same, and program | |
CN111654696B (en) | Intra-frame multi-reference-line prediction method and device, storage medium and terminal | |
WO2012160626A1 (en) | Image compression device, image restoration device, and program | |
JP2005039793A (en) | Image encoding device, program, and storage medium | |
JP4966263B2 (en) | Image processing apparatus and image processing program | |
JP6611562B2 (en) | Image processing apparatus, image processing method, and program | |
JP5560172B2 (en) | Image processing apparatus, image processing method, and image processing program | |
JP2001231009A (en) | Image data storage device ad method | |
JP6564314B2 (en) | Image encoding apparatus, control method thereof, program, and storage medium | |
JP5157490B2 (en) | Target code amount calculation device, target code amount calculation method, and target code amount calculation program | |
US10284879B2 (en) | Image processing apparatus and method based on integerprecision image data | |
JP2011077760A (en) | Image compression device and image compression program | |
JP5017198B2 (en) | Image processing apparatus and image processing program | |
JP2018033044A (en) | Image encoder and control method and program thereof | |
JP2008124969A (en) | Lossless image coding method and lossless image coding apparatus | |
KR20110099238A (en) | Moving image data compressing method | |
JP4309220B2 (en) | Image coding apparatus and image coding method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20101221 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20120228 |
|
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: 20120313 |
|
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: 20120410 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150427 Year of fee payment: 3 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4978934 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |