JP2012249061A - Run length coding device, run length decoding device, run length coding method, and run length decoding method - Google Patents
Run length coding device, run length decoding device, run length coding method, and run length decoding method Download PDFInfo
- Publication number
- JP2012249061A JP2012249061A JP2011118968A JP2011118968A JP2012249061A JP 2012249061 A JP2012249061 A JP 2012249061A JP 2011118968 A JP2011118968 A JP 2011118968A JP 2011118968 A JP2011118968 A JP 2011118968A JP 2012249061 A JP2012249061 A JP 2012249061A
- Authority
- JP
- Japan
- Prior art keywords
- run
- length
- color code
- bits
- code
- 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
Links
Images
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
Description
本発明は、ランレングス符号化に関する技術である。 The present invention is a technique related to run-length encoding.
ランレングス符号化は、画像の内容にもよるが、適した画像であれば、圧縮率が高い、ロスレス圧縮である、及びハードウェア化した場合の回路規模が小さいといった特徴があり、FAX等で広く使用されている。ランレングス符号化の概要に関しては例えば特許文献1、2に記述されている。
Run-length coding depends on the content of the image, but if it is a suitable image, it has features such as a high compression ratio, lossless compression, and a small circuit scale when implemented in hardware. Widely used. An outline of run-length encoding is described in
カメラにおいても、画像に重畳して出力するOSD(オンスクリーンディスプレイ)表示パターンをカメラ内に保持するといった用途でランレングス符号化を適用することができる。これは、予め決まったOSDパターンを表示するのであれば、OSD表示パターンを予めランレングス符号化してランレングスデータとして保持しておき、そのランレングスデータを表示タイミングに合わせてリアルタイムで復号化する方が、フレームバッファ用のRAMが不要で、低コストになるためである。つまり、ランレングス符号化は、圧縮ロスが小さく、復号化回路の回路構成が簡単、かつ、リアルタイム処理が可能といった特徴を持つため、このような用途に適している。 Also in the camera, run-length encoding can be applied for the purpose of holding an OSD (on-screen display) display pattern to be superimposed and output on an image. If a predetermined OSD pattern is to be displayed, the OSD display pattern is run-length encoded in advance and stored as run-length data, and the run-length data is decoded in real time in accordance with the display timing. However, this is because the RAM for the frame buffer is unnecessary and the cost is low. That is, run-length encoding is suitable for such applications because it has features such as a small compression loss, a simple circuit configuration of a decoding circuit, and real-time processing.
OSD表示パターンをランレングス符号化する場合、符号化するパターンは予め分かっているため、画像全体の特徴から符号化のパラメータを最適化することが可能である。 When the OSD display pattern is run-length encoded, since the pattern to be encoded is known in advance, the encoding parameters can be optimized from the characteristics of the entire image.
カラー表示されるOSD表示パターンは、自然画像とは異なり使用する色数は限定される場合が多い。したがって、OSD表示パターンをランレングス符号化する場合、色コードを用いて各色が表され、使用する色数に応じて、色コードのビット数が設定される。そして、各色コードと、各色コードをディスプレイで表示するための色情報とが対応付けられた色コードテーブルを用いて、各色コードが色情報に変換され、ランレングスデータがOSD表示パターンに復号化される。 The OSD display pattern displayed in color is often limited in the number of colors used, unlike a natural image. Therefore, when the OSD display pattern is run-length encoded, each color is represented using a color code, and the number of bits of the color code is set according to the number of colors used. Each color code is converted into color information using a color code table in which each color code is associated with color information for displaying each color code on a display, and run-length data is decoded into an OSD display pattern. The
図29(A)は、8×8のOSD表示パターンをランレングス符号化した一例である。図29(A)において、各グリッドは画素を表し、各グリッド内の数字は各画素の色コードを示している。図29(B)は図29(A)に示すOSD表示パターンを色コードとランレングスとでコード化して得られたランレングスコードである。 FIG. 29A shows an example of run-length encoding of an 8 × 8 OSD display pattern. In FIG. 29A, each grid represents a pixel, and the numbers in each grid indicate the color code of each pixel. FIG. 29B shows a run-length code obtained by encoding the OSD display pattern shown in FIG. 29A with a color code and a run-length.
このランレングスコードは、A、B等のアルファベットがランの色コード(A:色コード0、B:色コード1、...)を示し、それに続く数字がそのランのランレングスを10進数で示している。例えば、最初の“B18”は色コードが1、ランレングスが18のランを示している。また、“B18”の次の“A5”は色コードが0、ランレングスが5のランを示している。
In this run length code, alphabets such as A and B indicate the color code of the run (A:
ランレングス符号化では、水平ラインごとにランを区切って、次の水平ラインは新しいランとする場合もあるが、図29の例では水平ラインが変わる場合もランは区切らず、連続したランとして符号化している。このようにしても、復号化の際に水平画素数を指定することで正しい復号化が可能である。 In run-length encoding, a run may be divided for each horizontal line, and the next horizontal line may be a new run. However, in the example of FIG. 29, a run is not divided even when the horizontal line is changed, and is encoded as a continuous run. It has become. Even in this way, correct decoding is possible by designating the number of horizontal pixels at the time of decoding.
ランレングスコードをビットパターンで表したランレングスデータは、色コード部及び長さ部のそれぞれに所定のビット数が割り当てられたビットパターンで表される。色コード部のビット数は使用する色数で決まり、長さ部のビット数はランレングスデータの符号長を最小にすることができる値が採用される。使用する色数が8色の場合、色コード部のビット数は3bitとなる。また、長さ部のビット数をm、各ランのランレングスを0〜2m−1としたときの、長さ部のビット数と色コード部のビット数との関係は図30のようになる。 The run-length data in which the run-length code is represented by a bit pattern is represented by a bit pattern in which a predetermined number of bits are assigned to each of the color code part and the length part. The number of bits in the color code portion is determined by the number of colors used, and a value that can minimize the code length of the run-length data is adopted as the number of bits in the length portion. When the number of colors used is 8, the number of bits in the color code part is 3 bits. The relationship between the number of bits in the length part and the number of bits in the color code part when the number of bits in the length part is m and the run length of each run is 0 to 2 m−1 is as shown in FIG. Become.
図30は、図29のランレングスコードについて、色コード部のビット数を3として、長さ部のビット数を変えたときの色コード毎のランレングスデータの符号長である。 FIG. 30 shows the code length of run-length data for each color code when the number of bits in the color code part is 3 and the number of bits in the length part is changed for the run-length code in FIG.
図30において1行目には、1、88、168が格納されている。これは、m=1として図29のランレングスコードをビットパターンで表した場合、色コードが0のランレングスデータは符号長が88ビットとなり、色コードが1のランレングスデータは符号長が168ビットになることを示している。 In FIG. 30, 1, 88, 168 are stored in the first row. This is because when m = 1 and the run-length code in FIG. 29 is represented by a bit pattern, the run-length data with a color code of 0 has a code length of 88 bits, and the run-length data with a color code of 1 has a code length of 168. It shows that it becomes a bit.
また、図30において2行目には、2、40、75が格納されている。これは、m=1として、図29のランレングスコードをランレングスデータで表した場合、色コードが0のランレングスデータは符号長が40ビットとなり、色コードが1のランレングスデータは符号長が75ビットになることを示している。 In FIG. 30, 2, 40, 75 are stored in the second row. This is because when m = 1 and the run-length code in FIG. 29 is represented by run-length data, the run-length data with a color code of 0 has a code length of 40 bits, and the run-length data with a color code of 1 has a code length. Indicates 75 bits.
図30の表から分かるように、色コード0については、長さ部のビット数を3にすると、図29のランレングスコードを24ビットのランレングスデータで表すことができ、色コード1については、長さ部のビット数を5にすると、64ビットのランレングスデータで表すことができ、それぞれランレングスデータの符号長を最小にすることができる。
As can be seen from the table of FIG. 30, for the
図31は、色コード0の長さ部のビット数を3、色コード1の長さ部のビット数を5にした場合の図29のランレングスコードのランレングスデータである。
FIG. 31 shows run-length data of the run-length code of FIG. 29 when the number of bits of the length portion of the
図31に示すように、Bで表される色コード1は長さ部のビット数が5であるため、B18は00110010の8ビットで表されている。また、Aで表される色コード0は長さ部のビット数が3であるため、A5は000101の6ビットで表されている。
As shown in FIG. 31, since the
このようにして、図29の“B18〜B17”のランレングスコードをランレングスデータで表すと、図31に示す64ビットのランレングスデータが得られる。 In this way, when the run-length codes “B18 to B17” in FIG. 29 are represented by run-length data, 64-bit run-length data shown in FIG. 31 is obtained.
色コード部のビット数が例えば3の場合、8色の画像を取り扱うことができる。したがって、実際の画像で使用されている色が8色未満の場合、未使用の色コードが発生するが、従来のランレングス符号化においては、この未使用の色コードをどのように取り扱うかに関して全く考慮されていなかった。 When the number of bits in the color code part is 3, for example, an image of 8 colors can be handled. Therefore, when there are less than 8 colors used in the actual image, an unused color code is generated. In the conventional run-length encoding, how to handle this unused color code. It was not considered at all.
また、OSD表示パターンのランレングスデータは、ランレングスの分布には偏りがある場合が多い。図32(A)は、図29のランレングスコードにおいて、色コード1のランのヒストグラムである。図32(B)は、図29のランレングスコードの色コード1において、色コード部のビット数を3ビットとし、長さ部のビット数を1〜5としたときの符号長である。
In addition, the run length data of the OSD display pattern often has a bias in the run length distribution. FIG. 32A is a run histogram of
図32(B)の表から分かるように長さ部のビット数を5にすると符号長を最小にすることができる。しかしながら、ランレングスが2〜3のランは、長さ部のビット数が2であれば十分である。したがって、色コード1について長さ部のビット数を一律に5に設定すると、ランレングスが2〜3のランに対して長さ部のビット数が3ビット余分になり、符号化効率が悪い。これはランレングスの分布に複数の偏りがあることが原因であるが、この複数の偏りに関して、従来のランレングス符号化では全く考慮されていなかった。
As can be seen from the table in FIG. 32B, the code length can be minimized by setting the number of bits in the length part to 5. However, a run with a run length of 2 to 3 is sufficient if the number of bits in the length portion is 2. Therefore, if the number of bits in the length portion is uniformly set to 5 for the
本発明の目的は、原画像データをより効率良くランレングス符号化することができる技術を提供することである。 An object of the present invention is to provide a technique capable of more efficiently run-length encoding original image data.
(1)本発明によるランレングス符号化装置は、所定ビット数で色コードを格納する色コード部と、前記色コード毎にビット数が定められた長さ部とで各ランを表すランレングスデータに原画像データを符号化するランレングス符号化装置であって、前記原画像データを色コードとランレングスとでコード化し、ランレングスコードを生成し、前記ランレングスコードを構成する各色コードにつき、各ランのランレングスのヒストグラムを算出し、算出したヒストグラムに基づいて、ある色コードが割り当てられたランの一部を抽出し、未使用の色コードに割り当てる色コード割当部と、前記色コード割当部による割り当てが終了した後、各色コードにつき、全ランの符号化結果が最小となるビット数を前記長さ部のビット数として求め、各ランを符号化する符号化部とを備える。 (1) A run-length encoding apparatus according to the present invention is a run-length data representing each run by a color code part that stores a color code with a predetermined number of bits and a length part in which the number of bits is determined for each color code. A run-length encoding device that encodes original image data, encoding the original image data with a color code and a run length, generating a run-length code, and for each color code constituting the run-length code, A run length histogram of each run is calculated, a part of a run to which a certain color code is assigned is extracted based on the calculated histogram, and a color code assigning unit assigned to an unused color code, and the color code assignment After the allocation by the part is completed, for each color code, the number of bits that minimizes the encoding result of all runs is obtained as the number of bits of the length part. And a coding unit for coding the down.
この構成によれば、色コードごとのランレングスのヒストグラムに基づき、いずれかの色コードのランが未使用の色コードに振り分けられる。そのため、原画像データを効率良く符号化することができる。 According to this configuration, the run of any one of the color codes is assigned to an unused color code based on the run length histogram for each color code. Therefore, the original image data can be efficiently encoded.
(2)前記符号化部は、各色コードにつき、ランレングスの最小値をベース値として算出するベース値算出部と、各ランにつき、ランレングスから対応する色コードのベース値を差し引き、各ランの差分ランレングスを算出する差分ランレングス算出部と、各色コードにつき、全ランの差分ランレングスを表すことができる最小のビット数を前記長さ部のビット数として求め、各ランを符号化する差分ランレングス符号化部とを備えることが好ましい。 (2) The encoding unit subtracts the base value of the corresponding color code from the run length for each run by subtracting the base value calculation unit that calculates the minimum value of the run length as the base value for each color code. A difference run length calculation unit for calculating a difference run length, and a difference in which each run is encoded by obtaining the minimum number of bits that can represent the difference run length of all runs as the number of bits of the length part for each color code It is preferable to include a run-length encoding unit.
この構成によれば、各色コードにつき、ランレングスの最小値がベース値として算出される。そして、各ランのランレングスから対応する色コードのベース値が差し引かれて差分ランレングスが算出される。そのため、差分ランレングスはベース値からのオフセットを表し、ランレングスよりも小さくなる。よって、差分ランレングスで各ランを表すことで、各ランの符号長をより短くし、ランレングスデータのビット長を更に短くすることができる。 According to this configuration, the minimum run length is calculated as the base value for each color code. Then, a difference run length is calculated by subtracting the base value of the corresponding color code from the run length of each run. Therefore, the differential run length represents an offset from the base value, and is smaller than the run length. Therefore, by representing each run with a differential run length, the code length of each run can be further shortened, and the bit length of the run length data can be further shortened.
(3)前記符号化部は、各色コードにつき、前記ベース値を、前記長さ部のビット数と対応付けてベース値テーブルを生成するベース値テーブル生成部を更に備えることが好ましい。 (3) It is preferable that the encoding unit further includes a base value table generation unit that generates a base value table by associating the base value with the number of bits of the length part for each color code.
この構成によれば、各色コードにつき、ベース値と長さ部のビット数とが対応付けられたベース値テーブルが生成されるため、このベース値テーブルを参照することで、差分ランレングスからランレングスを算出することができる。 According to this configuration, for each color code, a base value table in which the base value and the number of bits of the length part are associated with each other is generated. By referring to this base value table, the difference run length is changed to the run length. Can be calculated.
(4)前記色コード割当部は、前記ヒストグラムからランレングスに複数の偏りがある色コードを特定し、特定した色コードに対し、同じ偏りに属するランを抽出し、前記未使用の色コードを割り当てることが好ましい。 (4) The color code assigning unit identifies a color code having a plurality of deviations in run length from the histogram, extracts a run belonging to the same deviation for the identified color code, and selects the unused color code. It is preferable to assign.
この構成によれば、各色コードに複数の偏りがある場合、これらの偏りが分散されるように、各色コードにランが割り当てられる。そのため、符号化効率を改善することができる。 According to this configuration, when there are a plurality of deviations in each color code, a run is assigned to each color code so that these deviations are distributed. Therefore, encoding efficiency can be improved.
(5)前記色コード割当部は、各色コードにつき、前記長さ部のビット数の分割位置を変えながら符号長の削減量を算出し、前記削減量を最大化する分割位置を持つ色コードを、前記複数の偏りがある色コードとして特定し、特定した色コードにおいて、前記削減量を最大化する分割位置より大きなビット数で表されるランレングスを持つランを抽出し、前記未使用の色コードを割り当てることが好ましい。 (5) The color code allocating unit calculates a code length reduction amount while changing a division position of the number of bits of the length portion for each color code, and selects a color code having a division position that maximizes the reduction amount. The color codes having a plurality of biases are extracted, and in the specified color code, a run having a run length represented by a bit number larger than a division position that maximizes the reduction amount is extracted, and the unused color is extracted. It is preferable to assign a code.
この構成によれば、各色コードにおいて長さ部のビット数を分割するための分割位置をより正確に求めることができる。 According to this configuration, the division position for dividing the number of bits of the length portion in each color code can be obtained more accurately.
(6)本発明によるランレングス復号化装置は、所定ビット数で色コードを格納する色コード部と、前記色コード毎にビット数が定められた長さ部とを用いて各ランを表すランレングスデータを原画像データに復号化するランレングス復号化装置であって、前記長さ部は、各ランのランレングスから各ランのベース値を差し引いた差分ランレングスを格納し、前記ベース値は、各色コードにおけるランレングスの最小値を示し、各色コードにつき、前記ベース値と前記長さ部のビット数とが対応付けられたベース値テーブルを保持するベース値テーブル保持部と、各色コードをビットマップ形式で表すための色情報を保持する色情報保持部と、前記ランレングスデータから色コードを特定し、特定した色コードに対応する前記長さ部のビット数を前記ベース値テーブルから特定し、特定したビット数分の前記色コードに続く前記ランレングスデータを差分ランレングスとして抽出する差分ランレングス抽出部と、前記差分ランレングス抽出部により抽出された差分ランレングスに対応するベース値を加算し、ランレングスを算出する加算部と、前記加算部により算出されたランレングス及び前記色情報に基づいて前記ランレングスデータを前記原画像データに復号化する復号化部とを備える。 (6) A run-length decoding apparatus according to the present invention uses a color code part that stores a color code with a predetermined number of bits and a length part in which the number of bits is determined for each color code to represent each run. A run-length decoding device that decodes length data into original image data, wherein the length section stores a differential run length obtained by subtracting the base value of each run from the run length of each run, and the base value is , A minimum value of run length in each color code, a base value table holding unit for holding a base value table in which the base value and the number of bits of the length part are associated with each color code, and each color code in bits A color information holding unit that holds color information to be expressed in a map format, a color code specified from the run-length data, and a bit of the length part corresponding to the specified color code Is determined from the base value table, and the run length data following the color code for the specified number of bits is extracted as a difference run length, and the difference run extracted by the difference run length extraction unit An adder that adds a base value corresponding to a length and calculates a run length; and a decoding that decodes the run length data into the original image data based on the run length calculated by the adder and the color information A part.
この構成によれば、差分ランレングスを用いて各ランが表された符号化ランレングスを復号化することができる。 According to this configuration, it is possible to decode the encoded run length in which each run is represented using the differential run length.
本発明によれば、原画像データを効率良くランレングスデータに符号化することができる。 According to the present invention, original image data can be efficiently encoded into run-length data.
図1は、本発明の実施の形態によるランレングス符号化装置のブロック図である。ランレングス符号化装置は、画像取得部11、テーブル保持部12、色コード割当部13、符号化部14、及びランレングスデータ保持部16を備えている。
FIG. 1 is a block diagram of a run-length encoding apparatus according to an embodiment of the present invention. The run-length encoding apparatus includes an
画像取得部11は、符号化対象となる原画像データを取得する。ここで、原画像データは、例えば、複数の画素がマトリックス状に配列されたデータ構造を持つ。また、各画素は、R,G,B、及び透明度の4成分からなる画素値を持つ。
The
色コード割当部13は、画像取得部11により取得された原画像データの各画素に対して色毎に色コードを付す。そして、色コードを付した原画像データを色コードとランレングスとでコード化し、ランレングスコードを生成する。ここで、ランレングスコードは、複数のランから構成されている。各ランは、色コードとランレングスとで構成されている。色コードはランの色を示す。ランレングスはランの長さを示す。
The color
例えば、図29(A)の例では、左上の画素からラスタ走査していくと、色コード1の画素が18個連続している。そのため、これら18個の画素が1つのランとなる。そして、色コード1に対応する符号Bがこのランの色コードとして設定される。なお、図29(B)の例では、色コード0,1は、それぞれA,Bの符号で表されている。
For example, in the example of FIG. 29A, when raster scanning is performed from the upper left pixel, 18 pixels of
また、この1つのランには18個の画素が含まれるため、この1つのランのランレングスとして10進数の18が設定される。色コード割当部13は、図29(A)に示す色コードを付与した原画像データに対してこの処理を繰り返し、図29(B)に示すランレングスコードを生成する。
Further, since this one run includes 18 pixels, the
また、色コード割当部13は、生成したランレングスコードを構成する各色コードにつき、各ランのランレングスのヒストグラムを算出し、算出したヒストグラムに基づいて、ある色コードが割り当てられたランの一部を抽出し、未使用の色コードに割り当てる。
The color
図29(A)の例では、原画像データには色コード0、色コード1が含まれているため、それぞれの色コード0,1のヒストグラムが算出される。この例において、色コード1に対しては、例えば図32(A)で示すようなヒストグラムが算出される。つまり、色コード割当部13は、ランレングスのビット長を複数の階級に分け、各ランのランレングスがどの階級に属するかを特定し、特定した階級に投票することでヒストグラムを算出し、テーブル保持部12に保持する。
In the example of FIG. 29A, since the original image data includes
本実施の形態では、最終的に色コードを3ビットのビット列で2進数表示する。そのため、色コードは、最大8つの色コードを表すことができるが、図29(A)の原画像データでは色コードが2つしか使用されていないため、6つの色コードが未使用となっている。 In the present embodiment, the color code is finally displayed as a binary number in a 3-bit bit string. Therefore, although the color code can represent a maximum of eight color codes, since only two color codes are used in the original image data of FIG. 29A, six color codes are unused. Yes.
そこで、色コード割当部13は、未使用の色コードがある場合、色コードごとのランレングスのヒストグラムに基づき、いずれかの色コードのランを未使用の色コードに振り分けることにより、符号化効率を改善している。
Therefore, when there is an unused color code, the color
図32(A)の例では、ランレングスが2〜3と16〜31に偏って分布している。そこで、色コード割当部13は、ランレングスが2〜3のランの色コードに対し、未使用の色コード2を割り当てる。つまり、色コード割当部13は、ランレングスに複数の偏りがある色コードに対し、同じ偏りに属するランを抽出し、未使用の色コードを割り当てる。
In the example of FIG. 32 (A), the run lengths are distributed in a biased way to 2-3 and 16-31. Therefore, the color
図2(A)は、図29(A)の例において、色コードが1、かつ、ランレングスが2〜3のランに色コード2を割り当てたときの原画像データである。図2(A)に示すように、図29(A)で色コード1が付与されていた画素が色コード2に変更されている。図2(B)は、図2(A)の原画像データのランレングスコードである。この例では、色コード2に対してCの符号が割り当てられ、ランレングスコードが表されている。
FIG. 2A shows original image data when
また、色コード割当部13は、各色コードと長さ部のビット数とが対応付けられた色コードテーブル(図19参照)を生成し、テーブル保持部12に保持する。
In addition, the color
そして、色コード割当部13は、色コードの割り当てを変更すると、その割り当ての変更が反映されるように色コードテーブル及びヒストグラムをそれぞれ更新する。具体的には、色コード割当部13は、あるランにつき色コードの割り当てを変更した場合、そのランの当初の色コードと変更後の色コードとが対応付けられるように色コードテーブルを更新する。
Then, when the color code assignment is changed, the color
このように、色コードテーブルを更新することで、復号化を行う際、色コードの割り当てが変更されたランについて、そのランが当初持っていた色を再現することができる。 In this way, by updating the color code table, when decoding is performed, the color originally assigned to the run can be reproduced for the run whose color code assignment is changed.
符号化部14は、色コード割当部13による割り当てが終了した後、各色コードにつき、全ランの符号化結果が最小となるビット数を長さ部のビット数として求め、各ランを符号化し、ランレングスコードをビットパターンで表したランレングスデータを求める。ここで、ランレングスデータは、各ランを色コード部と長さ部とで表すデータ構造を持っている。色コード部のビット数は3である。
After the assignment by the color
図3は、図2(B)のランレングスコードを、長さ部のビット数を変えて符号化したときの色コード別の符号長である。色コード0は長さ部のビット数を3、色コード1は長さ部のビット数を5、色コード2は長さ部のビット数を2に設定すると、ランレングスデータの符号長が55ビットとなり、符号長を最小にすることができる。一方、色コード1の一部のランを色コード2に割り当てる前は、図30に示すようにランレングスデータの符号長は64ビットであった。したがって、色コード1のランのうち、ランレングスが2〜3のランを色コード2に割り当てることで、符号号化効率を改善することができる。
FIG. 3 shows the code length for each color code when the run-length code in FIG. 2B is encoded by changing the number of bits in the length portion. If
具体的には、符号化部14は、ベース値算出部141、差分ランレングス算出部142、差分ランレングス符号化部143、及びベース値テーブル生成部144を備えている。
Specifically, the
ベース値算出部141は、画像取得部11により取得された原画像データから、色コード割当部13と同様にしてランレングスコードを生成し、各色コードにつき、ランレングスの最小値をベース値として算出する。差分ランレングス算出部142は、画像取得部11により取得された原画像データから色コード割当部13と同様にしてランレングスコードを生成し、各ランにつき、ランレングスから対応する色コードのベース値を差し引き各ランの差分ランレングスを算出する。
The base
差分ランレングス符号化部143は、画像取得部11により取得された原画像データから色コード割当部13と同様にしてランレングスコードを生成し、各色コードにつき、全ランの差分ランレングスを表すことができる最小のビット数を長さ部のビット数として求め、各ランを符号化する。
The difference run
ベース値テーブル生成部144は、ベース値算出部141により各色コードについて算出されたベース値を、差分ランレングス符号化部143により各色コードについて算出された長さ部のビット数と対応付けてベース値テーブルを生成し、テーブル保持部12に保持する。
The base value
図4は、ベース値テーブルが生成される処理を示した図である。図4(A)は図2(A)の色コードが付された原画像データであり、(B)は(A)の原画像データを差分ランレングスを用いて表したときのランレングスコードであり、(C)はベース値テーブルである。 FIG. 4 is a diagram illustrating processing for generating a base value table. 4A is the original image data to which the color code of FIG. 2A is attached, and FIG. 4B is a run-length code when the original image data of (A) is expressed using a differential run-length. Yes, (C) is a base value table.
図4(C)の例では、色コード0,1,2のベース値はそれぞれ5,17,2と算出されている。よって、図2(B)で“B18”と表されていたランの差分ランレングスは18−17=1となる。したがって、このB18のランは図4(B)ではB1と表されている。他のランについても同様に差分ランレングスが求められる。そして、各色コードにつき、全差分ランレングスを表すことができるビット数が求められる。すると、図4(C)に示すように、色コード0,1,2の長さ部のビット数はそれぞれ1と算出される。以上により、図4(C)に示すように、各色コードにつき、長さ部のビット数とベース値とが対応付けられたベース値テーブルが生成される。
In the example of FIG. 4C, the base values of the
図4(B)に示すランレングスコードをランレングスデータで表すと、符号長は36ビットであった。したがって、図2(B)で色コードを振り分けることで55ビットに削減された符号長が、更に36ビットまで削減され、符号化効率が改善されている。 When the run-length code shown in FIG. 4B is represented by run-length data, the code length is 36 bits. Therefore, the code length reduced to 55 bits by distributing the color code in FIG. 2B is further reduced to 36 bits, and the encoding efficiency is improved.
図1に戻り、ランレングスデータ保持部16は、差分ランレングス符号化部143により生成されたランレングスデータを保持する。
Returning to FIG. 1, the run-length
このように、ベース値からのランレングスのオフセットを表す差分ランレングスを用いて各ランを表すことで、各ランの符号長をより短くし、ランレングスデータの符号長を更に短くすることができる。 In this way, by representing each run using the differential run length representing the run length offset from the base value, the code length of each run can be further shortened, and the code length of the run length data can be further shortened. .
図5は、本発明の実施の形態によるランレングス復号化装置のブロック図である。ランレングス復号化装置は、図1に示すランレングス符号化装置で生成されたランレングスデータを復号する。 FIG. 5 is a block diagram of a run-length decoding apparatus according to the embodiment of the present invention. The run-length decoding apparatus decodes run-length data generated by the run-length encoding apparatus shown in FIG.
具体的には、ランレングス復号装置は、ベース値テーブル保持部51、色情報保持部52、差分ランレングス抽出部53、加算部54、及び復号化部55を備えている。
Specifically, the run length decoding apparatus includes a base value
ベース値テーブル保持部51は、各色コードにつき、ベース値と長さ部のビット数とが対応付けられたベース値テーブルを保持する。つまり、ベース値テーブル保持部51は、図1に示すランレングス符号化装置により生成されたベース値テーブルを保持する。
The base value
図5に示すようにベース値テーブル保持部51は、図4(C)に示すベース値テーブルと同じものを記憶している。
As shown in FIG. 5, the base value
色情報保持部52は、ランレングスデータをビットマップデータに展開する際に必要となる色情報を保持する。図5に示すように色情報保持部52は、各色コードに対し、R,G,Bの画素値と透明度αを示す画素値との4つの画素値が対応付けられた色情報テーブルを保持している。
The color
差分ランレングス抽出部53は、ランレングス符号化装置により生成されたランレングスデータから色コードを特定し、特定した色コードに対応する長さ部のビット数をベース値テーブルから特定し、特定したビット数分の色コードに続くランレングスデータを差分ランレングスとして抽出する。
The difference run-
具体的には、差分ランレングス抽出部53は、まず、ランレングスデータの最初の3ビットに格納された符号列を抽出する。本実施の形態では、ランレングスデータは、各ランが色コード部と長さ部との順で表され、色コード部のビット数は3ビットである。したがって、ランレングスデータの最初の3ビットは色コードを表すことになる。図5の例では、最初の3ビットに001の符号列が格納されている。よって、差分ランレングス抽出部53は、最初のランの色コード1と判定する。
Specifically, the differential run
次に、差分ランレングス抽出部53は、色コード1に対応する長さ部のビット数をベース値テーブルから特定する。この場合、色コード1に対応する長さ部のビット数は1である。よって、差分ランレングス抽出部53は、最初のランの長さ部のビット数は1と判定する。
Next, the differential run
次に、差分ランレングス抽出部53は、最初のランの色コードに続く、1ビットのランレングスデータを差分ランレングスとして抽出する。この場合、差分ランレングスは1である。つまり、最初のランは色コードが001の符号列で表され、長さ部が1の符号列で表されている。よって、差分ランレングス抽出部53は、ランレングスデータの5,6,7番目の3ビットを2番目のランの色コード部と判定する。差分ランレングス抽出部53は、以上の処理を繰り返し、ランレングスデータに含まれる色コードと差分ランレングスとを順次に特定する。
Next, the differential run
加算部54は、差分ランレングス抽出部53により抽出された差分ランレングスに対応するベース値を加算し、ランレングスを算出する。図5の例では、最初のランの差分ランレングスは1である。また、最初のランの色コードは1である。よって、加算部54は、色コード1に対応する長さ部のベース値である17をベース値テーブルから読み出す。そして、加算部54は、読み出したベース値である17に差分ランレングスである1を加算し、ランレングスを算出する。この場合、ランレングスは18となり、図2(B)に示す“B18”が再現される。
The adding
復号化部55は、加算部54により算出されたランレングス及び色情報テーブルに基づいてランレングスデータをビットマップデータに展開する。先の例では、最初のランの色コードは1であり、レングスは18であった。
The
したがって、復号化部55は、色コード1に対応するR,G,B,αの画素値を色情報テーブルから読み出し、連続する18個の画素に対して、色コード1に対応するR,G,B,αの画素値を設定し、各画素を順次に出力することで、ランレングスデータをビットマップデータに展開する。これにより原画像データが得られる。
Therefore, the
例えば、復号化部55は、撮像系で撮像された撮像画像データが展開されたフレームバッファに画素値を書き込むことでビットマップデータに展開する。その結果、OSD表示パターン専用のフレームバッファが不要となる。そして、復号化部55は、各ランに対して上記の処理を繰り返し、OSD表示パターンを撮像画像データに重畳表示する。
For example, the
(実施例1)
次に、図5に示すランレングス復号化装置を車載用カメラに適用した実施例1について説明する。車載用カメラでは、バックビューモニタ用途での車幅線表示など、撮像画像にグラフィックを重畳して出力する機能が求められる。このグラフィックがOSD表示パターンである。
Example 1
Next, a first embodiment in which the run-length decoding apparatus shown in FIG. 5 is applied to a vehicle-mounted camera will be described. A vehicle-mounted camera is required to have a function of superimposing a graphic on a captured image and outputting it, such as a vehicle width line display for backview monitor applications. This graphic is an OSD display pattern.
OSD表示パターンを表示する方法として、ECUなどではOSD表示パターン専用のフレームバッファを設け、グラフィックコントローラでフレームバッファにOSDパターンを描画する構成が採用される。 As a method for displaying the OSD display pattern, a configuration in which a frame buffer dedicated to the OSD display pattern is provided in the ECU or the like and the OSD pattern is drawn in the frame buffer by a graphic controller is adopted.
図6は、図5に示すランレングス符号化装置が適用されていない比較例の車載用カメラの機能ブロック図である。図6に示す車載用カメラは、撮像系61、画像処理回路62、グラフィックコントローラ63、フレームバッファ64、及び出力制御部65を備えている。
FIG. 6 is a functional block diagram of a vehicle-mounted camera of a comparative example to which the run-length encoding device shown in FIG. 5 is not applied. The in-vehicle camera shown in FIG. 6 includes an
撮像系61は、所定のフレームレートで被写体を撮像するカメラにより構成され、撮像画像データを取得する。画像処理回路62は、撮像系61により取得された撮像画像データに対し、ガンマ補正等の所定の画像処理を行う。グラフィックコントローラ63は、描画回路631及び重畳回路632を備えている。
The
描画回路631は、CPUから描画命令を受け、OSD表示パターンをフレームバッファ64に生成する。重畳回路632は、フレームバッファ64に展開されたOSD表示パターンと、画像処理回路62から出力された撮像画像データとを重畳し、出力制御部65に出力する。具体的には、重畳回路632は、画像処理回路62から入力される撮像画像データに同期してフレームバッファ64からOSD表示パターンを読み出し、画素演算により重畳結果を生成する。出力制御部65は、重畳結果画像をNTSC信号やデジタル信号として外部に出力する。
The
このように、比較例の車載用カメラの構成ではフレームバッファ64として、大容量のRAMが必要となる。また、描画回路631を備えるグラフィックコントローラ63が必要になり、コストが嵩む。
Thus, the configuration of the in-vehicle camera of the comparative example requires a large-capacity RAM as the
車載用途で必要となるOSD表示パターンは、車幅線等の予め決められたグラフィック画像が採用される。そのため、必要なOSD表示パターンを符号化し、データとして保持しておき、表示時にリアルタイムで復号化して表示する構成を採用すると、フレームバッファ64や描画回路631が不要となり、コストダウンが可能である。
The OSD display pattern required for in-vehicle use employs a predetermined graphic image such as a vehicle width line. Therefore, if a configuration is adopted in which a necessary OSD display pattern is encoded and stored as data, and decoded and displayed in real time at the time of display, the
図7は、図5に示すランレングス復号化装置が適用された車載用カメラの機能ブロック図である。図7に示す車載用カメラは、撮像系71、画像処理回路72、重畳回路73、符号データRAM74、復号化回路75、及び出力制御部76を備えている。
FIG. 7 is a functional block diagram of a vehicle-mounted camera to which the run-length decoding device shown in FIG. 5 is applied. The in-vehicle camera shown in FIG. 7 includes an
撮像系71、画像処理回路72、及び出力制御部76は、図6のものと同じである。符号データRAM74は、図1に示すランレングス符号化装置により予め生成されたランレングスデータを保持する。復号化回路75は、図5に示すランレングス復号化装置により構成されている。重畳回路73は、画像処理回路72から出力される撮像画像データと、復号化回路75から出力されるOSD表示パターンとを重畳し、重畳結果を出力する。
The
この構成によれば、OSD表示パターンの復号化が、車載用カメラ内部において、表示時にリアルタイムで行われる。そのため、比較例の車載用カメラのように描画回路631及びOSD表示パターン専用のフレームバッファ64が不要となり、装置構成を簡略化し、コストダウンを図ることができる。
According to this configuration, the decoding of the OSD display pattern is performed in real time at the time of display inside the vehicle-mounted camera. This eliminates the need for the
また、符号データRAM74が保持するランレングス符号化されたOSD表示パターンは、車載用カメラの外部で生成されるため、符号化アルゴリズムが複雑化してもコストに対する影響は少ない。また、ランレングスデータの復号化は比較的簡素な処理で実現できるため、表示時においてリアルタイムの復号化が可能となり、車載用カメラにとって好適である。
In addition, since the run-length encoded OSD display pattern held in the
図8は、図5に示すランレングス復号化装置が適用された車載用カメラのハードウェア構成を示すブロック図である。 FIG. 8 is a block diagram showing a hardware configuration of a vehicle-mounted camera to which the run-length decoding device shown in FIG. 5 is applied.
図8に示す車載用カメラは、撮像系81、画像処理回路82、OSD表示制御部83、出力制御部84、CPU85、RAM86、ROM87、及びI/O88を備えている。撮像系81〜I/O88はそれぞれ、バスライン89を介して相互に接続されている。
The in-vehicle camera shown in FIG. 8 includes an
撮像系81及び画像処理回路82は、それぞれ図7の撮像系71及び画像処理回路72を構成する。OSD表示制御部83は、図7に示す復号化回路75、符号データRAM74、及び重畳回路73を構成する。出力制御部84は図7に示す出力制御部76を構成する。CPU85は、車載用カメラの全体制御を司る。RAM86は、CPU85のワーキングメモリとして使用される。ROM87は予め作成されたランレングスデータを保持している。I/O88は、例えばECUとの間で各種の制御信号を入出力する。出力制御部84は、OSD表示パターンと撮像画像データとを重畳した画像データをデジタルの画像信号として外部に出力する、或いは、NTSC信号に変換して外部に出力する。
The
図9は、図8に示す車載用カメラにおいて、6種類のOSD表示パターンを撮像画像データに重畳して出力する場合のOSD表示制御部83の機能ブロック図である。
FIG. 9 is a functional block diagram of the OSD
図9に示すOSD表示制御部は、6種類のOSD表示パターンを表示時にリアルタイムに復号化して出力するものである。このOSD表示制御部は、図7に示す符号データRAM74、復号化回路75、及び重畳回路73からなる復号化ユニットが6段設けられている。
The OSD display control unit shown in FIG. 9 decodes and outputs six types of OSD display patterns in real time during display. The OSD display control unit is provided with six stages of decoding units including a
1段目の重畳回路73には、図7に示す撮像系71が画像処理回路72を介して接続され、撮像系71により撮像された撮像画像データが入力される。
An
1段目〜6段目の符号データRAM74は、それぞれ、それぞれ、6種類のOSD表示パターンである第1〜第6のOSD表示パターンをランレングス符号化することで予め得られたランレングスデータを保持している。そして、1段目〜6段目の符号データRAM74は、CPU85からの復号化開始の制御信号を受け付けると、保持するランレングスデータを復号化回路75に出力し、復号化回路75に復号化処理を実行させる。
The
復号化回路75は、ランレングスデータを復号化して重畳回路73に出力する。1段目の重畳回路73は1段目の復号化回路75から出力された第1のOSD表示パターンと撮像画像データを重畳して2段目の重畳回路73に出力する。2段目〜5段目の重畳回路73は、それぞれ、上段の重畳回路73から出力された画像データに第2〜第5のOSD表示パターンを重畳し、下段の重畳回路73に出力する。
The
6段目の重畳回路73は、5段目の重畳回路73から出力された画像データに第6のOSD表示パターンを重畳し、出力制御部76に出力する。これにより撮像画像データに第1〜第6のOSD表示パターンが重畳された画像データが出力制御部76に出力される。
The sixth
図10は、ランレングス符号化装置が車載用カメラにランレングスデータを書き込む際の処理を示したブロック図である。 FIG. 10 is a block diagram showing processing when the run-length encoding apparatus writes run-length data to the vehicle-mounted camera.
コンピュータ101は、図1に示すランレングス符号化装置の機能を実現する。まず、コンピュータ101はグラフィック作成ツールを起動し、デザイナーからの操作指示にしたがって、OSD表示パターンを生成する(工程1)。
The
次に、コンピュータ101は、生成したOSD表示パターンをランレングス符号化し、ランレングスデータを生成する(工程2)。次に、コンピュータ101は、生成したランレングスデータを車載用カメラ102のROMに書き込む(工程3)。これにより、車載用カメラ102はランレングスデータを得る。このとき、コンピュータ101は、ランレングスデータを復号化するために必要となる色コードテーブル及びベース値テーブルもROM87に書き込む。
Next, the
なお、コンピュータ101は、例えば車載用カメラ102が備えるI/O88とケーブルを介して接続され、ランレングスデータ等を車載用カメラ102に出力する。
The
次に、OSD表示制御部83がROM87からランレングス符号化データを読み出し(工程4)、復号化してOSD表示パターンを生成し、出力制御部84を介して外部に出力する。
Next, the OSD
(実施例2)
次に、実施例1の車載用カメラで使用されるOSD表示パターンを図1に示すランレングス符号化装置を用いてランレングス符号化する実施例2について説明する。
(Example 2)
Next, a second embodiment in which the OSD display pattern used in the vehicle-mounted camera of the first embodiment is run-length encoded using the run-length encoding device shown in FIG.
図10に示す車載用カメラ102の仕様は下記の通りである。
The specifications of the in-
OSD表示パターンの重畳数:6個
同時表示可能色数:8色/面
色コードのビット数:3bit
符号データRAM74:色コードが3bitなので、3bit/wordのRAMを使用する。回路を簡単にするため各ランの長さ部は3bitの倍数とする。
Number of superimposed OSD display patterns: 6 Number of simultaneously displayable colors: 8 colors / surface Number of color code bits: 3 bits
Code data RAM 74: Since the color code is 3 bits, a RAM of 3 bits / word is used. In order to simplify the circuit, the length of each run is a multiple of 3 bits.
符号データRAM74のサイズ:2049bit/面(3bit/word×683word)
表示色:RGB24bit→各面の各色コードに対応した色情報テーブルを設け、3bitの色コードをRGB24bitの画素データに変換する。
Display color: RGB 24-bit → Color information table corresponding to each color code on each surface is provided, and a 3-bit color code is converted into RGB 24-bit pixel data.
透過表示制御:0(透過率0)〜1(透過率100%)を1/16ステップの17段階で指定する。 Transmission display control: 0 (transmittance 0) to 1 (transmittance 100%) is designated in 17 steps of 1/16 steps.
出力される画像データ:360×480pixel,24bit/pixel
このように、符号データRAM74のサイズが2KBに限定されているため、各OSD表示パターンは2KB以下のサイズに符号化しなければならず、符号化効率のよい符号化アルゴリズムが必要となる。
Output image data: 360 × 480 pixels, 24 bits / pixel
Thus, since the size of the
<ランレングス符号化>
図11(A)は、図1に示すランレングス符号化装置が行うランレングス符号化処理を示したフローチャートである。図17は、実施例2でランレングス符号化の対象となるOSD表示パターンを示した図である。
<Run-length encoding>
FIG. 11A is a flowchart showing a run-length encoding process performed by the run-length encoding apparatus shown in FIG. FIG. 17 is a diagram illustrating an OSD display pattern that is a target of run-length encoding in the second embodiment.
このOSD表示パターンは、360×480の画素から構成され、3つの色コードを持っている。画面中央に示す傾斜した波線からなるグラフィックには色コード5が付与されている。OSD表示パターンの外周を覆う外枠のグラフィックには色コード6が付与されている。OSD表示パターンの傾斜した波線からなるグラフィックの背景のグラフィックには色コード0が付与されている。
This OSD display pattern is composed of 360 × 480 pixels and has three color codes. A
まず、色コード割当部13は、色コード分割処理を行う(S1)。次に、符号化部14は、ベース値算出処理を行う(S2)。次に、符号化部14は、ランレングス符号化を行い、ランレングスデータを生成する(S3)。
First, the color
<色コード分割処理>
図12は、図11(A)の色コード分割処理のサブルーチンを示すフローチャートである。まず、色コード割当部13は、初期化を行う。このとき、色コード割当部13は、初期の色コードテーブルを生成する(S11)。
<Color code division processing>
FIG. 12 is a flowchart showing a subroutine of color code division processing in FIG. First, the color
図19は、初期の色コードテーブルである。色コードテーブルは、色コードのフィールドと長さ部ビット数のフィールドとを備えている。色コードテーブルのフィールドには0(A)〜7(H)の8色の色コードが格納されている。長さ部ビット数のフィールドには、各色コードにおいて、長さ部のビット数毎に割り当てられた色コードが示されている。 FIG. 19 is an initial color code table. The color code table includes a color code field and a length bit number field. The color code table field stores eight color codes of 0 (A) to 7 (H). In the length part bit number field, a color code assigned to each length part bit number is shown in each color code.
図19の例では、長さ部ビット数は、0ビット、3ビット、6ビットというように3ビット毎区切られている。これは、符号データRAMを3bit/wordとしたためである。 In the example of FIG. 19, the number of bits in the length part is divided every 3 bits, such as 0 bits, 3 bits, and 6 bits. This is because the code data RAM is set to 3 bits / word.
図19は初期の色コードテーブルであるため、色コード0〜7のそれぞれに対して、長さ部ビット数にかかわらず、色コード0〜7が割り当てられている。
Since FIG. 19 is an initial color code table, the
また、S11において、色コード割当部13は、図20に示す符号長テーブルを生成する。図20は、初期の符号長テーブルである。符号長テーブルは、色コードテーブルと同様のデータ構造を持っている。そして、この符号長テーブルは、各色コードにつき、長さ部のビット数を変えたときのランレングスデータの符号長を示している。
In S11, the color
例えば、1行1列目のセルにはdda90が格納されている。これは、色コード0につき、長さ部のビット数を0ビットにしたとき、色コード0のグラフィックのランレングスデータの符号長がdda90ビットであったからである。
For example, dda90 is stored in the cell in the first row and the first column. This is because the code length of the run length data of the
図20に示すように、色コード0については、長さ部のビット数を9ビットにしたとき、符号長が1ef0となり最小となる。そのため、色コード割当部13は、色コード0の長さ部のビット数を9に設定する。
As shown in FIG. 20, for the
同様に色コード5,6については、それぞれ、長さ部のビット数を6ビットに設定したとき、符号長が最小となる。よって、色コード割当部13は、色コード5,6の長さ部のビット数をそれぞれ6に設定する。
Similarly, for the
なお、色コード0,5,6のそれぞれにつき、長さ部のビット数を9,6,6に設定したときのランレングスデータのトータルの符号長は、1ef0+06e4+14c7=449b=17,563bitとなる。
For each of the
図12に戻り、色コード割当部13は、ヒストグラムを作成する(S12)。図18は、初期のヒストグラムである。ヒストグラムは、色コードテーブルと同様のデータ構造を持っている。なお、ヒストグラムの各セルに格納された数値は16進数である。
Returning to FIG. 12, the color
図17のOSD表示パターンでは、色コード0のグラフィックにおいて、長さ部のビット数が0ビットより大きく3ビット以下で表すことのできるランの個数が6個であったため、1行2列目のセルには6が格納されている。また、色コード0のグラフィックにおいて、長さ部のビット数が3ビットより大きく6ビット以下で表すことができるランの個数が48個であったため、1行4列目のセルには48が格納されている。
In the OSD display pattern of FIG. 17, in the
また、図17に示すOSD表示パターンは、色コード0のグラフィックの他に、色コード5のグラフィックと色コード6のグラフィックとが存在するため、色コード5、6の該当するセルに数値が格納されている。色コード0,5,6以外の色コードのセルには、数値は格納されていない。
In addition, since the OSD display pattern shown in FIG. 17 includes a
図12に戻り、色コード割当部13は、未使用の色コードが存在するか否かを判定する(S13)。未使用の色コードが存在する場合(S13でYES)、色コード割当部13は、色コード分割位置を算出する(S14)。図18に示す初期のヒストグラムには、色コード0,5,6以外の色コードのセルには数値が格納されていないため、色コード割当部13は、未使用の色コードが存在すると判定する。
Returning to FIG. 12, the color
一方、未使用の色コードが存在しない場合(S13でNO)、処理をリターンさせる。この場合、ヒストグラムにおいて、初期状態で色コードが割り当てられていなかった色コードのいずれかのセルにおいて、数値が格納されていれば、未使用の色コードはないと判定される。 On the other hand, if there is no unused color code (NO in S13), the process is returned. In this case, if a numerical value is stored in any cell of the color code to which no color code is assigned in the initial state in the histogram, it is determined that there is no unused color code.
<S14>色コード分割位置算出処理
以下、S14の色コード分割位置算出処理について詳細に説明する。まず、色コード割当部13は、各色コードにつき、長さ部のビット数の分割位置を変えながら、現在の長さ部のビット数に対してどれだけ符号長を削減させることができるかを示す符号長削減量テーブルを算出する。そして、符号長削減量テーブルに基づいて、削減量を最大化することができる色コードの分割位置を算出する。図21は、符号長削減量テーブルである。なお、符号長削減量テーブルは、色コードテーブルと同様のデータ構造を持っている。
<S14> Color Code Division Position Calculation Processing Hereinafter, the color code division position calculation processing in S14 will be described in detail. First, the color
色コード割当部13は、現在、色コード0,5,6につき、長さ部のビット数を9,6,6に設定している。そのため、図21に示す符号長削減量テーブルは、この場合と比較したときの符号長の削減量を示している。
The color
色コード0において、分割位置を3ビットとすると、削減量は36ビットとなる。ここで、分割位置が3ビットとは、色コード0において、長さ部のビット数が3ビット以下のランは長さ部のビット数を3ビットとしてランレングス符号化を行い、長さ部のビット数が3ビットより大きいランは、分割前の長さ部のビット数(色コード0の場合は9ビット)でランレングス符号化を行った場合を示している。
In
同様に、色コード0において、分割位置を6ビットにすると、削減量は234ビットとなる。このことから、色コード0については、分割位置を6ビットすると、削減量を最大にすることができる。色コード5,6についても色コード0と同様に長さ部のビット数を変えながら削減量を求める。その結果、色コード5については、分割位置を3ビット、色コード6については分割位置を6ビット又は9ビットにすると削減量を最大にすることができる。
Similarly, in
そして、色コード割当部13は、図21に示す符号長削減量テーブルにおいて、全色コードのうち、削減量が最大の色コードを分割対象の色コードとして決定する。この場合、色コード6の6又は9ビットの削減量が1122ビットであるため、色コード6が分割対象の色コードとして決定される。
Then, the color
そして、色コード割当部13は、色コード6において、削減量が最大である6ビット、又は9ビットを分割位置として決定する。なお、色コード6では、分割位置を6ビット、9ビットとしても削減量は同じである。このような場合、色コード割当部13は、小さい方の6ビットを分割位置とするが、これに限定されず、大きい方の9ビットを分割位置にしてもよい。
Then, the color
<S15>ヒストグラム分割処理
図12に戻り、S15において、色コード割当部13は、色コード6の分割位置を6ビットとしたため、色コード6において、ランレングスが6ビットより大きなランを抽出し、未使用の色コードに割り当てる。この場合、色コード割当部13は、例えば、未使用の色コードのうち、番号が最も若い色コードに抽出したランを割り当てればよい。この場合、未使用の色コードのうち、番号が最も若い色コードは色コード1であるため、色コード6において、ランレングスが6ビットより大きなランは色コード1が割り当てられる。
<S15> Histogram Division Processing Returning to FIG. 12, in S15, the color
次に、色コード割当部13は、抽出したランに対して新たに色コードを割り当てたことを反映させるため、図18に示す初期のヒストグラムを更新する。図22は、初期のヒストグラムを更新することで得られたヒストグラムである。
Next, the color
図22に示すように、色コード6において長さ部のビット数が9〜21ビットの各セルに格納された数値が色コード1の長さ部のビット数が9〜21ビットの各セルに移動され、かつ、色コード6において長さ部のビット数が9〜12ビットの各セルに格納された数値が0に更新されている。
As shown in FIG. 22, the numerical value stored in each cell having a length portion of 9-21 bits in the
<S16>色コードテーブル更新処理
図12に戻り、S16において、色コード割当部13は、図19に示す初期の色コードテーブルを更新する。図23は、図19に示す初期の色コードテーブルを更新することで得られた色コードテーブルである。
<S16> Color Code Table Update Processing Returning to FIG. 12, in S16, the color
図23に示すように、色コード6において、長さ部のビット数が9〜12ビットの各セルに格納された数値が6から1に更新されている。これにより、色コード6においてランレングスが6ビットよりも大きいランに対して、色コード1を付与しても、これらのランは、元々は色コード6であったことが分かる。
As shown in FIG. 23, in the
次に、色コード割当部13は、図20に示す初期の符号長テーブルを生成したときと同様にして、各色コードについての符号長テーブルを生成し、各色コードについて、符号長を最小にする長さ部のビット数を求め、各色コードの長さ部の現在のビット数として設定する。
Next, the color
以後、色コード割当部13は、未使用の色コードが残っている間、S13〜S16の処理を繰り返す。すると、最終的に、図24に示すヒストグラム、図25に示す色コードテーブルが得られた。図24は、色コード分割処理によって最終的に得られたヒストグラムである。図25は、色コード分割処理によって最終的に得られた色コードテーブルである。
Thereafter, the color
図24に示すヒストグラムにおいて、色コード1〜色コード7はそれぞれ、いずれかのセルに数値が格納されており、ランが割り当てられていることが分かる。なお、色コード0において、いずれのセルも0になっているのは、S13〜S16の最後のループにおいて、色コード0の3ビットのセルの値が未使用の色コード7に移動されたからである。
In the histogram shown in FIG. 24, it can be seen that each of the
図24に示すヒストグラムでは、色コード1〜7につき、ランレングスが似たような長さを持つランが割り当てられていることが分かる。したがって、各色コードの長さ部は、無駄なくランレングスを格納することができる。
In the histogram shown in FIG. 24, it can be seen that runs having similar run lengths are assigned to the
また、図25に示すように、例えば、色コード0は、3ビットのセルに色コード7が格納されている。そのため、ランレングスデータにおいて、色コードが7で長さ部のビット数が3ビットのランは、元々の色コードが0であったことが分かる。
As shown in FIG. 25, for example, the
図26は、色コード分割処理によって最終的に得られた符号長テーブルである。色コード0〜7につき、それぞれ、網掛けで示すセルに対応するビット数で長さ部のビット数を設定すると符号長を最小化することができる。
FIG. 26 is a code length table finally obtained by the color code dividing process. For each of the
図17に示すOSD表示パターンの符号長は、色コード分割処理後により、001e+1b48+0426+0288+01d4+1047+0024=3453=13,395bitとなる。 The code length of the OSD display pattern shown in FIG. 17 is 001e + 1b48 + 0426 + 0288 + 01d4 + 1047 + 0024 = 3453 = 13,395 bits after color code division processing.
<ベース値処理>
次に、ベース値処理について説明する。図11(B)はベース値処理のフローチャートである。まず、ベース値算出部141は、ベース値算出処理を行う(S21)。次に、ベース値算出部141は、長さ部ビット数算出処理を行う(S22)。
<Base value processing>
Next, the base value process will be described. FIG. 11B is a flowchart of the base value process. First, the base
<ベース値算出処理>
図13は、図11に示すベース値算出処理のサブルーチンを示すフローチャートである。まず、ベース値算出部141は、各種パラメータを初期化する(S31)。
<Base value calculation processing>
FIG. 13 is a flowchart showing a subroutine of the base value calculation process shown in FIG. First, the base
次に、ベース値算出部141は、処理対象となるOSD表示パターンの最後のランの抽出が終了したか否かを判定し、終了した場合(S32でYES)、処理をリターンする。一方、最後のランの抽出が終了していない場合(S32でNO)、ベース値算出部141はラン抽出処理を行う(S33)。
Next, the base
<ラン抽出処理>
図15は、図13、図14、図16で示すラン抽出処理のサブルーチンを示すフローチャートである。まず、ランレングス変数に0が代入されて初期化され、色コード変数に注目画素の画素値が代入されて色コード変数が初期化される(S51)。ここで、注目画素は、OSD表示パターンにおいてラスタ走査順に決定される。
<Run extraction process>
FIG. 15 is a flowchart showing a subroutine of the run extraction process shown in FIGS. 13, 14, and 16. First, 0 is assigned to the run length variable and initialized, and the pixel value of the target pixel is assigned to the color code variable to initialize the color code variable (S51). Here, the target pixel is determined in the raster scan order in the OSD display pattern.
次に、ランレングス変数が1加算され、ランレングス変数が更新される(S52)。次に、注目画素の画素位置が更新される(S53)。次に、注目画素の画素値が色コード変数と同じ値であれば(S54でYES)、処理がS52に戻される。一方、注目画素の画素値が色コード変数と異なる値であれば、1つのランが抽出できたと判定され、処理がリターンされる。つまり、OSD表示パターンに対して、注目画素が順次ずらされ、注目画素の画素値が前の注目画素の画素値と異なる値になったとき、1つのランが抽出できたと判定する。そして、注目画素をずらす都度、1加算されたランレングス変数の値が抽出したランのランレングスとなる。 Next, 1 is added to the run length variable, and the run length variable is updated (S52). Next, the pixel position of the target pixel is updated (S53). Next, if the pixel value of the target pixel is the same value as the color code variable (YES in S54), the process returns to S52. On the other hand, if the pixel value of the target pixel is different from the color code variable, it is determined that one run has been extracted, and the process is returned. That is, when the target pixel is sequentially shifted with respect to the OSD display pattern and the pixel value of the target pixel becomes different from the pixel value of the previous target pixel, it is determined that one run has been extracted. Each time the pixel of interest is shifted, the value of the run length variable added by 1 becomes the run length of the extracted run.
図13に戻り、S34において、ベース値算出部141は、図25に示す色コードテーブルを参照し、S33で抽出したランの色コード分割処理後の色コードを算出する。例えば、色コードが0、ランレングスが3ビットより大きく6ビット以下で表すことができるランが抽出された場合、このランの色コードは4と算出される。
Returning to FIG. 13, in S34, the base
次に、ベース値算出部141は、S33で抽出したランのランレングスが対応する色コードの現在のベース値未満である場合(S35でYES)、現在のベース値を抽出したランのランレングスで更新し(S36)、処理をS32に戻す。
Next, when the run length of the run extracted in S33 is less than the current base value of the corresponding color code (YES in S35), the base
一方、S33で抽出したランのランレングスが対応する色コードの現在のベース値以上である場合(S35でNO)、現在のベース値を更新せず、処理をS32に戻す。 On the other hand, if the run length of the run extracted in S33 is greater than or equal to the current base value of the corresponding color code (NO in S35), the current base value is not updated, and the process returns to S32.
例えば、S34で色コード7と算出されたランのランレングスが色コード7の現在のベース値未満である場合、S35でYESと判定され、色コード7の現在のベース値がこのランレングスで更新される。このような処理が各色コードに対して行われ、各色コードにつき、ランレングスの最小値がベース値として算出される。
For example, if the run length of the run calculated as
<長さ部ビット数算出処理>
次に、図11(B)のS22の長さ部ビット数算出処理について説明する。図16は、図11(B)に示す長さ部ビット数算出処理のサブルーチンを示すフローチャートである。まず、差分ランレングス算出部142は、各種パラメータを初期化する(S61)。次に、差分ランレングス算出部142は、処理対象となるOSD表示パターンの最後のランの抽出が終了したか否かを判定し、終了した場合(S62でYES)、処理をS68に進める。一方、最後のランの抽出が終了していない場合(S62でNO)、差分ランレングス算出部142はラン抽出処理を行う(S63)。このラン抽出処理は、図15で示した処理と同じである。
<Length part bit number calculation processing>
Next, the length part bit number calculation processing in S22 of FIG. 11B will be described. FIG. 16 is a flowchart showing a subroutine of length part bit number calculation processing shown in FIG. First, the differential run
次に、差分ランレングス算出部142は、S63で抽出したランの色コードを算出する(S64)。この処理は図13のS34と同じである。
Next, the difference run
次に、差分ランレングス算出部142は、S63で抽出したランレングスから対応する色コードのベース値を差し引き、差分ランレングスを算出する(S65)。例えば、S63で抽出されたランにおいて、S64で算出された色コードが色コード7であった場合、色コード7のベース値を用いて差分ランレングスが算出される。
Next, the difference run
次に、差分ランレングス符号化部143は、S65で求められた差分ランレングスが対応する色コードの最大差分ランレングスより大きい場合(S66でYES)、対応する色コードの最大差分ランレングスをS65で算出された差分ランレングスで更新し(S67)、処理をS62に戻す。
Next, if the difference run length obtained in S65 is larger than the maximum difference run length of the corresponding color code (YES in S66), the difference run
一方、S65で求められた差分ランレングスが対応する色コードの最大差分ランレングス以下の場合(S66でNO)、最大差分ランレングスが更新されずに処理がS62に戻される。 On the other hand, if the difference run length obtained in S65 is less than or equal to the maximum difference run length of the corresponding color code (NO in S66), the process returns to S62 without updating the maximum difference run length.
S68において、差分ランレングス符号化部143は、各色コードにつき、最大差分ランレングスを表すことができる最小のビット数を長さ部のビット数として算出し、処理をリターンする。
In S68, the difference run
<ランレングス符号化処理>
次に、図11のS3のランレングス符号化処理の詳細について説明する。図14は、図11のランレングス符号化処理のサブルーチンを示すフローチャートである。まず、差分ランレングス符号化部143は、各種パラメータを初期化する(S41)。次に、差分ランレングス符号化部143は、処理対象となるOSD表示パターンの最後のランの抽出が終了したか否かを判定し、終了した場合(S42でYES)、処理をリターンする。一方、最後のランの抽出が終了していない場合(S42でNO)、差分ランレングス符号化部143はラン抽出処理を行う(S43)。このラン抽出処理は、図15で示した処理と同じである。
<Run-length encoding process>
Next, details of the run length encoding process of S3 of FIG. 11 will be described. FIG. 14 is a flowchart showing a subroutine of the run-length encoding process of FIG. First, the differential run
次に、差分ランレングス符号化部143は、S43で抽出したランの色コードを算出する(S44)。この処理は図13のS34と同じである。
Next, the differential run
次に、差分ランレングス符号化部143は、S44で算出した色コードをランレングスデータ保持部16に出力する(S45)。次に、差分ランレングス符号化部143は、S43で抽出したランのランレングスから対応する色コードのベース値から差し引き差分ランレングスを求める。そして、差分ランレングスを対応する色コードの長さ部のビット数で符号化することで、差分ランレングスを符号化し、長さ部を算出する(S46)。次に、差分ランレングス符号化部143は、S46で算出した長さ部をランレングスデータ保持部16に出力する(S47)。
Next, the differential run
このように、OSD表示パターンから順次ランが抽出され、抽出したランの色コードと長さ部とが順次に出力され、ランレングスデータが算出される。 In this manner, the runs are sequentially extracted from the OSD display pattern, and the color code and the length portion of the extracted runs are sequentially output to calculate run length data.
図27は、色コード分割処理が行われた図17に示すOSD表示パターンに対し、差分ランレングスを求めて符号化した場合の効果を示す表である。 FIG. 27 is a table showing the effect when the difference run length is obtained and encoded with respect to the OSD display pattern shown in FIG. 17 subjected to the color code division processing.
図27において、“長さ部ビット数(変更前)”は、差分ランレングスを求める前の長さ部のビット数を示している。“ランレングス”は、差分ランレングスを求める前のランレングスの範囲を示している。“ベース値”は、差分ランレングスを求める際に使用されたランレングスの最小値である。“最大差分ランレングス”は、差分ランレングスの最大値である。“長さ部ビット数(変更後)”は、差分ランレングスを求めた場合の長さ部のビット数を示している。“ラン数”は、各色コードにおけるランの数を示している。“符号長削減量”は、差分ランレングスを採用したことによる符号長の削減量を色コード別に示している。 In FIG. 27, “number of bits in the length part (before change)” indicates the number of bits in the length part before the difference run length is obtained. “Run length” indicates a range of run lengths before the differential run length is obtained. The “base value” is the minimum value of the run length used when obtaining the differential run length. “Maximum differential run length” is the maximum value of the differential run length. “Number of bits in the length part (after change)” indicates the number of bits in the length part when the differential run length is obtained. “Run number” indicates the number of runs in each color code. “Code length reduction amount” indicates the reduction amount of the code length by adopting the differential run length for each color code.
例えば、色コード1について、差分ランレングスを求めずに、ランレングスを符号化した場合、長さ部のビット数は12ビットであった。一方、色コード1について、差分ランレングスを求めて符号化を行うと、長さ部のビット数は0ビットとなった。色コード1のラン数は2であるため、符号長削減量は、2×12=24ビットとなった。
For example, when the run length is encoded without obtaining the differential run length for the
同様に、色コード6については、符号長削減量は、463×6=2778ビットとなった。他の色コードは、符号長削減量は0であった。よって、符号長削減量の合計は2802であった。
Similarly, for
一方、差分ランレングスを求めずにランレングス符号化した場合のランレングスデータの符号長は13395ビットであった。よって、差分ランレングスを求めることにより、ランレングスデータの符号長は、13395−2802=10,593bitとなる。 On the other hand, the code length of the run-length data when run-length encoding is performed without obtaining the differential run-length is 13395 bits. Therefore, by obtaining the differential run length, the code length of the run length data is 13395-2802 = 10,593 bits.
図28は、実施例2の結果をまとめた表である。色コード分割処理及びベース値処理を適用しない場合、つまり、従来のランレングス符号化を用いた場合、図17に示すOSD表示パターンの符号長は17,563ビットであった。一方、色コード分割処理のみ適用した場合、図17に示すOSD表示パターンの符号長は、13,395ビットであった。また、色コード分割処理及びベース値処理を適用した場合、図17に示すOSD表示パターンの符号長は、10,593ビットであった。 FIG. 28 is a table summarizing the results of Example 2. When color code division processing and base value processing are not applied, that is, when conventional run-length encoding is used, the code length of the OSD display pattern shown in FIG. 17 is 17,563 bits. On the other hand, when only the color code division processing is applied, the code length of the OSD display pattern shown in FIG. 17 is 13,395 bits. When the color code division process and the base value process are applied, the code length of the OSD display pattern shown in FIG. 17 is 10,593 bits.
なお、本実施の形態では、色コード分割処理とベース値処理及びランレングス符号化処理とが組み合わされていたが、これに限定されず、色コード分割処理のみ行ってランレングスデータを生成してもよい。また、ベース値処理及びランレングス符号化処理のみ行ってランレングスデータを生成してもよい。 In this embodiment, the color code division processing, the base value processing, and the run length encoding processing are combined. However, the present invention is not limited to this, and only the color code division processing is performed to generate run length data. Also good. Alternatively, only the base value processing and the run length encoding processing may be performed to generate run length data.
また、上記説明では、各色コードにつき、差分ランレングスを表すことができる最小のビット数を長さ部のビット数として採用したが、これに限定されず、各色コードにつき、差分ランレングスで表された全ランの符号化結果が最小となるビット数を長さ部のビット数として採用してもよい。 In the above description, the minimum number of bits that can represent the difference run length is adopted as the number of bits of the length portion for each color code. Alternatively, the number of bits that minimizes the encoding result of all runs may be adopted as the number of bits in the length portion.
11 画像取得部
12 テーブル保持部
13 色コード割当部
14 符号化部
16 ランレングスデータ保持部
51 ベース値テーブル保持部
52 色情報保持部
53 差分ランレングス抽出部
54 加算部
55 復号化部
DESCRIPTION OF
Claims (8)
前記原画像データを色コードとランレングスとでコード化し、ランレングスコードを生成し、前記ランレングスコードを構成する各色コードにつき、各ランのランレングスのヒストグラムを算出し、算出したヒストグラムに基づいて、ある色コードが割り当てられたランの一部を抽出し、未使用の色コードに割り当てる色コード割当部と、
前記色コード割当部による割り当てが終了した後、各色コードにつき、全ランの符号化結果が最小となるビット数を前記長さ部のビット数として求め、各ランを符号化する符号化部とを備えるランレングス符号化装置。 A run-length encoding device that encodes original image data into run-length data representing each run with a color code part that stores a color code with a predetermined number of bits and a length part in which the number of bits is determined for each color code Because
The original image data is encoded with a color code and a run length, a run length code is generated, a run length histogram of each run is calculated for each color code constituting the run length code, and based on the calculated histogram A color code assigning unit that extracts a part of a run to which a certain color code is assigned and assigns it to an unused color code;
After the assignment by the color code assigning unit is finished, for each color code, obtain the number of bits that minimizes the encoding result of all runs as the number of bits of the length part, and an encoding unit that encodes each run. A run-length encoding device.
各色コードにつき、ランレングスの最小値をベース値として算出するベース値算出部と、
各ランにつき、ランレングスから対応する色コードのベース値を差し引き、各ランの差分ランレングスを算出する差分ランレングス算出部と、
各色コードにつき、全ランの差分ランレングスを表すことができる最小のビット数を前記長さ部のビット数として求め、各ランを符号化する差分ランレングス符号化部とを備える請求項1記載のランレングス符号化装置。 The encoding unit includes:
For each color code, a base value calculation unit that calculates a minimum run length as a base value,
For each run, a difference run length calculation unit that subtracts the base value of the corresponding color code from the run length and calculates the difference run length of each run;
The difference run length encoding part which calculates | requires the minimum bit number which can represent the difference run length of all the runs for each color code as a bit number of the said length part, and encodes each run. Run-length encoding device.
前記長さ部は、各ランのランレングスから各ランのベース値を差し引いた差分ランレングスを格納し、
前記ベース値は、各色コードにおけるランレングスの最小値を示し、
各色コードにつき、前記ベース値と前記長さ部のビット数とが対応付けられたベース値テーブルを保持するベース値テーブル保持部と、
各色コードをビットマップ形式で表すための色情報を保持する色情報保持部と、
前記ランレングスデータから色コードを特定し、特定した色コードに対応する前記長さ部のビット数を前記ベース値テーブルから特定し、特定したビット数分の前記色コードに続く前記ランレングスデータを差分ランレングスとして抽出する差分ランレングス抽出部と、
前記差分ランレングス抽出部により抽出された差分ランレングスに対応するベース値を加算し、ランレングスを算出する加算部と、
前記加算部により算出されたランレングス及び前記色情報に基づいて前記ランレングスデータを前記原画像データに復号化する復号化部とを備えるランレングス復号化装置。 Run-length decoding that decodes run-length data representing each run into original image data using a color code part that stores a color code with a predetermined number of bits and a length part in which the number of bits is determined for each color code Device.
The length part stores a differential run length obtained by subtracting the base value of each run from the run length of each run,
The base value indicates the minimum run length of each color code,
For each color code, a base value table holding unit that holds a base value table in which the base value and the number of bits of the length part are associated;
A color information holding unit that holds color information for representing each color code in a bitmap format;
A color code is identified from the run-length data, the number of bits of the length portion corresponding to the identified color code is identified from the base value table, and the run-length data following the color code for the identified number of bits is A differential run length extracting unit for extracting as a differential run length;
An addition unit for calculating a run length by adding a base value corresponding to the difference run length extracted by the difference run length extraction unit;
A run-length decoding apparatus comprising: a decoding unit that decodes the run-length data into the original image data based on the run length calculated by the adding unit and the color information.
前記ランレングス符号化装置が、前記原画像データを色コードとランレングスとでコード化し、ランレングスコードを生成し、前記原画像データを構成する各色コードにつき、各ランのランレングスのヒストグラムを算出し、算出したヒストグラムに基づいて、ある色コードが割り当てられたランの一部を抽出し、未使用の色コードに割り当てる色コード割当ステップと、
前記ランレングス符号化装置が、前記色コード割当ステップによる割り当てが終了した後、各色コードにつき、全ランの符号化結果が最小となるビット数を前記長さ部のビット数として求め、各ランを符号化する符号化ステップとを備えるランレングス符号化方法。 A run-length encoding method that encodes original image data into run-length data representing each run by a color code part that stores a color code with a predetermined number of bits and a length part in which the number of bits is determined for each color code Because
The run-length encoding device encodes the original image data with a color code and a run length, generates a run-length code, and calculates a run-length histogram of each run for each color code constituting the original image data. A color code assigning step for extracting a part of a run to which a certain color code is assigned based on the calculated histogram and assigning it to an unused color code;
The run-length encoding apparatus obtains, as the number of bits of the length part, the number of bits that minimizes the encoding result of all the runs for each color code after the assignment by the color code assigning step is completed. A run-length encoding method comprising: an encoding step for encoding.
前記長さ部は、各ランのランレングスから各ランのベース値を差し引いた差分ランレングスを格納し、
前記ベース値は、各色コードにおけるランレングスの最小値を示し、
前記ランレングス復号化装置は、
各色コードにつき、前記ベース値と前記長さ部のビット数とが対応付けられたベース値テーブルを保持するベース値テーブル保持部と、
各色コードを前記原画像データで表すための色情報を保持する色情報保持部とを備え、
前記ランレングス復号化装置が、前記ランレングスデータから色コードを特定し、特定した色コードに対応する前記長さ部のビット数を前記ベース値テーブルから特定し、特定したビット数分の前記色コードに続く前記ランレングスデータを差分ランレングスとして抽出する差分ランレングス抽出ステップと、
前記差分ランレングス抽出ステップにより抽出された差分ランレングスに対応するベース値を加算し、ランレングスを算出する加算ステップと、
前記加算ステップにより算出されたランレングス及び前記色情報に基づいて前記ランレングスデータを前記原画像データに復号化する復号化ステップとを備えるランレングス復号化方法。 The run-length decoding device converts the run-length data representing each run into the original image data using a color code portion that stores a color code with a predetermined number of bits and a length portion in which the number of bits is determined for each color code. A run-length decoding method for decoding
The length part stores a differential run length obtained by subtracting the base value of each run from the run length of each run,
The base value indicates the minimum run length of each color code,
The run length decoding device comprises:
For each color code, a base value table holding unit that holds a base value table in which the base value and the number of bits of the length part are associated;
A color information holding unit for holding color information for representing each color code by the original image data,
The run-length decoding apparatus specifies a color code from the run-length data, specifies the number of bits of the length portion corresponding to the specified color code from the base value table, and the color for the specified number of bits A differential run length extracting step of extracting the run length data following the code as a differential run length;
An addition step of adding a base value corresponding to the difference run length extracted by the difference run length extraction step, and calculating a run length;
A run-length decoding method comprising: a decoding step of decoding the run-length data into the original image data based on the run length calculated in the adding step and the color information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011118968A JP2012249061A (en) | 2011-05-27 | 2011-05-27 | Run length coding device, run length decoding device, run length coding method, and run length decoding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011118968A JP2012249061A (en) | 2011-05-27 | 2011-05-27 | Run length coding device, run length decoding device, run length coding method, and run length decoding method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2012249061A true JP2012249061A (en) | 2012-12-13 |
Family
ID=47469100
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011118968A Withdrawn JP2012249061A (en) | 2011-05-27 | 2011-05-27 | Run length coding device, run length decoding device, run length coding method, and run length decoding method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2012249061A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111384960A (en) * | 2018-12-28 | 2020-07-07 | 上海寒武纪信息科技有限公司 | Decoding method, processor, decoding device and storage medium |
-
2011
- 2011-05-27 JP JP2011118968A patent/JP2012249061A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111384960A (en) * | 2018-12-28 | 2020-07-07 | 上海寒武纪信息科技有限公司 | Decoding method, processor, decoding device and storage medium |
CN111384960B (en) * | 2018-12-28 | 2022-05-10 | 上海寒武纪信息科技有限公司 | Decoding method, processor, decoding device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109427047B (en) | Image processing method and device | |
US9584701B2 (en) | Image processing system and method | |
US7750927B2 (en) | Image processing apparatus, image processing method, and computer program | |
CN101097710A (en) | Image processor and image processing method | |
CN112118449B (en) | Method and device for compressing and decompressing image | |
US20090256852A1 (en) | Character display apparatus | |
CN114040246A (en) | Image format conversion method, device, equipment and storage medium of graphic processor | |
JP2017204811A5 (en) | ||
JPH1188700A (en) | Coding method of color image signal, and decoding method and color image processor thereof | |
JP2017204811A (en) | Image compressor, image developer, image compression and development system and display driver | |
JP4179255B2 (en) | Image processing apparatus, image transmission apparatus, display apparatus, image processing method, and image transmission method | |
JP2008193263A (en) | Image processing method, image processing device, image processing program, and record medium | |
JP2012249061A (en) | Run length coding device, run length decoding device, run length coding method, and run length decoding method | |
JP2702408B2 (en) | Image conversion system | |
CN115576513A (en) | Target image display method, display device, electronic device, and storage medium | |
JP5367552B2 (en) | Image processing apparatus and image processing program | |
JP5337250B2 (en) | Image processing apparatus and method | |
JP2010541094A (en) | Method, compressor, decompressor and signal representation for lossless compression of pixel block values using row tilt codewords and column tilt codewords | |
US9077993B2 (en) | Method of converting a video file to a graphics interchange format image using same palette table for consecutive frames | |
JP2005055824A (en) | Image display device, image display method and image display program | |
JP2703223B2 (en) | Color image processing equipment | |
JP2004213464A (en) | Image processor | |
JP3911986B2 (en) | Method and apparatus for compressing and decompressing image data | |
US6067380A (en) | Image compression method | |
JP3711104B2 (en) | Image compression apparatus and image compression method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A712 Effective date: 20130418 |
|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20140805 |