JP2009076992A - Image coding device and its control method - Google Patents

Image coding device and its control method Download PDF

Info

Publication number
JP2009076992A
JP2009076992A JP2007241621A JP2007241621A JP2009076992A JP 2009076992 A JP2009076992 A JP 2009076992A JP 2007241621 A JP2007241621 A JP 2007241621A JP 2007241621 A JP2007241621 A JP 2007241621A JP 2009076992 A JP2009076992 A JP 2009076992A
Authority
JP
Japan
Prior art keywords
encoding
run
pixel
parameter
length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2007241621A
Other languages
Japanese (ja)
Inventor
Yuuki Matsumoto
友希 松本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2007241621A priority Critical patent/JP2009076992A/en
Publication of JP2009076992A publication Critical patent/JP2009076992A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To obtain coded data of high compression efficiency by not only suppressing the variation of a coding parameter but also increasing a probability that the coding parameter becomes a value suitable for run. <P>SOLUTION: When run-length coding an elementary pixel Xi, the run of a pixel one line preceding the elementary pixel Xi is acquired from an array variable, and the coding parameters J, K of the run including the elementary pixel is determined (step S903). Then, the run RL from the elementary pixel is counted (S905-S908). Then, the acquired coding parameter is defined as an initial parameter when coding the run RL including the elementary pixel, and the run including the elementary pixel is run-length coded while updating the coding parameter (step S911). Then, the array variable is updated by the run including the elementary pixel (step S912). <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、画像データの符号化技術に関するものである。   The present invention relates to an image data encoding technique.

従来、同じ値が連続している画素について、その連続数を符号化するランレングス符号化方式が広く一般的に知られている。   Conventionally, a run-length encoding method that encodes the number of consecutive pixels having the same value is widely known.

例えば、上記ランレングス符号化を用いる方式としては、国際標準方式であるJPEG−LS(非特許文献1)が知られている。   For example, as a method using the run-length encoding, JPEG-LS (Non-patent Document 1), which is an international standard method, is known.

図1はJPEG−LSにおけるランレングス符号化モードでの処理の流れを示すフローチャートである。   FIG. 1 is a flowchart showing the flow of processing in the run-length encoding mode in JPEG-LS.

以下、同図に従ってJPEG−LSにおけるランレングス符号化の処理の流れについて説明をする。符号化時の画素のスキャン順はラスタースキャン順である。   The flow of run length encoding processing in JPEG-LS will be described below with reference to FIG. The scan order of pixels at the time of encoding is the raster scan order.

ランレングス符号化モードに入る前に、ランの長さnと、符号化対象であるランが画像端にかかっているかどうかを表すフラグfは決まっているものとする。そして、ランインデックスの値Jとランインデックスによって変更する値Kとの関係を図2に示す。ランインデックスJの初期値を“0”とするとKの値は“0”となる。なお、フラグfが“1”は、着目ランが画像の右端まで到達していることを示し、フラグfが“0”の場合には、着目ランの終端位置が画像の右端に至っていないことを示す。   Before entering the run-length encoding mode, it is assumed that the run length n and the flag f indicating whether or not the run to be encoded is on the end of the image are determined. FIG. 2 shows the relationship between the run index value J and the value K changed by the run index. If the initial value of the run index J is “0”, the value of K is “0”. When the flag f is “1”, it indicates that the target run has reached the right end of the image. When the flag f is “0”, it indicates that the end position of the target run has not reached the right end of the image. Show.

長さnのランを符号化するとき、まずステップ101にて、nと2kを比較する(ステップS101)。ここで、n>2k(YES)ならば、ステップ102に進んで“1”(1ビット)を出力する。そして、ステップSにて、nから2Kを減じた結果を新たなnとする。つまり、nを更新する。この後、ステップS104にて、ランインデックスJに1を足して、ランインデックスJを更新し、ステップS101へと処理を戻す。 When encoding a run of length n, first, in step 101, n is compared with 2 k (step S101). If n> 2 k (YES), the routine proceeds to step 102 where “1” (1 bit) is output. In step S, the result obtained by subtracting 2K from n is set as a new n. That is, n is updated. Thereafter, in step S104, 1 is added to the run index J to update the run index J, and the process returns to step S101.

一方、ステップS101にて、n≦2kであると判定した場合、処理はステップS105に進む。ステップS105では、着目しているランが画像端に掛かっているかどうかを示すフラグfをチェックする。フラグfが“0”であると判定した場合には、ステップS106にて、“0”(1ビット)を出力する。そして、ステップS107にて、ランの残りの長さをKビットを使って符号化し出力する。そして、ステップS108にて、ランインデックスJから1を引き更新する。 On the other hand, if it is determined in step S101 that n ≦ 2 k , the process proceeds to step S105. In step S105, a flag f indicating whether or not the run of interest is on the edge of the image is checked. If it is determined that the flag f is “0”, “0” (1 bit) is output in step S106. In step S107, the remaining length of the run is encoded using K bits and output. In step S108, 1 is updated from the run index J.

また、ステップS105にて、フラグfが“0”以外(フラグfが“1”)であると判定した場合、ステップS109に進み、nと“0”とを比較する。n>0であると判定した場合には、“1”を出力し、n=0であれば何もしないで処理を終了する。   If it is determined in step S105 that the flag f is other than “0” (flag f is “1”), the process proceeds to step S109, where n is compared with “0”. If it is determined that n> 0, “1” is output, and if n = 0, the process ends without doing anything.

次のランを符号化する際には、更新されているランインデックスの値を初期値として符号化を行うことで、動的にランインデックスが変化し、徐々にランの長さに適した値が割り当てられるようになる。
ITU−T T.87 | ISO/IEC14495−1
When the next run is encoded, the run index is dynamically changed by using the updated run index value as the initial value, and a value suitable for the run length is gradually obtained. Will be assigned.
ITU-T TT. 87 | ISO / IEC14495-1

上記の如く、JPEG−LSの符号化モードの一つにランレングス符号化モードがある。このランレングス符号化では、ランの長さに対して最適な符号が割り当てられるように、ランインデックス等の符号化パラメータを動的に変化させる方式を取っている。この方式の場合、同じような長さのランが連続していれば、次第に最適な符号が割り当てられ、符号量を最小限に抑えることができる。しかしながら、短いランと長いランが交互に発生するような画像の場合、ランインデックスが適当な値に収束せず、多くの符号を発生させてしまう場合がある。   As described above, there is a run-length encoding mode as one of JPEG-LS encoding modes. In this run-length coding, a coding parameter such as a run index is dynamically changed so that an optimum code is assigned to the run length. In the case of this method, if runs of the same length are continuous, an optimum code is gradually assigned, and the amount of codes can be minimized. However, in the case of an image in which short runs and long runs are generated alternately, the run index may not converge to an appropriate value, and many codes may be generated.

本発明は係る課題に鑑みなされたものであり、符号化パラメータの変動を抑制するだけでなく、その符号化パラメータがランに適した値になる確率を高くすることで、高い圧縮率の符号化データを生成する符号化技術を提供しようとするものである。   The present invention has been made in view of the above problems, and not only suppresses fluctuations in coding parameters, but also increases the probability that the coding parameters become values suitable for a run, thereby encoding at a high compression rate. The present invention intends to provide an encoding technique for generating data.

かかる課題を解決するため、例えば本発明の画像符号化装置は以下の構成を備える。すなわち、
ラスタースキャン順に画素データを入力し、動的に更新される符号化パラメータに従ってランレングス符号化する画像符号化装置であって、
ランレングス符号化を行なうことで更新された前記符号化パラメータを特定する符号化履歴情報を、画素位置毎に記憶するための記憶手段と、
着目画素の位置からのランをランレングス符号化する際、前記着目画素の水平方向の位置と同じであって、1ライン前の画素位置の符号化履歴情報を前記記憶手段から取得する取得手段と、
前記取得手段で取得した符号化履歴情報で特定される前記符号化パラメータを前記ランの符号化の初期の符号化パラメータとし、当該初期の符号化パラメータを前記ランに応じて更新しながら、前記ランをランレングス符号化する符号化手段と、
前記符号化手段による前記ランの符号化を行なった後の前記符号化パラメータを特定する情報を、前記ランを構成する各画素の符号化履歴情報として前記記憶手段に格納する格納手段とを備える。
In order to solve this problem, for example, an image encoding device of the present invention has the following configuration. That is,
An image encoding device that inputs pixel data in raster scan order and performs run-length encoding according to dynamically updated encoding parameters,
Storage means for storing, for each pixel position, encoding history information for specifying the encoding parameter updated by performing run-length encoding;
An acquisition unit that acquires, from the storage unit, encoding history information of a pixel position of the previous line that is the same as the horizontal position of the target pixel when run-length encoding a run from the position of the target pixel; ,
The encoding parameter specified by the encoding history information acquired by the acquisition unit is set as an initial encoding parameter of the encoding of the run, and the initial encoding parameter is updated according to the run, and the run Encoding means for run-length encoding
Storage means for storing, in the storage means, information for specifying the encoding parameter after encoding the run by the encoding means as encoding history information of each pixel constituting the run.

本発明によれば、符号化パラメータの変動を抑制するだけでなく、その符号化パラメータがランに適した値になる確率を高くし、高い圧縮率の符号化データを得ることが可能となる。   According to the present invention, it is possible not only to suppress fluctuations in coding parameters, but also to increase the probability that the coding parameters will be a value suitable for a run, and to obtain coded data with a high compression rate.

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

[第1の実施形態]
図8は本実施形態に係る画像符号化装置の基本構成を示す図である。
[First Embodiment]
FIG. 8 is a diagram showing a basic configuration of an image encoding device according to this embodiment.

1401は装置全体の制御を司る制御部として機能するCPUである。1402はCPU1401が実行するプログラムを格納したり、ワークエリアとして使用するRAMである。1403は、BIOSやブートプログラムを格納しているROMである。1404はキーボード、1405はポインティングデバイスであるマウスである。1406は表示装置であり、CRTやLCD等の表示デバイスで構成される。1407はハードディスク装置等に代表される大容量の外部記憶装置であり、ここにOSや実施形態に係る符号化/復号処理のプログラムが格納されている。また、この外部記憶装置1407は、各種データファイルを格納するためにも利用される。1408は記憶媒体ドライブで、CD−ROMやDVD−ROMなどの記憶媒体に記録されたプログラムやデータを読み出してRAM1402や外部記憶装置1407に出力するものである。なお、この記憶媒体に後述する画像符号化処理の為のプログラム、符号化対象画像データをファイルとして記録しても良い。この場合、記憶媒体ドライブ1408は、CPU1401による制御によって、そのプログラムやデータをRAM1402上の所定のエリアにロードする。   A CPU 1401 functions as a control unit that controls the entire apparatus. A RAM 1402 stores a program executed by the CPU 1401 and is used as a work area. A ROM 1403 stores a BIOS and a boot program. Reference numeral 1404 denotes a keyboard, and 1405 denotes a mouse which is a pointing device. Reference numeral 1406 denotes a display device, which includes a display device such as a CRT or LCD. Reference numeral 1407 denotes a large-capacity external storage device typified by a hard disk device or the like, in which an OS and a program for encoding / decoding processing according to the embodiment are stored. The external storage device 1407 is also used for storing various data files. A storage medium drive 1408 reads programs and data recorded on a storage medium such as a CD-ROM or DVD-ROM and outputs them to the RAM 1402 or the external storage device 1407. Note that a program for image encoding processing (to be described later) and encoding target image data may be recorded as files on this storage medium. In this case, the storage medium drive 1408 loads the program and data into a predetermined area on the RAM 1402 under the control of the CPU 1401.

1409はI/Fで、このI/F1409によって外部装置を本装置に接続し、本装置と外部装置との間でデータ通信を可能にするものである。例えはI/F1409を介して符号化対象となる画像データを本装置の本装置のRAM1402や外部記憶装置1407に入力することや、逆に、本装置のRAM1402や外部記憶装置1407から生成した画像符号化データを装置外部に出力することができる。1410は上述の各部を繋ぐバスである。   Reference numeral 1409 denotes an I / F, which connects an external device to the present apparatus through the I / F 1409 and enables data communication between the present apparatus and the external apparatus. For example, image data to be encoded is input to the RAM 1402 or the external storage device 1407 of the apparatus via the I / F 1409, or conversely, an image generated from the RAM 1402 or the external storage apparatus 1407 of the apparatus. The encoded data can be output outside the apparatus. A bus 1410 connects the above-described units.

上記構成において、本装置の電源がONになると、CPU1401はROM1403のブートプログラムに従って、外部記憶装置1407からOSをRAM1402にロードし、実行する。この結果、本装置は情報処理装置として機能する。更に、ユーザがマウス1405を操作して、画像符号化/復号の開始指示を行なうと、CPU1401は該当するアプリケーションプログラムを外部記憶装置1407からRAM1402にロードし、実行する。この結果、本装置が画像符号化装置、或いは、画像復号装置として機能することになる。   In the above configuration, when the power of this apparatus is turned on, the CPU 1401 loads the OS from the external storage device 1407 to the RAM 1402 and executes it in accordance with the boot program stored in the ROM 1403. As a result, this apparatus functions as an information processing apparatus. Further, when the user operates the mouse 1405 to give an instruction to start image encoding / decoding, the CPU 1401 loads the corresponding application program from the external storage device 1407 to the RAM 1402 and executes it. As a result, this apparatus functions as an image encoding apparatus or an image decoding apparatus.

以下は、画像符号化アプリケーションを実行し、本装置が画像データを可逆符号化する画像符号化装置として機能する場合の説明である。   The following is a description of a case where an image encoding application is executed and this apparatus functions as an image encoding apparatus that performs lossless encoding of image data.

説明を簡単なものとするため、符号化対象の画像データのサイズは水平方向W画素、垂直方向H画素であるものとする。また画素は、R、G、Bの3つの輝度成分で表わされ、それぞれは8ビット(256階調)であるのとする。また、符号化対象の画像データを入力する順序は点順次、即ち、ラスタースキャン順であって、その各画素を構成するデータがR,G,Bの順番に並べられているものとする。なお、色空間の種類はRGBに限らず、YMCKでも構わないし、その色空間の種類でも良いし、成分の数は問わない。モノクロ画像であれば1成分(濃度、又は輝度)となる。   In order to simplify the description, it is assumed that the size of the image data to be encoded is W pixels in the horizontal direction and H pixels in the vertical direction. A pixel is represented by three luminance components of R, G, and B, each of which has 8 bits (256 gradations). Further, it is assumed that the order of inputting the image data to be encoded is dot-sequential, that is, raster scan order, and the data constituting each pixel is arranged in the order of R, G, and B. The type of color space is not limited to RGB, and may be YMCK, or may be the type of color space, and the number of components is not limited. If it is a monochrome image, it becomes one component (density or luminance).

また、符号化対象の画像データの発生源は、外部記憶装置1407(画像データファイル)、インタフェース1409に接続されたイメージスキャナ、或いは、印刷データ等のデータをレンダリング処理した結果でも構わず、その種類も問わない。また、符号化されたデータは、外部記憶装置1407に圧縮ファイルとして格納(出力)するものとするが、その出力対象の種類も問わない。   The generation source of image data to be encoded may be the result of rendering processing of data such as an external storage device 1407 (image data file), an image scanner connected to the interface 1409, or print data. It doesn't matter. The encoded data is stored (output) as a compressed file in the external storage device 1407, but the type of output target is not limited.

さて、本実施形態では、符号化処理を開始にするに先立ち、画像の1ライン分、すなわち、水平方向の画素の数Wに相当する配列変数D(x,C)をRAM1402の予め設定された記憶領域に確保する。なお、ここでは配列変数D(,)はRAM1402に確保する例を示しているが、ハードディスク等の書き換え可能なメモリ内であればその種類は問わない。   In this embodiment, prior to starting the encoding process, an array variable D (x, C) corresponding to one line of an image, that is, the number W of pixels in the horizontal direction, is set in advance in the RAM 1402. Secure in the storage area. Here, an example in which the array variable D (,) is secured in the RAM 1402 is shown, but the type thereof is not limited as long as it is in a rewritable memory such as a hard disk.

ここで変数xは、水平方向の画素位置を特定するものであり、変数xの取り得る範囲は0≦x≦W−1である。つまり、この配列変数は座標xで示される画素位置毎に情報を保持する変数と言える。引数Cは、0、1のいずれかの値である。D(x,0)には、符号化の種類を識別する識別情報を格納する。実施形態における符号化の種類はパラメータJ,Kを用いるランレングス符号化と、予測符号化の2種類である。また、D(x,1)には、ランレングス符号化された際のラン(連続する画素数)を格納する。   Here, the variable x specifies the pixel position in the horizontal direction, and the range that the variable x can take is 0 ≦ x ≦ W−1. That is, this array variable can be said to be a variable that holds information for each pixel position indicated by the coordinate x. The argument C is a value of 0 or 1. In D (x, 0), identification information for identifying the type of encoding is stored. There are two types of encoding in the embodiment: run-length encoding using parameters J and K and predictive encoding. In D (x, 1), the run (number of continuous pixels) when run-length encoding is stored.

例えば、D(x、0)が“0”の場合、水平方向の座標xの画素は、ランレングス符号化されていることを示す。D(x,1)で示される値は、そのランを示す。また、D(x,0)が“1”の場合、水平方向の座標xの画素は、予測符号化されていることを示す。   For example, when D (x, 0) is “0”, it indicates that the pixel at the coordinate x in the horizontal direction is run-length encoded. The value indicated by D (x, 1) indicates the run. Further, when D (x, 0) is “1”, it indicates that the pixel at the coordinate x in the horizontal direction has been predictively encoded.

以下の説明において、符号化しようとする座標(x,y)の着目画素をXiと表現する。上記配列変数D(,)を、着目画素Xiの1ライン前の座標(x,y−1)の画素の符号化履歴を判定するために用いる。すなわち、着目画素Xiの1ライン前の座標(x,y−1)の符号化種別を、D(x,0)に従って判定する。また、着目画素Xiの1ライン前の座標(x,y−1)の符号化種別がランレングス符号化されている場合には、D(x,1)の値を調べることで、そのランが幾つであったのか判定する。   In the following description, a pixel of interest at coordinates (x, y) to be encoded is expressed as Xi. The array variable D (,) is used to determine the coding history of the pixel at the coordinate (x, y−1) one line before the pixel of interest Xi. That is, the encoding type of the coordinate (x, y−1) one line before the pixel of interest Xi is determined according to D (x, 0). Further, when the encoding type of the coordinate (x, y−1) one line before the pixel of interest Xi is run-length encoded, the value of D (x, 1) is checked to determine the run. Judge how many.

本実施形態では、着目画素Xiがランレングス符号化対象の画素であった場合、1ライン前の画素の符号化履歴から、着目画素Xiを含むランを符号化する際のパラメータJ、Kを決定し、符号化するものである。   In this embodiment, when the target pixel Xi is a pixel to be run-length encoded, parameters J and K for encoding a run including the target pixel Xi are determined from the encoding history of the pixel one line before. And is to be encoded.

以下、図3のフローチャートに従って、実施形態における符号化処理手順を説明する。なお、符号化を開始にするに先立ち、外部記憶装置1407には出力ファイルのヘッダを格納する。このヘッダには、画像データの水平、垂直方向の画素数(サイズ情報)、色空間の種類、色成分のビット数等、復号に必要なデータを格納する。以下の説明で生成される符号化データは、このヘッダに後続するデータとして格納されるものである。   Hereinafter, the encoding processing procedure in the embodiment will be described with reference to the flowchart of FIG. Prior to starting encoding, the external storage device 1407 stores the header of the output file. This header stores data necessary for decoding, such as the number of pixels (size information) in the horizontal and vertical directions of the image data, the type of color space, and the number of bits of the color component. The encoded data generated in the following description is stored as data following this header.

まず、ステップS301にて、RAM1402に配列変数D(,)を確保し、その配列変数の値を初期化する。初期化処理では、D(,0)=0、D(,1)=0とする。つまり、全てがランレングス符号化され、ランが“0”であるものとして設定する。但し、この初期値は、復号装置と同じようにすれば良く、上記の初期値でもって本発明が限定されるものではない。   First, in step S301, the array variable D (,) is secured in the RAM 1402, and the value of the array variable is initialized. In the initialization process, D (, 0) = 0 and D (, 1) = 0. That is, all are run-length encoded and the run is set to “0”. However, the initial value may be the same as that of the decoding device, and the present invention is not limited to the initial value.

次いで、ステップS302にて、垂直方向の座標を示す変数yを“0”で初期化し、ステップS303にて、水平方向の座標を示す変数xを“0”で初期化する。   Next, in step S302, the variable y indicating the vertical coordinate is initialized with “0”, and in step S303, the variable x indicating the horizontal coordinate is initialized with “0”.

この後、処理はステップS304に進み、座標(x,y)で示される着目画素Xiの近傍に位置する4つの近傍画素Xa,Xb,Xc,Xdが互いに同じ色であるかを判定する。言い替えれば、ステップS304では、近傍画素{Xa,Xb,Xc,Xd}の色数が“1”であるか否かを判定している、とも言える。   Thereafter, the process proceeds to step S304, and it is determined whether the four neighboring pixels Xa, Xb, Xc, and Xd located in the vicinity of the pixel of interest Xi indicated by the coordinates (x, y) have the same color. In other words, in step S304, it can be said that it is determined whether or not the number of colors of the neighboring pixels {Xa, Xb, Xc, Xd} is “1”.

着目画素Xiと近傍画素Xa,Xb,Xc,Xdとの相対位置関係は図4に示す通りである。すなわち、近傍画素Xa,Xb,Xc,Xdは、着目画素の近傍の符号済みの画素である。なお、着目画素Xiが画像の境界位置にあるとき、近傍画素Xa、Xb、Xc、Xdの全て、若しくはその幾つかが画像外に位置することになる。このように画像外に位置する近傍画素は、その成分R、G、Bは“0”と見なす。ただし、この値は、復号装置と共通にすれば良いので、これによって本発明が限定されるものではない。   The relative positional relationship between the pixel of interest Xi and the neighboring pixels Xa, Xb, Xc, and Xd is as shown in FIG. That is, the neighboring pixels Xa, Xb, Xc, and Xd are signed pixels in the vicinity of the target pixel. When the target pixel Xi is at the boundary position of the image, all or some of the neighboring pixels Xa, Xb, Xc, and Xd are located outside the image. In this way, the neighboring pixels located outside the image are considered to have components R, G, and B of “0”. However, since this value may be shared by the decoding device, this does not limit the present invention.

4つの近傍画素が互いに等しい場合(色数が“1”である場合)、着目画素Xiが近傍画素Xaと等しくなる確率が非常に高い。そこで、処理はステップS305に進み、ランレングス符号化処理を行なう(詳細は後述)。この後、処理はステップS309に進む。   When the four neighboring pixels are equal to each other (when the number of colors is “1”), the probability that the pixel of interest Xi is equal to the neighboring pixel Xa is very high. Therefore, the process proceeds to step S305, and a run-length encoding process is performed (details will be described later). Thereafter, the process proceeds to step S309.

一方、ステップS304にて、4つの近傍画素が表わす色数が2以上であると判定した場合、処理はステップS306に進み、着目画素Xiを構成する各色成分毎に予測符号化し、その符号化データを出力する。この予測符号化処理は、本実施形態では、JPEG−LSに規定されている手順に従うものとする。一例を示すのであれば、次の通りである。   On the other hand, if it is determined in step S304 that the number of colors represented by the four neighboring pixels is 2 or more, the process proceeds to step S306, where each color component constituting the pixel of interest Xi is predictively encoded, and the encoded data Is output. In the present embodiment, this predictive encoding process is assumed to follow the procedure defined in JPEG-LS. An example is as follows.

以下は着目画素Xiの色成分Rを符号化する場合について説明する。G成分については、符号化対象がR成分からG成分に代わるだけである。B成分も同様である。   Hereinafter, a case where the color component R of the pixel of interest Xi is encoded will be described. For the G component, the encoding target is simply changed from the R component to the G component. The same applies to the B component.

着目画素XiのR成分、近傍画素Xa,Xb,XcのR成分を仮に、Xi(R)、Xa(R),Xb(R),Xc(R)と表現する。先ず、着目画素のR成分の予測値Pを求める。JPEG−LSでは、予測値Pを求めるために、幾つかの式が定義されている。ここでは、簡単のため、予測値Pを以下のようにしても求めるものとする。
P=Xa(R)+Xb(R)−Xc(R)
The R component of the pixel of interest Xi and the R components of neighboring pixels Xa, Xb, and Xc are expressed as Xi (R), Xa (R), Xb (R), and Xc (R). First, the predicted value P of the R component of the pixel of interest is obtained. In JPEG-LS, several formulas are defined in order to obtain the predicted value P. Here, for the sake of simplicity, the predicted value P is also obtained as follows.
P = Xa (R) + Xb (R) -Xc (R)

次に、着目画素のR成分であるXi(R)と予測値Pとの予測誤差eを算出する。
e=Xi(R)−P
Next, the prediction error e between Xi (R), which is the R component of the pixel of interest, and the predicted value P is calculated.
e = Xi (R) -P

この後、この予測誤差eをエントロピー符号化(例えば、ハフマン符号化、Golomb符号化、算術符号化等)し、その符号語(符号化データ)を出力する。   Thereafter, the prediction error e is entropy-encoded (for example, Huffman encoding, Golomb encoding, arithmetic encoding, etc.), and the code word (encoded data) is output.

上記のようにして、着目画素XiのR成分の符号化データを生成し、出力すると、着目画素XiのG成分、B成分についても同様に処理することにより、着目画素Xiの全色成分の符号化処理を行なう。   When the encoded data of the R component of the pixel of interest Xi is generated and output as described above, the G component and the B component of the pixel of interest Xi are processed in the same manner, thereby encoding all the color components of the pixel of interest Xi. The process is performed.

この後、着目画素Xiが予測符号化されたことを示すため、ステップS307にて、着目画素のx座標で特定される配列変数D(x,0)に“1”を格納する。   Thereafter, in order to indicate that the target pixel Xi has been subjected to predictive encoding, “1” is stored in the array variable D (x, 0) specified by the x coordinate of the target pixel in step S307.

また、予測符号化は、1画素単位に符号化することになるので、ステップS308では、変数xを“1”だけ増加させ、ステップS309に処理を進める。   In addition, since predictive encoding is performed in units of one pixel, in step S308, the variable x is increased by “1”, and the process proceeds to step S309.

ステップS309では、変数xと変数Wとを比較する。x<Wであると判定した場合、着目画素Xiの位置は右端位置に到達していないことになるので、ステップS304に処理を戻す。   In step S309, the variable x and the variable W are compared. If it is determined that x <W, the position of the pixel of interest Xi has not reached the right end position, and the process returns to step S304.

また、ステップS309にて、x=Wと判定された場合、処理はステップS310に進み、変数yを“1”だけ増加させ、処理をステップS311に進める。   If it is determined in step S309 that x = W, the process proceeds to step S310, the variable y is increased by “1”, and the process proceeds to step S311.

ステップS311では、変数yと変数Hとを比較する。y<Hであると判定した場合、着目画素は最終ライン上にないことになるので、ステップS303以降の処理を行なう。また。y=Hであると判断した場合には、画像データの全画素について符号化が完了したことになるので、本処理を終える。   In step S311, the variable y is compared with the variable H. If it is determined that y <H, the pixel of interest is not on the final line, so the processing from step S303 is performed. Also. If it is determined that y = H, the encoding is completed for all the pixels of the image data, and thus this processing ends.

次に、上記のステップS305のランレングス符号化処理の詳細を、図9のフローチャートに従って説明する。なお、以下の説明において、着目画素Xiの座標は、図3の処理で利用される変数x、yによって特定されることに注意されたい。   Next, details of the run-length encoding process in step S305 will be described with reference to the flowchart of FIG. In the following description, it should be noted that the coordinates of the target pixel Xi are specified by the variables x and y used in the processing of FIG.

先ず、ステップS901にて、ランを計数するための変数RL、及び、フラグfをそれぞれ“0”で初期化する。   First, in step S901, a variable RL for counting runs and a flag f are each initialized with “0”.

次いで、ステップS902に進み、変数D(x、0)を調べ、着目画素Xiの1ライン前の画素、すなわち、座標(x,y−1)の画素がランレングス符号化されているのか、予測誤差符号化されているのかを判定する。   Next, the process proceeds to step S902, where the variable D (x, 0) is examined to predict whether the pixel one line before the pixel of interest Xi, that is, the pixel at coordinates (x, y-1) has been run-length encoded. It is determined whether it is error encoded.

着目画素Xiの1ライン前の画素がランレングス符号化されていると判定した場合には、ステップS903に進む。ステップS903では、着目画素Xiの1ライン前の画素のランを変数D(x,1)を読出すことで取得する。そして、このD(x,1)の値に従って、着目画素のランレングス符号化を行なうための初期のパラメータJ,Kを決定する。これらパラメータJ,Kを求め方は、以下の通りである。   If it is determined that the pixel one line before the target pixel Xi is run-length encoded, the process proceeds to step S903. In step S903, the run of the pixel one line before the target pixel Xi is acquired by reading the variable D (x, 1). Then, initial parameters J and K for performing run-length encoding of the pixel of interest are determined according to the value of D (x, 1). The method for obtaining these parameters J and K is as follows.

説明を簡単なものとするため、今、着目画素Xiが図5の“*”位置にあるものとする。なお、図5は白地に黒色の垂直線が存在する例を示している。着目画素Xiが存在するライン上の着目画素Xiよりも左側、及び、着目画素Xiより上のラインは符号化済みの領域である点に注意されたい。   In order to simplify the description, it is assumed that the pixel of interest Xi is at the “*” position in FIG. FIG. 5 shows an example in which a black vertical line exists on a white background. Note that the left side of the target pixel Xi on the line where the target pixel Xi exists and the line above the target pixel Xi are encoded regions.

この符号化済み領域において、符号化種類が予測符号化(D(,0)=1)であった画素を“R”、ランレングス符号化(D(,0)=0)であれば、そのランを示す数値(D(,1))で表現すると、図5の画像は図6のように表現できる。図6において“−”の画素は、着目ライン上の着目画素Xiよりも左側にある画素の符号化処理によって、D(,)が上書きされたことを示している。   In this encoded area, a pixel whose encoding type is predictive encoding (D (, 0) = 1) is “R”, and if run-length encoding (D (, 0) = 0), When expressed by a numerical value (D (, 1)) indicating a run, the image of FIG. 5 can be expressed as shown in FIG. In FIG. 6, a pixel “−” indicates that D (,) has been overwritten by the encoding process of the pixel on the left side of the target pixel Xi on the target line.

図6から、着目画素Xiの1ライン前の画素(座標(x,y−1))の符号化の種別はランレングス符号化であって、ランが“4”であることがわかる。本実施形態では、このラン“4”を2q+mで表わした際の指数qを求める。数値“4”は22+0であるから、指数qは“2”となる。実際は、このような複雑な演算は不要である。すなわち、ランを二進表現した際、MSBからLSBに向かって最初に“1”に現れるビット位置をqとして求めればよい。そして、求めたqをパラメータKとして決定する。 FIG. 6 shows that the type of encoding of the pixel (coordinate (x, y−1)) one line before the pixel of interest Xi is run-length encoding, and the run is “4”. In the present embodiment, an index q when the run “4” is expressed by 2 q + m is obtained. Since the numerical value “4” is 2 2 +0, the index q is “2”. Actually, such a complicated operation is unnecessary. That is, when the run is expressed in binary, the bit position that first appears at “1” from the MSB to the LSB may be obtained as q. Then, the obtained q is determined as a parameter K.

また、パラメータJの求め方は次の通りである。   The parameter J is obtained as follows.

先ず、図2のテーブルを左から右側に調べ、決定したパラメータKと同じ値が最初に見つかった位置のランインデックス値を、パラメータJとして決定する。図2の場合、最初にK=2となるのは、ランインデックス値が“8”であるので、パラメータJは“8”として決定する。   First, the table of FIG. 2 is examined from the left to the right, and the run index value at the position where the same value as the determined parameter K is first found is determined as the parameter J. In the case of FIG. 2, K = 2 is first determined because the run index value is “8”, and the parameter J is determined as “8”.

以上が、ステップS903におけるパラメータJ,Kの決定手順である。   The above is the procedure for determining the parameters J and K in step S903.

一方、ステップS902にて、着目画素Xiの1ライン前の画素、すなわち、座標(x,y−1)の画素が予測符号化されている場合(D(x,0)=1の場合)には、ステップS904に進む。この棄て追う904で、配列変数D(,)を参酌せず、デフォルトの値をパラメータK,Jに設定する。デフォルトの値は、復号装置との間で同一の値であれば良い。本実施形態では、パラメータK,Jは共に“0”であるものとして決定する。   On the other hand, in step S902, when the pixel one line before the pixel of interest Xi, that is, the pixel at the coordinate (x, y−1) is predictively encoded (when D (x, 0) = 1). Advances to step S904. In step 904, the default values are set in the parameters K and J without considering the array variable D (,). The default value may be the same value as the decoding device. In this embodiment, the parameters K and J are determined to be “0”.

上記のようにしてパラメータJ,Kが求まると、処理はステップS905に進み、ランの検出と符号化処理を行なうことになる。   When the parameters J and K are obtained as described above, the process proceeds to step S905, and run detection and encoding processing are performed.

先ず、このステップS905では、着目画素Xiと、その直前の画素Xaとが同じ色であるか否かを判定する(ここで、画素Xaの座標は(x−1,y)である)。また、2つの画素が同じ色であるというのは、それら2つの各成分の値が互いに等しい場合である。   First, in step S905, it is determined whether the pixel of interest Xi and the immediately preceding pixel Xa have the same color (here, the coordinates of the pixel Xa are (x-1, y)). Two pixels have the same color when the values of the two components are equal to each other.

着目画素Xiと画素Xaが等しいと判定した場合には、ステップS906に進み、変数RLを“1”だけ増加させる。そして、着目画素Xiの位置を更新するため、ステップS907にて、変数xを“1”だけ増加させる。この後、ステップS908に進み、変数xと変数Wとを比較する。x<Wである場合、着目画素は画像の右端に到達していないことを示すので、ステップS905の処理に戻る。一方、変数xと変数Wが等しいと判断した場合、着目画素は画像の右端に位置することを示すので、フラグfに“1”をセットし、ステップS910に処理を進める。   If it is determined that the target pixel Xi and the pixel Xa are equal, the process proceeds to step S906, and the variable RL is increased by “1”. In order to update the position of the pixel of interest Xi, the variable x is increased by “1” in step S907. Thereafter, the process proceeds to step S908, and the variable x and the variable W are compared. If x <W, it indicates that the pixel of interest has not reached the right edge of the image, and the process returns to step S905. On the other hand, if it is determined that the variable x and the variable W are equal, it indicates that the pixel of interest is located at the right end of the image, so “1” is set in the flag f, and the process proceeds to step S910.

上記のステップS905乃至ステップS908のループは、同じ色の画素の連続数、すなわち、ランを求めていることに他ならない。   The loop from step S905 to step S908 is nothing but finding the number of consecutive pixels of the same color, that is, a run.

さて、ステップS905にて、着目画素Xiとその直前の画素Xaとが異なる色であると判定された場合、又は、ステップS908にて、同じ色が連続したまま着目画素が画像の右端位置まで到達したと判断した場合、処理はステップS910に進む。   If it is determined in step S905 that the pixel of interest Xi and the immediately preceding pixel Xa are different colors, or in step S908, the pixel of interest reaches the right end position of the image while the same color continues. If it is determined that the process has been performed, the process proceeds to step S910.

この後、ステップS910にて、変数nに変数RLの値を代入し、ステップS911にて変数nのランレングス符号化を行なう。このステップS911におけるランレングス符号化処理の内容は、図1のフローチャートで示した通りであるので、その説明は省略する。なお、図1では符号化対象のランを変数nで表わしている。この理由で、ステップS910では便宜的に変数nに変数RLの値を格納している。   Thereafter, in step S910, the value of variable RL is substituted for variable n, and in step S911, run-length encoding of variable n is performed. The contents of the run-length encoding process in step S911 are as shown in the flowchart of FIG. In FIG. 1, a run to be encoded is represented by a variable n. For this reason, in step S910, the value of the variable RL is stored in the variable n for convenience.

ステップS912では、着目画素Xiが存在するラインの次のラインの符号化処理に備えて、ランの最初の画素位置から、RL個分の配列変数D(,)を更新する処理を行なう。符号化したランの先頭のx座標をxsで表わすと、
D(xs,0)、D(xs+1,0)、…、D(xs+RL−1、0)それぞれを“0”を格納する。言い替えれば、水平方向の座標xsの画素位置からRL個の範囲の画素群がランレングス符号化されたことを示す履歴情報を配列変数D(,)に格納し、更新する。また、同様に、D(Xs,1)、D(Xs+1,1)、…、D(Xs+RL−1、1)には、変数RLの値(着目画素を含むラン)を格納する。
In step S912, processing for updating RL array variables D (,) from the first pixel position of the run is performed in preparation for the encoding processing of the line next to the line where the pixel of interest Xi exists. If the x coordinate of the head of the encoded run is represented by xs,
Each of D (xs, 0), D (xs + 1, 0),..., D (xs + RL-1, 0) is stored as “0”. In other words, history information indicating that the RL range of pixel groups from the pixel position of the coordinate xs in the horizontal direction has been run-length encoded is stored in the array variable D (,) and updated. Similarly, D (Xs, 1), D (Xs + 1,1),..., D (Xs + RL-1, 1) stores the value of the variable RL (run including the target pixel).

なお、図3のフローチャートにおいて、ステップS304にてYesと判断され、図9のフローチャートに従った処理を開始した最初のステップS905にて、着目Xiと直前画素Xaが等しくない、と判定されることも起こりえる。この場合、ラン“0”を符号化して出力することになる。ラン“0”の場合、着目画素Xiは、図9の処理では符号化対象とはならず、図3の処理にて予測符号化されることになる。   In the flowchart of FIG. 3, “Yes” is determined in step S304, and it is determined in first step S905 that the processing according to the flowchart of FIG. 9 is started, the target Xi is not equal to the immediately preceding pixel Xa. Can also happen. In this case, the run “0” is encoded and output. In the case of run “0”, the pixel of interest Xi is not subject to encoding in the process of FIG. 9, but is predictively encoded in the process of FIG.

以上説明した様に本実施形態に従えば、着目画素Xiを含むランを符号化する際の初期パラメータJ,Kを、着目画素Xiの1つ前のラインの画素の符号化履歴に従って決定する。これにより、パラメータの変動を抑制すると共に、ランに最適なパラメータを維持する確率を高め、圧縮効率を向上させることが可能となる。   As described above, according to the present embodiment, the initial parameters J and K for encoding a run including the target pixel Xi are determined according to the encoding history of the pixels on the line immediately before the target pixel Xi. As a result, it is possible to suppress the fluctuation of the parameters, increase the probability of maintaining the optimum parameters for the run, and improve the compression efficiency.

なお、実施形態では、画像の符号化を開始した際の最初のラインでは、初期値で初期化した配列変数D(,)を用いて符号化するものとして説明した。しかしながら、これによって本発明が限定されるものではない。すなわち、画像の最初のラインについては従来の同様の処理を行ない、パラメータJ、Kを更新しても良い。但し、この場合にも、符号化済みとなった画素位置に対応する配列変数D(,)を、その際に用いた符号化種別を示す情報、ランレングス符号化したのであればそのランを示す情報の符号化履歴情報で更新することになる。   In the embodiment, the first line at the start of image encoding is described as being encoded using the array variable D (,) initialized with the initial value. However, this does not limit the present invention. That is, for the first line of the image, the same processing as in the past may be performed to update the parameters J and K. However, in this case as well, if the array variable D (,) corresponding to the pixel position that has already been encoded is the information indicating the encoding type used at that time, and if run-length encoding is performed, that run is indicated. It will be updated with the coding history information of the information.

また、上記実施形態では、着目画素Xiを含むランを符号化する際に、着目画素Xiの1ライン前の画素の符号化種類が予測誤差符号化であった場合、デフォルトの値を用いるものとして説明した(図9のステップS904)。しかし、このデフォルトの値を用いる代わりに、直前のランの符号化処理で更新されたパラメータJを用いても構わない。   In the above embodiment, when encoding a run including the target pixel Xi, if the encoding type of the pixel one line before the target pixel Xi is prediction error encoding, the default value is used. This has been described (step S904 in FIG. 9). However, instead of using this default value, the parameter J updated in the encoding process of the immediately preceding run may be used.

さらにまた、実施形態では、ランレングス符号化と予測誤差符号化を用いる例を説明したが、ランレングス符号化のみを用いるようにしても構わない。この場合、符号化の種類は1種類だけとなるので、配列変数Dはランのみを格納すればよい。   Furthermore, in the embodiment, an example in which run-length encoding and prediction error encoding are used has been described. However, only run-length encoding may be used. In this case, since there is only one type of encoding, the array variable D only needs to store a run.

また、実施形態では、ランレングス符号化を開始する条件が、着目画素Xiの近傍の4つの画素Xa,Xb,Xc,Xdが互いに等しい、すなわち、近傍4画素が示す色数が“1”である例を説明した。しかしながら、近傍画素が表わす最大色数よりも十分に小さい値の候補、例えば{1,2}の中からユーザが閾値を1つ選択できるようにしても構わない。この場合、近傍画素の色数が閾値以下の場合に、ランレングス符号化を行なうように、閾値を超える場合には予測符号化を行なう。ただし、閾値はユーザが選択することになるので、生成される符号化データファイルのヘッダに、その閾値を特定する情報を格納することが必要である。   In the embodiment, the condition for starting run-length encoding is that the four pixels Xa, Xb, Xc, and Xd in the vicinity of the target pixel Xi are equal to each other, that is, the number of colors indicated by the four neighboring pixels is “1”. An example has been described. However, the user may be able to select one threshold value from among candidates whose values are sufficiently smaller than the maximum number of colors represented by neighboring pixels, for example, {1, 2}. In this case, run-length encoding is performed when the number of colors of neighboring pixels is equal to or less than the threshold, and predictive encoding is performed when the threshold is exceeded. However, since the threshold value is selected by the user, it is necessary to store information for specifying the threshold value in the header of the encoded data file to be generated.

また、上記実施形態の画像符号化装置で生成された符号化画像データを復号する場合には、上記と逆の処理を行なえばよい。着目画素が、符号化対象の画像データの最初の画素(画像の左上隅の位置の画素)である場合、着目画素がランレングス符号化される。なぜなら、その画像外の近傍画素Xa,Xb,Xc,Xdが共に同じ色であるものとして判定されるからである。しかしながら、この最初の画素を除けば、基本的に、1つのランレングス符号化データの前には予測符号化データが位置する。それ故、予測符号化データを復号して得られた画素データを仮にXpとしたとき、ランレングス符号化データを復号したランで示される数分の画素データXpを出力すればよい。   In addition, when decoding the encoded image data generated by the image encoding device of the above-described embodiment, a process reverse to the above may be performed. When the target pixel is the first pixel of the image data to be encoded (the pixel at the upper left corner of the image), the target pixel is run-length encoded. This is because it is determined that the neighboring pixels Xa, Xb, Xc, and Xd outside the image are all the same color. However, except for the first pixel, predictive encoded data is basically positioned before one run-length encoded data. Therefore, if the pixel data obtained by decoding the predicted encoded data is Xp, pixel data Xp corresponding to the number indicated by the run obtained by decoding the run-length encoded data may be output.

また、上記実施形態では、配列変数D(,)の引数を2つの例で示したが、QビットのMSBを符号化種別を示す情報を格納し、残りのQ−1ビットをランを格納する領域として用いてもかまわない。   In the above embodiment, the argument of the array variable D (,) is shown in two examples, but the information indicating the encoding type is stored in the MSB of Q bits, and the run is stored in the remaining Q-1 bits. It may be used as a region.

また、実施形態では、ランレングス符号化処理を図1に示した手順に従い行なうものとしたが、符号化の種類はこれに限定されるものではない。すなわち、動的にパラメータを変更もしくは更新して符号化するものであれば良い。例えば、ランRLを、動的パラメータKを用いてGolomb符号化する場合にも適用しても良いであろう。   In the embodiment, the run-length encoding process is performed according to the procedure shown in FIG. 1, but the type of encoding is not limited to this. That is, any code may be used as long as it dynamically changes or updates the parameters. For example, the run RL may be applied to the Golomb coding using the dynamic parameter K.

[第2の実施形態]
上記第1の実施形態では、着目画素Xiの1ライン前の画素の履歴情報のパラメータ特定情報(第1の実施形態ではラン)を参照してパラメータJ,Kを決定した。しかしながら、着目画素Xiの1ライン前の画素のランインデックス値そのものを着目画素をランレングス符号化する際にランインデックス値として適用しても構わない。
[Second Embodiment]
In the first embodiment, the parameters J and K are determined with reference to the parameter specifying information (run in the first embodiment) of the history information of the pixel one line before the target pixel Xi. However, the run index value of the pixel one line before the target pixel Xi may be applied as the run index value when the target pixel is run-length encoded.

この場合、図9のステップS912では、配列変数D(x,1)には、ランではなく、ランレングス符号化した際の更新後のラインインデックス値である変数Jを格納するようにすればよい。   In this case, in step S912 of FIG. 9, the array variable D (x, 1) may store not the run but the variable J that is the updated line index value when run-length encoding is performed. .

また、図9のステップS903では、D(x,1)からランインデックス値を取得し、それがパラメータJの値であるとして決定すればよい。パラメータJが決定されると、図2のテーブルからパラメータKを一義的に決定できる。   Further, in step S903 in FIG. 9, the run index value may be acquired from D (x, 1) and determined as the value of the parameter J. When the parameter J is determined, the parameter K can be uniquely determined from the table of FIG.

[第3の実施形態]
本第3の実施形態では、複数画像を合成して作成されたような画像に対して、領域情報を用いて、参照するランインデックスの値を変更する例を説明する。
[Third Embodiment]
In the third embodiment, an example will be described in which the run index value to be referred to is changed using region information for an image created by combining a plurality of images.

例えば、前景と背景の領域情報が与えられているような2種類の属性を持つ画像の場合には、前景と背景を別々に符号化する。ランインデックスの値も画像領域によってそれぞれ違う値をとるので、動的に追従させていった場合、最適なランインデックス値を割り当てることができる。   For example, in the case of an image having two types of attributes for which foreground and background area information is given, the foreground and the background are encoded separately. Since the value of the run index varies depending on the image area, an optimum run index value can be assigned when the run index is dynamically followed.

具体的には、図7のような画像の場合、グレーの部分が前景画像、その他が背景画像の属性を持つ。背景画像は真っ白のベタ画像となり、ランレングス符号化方式による符号化効率の向上が見込まれる。前景画像に関しても、ランの長さが極端に変動することがなくなるので、符号化効率を改善することが可能となる。   Specifically, in the case of the image as shown in FIG. 7, the gray portion has the foreground image attribute and the others have the background image attribute. The background image is a solid white image, and the improvement of the encoding efficiency by the run-length encoding method is expected. Also for the foreground image, since the run length does not fluctuate extremely, the encoding efficiency can be improved.

これを実現するには、画像をラスタースキャンして符号化する際に、各画素の属性(2つの属性にて切り替えるあれば1ビットで良い)を入力し、その入力した属性を示す情報に基づき、参照する履歴情報を切り替えればよい。具体的には、配列変数D(x,C,Atr)のように3つの引数で表わし、変数Atrを属性とみなし、これによって2種類の履歴情報を利用すればよいであろう。   In order to realize this, when the image is raster-scanned and encoded, the attribute of each pixel (one bit is sufficient if switching between two attributes) is input, and based on the information indicating the input attribute The history information to be referred to may be switched. Specifically, it may be expressed by three arguments such as an array variable D (x, C, Atr), the variable Atr is regarded as an attribute, and two types of history information may be used.

この結果、図7に示される1つの自然画ブロック中の最後のラインの次のラインを符号化する場合には、その自然画ブロックの最初のラインよりも1つ前のラインの符号化履歴情報を参照することも可能になる。   As a result, when the line following the last line in one natural image block shown in FIG. 7 is encoded, the encoding history information of the line immediately before the first line of the natural image block is encoded. Can also be referred to.

なお、符号化対象の画像データとしては、PDL形式の印刷データを受信してレンダリングした画像が好適である。レンダリング処理を行なうレンダリング部は、印刷データに基づいて文字パターンや線画の描画をページメモリに行ない、印刷データ中に含まれる自然画もページメモリに展開することになる。従って、レンダリング部は、ページメモリに対応する属性メモリを備えるようにする。1ページのレンダリングを開始する際には属性メモリに対して全ての画素が文字線画の属性を持つものとして初期化する。そして、その後で、自然画をページメモリに展開した際には、属性メモリの該当する領域の属性を自然画を示すように書き換えればよい。そして、レンダリング部が1ページのレンダリングを終えたところで、ページメモリの画像データと、属性メモリのデータとを本装置に出力すればよい。この結果、画素単位に属性を判別することができ、属性毎に符号化パラメータを切り替えることが可能になる。   As the image data to be encoded, an image obtained by receiving and rendering print data in PDL format is suitable. The rendering unit that performs the rendering process draws a character pattern or a line drawing in the page memory based on the print data, and develops a natural image included in the print data in the page memory. Accordingly, the rendering unit includes an attribute memory corresponding to the page memory. When the rendering of one page is started, all pixels are initialized in the attribute memory as having a character / line drawing attribute. After that, when the natural image is expanded in the page memory, the attribute of the corresponding area in the attribute memory may be rewritten to indicate the natural image. Then, when the rendering unit finishes rendering one page, the image data in the page memory and the data in the attribute memory may be output to this apparatus. As a result, the attribute can be discriminated for each pixel, and the encoding parameter can be switched for each attribute.

また、上記実施形態では、符号化対象の画像データのサイズは水平方向画素数W、垂直方向の画素数Hとし、その画像データをラスタースキャンして符号化する例を説明した。しかしながら、この画像データからユーザが不図示の操作部で設定したm×n(m,nは2以上の値)画素のブロックを単位に入力し、符号化しても構わない。この場合、Wをm、Hをnと読み代えて、各ブロック単位に符号化するだけで良い。   In the above embodiment, the size of image data to be encoded is set to the number of pixels W in the horizontal direction and the number of pixels H in the vertical direction, and the image data is encoded by raster scanning. However, from this image data, a block of m × n (m, n is a value of 2 or more) pixels set by the user using an operation unit (not shown) may be input and encoded. In this case, it is only necessary to encode each block unit by replacing W with m and H with n.

[他の実施形態]
第1や第2の実施形態では、着目画素の1ライン前の画素のランの長さや、ランインデックス値を参照して、ランレングス符号化を行ったが、参照する画素は、着目画素の1ライン前の画素でなくてもよい。
[Other Embodiments]
In the first and second embodiments, the run length encoding is performed by referring to the run length of the pixel one line before the target pixel and the run index value. It does not have to be a pixel before the line.

例えば、図10のような画像の場合は、白い画素をランレングス符号化する際に第1の実施形態のように1ライン前の画素のラン長やランインデックス値を参照してランインデックスの値を決定すると、最適なランインデックス値は割り当てられず符号量が増加してしまう可能性がある。このような画像の場合には、1回目に出てくるランの長さ又はランインデックスと、2回目に出てくるランの長さ又はランインデックスを保存しておき、ランインデックス値の変動を見て、参照するランの長さ又はランインデックスの値を、着目画素の上のランから参照するか、別のランから参照するかどうかを判定し、適用する。こうすることで、符号量の抑制ができる。   For example, in the case of an image as shown in FIG. 10, when run length coding is performed on a white pixel, the run index value is referred to by referring to the run length or run index value of the previous pixel as in the first embodiment. Is determined, the optimal run index value is not assigned, and the amount of codes may increase. In the case of such an image, the run length or run index that appears for the first time and the run length or run index that appears for the second time are stored, and fluctuations in the run index value are monitored. Then, it is determined whether or not the length of the reference run or the value of the run index is referred to from a run above the target pixel or from another run. By doing so, the amount of code can be suppressed.

以上、本発明に係る実施形態を説明した。上記実施形態では、パーソナルコンピュータ等の汎用情報処理装置上で実行するアプリケーションで実現する例を説明したが、同様の処理をハードウェアにて行なっても構わない。   The embodiment according to the present invention has been described above. In the above-described embodiment, an example has been described in which an application is executed on a general-purpose information processing apparatus such as a personal computer. However, similar processing may be performed by hardware.

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

従来のランレングス符号化処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the conventional run length encoding process. ランインデックス値とパラメータKの対応テーブルを示す図である。It is a figure which shows the correspondence table of a run index value and the parameter K. 第1の実施形態の符号化処理のメイン処理を示すフローチャートである。It is a flowchart which shows the main process of the encoding process of 1st Embodiment. 着目画素Xiとその近傍画素Xa,Xb,Xc,Xdの相対位置関係を示す図である。It is a figure which shows the relative positional relationship of the pixel of interest Xi and its vicinity pixel Xa, Xb, Xc, Xd. 実施形態のける符号化対象の画像の一例を示す図である。It is a figure which shows an example of the image of the encoding target in embodiment. 図5の画像中の着目画素の近傍に位置する符号化履歴情報の例を示す図である。FIG. 6 is a diagram illustrating an example of coding history information located in the vicinity of a target pixel in the image of FIG. 5. 第3の実施形態が適用する画像の例を示す図である。It is a figure which shows the example of the image which 3rd Embodiment applies. 実施形態の画像符号化装置のブロック構成図である。It is a block block diagram of the image coding apparatus of embodiment. 図3のステップS305の詳細を示すフローチャートである。It is a flowchart which shows the detail of step S305 of FIG. 変形例の符号化対象の画像の一例を示す図である。It is a figure which shows an example of the image of the encoding target of a modification.

Claims (12)

ラスタースキャン順に画素データを入力し、動的に更新される符号化パラメータに従ってランレングス符号化する画像符号化装置であって、
ランレングス符号化を行なうことで更新された前記符号化パラメータを特定する符号化履歴情報を、画素位置毎に記憶するための記憶手段と、
着目画素の位置からのランをランレングス符号化する際、前記着目画素の水平方向の位置と同じであって、1ライン前の画素位置の符号化履歴情報を前記記憶手段から取得する取得手段と、
前記取得手段で取得した符号化履歴情報で特定される前記符号化パラメータを前記ランの符号化の初期の符号化パラメータとし、当該初期の符号化パラメータを前記ランに応じて更新しながら、前記ランをランレングス符号化する符号化手段と、
前記符号化手段による前記ランの符号化を行なった後の前記符号化パラメータを特定する情報を、前記ランを構成する各画素の符号化履歴情報として前記記憶手段に格納する格納手段と
を備えることを特徴とする画像符号化装置。
An image encoding device that inputs pixel data in raster scan order and performs run-length encoding according to dynamically updated encoding parameters,
Storage means for storing, for each pixel position, encoding history information for specifying the encoding parameter updated by performing run-length encoding;
An acquisition unit that acquires, from the storage unit, encoding history information of a pixel position of the previous line that is the same as the horizontal position of the target pixel when run-length encoding a run from the position of the target pixel; ,
The encoding parameter specified by the encoding history information acquired by the acquisition unit is set as an initial encoding parameter of the encoding of the run, and the initial encoding parameter is updated according to the run, and the run Encoding means for run-length encoding
Storage means for storing, in the storage means, information specifying the encoding parameter after encoding the run by the encoding means as encoding history information of each pixel constituting the run. An image encoding device characterized by the above.
前記記憶手段は、各画素位置毎に、それぞれの画素が属するランを前記符号化履歴情報として記憶することを特徴とする請求項1に記載の画像符号化装置。   The image encoding apparatus according to claim 1, wherein the storage unit stores, as the encoding history information, a run to which each pixel belongs for each pixel position. 前記記憶手段は、各画素位置毎に、ランレングス符号化した際の更新後の符号化パラメータを前記符号化履歴情報として記憶することを特徴とする請求項1に記載の画像符号化装置。   The image encoding apparatus according to claim 1, wherein the storage unit stores, as the encoding history information, an updated encoding parameter when run-length encoding is performed for each pixel position. ラスタースキャン順に画素データを入力し、動的に更新される符号化パラメータに従ってランレングス符号化する画像符号化装置の制御方法であって、
ランレングス符号化を行なうことで更新された前記符号化パラメータを特定する符号化履歴情報を、画素位置毎に記憶するための記憶領域をメモリ内に確保する工程と、
着目画素の位置からのランをランレングス符号化する際、前記着目画素の水平方向の位置と同じであって、1ライン前の画素位置の符号化履歴情報を前記記憶領域から取得する取得工程と、
前記取得工程で取得した符号化履歴情報で特定される前記符号化パラメータを前記ランの符号化の初期の符号化パラメータとし、当該初期の符号化パラメータを前記ランに応じて更新しながら、前記ランをランレングス符号化する符号化工程と、
前記符号化工程による前記ランの符号化を行なった後の前記符号化パラメータを特定する情報を、前記ランを構成する各画素の符号化履歴情報として前記記憶領域に格納する格納工程と
を備えることを特徴とする画像符号化装置の制御方法。
A control method for an image encoding device that inputs pixel data in raster scan order and performs run-length encoding according to dynamically updated encoding parameters,
Securing a storage area in the memory for storing, for each pixel position, encoding history information for specifying the encoding parameter updated by performing run-length encoding;
An acquisition step of acquiring, from the storage area, encoding history information of the pixel position of the previous line that is the same as the horizontal position of the target pixel when the run from the position of the target pixel is run-length encoded; ,
The encoding parameter specified by the encoding history information acquired in the acquisition step is set as an initial encoding parameter of the encoding of the run, and the initial encoding parameter is updated according to the run, and the run An encoding step for run-length encoding
A storage step of storing, in the storage area, information specifying the encoding parameter after encoding the run by the encoding step as encoding history information of each pixel constituting the run. A control method for an image encoding device characterized by the above.
コンピュータが読み込み実行することで、前記コンピュータを、請求項1乃至3のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。   A computer program that causes a computer to function as the image encoding device according to any one of claims 1 to 3 when the computer reads and executes the computer program. ラスタースキャン順に画素データを入力し、動的に更新される符号化パラメータに従ってランレングス符号化又は予測符号化する画像符号化装置であって、
ランレングス符号化、予測符号化のいずれで符号化したのかを示す識別情報と、ランレングス符号化を行なうことで更新された前記符号化パラメータを特定する特定情報とで表わされる符号化履歴情報を、画素位置毎に記憶するための記憶手段と、
着目画素の近傍に位置し、既に符号化された複数の画素で表わされる色数が、予め設定された閾値以下であるか否かを判定する判定手段と、
前記判定手段で前記色数が前記閾値以下であると判定した場合、着目画素からのランを検出し、検出したランをランレングス符号化するランレングス符号化手段と、
前記判定手段で前記色数が前記閾値を超えると判定した場合、着目画素を予測符号化すると共に、前記着目画素が予測符号化されたことを示す識別情報を含む符号化履歴情報を前記記憶手段に格納する予測符号化手段とを備え、
前記ランレングス符号化手段は、
前記着目画素の位置からのランをランレングス符号化する際、前記着目画素の水平方向の位置と同じであって、1ライン前の画素位置の符号化履歴情報を前記記憶手段から取得する取得手段と、
前記取得手段で取得した符号化履歴情報に含まれる前記識別情報がランレングス符号化を示す場合には、取得した符号化履歴情報に含まれるの前記パラメータ特定情報で特定される符号化パラメータを初期の符号化パラメータとして決定し、
前記取得手段で取得した符号化履歴情報に含まれる前記識別情報が予測符号化を示す場合には、デフォルトの符号化パラメータを初期のパラメータとして決定する決定手段と、
前記決定手段で決定された初期の符号化パラメータを前記ランに応じて更新しながら、前記ランをランレングス符号化する符号化手段と、
前記符号化手段による符号化を行なった際、ランレングス符号化されたことを示す識別情報、及び、前記ランの符号化を行なった後の前記符号化パラメータを特定する情報を、前記ランを構成する各画素位の前記符号化履歴情報として、前記記憶手段に格納する格納手段と
を備えることを特徴とする画像符号化装置。
An image encoding device that inputs pixel data in raster scan order and performs run-length encoding or predictive encoding according to dynamically updated encoding parameters,
Encoding history information represented by identification information indicating whether the encoding is performed by run-length encoding or predictive encoding, and specific information for specifying the encoding parameter updated by performing run-length encoding Storage means for storing for each pixel position;
Determining means for determining whether or not the number of colors represented by a plurality of already encoded pixels located in the vicinity of the pixel of interest is equal to or less than a preset threshold value;
A run length encoding means for detecting a run from the pixel of interest and performing a run length encoding on the detected run when the determination means determines that the number of colors is equal to or less than the threshold;
When the determination unit determines that the number of colors exceeds the threshold, the storage unit stores encoding history information including identification information indicating that the pixel of interest is prediction-encoded and the pixel of interest is prediction-encoded. Predictive encoding means stored in
The run-length encoding means is
An acquisition unit that acquires, from the storage unit, encoding history information of the pixel position of the previous line that is the same as the horizontal position of the target pixel when the run from the position of the target pixel is run-length encoded. When,
When the identification information included in the encoding history information acquired by the acquisition means indicates run-length encoding, the encoding parameter specified by the parameter specifying information included in the acquired encoding history information is initialized. Is determined as an encoding parameter of
When the identification information included in the encoding history information acquired by the acquiring unit indicates predictive encoding, a determining unit that determines a default encoding parameter as an initial parameter;
Encoding means for run-length encoding the run while updating the initial encoding parameters determined by the determining means according to the run;
When the encoding is performed by the encoding means, identification information indicating that the run-length encoding has been performed, and information for specifying the encoding parameter after performing the encoding of the run, configure the run An image encoding apparatus comprising: a storage unit that stores the encoding history information of each pixel position in the storage unit.
前記記憶手段に記憶される前記パラメータ特定情報は、ランであることを特徴とする請求項6に記載の画像符号化装置。   The image encoding apparatus according to claim 6, wherein the parameter specifying information stored in the storage unit is a run. 前記記憶手段に記憶される前記パラメータ特定情報は、ランレングス符号化した際の更新後の符号化パラメータとすることを特徴とする請求項6に記載の画像符号化装置。   The image encoding apparatus according to claim 6, wherein the parameter specifying information stored in the storage unit is an updated encoding parameter when run-length encoding is performed. 前記デフォルトの符号化パラメータは、着目画素の位置より前であって、最後にランレングス符号化した際の更新後の符号化パラメータとすることを特徴とする請求項6乃至8いずれか1項に記載の画像符号化装置。   9. The encoding parameter according to claim 6, wherein the default encoding parameter is an updated encoding parameter before the position of the target pixel and last run-length encoding. The image encoding device described. ラスタースキャン順に画素データを入力し、動的に更新される符号化パラメータに従ってランレングス符号化又は予測符号化する画像符号化装置の制御方法であって、
ランレングス符号化、予測符号化のいずれで符号化したのかを示す識別情報と、ランレングス符号化を行なうことで更新された前記符号化パラメータを特定する特定情報とで表わされる符号化履歴情報を、画素位置毎に記憶するための記憶領域をメモリに確保する工程と、
着目画素の近傍に位置し、既に符号化された複数の画素で表わされる色数が、予め設定された閾値以下であるか否かを判定する判定工程と、
前記判定工程で前記色数が前記閾値以下であると判定した場合、着目画素からのランを検出し、検出したランをランレングス符号化するランレングス符号化工程と、
前記判定工程で前記色数が前記閾値を超えると判定した場合、着目画素を予測符号化すると共に、前記着目画素が予測符号化されたことを示す識別情報を前記記憶領域に格納する予測符号化工程とを備え、
前記ランレングス符号化工程は、
前記着目画素の位置からのランをランレングス符号化する際、前記着目画素の水平方向の位置と同じであって、1ライン前の画素位置の符号化履歴情報を前記記憶領域から取得する取得工程と、
前記取得工程で取得した符号化履歴情報に含まれる前記識別情報がランレングス符号化を示す場合には、取得した符号化履歴情報に含まれるの前記パラメータ特定情報で特定される符号化パラメータを初期の符号化パラメータとして決定し、
前記取得工程で取得した符号化履歴情報に含まれる前記識別情報が予測符号化を示す場合には、デフォルトの符号化パラメータを初期のパラメータとして決定する決定工程と、
前記決定工程で決定された初期の符号化パラメータを前記ランに応じて更新しながら、前記ランをランレングス符号化する符号化工程と、
前記符号化工程による符号化を行なった際、ランレングス符号化されたことを示す識別情報、及び、前記ランの符号化を行なった後の前記符号化パラメータを特定する情報を、前記ランを構成する各画素の前記符号化履歴情報として、前記記憶領域に格納する格納工程と
を備えることを特徴とする画像符号化装置の制御方法。
A method of controlling an image encoding device that inputs pixel data in raster scan order and performs run-length encoding or predictive encoding according to dynamically updated encoding parameters,
Encoding history information represented by identification information indicating whether the encoding is performed by run-length encoding or predictive encoding, and specific information for specifying the encoding parameter updated by performing run-length encoding Securing a storage area in the memory for storing for each pixel position;
A determination step for determining whether or not the number of colors represented by a plurality of already encoded pixels located in the vicinity of the pixel of interest is equal to or less than a preset threshold;
If it is determined in the determination step that the number of colors is equal to or less than the threshold value, a run length encoding step of detecting a run from the target pixel and performing a run length encoding on the detected run;
When it is determined in the determination step that the number of colors exceeds the threshold, the target pixel is predictively encoded, and at the same time, identification information indicating that the target pixel has been predictively encoded is stored in the storage area. A process,
The run length encoding step includes:
An acquisition step of acquiring, from the storage area, encoding history information of the pixel position of the previous line that is the same as the horizontal position of the target pixel when the run from the position of the target pixel is run-length encoded. When,
When the identification information included in the encoding history information acquired in the acquisition step indicates run-length encoding, the encoding parameter specified by the parameter specifying information included in the acquired encoding history information is initialized. Is determined as an encoding parameter of
When the identification information included in the encoding history information acquired in the acquisition step indicates predictive encoding, a determination step of determining a default encoding parameter as an initial parameter;
An encoding step for run-length encoding the run while updating the initial encoding parameters determined in the determination step according to the run;
When the encoding is performed by the encoding step, identification information indicating that the run-length encoding has been performed, and information for specifying the encoding parameter after the encoding of the run are configured in the run And a storage step of storing in the storage area as the encoding history information of each pixel to be performed.
コンピュータが読み込み実行することで、前記コンピュータを、請求項6乃至9のいずれか1項に記載の画像符号化装置として機能させることを特徴とするコンピュータプログラム。   A computer program that causes a computer to function as the image encoding device according to any one of claims 6 to 9 when the computer reads and executes the computer program. 請求項5又は11に記載のコンピュータプログラムを格納したことを特徴とするコンピュータ可読記憶媒体。   A computer-readable storage medium, wherein the computer program according to claim 5 or 11 is stored.
JP2007241621A 2007-09-18 2007-09-18 Image coding device and its control method Withdrawn JP2009076992A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007241621A JP2009076992A (en) 2007-09-18 2007-09-18 Image coding device and its control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007241621A JP2009076992A (en) 2007-09-18 2007-09-18 Image coding device and its control method

Publications (1)

Publication Number Publication Date
JP2009076992A true JP2009076992A (en) 2009-04-09

Family

ID=40611577

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007241621A Withdrawn JP2009076992A (en) 2007-09-18 2007-09-18 Image coding device and its control method

Country Status (1)

Country Link
JP (1) JP2009076992A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778769A (en) * 2016-11-23 2017-05-31 北京电子工程总体研究所 A kind of bullet epigraph connected domain extracting method based on FPGA

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778769A (en) * 2016-11-23 2017-05-31 北京电子工程总体研究所 A kind of bullet epigraph connected domain extracting method based on FPGA

Similar Documents

Publication Publication Date Title
JP4732203B2 (en) Image encoding apparatus, decoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP4418762B2 (en) Image encoding apparatus, image decoding apparatus, control method thereof, computer program, and computer-readable storage medium
JP5302336B2 (en) Method and system for compressing blocks of pixels
JP5214742B2 (en) Predictive image processing
US7826670B2 (en) Data compression apparatus and data compression program storage medium
JP5132517B2 (en) Image processing apparatus and image processing method
US7650039B2 (en) Image encoding apparatus, image decoding apparatus, control method therefor, computer program, and computer-readable storage medium
JP5251758B2 (en) Compression encoding apparatus and image display control apparatus
JP2008042688A (en) Image processing apparatus and control method thereof, and computer program and computer readable storage medium
JP2007182060A (en) Image processing device and its control method
JP2008306394A (en) Image processing apparatus and its method
JP5893379B2 (en) Image compression apparatus, image compression method, and computer program
JP2008311792A (en) Device for encoding image and control method therefor
JP2008278042A (en) Image coding device, decoding device, and control method for them
US20150023416A1 (en) Image encoding device and image decoding device
JP2009076992A (en) Image coding device and its control method
JP2008042683A (en) Image processing apparatus and its control method, computer program and computer readable storage medium
JP2009212800A (en) Image compression apparatus
JP2008078826A (en) Image processor and its control method
JP2008042681A (en) Image processing method and processor, computer program and computer readable storage medium
JP2008022376A (en) Image processing device, control method thereof, computer program, and computer readable storage medium
JP5873272B2 (en) Image coding apparatus and control method thereof
CN110913223B (en) Image decompression apparatus, control method thereof, and computer-readable storage medium
JP4343863B2 (en) Image encoding device, image decoding device, and control method thereof
JP5523177B2 (en) Image coding apparatus and control method thereof

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20101207