JP2010130213A - Image coding device and image coding method - Google Patents

Image coding device and image coding method Download PDF

Info

Publication number
JP2010130213A
JP2010130213A JP2008301333A JP2008301333A JP2010130213A JP 2010130213 A JP2010130213 A JP 2010130213A JP 2008301333 A JP2008301333 A JP 2008301333A JP 2008301333 A JP2008301333 A JP 2008301333A JP 2010130213 A JP2010130213 A JP 2010130213A
Authority
JP
Japan
Prior art keywords
zero
coefficient
code
input
unit
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.)
Granted
Application number
JP2008301333A
Other languages
Japanese (ja)
Other versions
JP5230375B2 (en
Inventor
Minoru Otani
稔 大谷
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.)
Samsung Electronics Co Ltd
Original Assignee
Samsung Digital Imaging Co Ltd
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 Samsung Digital Imaging Co Ltd filed Critical Samsung Digital Imaging Co Ltd
Priority to JP2008301333A priority Critical patent/JP5230375B2/en
Priority to KR20090068407A priority patent/KR20100059665A/en
Publication of JP2010130213A publication Critical patent/JP2010130213A/en
Application granted granted Critical
Publication of JP5230375B2 publication Critical patent/JP5230375B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/93Run-length coding

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image coding device and an image coding method, which can increase a substantial processing speed of variable length coding. <P>SOLUTION: The image coding device includes: a coefficient detection part 105 which detects non-zero coefficients where quantization coefficient values are not zero (0), zero run lengths showing the numbers of continuous zero coefficients where quantization coefficient values are zero, and non-zero coefficients which follow zero coefficients and where quantization coefficient values are not zero; an intermediate code generation part 105 which successively combines two or more every prescribed number of successively detected non-zero coefficients or zero run lengths and gives identifiers for discrimination between non-zero coefficients and zero run lengths per non-zero coefficient and zero run length to generate an intermediate code; and a plurality of coding parts 107 of which the number is equal to or larger than the prescribed number, wherein one non-zero coefficient and one zero run length are input to each coding part on the basis of non-zero coefficients or zero run lengths and the identifiers of the intermediate code and are subjected to variable length coding processing. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、画像符号化装置及び画像符号化方法に関する。   The present invention relates to an image encoding device and an image encoding method.

静止画像データの圧縮方式として、JPEGベースライン方式があり、JPEGベースライン方式の可変長符号化方式には、ハフマン符号が用いられる。8×8画素のブロックに分割された画像データをDCT変換し量子化して得られる係数は、ゼロ(0)とゼロではない値からなる。ハフマン符号化は、係数がゼロ(ゼロ係数)であるときのゼロの数(ゼロランレングス)と、ゼロ係数の後に続くゼロでない係数である非ゼロ係数の組み合わせを、発生頻度の高い順にコード長の短いコードを割り当てる。これにより、効率的な符号化を行うことができる。   As a still image data compression method, there is a JPEG baseline method, and a Huffman code is used as a variable length coding method of the JPEG baseline method. Coefficients obtained by DCT transforming and quantizing image data divided into 8 × 8 pixel blocks consist of zero (0) and non-zero values. Huffman coding uses a combination of the number of zeros (zero run length) when the coefficient is zero (zero coefficient) and the nonzero coefficient that is a nonzero coefficient following the zero coefficient in order of increasing frequency. Assign a short code. Thereby, efficient encoding can be performed.

従来のハフマン符号では、符号化の際、DCT係数ブロック内の全データについて、ブロック毎に、DCT係数がゼロであるか、又は非ゼロ係数であるかを判別する必要があった。例えば、DCT係数ブロックは、8×8のブロックであり、64データであるため、ハフマン符号で符号化する場合、通常1ブロックあたり64クロック以上を要した。そこで、例えば特許文献1には、ハフマン符号の処理時間の短縮化を図る技術が開示されている。   In the conventional Huffman code, it is necessary to determine whether the DCT coefficient is zero or a non-zero coefficient for each block of all data in the DCT coefficient block at the time of encoding. For example, since the DCT coefficient block is an 8 × 8 block and has 64 data, when coding with a Huffman code, normally 64 clocks or more are required per block. Thus, for example, Patent Document 1 discloses a technique for shortening the processing time of the Huffman code.

特開2003−333339号公報JP 2003-333339 A

従来、可変長符号化において、連続するゼロ係数を数え上げてゼロランレングスを算出しており、1つのゼロ係数を数えるのに1クロックを必要としていた。そこで、特許文献1の技術では、符号化の際の処理クロック数を抑えるため、ゼロランレングス及び非ゼロ係数から可変長符号を生成する可変長符号化の前段で、ゼロランレングスと非ゼロ係数を組み合わせて1つの係数を生成する。そして、可変長符号化では、生成した1つの係数をもとに可変長符号を生成する。従って、特許文献1の可変長符号化では、ゼロランレングスを算出するための処理クロック数が不要となり、ゼロランレングスと非ゼロ係数が直接入力されるため、符号化の際の処理クロック数を削減できた。   Conventionally, in variable-length coding, consecutive zero coefficients are counted to calculate a zero run length, and one clock is required to count one zero coefficient. Therefore, in the technique of Patent Document 1, in order to suppress the number of processing clocks at the time of encoding, the zero run length and the non-zero coefficient are preceded by the variable length encoding that generates the variable length code from the zero run length and the non-zero coefficient. Are combined to generate one coefficient. In variable length coding, a variable length code is generated based on one generated coefficient. Therefore, in the variable length encoding of Patent Document 1, the number of processing clocks for calculating the zero run length becomes unnecessary, and the zero run length and the non-zero coefficient are directly input. Reduced.

しかし、この方法では、ゼロ係数が長く連続しているとき、即ちゼロランレングスが大きいときには処理クロック数の削減効果があるが、非ゼロ係数が1ブロック内で多いときは、処理クロック数の削減効果が低くなる。また、量子化後の係数が全て非ゼロ係数になったときは、処理クロック数の削減効果は全くなくなるという問題があった。   However, this method has an effect of reducing the number of processing clocks when the zero coefficients are long and continuous, that is, when the zero run length is large, but when the number of non-zero coefficients is large in one block, the number of processing clocks is reduced. Less effective. In addition, when all the quantized coefficients are non-zero coefficients, there is a problem that the effect of reducing the number of processing clocks is completely lost.

そこで、本発明は、上記問題に鑑みてなされたものであり、本発明の目的とするところは、可変長符号化において実質的な処理速度を向上させることが可能な、新規かつ改良された画像符号化装置及び画像符号化方法を提供することにある。   Accordingly, the present invention has been made in view of the above problems, and an object of the present invention is to provide a new and improved image capable of improving a substantial processing speed in variable-length coding. An encoding device and an image encoding method are provided.

上記課題を解決するために、本発明のある観点によれば、画像データを直交変換し直交変換係数を生成する直交変換部と、直交変換係数を量子化し量子化係数を生成する量子化部と、量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、ゼロ係数の後に続く、量子化係数の値がゼロでない非ゼロ係数とを検出する係数検出部と、順次検出された非ゼロ係数又はゼロランレングスを2以上の所定数毎に順次組み合わせると共に、非ゼロ係数及びゼロランレングスのいずれであるかを識別する識別子を非ゼロ係数及びゼロランレングス毎に付与して中間コードを生成する中間コード生成部と、中間コードの非ゼロ係数又はゼロランレングスと、識別子に基づいて、それぞれ1つの非ゼロ係数と1つのゼロランレングスが入力されて可変長符号化処理する、上記所定数と同一数以上からなる複数の符号化部とを有する画像符号化装置が提供される。   In order to solve the above problems, according to an aspect of the present invention, an orthogonal transform unit that orthogonally transforms image data to generate an orthogonal transform coefficient, a quantization unit that quantizes the orthogonal transform coefficient and generates a quantization coefficient, and A coefficient detection unit that detects a zero run length indicating the number of consecutive zero coefficients whose quantization coefficient value is zero (0), and a non-zero coefficient whose quantization coefficient value is not zero, following the zero coefficient; The sequentially detected non-zero coefficient or zero run length is sequentially combined every two or more predetermined numbers, and an identifier for identifying whether it is a non-zero coefficient or zero run length is provided for each non-zero coefficient and zero run length. An intermediate code generation unit that generates an intermediate code by adding the non-zero coefficient or zero run length of the intermediate code, and one non-zero coefficient and one zero run length based on the identifier, respectively It is input to process variable length coding, the image coding device having a plurality of encoding unit consisting of the predetermined number and above same number is provided.

かかる構成により、直交変換部が、画像データを直交変換し直交変換係数を生成し、量子化部が、直交変換係数を量子化し量子化係数を生成する。また、係数検出部が、量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、ゼロ係数の後に続く、量子化係数の値がゼロでない非ゼロ係数とを検出し、中間コード生成部が、順次検出された非ゼロ係数又はゼロランレングスを2以上の所定数毎に順次組み合わせると共に、非ゼロ係数及びゼロランレングスのいずれであるかを識別する識別子を非ゼロ係数及びゼロランレングス毎に付与して中間コードを生成する。また、上記所定数と同一数以上からなる複数の符号化部が、中間コードの非ゼロ係数又はゼロランレングスと、識別子に基づいて、それぞれ1つの非ゼロ係数と1つのゼロランレングスが入力されて可変長符号化処理する。   With this configuration, the orthogonal transform unit orthogonally transforms the image data to generate an orthogonal transform coefficient, and the quantization unit quantizes the orthogonal transform coefficient to generate a quantized coefficient. In addition, the coefficient detection unit calculates a zero run length indicating the number of consecutive zero coefficients whose quantization coefficient value is zero (0), and a non-zero coefficient whose quantization coefficient value is not zero following the zero coefficient. And the intermediate code generator sequentially combines the sequentially detected non-zero coefficients or zero run lengths every two or more predetermined numbers, and identifies an identifier that identifies whether the non-zero coefficient or zero run length is non-zero. An intermediate code is generated for each zero coefficient and zero run length. In addition, a plurality of encoding units having the same number or more as the predetermined number are inputted with one non-zero coefficient and one zero-run length based on the non-zero coefficient or zero run length of the intermediate code and the identifier, respectively. Variable-length encoding processing.

上記量子化部、係数検出部及び中間コード生成部は、並列した複数の系統からなってもよい。かかる構成により、量子化部、係数検出部及び中間コード生成部において、画像データを並行に処理することができる。   The quantization unit, the coefficient detection unit, and the intermediate code generation unit may include a plurality of systems in parallel. With this configuration, image data can be processed in parallel in the quantization unit, the coefficient detection unit, and the intermediate code generation unit.

また、上記課題を解決するために、本発明の別の観点によれば、直交変換部が、画像データを直交変換し直交変換係数を生成するステップと、量子化部が、直交変換係数を量子化し量子化係数を生成するステップと、係数検出部が、量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、ゼロ係数の後に続く、量子化係数の値がゼロでない非ゼロ係数とを検出するステップと、中間コード生成部が、順次検出された非ゼロ係数又はゼロランレングスを2以上の所定数毎に順次組み合わせると共に、非ゼロ係数及びゼロランレングスのいずれであるかを識別する識別子を非ゼロ係数及びゼロランレングス毎に付与して中間コードを生成するステップと、上記所定数と同一数以上からなる複数の符号化部が、中間コードの非ゼロ係数又はゼロランレングスと、識別子に基づいて、それぞれ1つの非ゼロ係数と1つのゼロランレングスが入力されて可変長符号化処理するステップとを有する画像符号化方法が提供される。   In order to solve the above problem, according to another aspect of the present invention, an orthogonal transform unit orthogonally transforms image data to generate an orthogonal transform coefficient, and a quantization unit quantizes the orthogonal transform coefficient. And generating a quantized coefficient, and a coefficient detecting unit, a zero run length indicating a continuous number of zero coefficients whose quantized coefficient value is zero (0), and a quantized coefficient value following the zero coefficient Detecting a non-zero coefficient that is not zero, and an intermediate code generator sequentially combines the detected non-zero coefficient or zero run length every two or more predetermined numbers, and the non-zero coefficient and zero run length of A step of generating an intermediate code by assigning an identifier for identifying each for each non-zero coefficient and zero run length, and a plurality of encoding units having the same number or more as the predetermined number, And a non-zero coefficient or zero run length, based on the identifier, the image coding method and a step of processing variable-length coding are each one nonzero coefficient and one zero run length of the input is provided.

かかる構成により、画像データが直交変換されて直交変換係数が生成され、直交変換係数が量子化されて量子化係数を生成される。そして、量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、ゼロ係数の後に続く、量子化係数の値がゼロでない非ゼロ係数とを検出され、順次検出された非ゼロ係数又はゼロランレングスが2以上の所定数毎に順次組み合わされると共に、非ゼロ係数及びゼロランレングスのいずれであるかを識別する識別子が非ゼロ係数及びゼロランレングス毎に付与されて中間コードが生成される。その後、上記所定数と同一数以上からなる複数の符号化部で、中間コードの非ゼロ係数又はゼロランレングスと、識別子に基づいて、それぞれ1つの非ゼロ係数と1つのゼロランレングスが入力されて可変長符号化処理が行われる。   With this configuration, image data is orthogonally transformed to generate orthogonal transform coefficients, and the orthogonal transform coefficients are quantized to generate quantized coefficients. Then, a zero run length indicating the number of consecutive zero coefficients whose quantization coefficient value is zero (0) and a non-zero coefficient whose quantization coefficient value is not zero following the zero coefficient are detected and sequentially detected. Non-zero coefficients or zero run lengths are sequentially combined every two or more predetermined numbers, and an identifier identifying whether the non-zero coefficient or zero run length is given to each non-zero coefficient or zero run length. Intermediate code is generated. Thereafter, one non-zero coefficient and one zero-run length are respectively input based on the non-zero coefficient or zero run length of the intermediate code and the identifier in a plurality of encoding units having the same number or more as the predetermined number. Thus, the variable length encoding process is performed.

本発明によれば、可変長符号化において実質的な処理速度を向上させることができる。   According to the present invention, a substantial processing speed can be improved in variable length coding.

以下に添付図面を参照しながら、本発明の好適な実施の形態について詳細に説明する。なお、本明細書及び図面において、実質的に同一の機能構成を有する構成要素については、同一の符号を付することにより重複説明を省略する。   Exemplary embodiments of the present invention will be described below in detail with reference to the accompanying drawings. In addition, in this specification and drawing, about the component which has the substantially same function structure, duplication description is abbreviate | omitted by attaching | subjecting the same code | symbol.

(第1の実施形態)
[第1の実施形態の構成]
まず、本発明の第1の実施形態に係る画像符号化装置100について説明する。図1は、本実施形態に係る画像符号化装置100の構成を示すブロック図である。画像符号化装置100は、例えば、2次元DCT部101と、第1バッファ102と、ジグザグスキャン部103と、量子化部104と、中間コード生成部105と、第2バッファ106と、可変長符号化部107などからなる。
(First embodiment)
[Configuration of First Embodiment]
First, the image coding apparatus 100 according to the first embodiment of the present invention will be described. FIG. 1 is a block diagram illustrating a configuration of an image encoding device 100 according to the present embodiment. The image encoding device 100 includes, for example, a two-dimensional DCT unit 101, a first buffer 102, a zigzag scan unit 103, a quantization unit 104, an intermediate code generation unit 105, a second buffer 106, and a variable length code. And the like.

2次元DCT部101は、入力された画像データをDCT変換(離散コサイン変換:Discrete Cosine Transform)(直交変換)し、DCT係数を生成する。ここで、入力される画像データとは、例えば撮像素子から出力された画像信号を8×8画素のブロックに分割してブロック化処理したデータである。2次元DCT部101が画像データをDCT変換することによって、8×8画素のブロック毎に8×8のDCT係数ブロックが生成される。
第1バッファ102は、2次元DCT部101で生成されたDCT係数のデータをDCT係数ブロック単位で格納する。
The two-dimensional DCT unit 101 performs DCT transform (Discrete Cosine Transform) (orthogonal transform) on the input image data to generate DCT coefficients. Here, the input image data is, for example, data obtained by dividing the image signal output from the image sensor into blocks of 8 × 8 pixels. The two-dimensional DCT unit 101 performs DCT conversion on the image data, whereby an 8 × 8 DCT coefficient block is generated for each 8 × 8 pixel block.
The first buffer 102 stores the DCT coefficient data generated by the two-dimensional DCT unit 101 in units of DCT coefficient blocks.

ジグザグスキャン部103は、第1バッファ102からDCT係数を読み出して、読み出したDCT係数を量子化部104に送る。ジグザグスキャン部103は、第1バッファ102からDCT係数のデータを読み出す際、DCT係数ブロック毎にジグザグスキャンをする。図2は、8×8のDCT係数ブロックを示しており、DCT係数ブロックにおけるジグザグスキャンを示す説明図である。DCT係数ブロックでは、2次元DCT部101で生成されたDCT係数が、図2に示す0→63の順番で配置されている。ジグザグスキャン部103は、図2の矢印に示すように、DCT係数ブロックの低周波数領域を優先してDCT係数を読み出して、次第に高周波領域となるようにDCT係数を読み出していく。   The zigzag scan unit 103 reads the DCT coefficient from the first buffer 102 and sends the read DCT coefficient to the quantization unit 104. The zigzag scanning unit 103 performs zigzag scanning for each DCT coefficient block when reading DCT coefficient data from the first buffer 102. FIG. 2 shows an 8 × 8 DCT coefficient block and is an explanatory diagram showing zigzag scanning in the DCT coefficient block. In the DCT coefficient block, the DCT coefficients generated by the two-dimensional DCT unit 101 are arranged in the order of 0 → 63 shown in FIG. As indicated by the arrows in FIG. 2, the zigzag scanning unit 103 reads the DCT coefficients by giving priority to the low frequency region of the DCT coefficient block, and gradually reads the DCT coefficients so as to become the high frequency region.

量子化部104は、ジグザグスキャン部103でジグザグスキャンによって読み出されたDCT係数を、所定の量子化値で量子化する。量子化部104は、量子化されたDCT係数を中間コード生成部105に送る。このとき、量子化されたDCT係数は、量子化部104で出力された後、バッファ等に一時的に格納されることなく、直接中間コード生成部105に送られる。   The quantization unit 104 quantizes the DCT coefficient read by the zigzag scan by the zigzag scan unit 103 with a predetermined quantization value. The quantization unit 104 sends the quantized DCT coefficient to the intermediate code generation unit 105. At this time, the quantized DCT coefficient is output from the quantization unit 104 and then directly sent to the intermediate code generation unit 105 without being temporarily stored in a buffer or the like.

中間コード生成部105は、量子化されたDCT係数に基づいて、中間コードを生成する。中間コードは、DCT係数の非ゼロ係数、ゼロランレングス及びそれぞれの識別子(ID)からなる。中間コード生成部105は、生成した中間コードを第2バッファ106に送る。
第2バッファ106は、中間コード生成部105で生成された中間コードを格納する。
The intermediate code generation unit 105 generates an intermediate code based on the quantized DCT coefficient. The intermediate code includes a non-zero coefficient of DCT coefficient, a zero run length, and an identifier (ID). The intermediate code generation unit 105 sends the generated intermediate code to the second buffer 106.
The second buffer 106 stores the intermediate code generated by the intermediate code generation unit 105.

可変長符号化部107は、第2バッファ106から中間コードを読み出して、中間コードの非ゼロ係数、ゼロランレングスを示すIDに基づいて、非ゼロ係数、ゼロランレングスを判別する。そして、可変長符号化部107は、非ゼロ係数、ゼロランレングスに基づいてハフマン符号を生成し、生成したハフマン符号を出力する。本実施形態の可変長符号化部107は、後述するとおり、1セット(中間コードセット)に含まれる中間コードの数に対応して、複数の符号部を有する。例えば、1セットに含まれる中間コードが2組である場合は、可変長符号化部107の符号部は2つからなる。   The variable length encoding unit 107 reads the intermediate code from the second buffer 106 and determines the non-zero coefficient and the zero run length based on the ID indicating the non-zero coefficient and the zero run length of the intermediate code. Then, the variable length coding unit 107 generates a Huffman code based on the non-zero coefficient and the zero run length, and outputs the generated Huffman code. As will be described later, the variable length encoding unit 107 of the present embodiment has a plurality of encoding units corresponding to the number of intermediate codes included in one set (intermediate code set). For example, when there are two sets of intermediate codes included in one set, the variable length coding unit 107 has two coding units.

[中間コードの生成]
次に、本実施形態に係る中間コードの生成について説明する。
中間コードは、量子化されたDCT係数に基づいて生成される。量子化されたDCT係数は、ゼロ(0)とゼロではない値からなる。そこで、中間コード生成部105は、係数検出部の一例であり、まず、DCT係数について、値がゼロでない係数である非ゼロ係数と、値がゼロである係数(ゼロ係数)を判別する。そして、中間コード生成部105は、DCT係数が非ゼロ係数であると判別したときは、その値を出力する。また、中間コード生成部105は、出力値が非ゼロ係数であることを示す識別子(ID)を出力する。本実施形態では、非ゼロ係数であることを示すIDは、「1」とした。中間コード生成部105は、非ゼロ係数の値とIDを組み合わせて1組の中間コードを生成する。IDは、中間コードのMSB(最上位ビット:most significant bit)に付加される。
[Generate intermediate code]
Next, the generation of the intermediate code according to the present embodiment will be described.
The intermediate code is generated based on the quantized DCT coefficient. The quantized DCT coefficient consists of zero (0) and a non-zero value. Therefore, the intermediate code generation unit 105 is an example of a coefficient detection unit. First, for the DCT coefficient, the intermediate code generation unit 105 determines a non-zero coefficient that is a coefficient whose value is not zero and a coefficient whose value is zero (zero coefficient). When the intermediate code generation unit 105 determines that the DCT coefficient is a non-zero coefficient, the intermediate code generation unit 105 outputs the value. Further, the intermediate code generation unit 105 outputs an identifier (ID) indicating that the output value is a non-zero coefficient. In the present embodiment, the ID indicating a non-zero coefficient is “1”. The intermediate code generation unit 105 generates a set of intermediate codes by combining non-zero coefficient values and IDs. The ID is added to the MSB (most significant bit) of the intermediate code.

一方、中間コード生成部105は、DCT係数がゼロ係数であると判別したときは、非ゼロ係数の後に連続するゼロ係数の数を、次に非ゼロ係数が判別されるまで数え上げる。そして、中間コード生成部105は、数え上げたゼロ係数の数をゼロランレングスとして出力する。また、中間コード生成部105は、出力値がゼロランレングスであることを示す識別子(ID)を出力する。本実施形態では、ゼロランレングスであることを示すIDは、「0」とした。中間コード生成部105は、ゼロランレングスの値とIDを組み合わせて1組の中間コードを生成する。IDは、中間コードのMSB(最上位ビット:most significant bit)に付加される。   On the other hand, when the intermediate code generation unit 105 determines that the DCT coefficient is a zero coefficient, the intermediate code generation unit 105 counts up the number of zero coefficients consecutive after the non-zero coefficient until the next non-zero coefficient is determined. The intermediate code generation unit 105 then outputs the counted number of zero coefficients as a zero run length. Further, the intermediate code generation unit 105 outputs an identifier (ID) indicating that the output value is zero run length. In the present embodiment, the ID indicating zero run length is “0”. The intermediate code generation unit 105 generates a set of intermediate codes by combining the zero run length value and the ID. The ID is added to the MSB (most significant bit) of the intermediate code.

[中間コードの配置]
次に、図3を参照して、第2バッファ106に格納される中間コードの配置について説明する。図3は、本実施形態の第2バッファ106に格納される中間コードの配置を示す説明図である。
[Placement of intermediate code]
Next, the arrangement of intermediate codes stored in the second buffer 106 will be described with reference to FIG. FIG. 3 is an explanatory diagram showing the arrangement of intermediate codes stored in the second buffer 106 of this embodiment.

第2バッファ106は、時系列で連続する複数の中間コードを、時間的に先行するものを下位に配置し、時間的に後行するものを上位に配置して格納する。本実施形態では、2組の中間コードを1セット(中間コードセット)とする。図3上では、1セットを1行で表した。図3における「係数データ」とは、非ゼロ係数の値を示し、「ゼロランレングス」とは、ゼロランレングスの値を示す。本実施形態では、中間コードの非ゼロ係数の値又はゼロランレングスの値は、11bitで表す。また、IDは、1bitで表す。従って、本実施形態では、1組の中間コードは12bitで表され、2組の中間コードを合わせた1つの中間コードセットは、24bitで表される。よって、1つのDCT係数ブロックは64のDCT係数からなるため、中間コードのバッファ容量は最大でも768bit(=12bit×64)でよい。   The second buffer 106 stores a plurality of time-sequential intermediate codes, one that precedes in time is arranged in the lower order and one that follows in time is arranged in the upper order. In the present embodiment, two sets of intermediate codes are defined as one set (intermediate code set). In FIG. 3, one set is represented by one line. “Coefficient data” in FIG. 3 indicates a non-zero coefficient value, and “zero run length” indicates a zero run length value. In the present embodiment, the value of the non-zero coefficient or the value of zero run length of the intermediate code is represented by 11 bits. The ID is represented by 1 bit. Therefore, in this embodiment, one set of intermediate codes is represented by 12 bits, and one intermediate code set including two sets of intermediate codes is represented by 24 bits. Therefore, since one DCT coefficient block is composed of 64 DCT coefficients, the buffer capacity of the intermediate code may be 768 bits (= 12 bits × 64) at the maximum.

一方、特許文献1では、ゼロランレングスと非ゼロ係数を組み合わせて生成する1つの係数は、ゼロランレングスを表す4bitと非ゼロ係数を表す11bitを合わせた15bitで表される。従って、係数のバッファ容量は最大960bit(=15bit×64)となる。よって、本実施形態の中間コードのバッファ容量は特許文献1に比べて少ない容量でよい。   On the other hand, in Patent Document 1, one coefficient generated by combining a zero run length and a non-zero coefficient is represented by 15 bits including 4 bits representing a zero run length and 11 bits representing a non-zero coefficient. Accordingly, the buffer capacity of the coefficient is 960 bits (= 15 bits × 64) at the maximum. Therefore, the buffer capacity of the intermediate code of this embodiment may be smaller than that of Patent Document 1.

図4を用いて、中間コード生成部105で生成される中間コードの一例を説明する。図4は、時系列順に配置された量子化後のDCT係数(A)と、量子化後のDCT係数から生成した中間コード(B)を示す説明図である。   An example of the intermediate code generated by the intermediate code generation unit 105 will be described with reference to FIG. FIG. 4 is an explanatory diagram showing a DCT coefficient after quantization (A) arranged in time series order and an intermediate code (B) generated from the DCT coefficient after quantization.

中間コードは、図4(B)に示すように、中間コードの値(非ゼロ係数の値又はゼロランレングスの値)と、IDからなる。図4(B)ではゼロランレングス値を網掛けで示した。中間コードの値は、中間コードのMSBに付加されたIDによって、非ゼロ係数の値であるか、ゼロランレングスの値であるか識別することができる。   As shown in FIG. 4B, the intermediate code includes an intermediate code value (a non-zero coefficient value or a zero run length value) and an ID. In FIG. 4B, the zero run length value is shown by shading. The intermediate code value can be identified as a non-zero coefficient value or a zero run length value by the ID added to the MSB of the intermediate code.

[中間コードの読出し]
次に、図5を参照して、可変長符号化部107による第2バッファ106からの中間コードの読み出しについて説明する。図5は、第2バッファ106と、第2バッファ106から中間コードを読み出す可変長符号化部107を示すブロック図である。
[Read intermediate code]
Next, reading of the intermediate code from the second buffer 106 by the variable length coding unit 107 will be described with reference to FIG. FIG. 5 is a block diagram showing the second buffer 106 and the variable length coding unit 107 that reads the intermediate code from the second buffer 106.

可変長符号化部107は、図5に示すように、分離部110を有する。分離部110は、第2バッファ106に格納された中間コードセットから、上位に配置された中間コード(上位コード)と、下位に配置された中間コード(下位コード)を分離する。また、分離部110は、遅延部(DFF:D型フリップフロップ)111を有する。遅延部111は、1つ先行する中間コードセットのうち上位コードが入力され、入力された上位コードを1クロック遅延して出力する。これにより、遅延した上位コードがゼロランレングスであったとき、遅延した上位コードと下位コードで符号化することができる。以上より、分離部110は、上位コード、下位コード及び1クロック遅延した上位コードを同時に出力する。   The variable length encoding unit 107 includes a separation unit 110 as illustrated in FIG. The separation unit 110 separates the intermediate code (upper code) arranged in the higher order and the intermediate code (lower code) arranged in the lower order from the intermediate code set stored in the second buffer 106. The separation unit 110 includes a delay unit (DFF: D-type flip-flop) 111. The delay unit 111 receives an upper code of one preceding intermediate code set, and outputs the input upper code with a delay of one clock. Thus, when the delayed upper code is zero run length, it is possible to encode with the delayed upper code and lower code. As described above, the separation unit 110 simultaneously outputs the upper code, the lower code, and the upper code delayed by one clock.

[可変長符号化部107による符号化]
次に、図6を参照して、可変長符号化部107による符号化について説明する。図6は、本実施形態の可変長符号化部107を示すブロック図である。第2バッファ106に入力された中間コードセットのうち、下位コードをC0、そのIDをID0とし、上位コードをC1、そのIDをID1とする。また、1クロック遅延した上位コードは、末尾に_dを付け、例えばC1_d、そのIDをID1_dと表わす。
[Encoding by variable length encoding unit 107]
Next, the encoding by the variable length encoding unit 107 will be described with reference to FIG. FIG. 6 is a block diagram showing the variable length coding unit 107 of this embodiment. Of the intermediate code set input to the second buffer 106, the lower code is C0, its ID is ID0, the higher code is C1, and its ID is ID1. The upper code delayed by one clock is suffixed with _d, for example, C1_d, and its ID is ID1_d.

可変長符号化部107は、図6に示すように、セレクタ121,122と、第1符号部131と、第2符号部132と、連結部141を有する。1セット(中間コードセット)に含まれる中間コードが2組である場合、可変長符号化部107は、可変長符号化部107の符号部は2つからなることから、可変長符号化部107は、第1符号部131と第2符号部132を有する。   As shown in FIG. 6, the variable length encoding unit 107 includes selectors 121 and 122, a first encoding unit 131, a second encoding unit 132, and a connecting unit 141. When there are two sets of intermediate codes included in one set (intermediate code set), the variable length encoding unit 107 includes two code units of the variable length encoding unit 107. Therefore, the variable length encoding unit 107 Includes a first encoding unit 131 and a second encoding unit 132.

第1符号部131、第2符号部132の入力における「A」は、非ゼロ係数の入力を示し、「Z」はゼロランレングスの入力を示す。第1符号部131、第2符号部132は、非ゼロ係数とゼロランレングスに基づき、例えば2次元ハフマンテーブルを参照してハフマン符号を出力する。第1符号部131、第2符号部132におけるハフマン符号化は、係数がゼロ(ゼロ係数)であるときのゼロの数(ゼロランレングス)と、ゼロ係数の後に続くゼロでない非ゼロ係数との組み合わせを、発生頻度の高い順にコード長の短いコードを割り当てる。これにより、効率的な符号化を行うことができる。   “A” at the input of the first encoding unit 131 and the second encoding unit 132 indicates an input of a non-zero coefficient, and “Z” indicates an input of a zero run length. The first encoding unit 131 and the second encoding unit 132 output a Huffman code with reference to, for example, a two-dimensional Huffman table based on the non-zero coefficient and the zero run length. The Huffman coding in the first code unit 131 and the second code unit 132 is performed by calculating the number of zeros (zero run length) when the coefficient is zero (zero coefficient) and the nonzero non-zero coefficient following the zero coefficient. As a combination, codes with shorter code lengths are assigned in descending order of occurrence frequency. Thereby, efficient encoding can be performed.

第1符号部131は、中間コードに含まれるIDの組み合わせに基づいて、前段のセレクタ121,122で切り替えて、入力A及び入力Zの入力処理を行う。   Based on the combination of IDs included in the intermediate code, the first encoding unit 131 switches between the selectors 121 and 122 in the previous stage and performs input processing of the input A and the input Z.

図6に示すように、第1符号部131の入力Aに入力される非ゼロ係数は、上位コードC1又は下位コードC0である。第1符号部131の入力Zに入力されるゼロランレングスは、値が0、下位コードC0又は1クロック前の上位コードC1_dである。第2符号部132の入力Aに入力される非ゼロ係数は、上位コードC1である。第2符号部132の入力Zに入力されるゼロランレングスは、値が0である。第2符号部132は、中間コードセットの上位コードC1、下位コードC0両方が非ゼロ係数であるときのみ動作し、ハフマン符号を出力する。   As shown in FIG. 6, the non-zero coefficient input to the input A of the first encoding unit 131 is the upper code C1 or the lower code C0. The zero run length input to the input Z of the first encoding unit 131 is 0, the lower code C0, or the upper code C1_d one clock before. The non-zero coefficient input to the input A of the second encoding unit 132 is the upper code C1. The zero run length input to the input Z of the second encoding unit 132 has a value of zero. The second encoding unit 132 operates only when both the upper code C1 and the lower code C0 of the intermediate code set are non-zero coefficients, and outputs a Huffman code.

第1符号部131と第2符号部132の入力Aは、非ゼロ係数である。2組の中間コードからなる中間コードセットのうち、下位コードC0に非ゼロ係数があるときは、下位コードC0の非ゼロ係数が第1符号部131の入力Aに入力される。下位コードC0に非ゼロ係数があり、上位コードC1にも非ゼロ係数があるときは、下位コードC0の非ゼロ係数が第1符号部131の入力Aに入力され、上位コードC1の非ゼロ係数が第2符号部132の入力Aに入力される。下位コードC0にゼロランレングスがあり、上位コードC1に非ゼロ係数があるときは、上位コードC1の非ゼロ係数が第1符号部131の入力Aに入力される。   The input A of the first code unit 131 and the second code unit 132 is a non-zero coefficient. When the non-zero coefficient exists in the low-order code C0 among the intermediate code sets composed of two sets of intermediate codes, the non-zero coefficient of the low-order code C0 is input to the input A of the first encoding unit 131. When the low-order code C0 has a non-zero coefficient and the high-order code C1 also has a non-zero coefficient, the non-zero coefficient of the low-order code C0 is input to the input A of the first code unit 131, and the non-zero coefficient of the high-order code C1 Is input to the input A of the second encoding unit 132. When the low-order code C0 has a zero run length and the high-order code C1 has a non-zero coefficient, the non-zero coefficient of the high-order code C1 is input to the input A of the first encoding unit 131.

第1符号部131の入力Zは、ゼロランレングスであり、第1符号部131の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。例えば、第1符号部131の入力Aが下位コードC0の非ゼロ係数であり、下位コードC0の直前の1クロック遅延した上位コードC1_dにゼロランレングスがあるときは、C1_dのゼロランレングスが第1符号部131の入力Zに入力される。また、第1符号部131の入力Aが下位コードC0の非ゼロ係数であり、下位コードC0の直前の1クロック遅延した上位コードC1_dに非ゼロ係数があるときは、入力Aに入力される非ゼロ係数の直前のゼロランレングスは、0である。従って、ゼロランレングス値=0が第1符号部131の入力Zに入力される。また、第1符号部131の入力Aが上位コードC1の非ゼロ係数であるときは、下位コードC0のゼロランレングスが第1符号部131の入力Zに入力される。   The input Z of the first encoding unit 131 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the first encoding unit 131. For example, when the input A of the first encoding unit 131 is a non-zero coefficient of the lower code C0 and the upper code C1_d delayed by one clock immediately before the lower code C0 has a zero run length, the zero run length of C1_d is the first 1 is input to the input Z of the encoding unit 131. Further, when the input A of the first encoding unit 131 is a non-zero coefficient of the lower code C0 and the higher code C1_d delayed by one clock immediately before the lower code C0 has a non-zero coefficient, the non-zero coefficient input to the input A The zero run length immediately before the zero coefficient is zero. Accordingly, zero run length value = 0 is input to the input Z of the first encoding unit 131. Further, when the input A of the first encoding unit 131 is a non-zero coefficient of the upper code C1, the zero run length of the lower code C0 is input to the input Z of the first encoding unit 131.

第2符号部132の入力Zは、ゼロランレングスであり、第2符号部132の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。第2符号部132の入力A,Zに入力が行われるときは、中間コードセットの上位コードC1、下位コードC0両方が非ゼロ係数であるときである。従って、第2符号部132の入力Aに入力される非ゼロ係数の直前のゼロランレングスは、0であるから、ゼロランレングス値=0が第2符号部132の入力Zに入力される。   The input Z of the second encoding unit 132 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the second encoding unit 132. The input to the inputs A and Z of the second encoding unit 132 is when both the upper code C1 and the lower code C0 of the intermediate code set are non-zero coefficients. Accordingly, since the zero run length immediately before the non-zero coefficient input to the input A of the second encoding unit 132 is 0, zero run length value = 0 is input to the input Z of the second encoding unit 132.

セレクタ121,122における入力の切り替えは、中間コードに含まれるIDに基づいて行われる。セレクタ121,122は、中間コードセットが入力されると、中間コードセットに含まれる上位コードのIDであるID1、下位コードのIDであるID0、1クロック前の上位コードのIDであるID1_dの組み合わせによって、入力A及び入力Zの入力を切り替える。IDの組合せと、入力される中間コードの種類の関係を図7に示す。図7は、IDの組合せと、入力される中間コードの種類の関係を示す表である。   The input switching in the selectors 121 and 122 is performed based on the ID included in the intermediate code. When the intermediate code set is input to the selectors 121 and 122, a combination of ID1 that is the ID of the higher code included in the intermediate code set, ID0 that is the ID of the lower code, and ID1_d that is the ID of the higher code before one clock To switch the input A and the input Z. FIG. 7 shows the relationship between ID combinations and the types of intermediate codes that are input. FIG. 7 is a table showing the relationship between ID combinations and the types of intermediate codes that are input.

例えば、組合せが(ID1,ID0,ID1_d)=(0,1,0)であれば、上位コードC1がゼロランレングス、下位コードC0が非ゼロ係数、1クロック前の上位コードC1_dがゼロランレングスである。図4に示す例では、例えば、係数が0→0→0→0→6→0→0→0の部分であり(図4(A))、中間コードは1クロック前の上位コードC1_dが4、下位コードC0が6、上位コードC1が3である(図4(B))。このとき、図7によれば、第1符号部131には、入力Aとして下位コードC0が入力され、入力Zとして1クロック前の上位コードC1_dが入力される。第2符号部132は使用しない。   For example, if the combination is (ID1, ID0, ID1_d) = (0, 1, 0), the upper code C1 has a zero run length, the lower code C0 has a non-zero coefficient, and the upper code C1_d before one clock has a zero run length. It is. In the example shown in FIG. 4, for example, the coefficient is a part of 0 → 0 → 0 → 0 → 6 → 0 → 0 → 0 (FIG. 4A), and the intermediate code has 4 upper codes C1_d before one clock. The lower code C0 is 6 and the upper code C1 is 3 (FIG. 4B). At this time, according to FIG. 7, the lower code C0 is input as the input A to the first encoding unit 131, and the upper code C1_d one clock before is input as the input Z. The second encoding unit 132 is not used.

例えば、組合せが(ID1,ID0,ID1_d)=(1,0,1)であれば、上位コードC1が非ゼロ係数、下位コードC0がゼロランレングス、1クロック前の上位コードC1_dが非ゼロ係数である。図4に示す例では、例えば、係数が2→0→1の部分であり(図4(A))、中間コードは1クロック前の上位コードC1_dが2、下位コードC0が1、上位コードC1が1である(図4(B))。このとき、図7によれば、第1符号部131には、入力Aとして上位コードC1が入力され、入力Zとして下位コードC0が入力される。第2符号部132は使用しない。   For example, if the combination is (ID1, ID0, ID1_d) = (1, 0, 1), the upper code C1 is a non-zero coefficient, the lower code C0 is a zero run length, and the upper code C1_d before one clock is a non-zero coefficient. It is. In the example shown in FIG. 4, for example, the coefficient is a part of 2 → 0 → 1 (FIG. 4 (A)), and the intermediate code is 2 for the upper code C1_d, 1 for the lower code C0, and 1 for the upper code C1. Is 1 (FIG. 4B). At this time, according to FIG. 7, the first code unit 131 receives the upper code C1 as the input A and the lower code C0 as the input Z. The second encoding unit 132 is not used.

また、例えば、組合せが(ID1,ID0,ID1_d)=(1,1,1)であれば、上位コードC1が非ゼロ係数、下位コードC0が非ゼロ係数、1クロック前の上位コードC1_dが非ゼロ係数である。図4に示す例では、例えば、係数が1→1→2の部分であり(図4(A))、中間コードは1クロック前の上位コードC1_dが1、下位コードC0が1、上位コードC1が2である(図4(B))。このとき、図7によれば、第1符号部131には、入力Aとして下位コードC0が入力され、入力Zとして値0が入力される。第2符号部132には、入力Aとして上位コードC1が入力され、入力Zとして値0が入力される。   For example, if the combination is (ID1, ID0, ID1_d) = (1, 1, 1), the upper code C1 is a non-zero coefficient, the lower code C0 is a non-zero coefficient, and the upper code C1_d before one clock is not Zero coefficient. In the example shown in FIG. 4, for example, the coefficient is a part of 1 → 1 → 2 (FIG. 4A), and the intermediate code is 1 for the upper code C1_d, 1 for the lower code C0, and 1 for the upper code C1. Is 2 (FIG. 4B). At this time, according to FIG. 7, the lower code C0 is input as the input A and the value 0 is input as the input Z to the first encoding unit 131. The second code unit 132 receives the upper code C1 as the input A and the value 0 as the input Z.

なお、図7にない組み合わせは、出現することがない組み合わせである。例えば、1クロック前の上位コードがゼロランレングス(IDが0)の場合、下位コードはゼロランレングスになることはなく、下位コードのIDが0になることはない。中間コードがゼロランレングスの後は必ず非ゼロ係数の中間コードとなるためである。   Note that combinations not shown in FIG. 7 are combinations that do not appear. For example, when the upper code one clock before is zero run length (ID is 0), the lower code is never zero run length, and the lower code ID is never 0. This is because the intermediate code always becomes an intermediate code having a non-zero coefficient after the zero run length.

連結部141は、第1符号部131、第2符号部132から出力されたハフマン符号をビット単位での結合を行う。例えば、第1符号部131から出力されるハフマン符号が11bitであり、第2符号部132から出力されるハフマン符号が5bitであるときは、連結部141は、16bitの結合したハフマン符号を出力する。   The concatenation unit 141 combines the Huffman codes output from the first encoding unit 131 and the second encoding unit 132 in units of bits. For example, when the Huffman code output from the first encoding unit 131 is 11 bits and the Huffman code output from the second encoding unit 132 is 5 bits, the concatenating unit 141 outputs a 16-bit combined Huffman code. .

本実施形態によれば、可変長符号化の前段で、DCT係数の非ゼロ係数、ゼロランレングス及びそれぞれの識別子(ID)からなる中間コードを生成する。そして、可変長符号化部107において、符号部が複数設けられることで、符号化に要する処理時間を短縮することができる。例えば、中間コードを2つ組み合わせて1組の中間コードセットとし、符号部を2つ設けることによって、符号化に要する処理クロック数を1/2以下に抑えることができる。   According to the present embodiment, an intermediate code including non-zero coefficients of DCT coefficients, zero run lengths, and respective identifiers (IDs) is generated before the variable length coding. The variable length encoding unit 107 is provided with a plurality of encoding units, so that the processing time required for encoding can be shortened. For example, by combining two intermediate codes into one intermediate code set and providing two encoding units, the number of processing clocks required for encoding can be reduced to ½ or less.

更に、上述した特許文献1の技術では、画像データを量子化した後の係数を一旦バッファに格納した後、ジグザグスキャン(zigzag scan)をして、ゼロランレングスと非ゼロ係数を組み合わせて1つの係数を生成している。しかし、この処理の順序では、ジグザグスキャン後に量子化を行う場合に比べて、反対に処理クロック数が増加してしまうという問題があった。一方、本実施形態によれば、ジグザグスキャン後に量子化しているため、特許文献1のように処理クロック数が増加するという問題がない。   Furthermore, in the technique of Patent Document 1 described above, the coefficient after quantizing the image data is temporarily stored in a buffer, and then zigzag scan is performed to combine one zero run length and a non-zero coefficient. Coefficients are generated. However, this processing order has a problem that the number of processing clocks is increased as compared with the case where quantization is performed after zigzag scanning. On the other hand, according to this embodiment, since quantization is performed after zigzag scanning, there is no problem that the number of processing clocks increases as in Patent Document 1.

[第1の実施形態の第1変更例]
次に、本発明の第1の実施形態に係る画像符号化装置100の第1変更例について説明する。
上述した画像符号化装置100では、2組の中間コードを1つの中間コードセットとする場合について説明したが、本発明はかかる例に限定されない。例えば3組の中間コードを1つの中間コードセットとする等、3組以上の中間コードを1セットとしてもよい。
[First Modification of First Embodiment]
Next, a first modification of the image encoding device 100 according to the first embodiment of the present invention will be described.
In the image coding apparatus 100 described above, the case where two sets of intermediate codes are used as one intermediate code set has been described, but the present invention is not limited to such an example. For example, three sets of intermediate codes may be set as one set, such as three sets of intermediate codes as one intermediate code set.

まず、3組の中間コードを1つの中間コードセットとする場合について説明する。この場合、可変長符号化部107は、図8に示すように、3つの符号部、即ち第1符号部231、第2符号部232、第3符号部233を有する。図8は、本実施形態の可変長符号化部107の変更例を示すブロック図である。   First, a case where three sets of intermediate codes are used as one intermediate code set will be described. In this case, the variable length coding unit 107 includes three coding units, that is, a first coding unit 231, a second coding unit 232, and a third coding unit 233, as shown in FIG. FIG. 8 is a block diagram illustrating a modification of the variable length coding unit 107 of the present embodiment.

まず、中間コード生成部105は、非ゼロ係数とゼロランレングスに基づいて、非ゼロ係数の値又はゼロランレングスの値と、IDからなる中間コードを生成する。生成された中間コードは、第2バッファ106を介して、可変長符号化部107に送られる。本変更例では、3組の中間コードを1セット(中間コードセット)とする。   First, the intermediate code generation unit 105 generates an intermediate code including a non-zero coefficient value or a zero-run length value and an ID based on the non-zero coefficient and the zero run length. The generated intermediate code is sent to the variable length coding unit 107 via the second buffer 106. In this modification, three sets of intermediate codes are set as one set (intermediate code set).

次に、可変長符号化部107による符号化について説明する。第2バッファ106に入力された3組の中間コードからなる中間コードセットのうち、下位側の中間コードから、C0、C1、C2とし、それぞれのIDをID0、ID1、ID2とする。また、1クロック遅延した最上位コードは、末尾に_dを付け、例えばC2_d、そのIDをID2_dと表わす。   Next, encoding by the variable length encoding unit 107 will be described. Of the intermediate code set consisting of three intermediate codes input to the second buffer 106, C0, C1, and C2 are assigned to the lower-order intermediate codes, and the IDs are ID0, ID1, and ID2, respectively. The most significant code delayed by one clock is suffixed with _d, for example, C2_d, and its ID is ID2_d.

可変長符号化部107は、図8に示すように、セレクタ221,222,223,224、第1符号部231、第2符号部232、第3符号部233、連結部241を有する。1セット(中間コードセット)に含まれる中間コードが3組である場合、可変長符号化部107は、可変長符号化部107の符号部は3つからなることから、可変長符号化部107は、第1符号部231と第2符号部232と第3符号部233を有する。   As shown in FIG. 8, the variable length encoding unit 107 includes selectors 221, 222, 223, 224, a first encoding unit 231, a second encoding unit 232, a third encoding unit 233, and a connecting unit 241. When there are three intermediate codes included in one set (intermediate code set), the variable length encoding unit 107 includes three variable length encoding units 107. Therefore, the variable length encoding unit 107 Includes a first encoding unit 231, a second encoding unit 232, and a third encoding unit 233.

第1符号部231、第2符号部232、第3符号部233は、非ゼロ係数とゼロランレングスに基づき、例えば2次元ハフマンテーブルを参照してハフマン符号を出力する。第1符号部231、第2符号部232、第3符号部233は、中間コードに含まれるIDの組み合わせに基づいて、前段のセレクタ221,222,223,224で切り替えて、入力A及び入力Zの入力処理を行う。   The first encoding unit 231, the second encoding unit 232, and the third encoding unit 233 output a Huffman code with reference to, for example, a two-dimensional Huffman table based on the non-zero coefficient and the zero run length. The first encoder 231, the second encoder 232, and the third encoder 233 are switched by the preceding selectors 221, 222, 223, and 224 based on the combination of IDs included in the intermediate code, and input A and input Z Perform input processing.

図8に示すように、第1符号部231の入力Aに入力される非ゼロ係数は、中位コードC1又は下位コードC0である。第1符号部231の入力Zに入力されるゼロランレングスは、値が0、下位コードC0又は1クロック前の上位コードC2_dである。第2符号部232の入力Aに入力される非ゼロ係数は、上位コードC2又は中位コードC1である。第2符号部232の入力Zに入力されるゼロランレングスは、値が0又は中位コードC1である。第3符号部233の入力Aに入力される非ゼロ係数は、上位コードC2である。第3符号部233の入力Zに入力されるゼロランレングスは、値が0である。第3符号部233は、中間コードセットの中間コードC2,C1,C0全てが非ゼロ係数であるときのみ動作し、ハフマン符号を出力する。   As shown in FIG. 8, the non-zero coefficient input to the input A of the first encoding unit 231 is the middle code C1 or the lower code C0. The zero run length input to the input Z of the first encoding unit 231 is 0, the lower code C0, or the upper code C2_d one clock before. The non-zero coefficient input to the input A of the second encoding unit 232 is the upper code C2 or the middle code C1. The zero run length input to the input Z of the second encoding unit 232 has a value of 0 or a middle code C1. The non-zero coefficient input to the input A of the third encoding unit 233 is the upper code C2. The zero run length input to the input Z of the third encoding unit 233 has a value of 0. The third encoding unit 233 operates only when all the intermediate codes C2, C1, and C0 of the intermediate code set are non-zero coefficients, and outputs a Huffman code.

第1符号部231、第2符号部232及び第3符号部233の入力Aは、非ゼロ係数である。3組の中間コードからなる中間コードセットのうち、非ゼロ係数は、下位側の非ゼロ係数から上位側の非ゼロ係数の順で、第1符号部231→第2符号部232→第3符号部233の順番で入力Aの入力に割り当てられる。例えば、下位コードC0はゼロランレングスであり、中位コードC1に非ゼロ係数があるときは、中位コードC1の非ゼロ係数が第1符号部231の入力Aに入力される。下位コードC0に非ゼロ係数があり、中位コードC1にも非ゼロ係数があるときは、下位コードC0の非ゼロ係数が第1符号部231の入力Aに入力され、中位コードC1の非ゼロ係数が第2符号部232の入力Aに入力される。中間コードC2,C1,C0全てが非ゼロ係数であるときは、下位側の中間コードの非ゼロ係数から順に、第1符号部231の入力Aに入力され、中位コードC1の非ゼロ係数が第2符号部232の入力Aに入力され、上位コードC2の非ゼロ係数が第3符号部233の入力Aに入力される。   The input A of the first code unit 231, the second code unit 232, and the third code unit 233 is a non-zero coefficient. Among the intermediate code set composed of three sets of intermediate codes, the non-zero coefficients are the first code unit 231 → the second code unit 232 → the third code in the order of the lower non-zero coefficient to the higher non-zero coefficient. Assigned to the input A in the order of the unit 233. For example, the low-order code C0 has a zero run length, and when the intermediate code C1 has a non-zero coefficient, the non-zero coefficient of the intermediate code C1 is input to the input A of the first encoding unit 231. When the lower code C0 has a non-zero coefficient and the middle code C1 also has a non-zero coefficient, the non-zero coefficient of the lower code C0 is input to the input A of the first code unit 231 and the non-zero coefficient of the middle code C1 The zero coefficient is input to the input A of the second encoding unit 232. When all of the intermediate codes C2, C1, and C0 are non-zero coefficients, the non-zero coefficients of the intermediate code C1 are input to the input A of the first encoding unit 231 in order from the non-zero coefficient of the lower intermediate code. The non-zero coefficient of the upper code C2 is input to the input A of the second encoding unit 232, and the non-zero coefficient of the upper code C2 is input to the input A of the third encoding unit 233.

第1符号部231の入力Zは、ゼロランレングスであり、第1符号部231の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。例えば、第1符号部231の入力Aが下位コードC0の非ゼロ係数であり、下位コードC0の直前の1クロック遅延した上位コードC2_dにゼロランレングスがあるときは、C2_dのゼロランレングスが第1符号部231の入力Zに入力される。また、第1符号部231の入力Aが下位コードC0の非ゼロ係数であり、下位コードC0の直前の1クロック遅延した上位コードC2_dに非ゼロ係数があるときは、入力Aに入力される非ゼロ係数の直前のゼロランレングスは、0である。従って、ゼロランレングス値=0が第1符号部231の入力Zに入力される。また、第1符号部231の入力Aが中位コードC1の非ゼロ係数であるときは、下位コードC0のゼロランレングスが第1符号部231の入力Zに入力される。   The input Z of the first encoding unit 231 is a zero run length, and is the zero run length immediately before the non-zero coefficient input to the input A of the first encoding unit 231. For example, when the input A of the first encoding unit 231 is a non-zero coefficient of the lower code C0 and the upper code C2_d delayed by one clock immediately before the lower code C0 has a zero run length, the zero run length of C2_d is the first It is input to the input Z of the 1 encoding unit 231. Further, when the input A of the first encoding unit 231 is a non-zero coefficient of the lower code C0, and the higher code C2_d delayed by one clock immediately before the lower code C0 has a non-zero coefficient, the non-zero coefficient input to the input A The zero run length immediately before the zero coefficient is zero. Accordingly, zero run length value = 0 is input to the input Z of the first encoding unit 231. Further, when the input A of the first encoding unit 231 is a non-zero coefficient of the middle code C1, the zero run length of the lower code C0 is input to the input Z of the first encoding unit 231.

第2符号部232の入力Zは、ゼロランレングスであり、第2符号部232の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。例えば、第2符号部232の入力Aが上位コードC2の非ゼロ係数であり、上位コードC2の直前の中位コードC1に非ゼロ係数があるときは、入力Aに入力される非ゼロ係数の直前のゼロランレングスは、0である。従って、ゼロランレングス値=0が第2符号部232の入力Zに入力される。また、第2符号部232の入力Aが中位コードC1の非ゼロ係数であるときは、ゼロランレングス値=0が第2符号部232の入力Zに入力される。   The input Z of the second encoding unit 232 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the second encoding unit 232. For example, when the input A of the second encoding unit 232 is a non-zero coefficient of the upper code C2, and the intermediate code C1 immediately before the upper code C2 has a non-zero coefficient, the non-zero coefficient input to the input A The immediately preceding zero run length is zero. Accordingly, zero run length value = 0 is input to the input Z of the second encoding unit 232. Further, when the input A of the second encoding unit 232 is a non-zero coefficient of the intermediate code C1, zero run length value = 0 is input to the input Z of the second encoding unit 232.

第3符号部233の入力Zは、ゼロランレングスであり、第3符号部233の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。第3符号部233の入力A,Zに入力が行われるときは、中間コードセットの上位コードC2、中位コードC1、下位コードC0全てが非ゼロ係数であるときである。従って、第3符号部233の入力Aに入力される非ゼロ係数の直前のゼロランレングスは、0であるから、ゼロランレングス値=0が第3符号部233の入力Zに入力される。   The input Z of the third encoding unit 233 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the third encoding unit 233. The input to the inputs A and Z of the third encoding unit 233 is when all of the upper code C2, the intermediate code C1, and the lower code C0 of the intermediate code set are non-zero coefficients. Accordingly, since the zero run length immediately before the non-zero coefficient input to the input A of the third encoding unit 233 is 0, zero run length value = 0 is input to the input Z of the third encoding unit 233.

セレクタ221,222,223,224における入力の切り替えは、中間コードに含まれるIDに基づいて行われる。セレクタ221,222,223,224は、中間コードセットが入力されると、中間コードセットに含まれる上位コードのIDであるID2、中位コードのIDであるID1、下位コードのIDであるID0、1クロック前の上位コードのIDであるID2_dの組み合わせによって、入力A及び入力Zの入力を切り替える。IDの組合せと、入力される中間コードの種類の関係を図9に示す。図9は、IDの組合せと、入力される中間コードの種類の関係を示す表である。   The input switching in the selectors 221, 222, 223, and 224 is performed based on the ID included in the intermediate code. When the intermediate code set is input to the selectors 221, 222, 223, and 224, ID2 that is the ID of the higher code included in the intermediate code set, ID1 that is the ID of the intermediate code, ID0 that is the ID of the lower code, The input A and the input Z are switched according to the combination of ID2_d which is the ID of the upper code one clock before. FIG. 9 shows the relationship between ID combinations and the types of intermediate codes that are input. FIG. 9 is a table showing the relationship between ID combinations and the types of intermediate codes that are input.

例えば、組合せが(ID2,ID1,ID0,ID2_d)=(0,1,1,0)であれば、上位コードC2がゼロランレングス、中位コードC1が非ゼロ係数、下位コードC0が非ゼロ係数、1クロック前の上位コードC2_dがゼロランレングスである。このとき、図9によれば、第1符号部231には、入力Aとして下位コードC0が入力され、入力Zとして1クロック前の上位コードC2_dが入力される。第2符号部232には、入力Aとして下位コードC1が入力され、入力Zとして値0が入力される。第3符号部233は使用しない。   For example, if the combination is (ID2, ID1, ID0, ID2_d) = (0, 1, 1, 0), the upper code C2 is a zero run length, the middle code C1 is a nonzero coefficient, and the lower code C0 is nonzero. The upper code C2_d one coefficient before the coefficient is zero run length. At this time, according to FIG. 9, the first code unit 231 receives the lower code C0 as the input A and the higher code C2_d one clock earlier as the input Z. The second code unit 232 receives the lower code C1 as the input A and the value 0 as the input Z. The third encoding unit 233 is not used.

また、例えば、組合せが(ID2,ID1,ID0,ID1_d)=(1,0,1,0)であれば、上位コードC2が非ゼロ係数、中位コードC1がゼロランレングス、下位コードC0が非ゼロ係数、1クロック前の上位コードC2_dがゼロランレングスである。このとき、図9によれば、第1符号部231には、入力Aとして下位コードC0が入力され、入力Zとして1クロック前の上位コードC2_dが入力される。第2符号部232には、入力Aとして上位コードC2が入力され、入力Zとして中位コードC1が入力される。第3符号部233は使用しない。   Also, for example, if the combination is (ID2, ID1, ID0, ID1_d) = (1, 0, 1, 0), the upper code C2 is a non-zero coefficient, the middle code C1 is zero run length, and the lower code C0 is The non-zero coefficient, the upper code C2_d one clock before is the zero run length. At this time, according to FIG. 9, the first code unit 231 receives the lower code C0 as the input A and the higher code C2_d one clock earlier as the input Z. The second code unit 232 receives the upper code C2 as the input A and the middle code C1 as the input Z. The third encoding unit 233 is not used.

例えば、組合せが(ID2,ID1,ID0,ID1_d)=(1,1,0,1)であれば、上位コードC2が非ゼロ係数、中位コードC1が非ゼロ係数、下位コードC0がゼロランレングス、1クロック前の上位コードC2_dが非ゼロ係数である。このとき、図9によれば、第1符号部231には、入力Aとして中位コードC1が入力され、入力Zとして下位コードC0が入力される。第2符号部232には、入力Aとして上位コードC2が入力され、入力Zとして下位コードC0が入力される。第3符号部233は使用しない。   For example, if the combination is (ID2, ID1, ID0, ID1_d) = (1, 1, 0, 1), the upper code C2 is a non-zero coefficient, the middle code C1 is a non-zero coefficient, and the lower code C0 is a zero run. The upper code C2_d with a length of one clock is a non-zero coefficient. At this time, according to FIG. 9, the middle code C <b> 1 is input as the input A and the lower code C <b> 0 is input as the input Z to the first encoding unit 231. The second code unit 232 receives the upper code C2 as the input A and the lower code C0 as the input Z. The third encoding unit 233 is not used.

連結部241は、第1符号部231、第2符号部232、第3符号部233から出力されたハフマン符号をビット単位での結合を行う。例えば、第1符号部231から出力されるハフマン符号が11bitであり、第2符号部232から出力されるハフマン符号が5bitであり、第3符号部233からハフマン符号が出力されないときは、連結部241は、16bitの結合したハフマン符号を出力する。   The concatenating unit 241 combines the Huffman codes output from the first encoding unit 231, the second encoding unit 232, and the third encoding unit 233 in units of bits. For example, when the Huffman code output from the first encoding unit 231 is 11 bits, the Huffman code output from the second encoding unit 232 is 5 bits, and the Huffman code is not output from the third encoding unit 233, the connecting unit 241 outputs a 16-bit combined Huffman code.

本変更例によれば、可変長符号化の前段で、DCT係数の非ゼロ係数、ゼロランレングス及びそれぞれの識別子(ID)からなる中間コードを生成する。そして、中間コードを3つ組み合わせて1組の中間コードセットとし、符号部を3つ設けることによって、符号化に要する処理クロック数を1/3以下に抑えることができる。   According to this modification, an intermediate code including a non-zero coefficient of a DCT coefficient, a zero run length, and each identifier (ID) is generated before the variable length coding. Then, by combining three intermediate codes to form one intermediate code set and providing three encoding units, the number of processing clocks required for encoding can be suppressed to 1/3 or less.

[第1の実施形態の第2変更例]
4組以上の中間コードを含む1つの中間コードセットの場合も、上述した2組又は3組の中間コードを含む中間コードセットの場合と同様に処理できる。例えば、4組の中間コードを1つの中間コードセットとする場合、可変長符号化部107は、図10に示すように、4つの符号部、即ち第1符号部331、第2符号部332、第3符号部333、第4符号部334を有する。図10は、符号化を行う可変長符号化部107の変更例を示すブロック図である。
[Second Modification of First Embodiment]
The case of one intermediate code set including four or more sets of intermediate codes can be processed in the same manner as the case of the intermediate code set including two or three sets of intermediate codes described above. For example, when four sets of intermediate codes are used as one intermediate code set, the variable-length encoding unit 107 includes four encoding units, that is, a first encoding unit 331, a second encoding unit 332, as shown in FIG. A third encoding unit 333 and a fourth encoding unit 334 are included. FIG. 10 is a block diagram illustrating a modification of the variable length coding unit 107 that performs coding.

まず、中間コード生成部105は、非ゼロ係数とゼロランレングスに基づいて、非ゼロ係数の値又はゼロランレングスの値と、IDからなる中間コードを生成する。生成された中間コードは、第2バッファ106を介して、可変長符号化部107に送られる。本変更例では、4組の中間コードを1セット(中間コードセット)とする。   First, the intermediate code generation unit 105 generates an intermediate code including a non-zero coefficient value or a zero-run length value and an ID based on the non-zero coefficient and the zero run length. The generated intermediate code is sent to the variable length coding unit 107 via the second buffer 106. In this modification, four sets of intermediate codes are set as one set (intermediate code set).

次に、可変長符号化部107による符号化について説明する。第2バッファ106に入力された4組の中間コードからなる中間コードセットのうち、下位側の中間コードから、C0、C1、C2、C3とし、それぞれのIDをID0、ID1、ID2、ID3とする。また、1クロック遅延した最上位コードは、末尾に_dを付け、例えばC3_d、そのIDをID3_dと表わす。   Next, encoding by the variable length encoding unit 107 will be described. Of the intermediate code set consisting of four sets of intermediate codes input to the second buffer 106, C0, C1, C2, and C3 are assigned from the lower intermediate code, and the IDs are ID0, ID1, ID2, and ID3, respectively. . The most significant code delayed by one clock is suffixed with _d, for example, C3_d, and its ID is ID3_d.

可変長符号化部107は、図10に示すように、セレクタ321,322,323,324,325,326、第1符号部331、第2符号部332、第3符号部333、第4符号部334、連結部341を有する。1セット(中間コードセット)に含まれる中間コードが4組である場合、可変長符号化部107は、可変長符号化部107の符号部は4つからなることから、可変長符号化部107は、第1符号部331と第2符号部332と第3符号部333と第4符号部334を有する。   As shown in FIG. 10, the variable length encoding unit 107 includes selectors 321, 322, 323, 324, 325, 326, a first encoding unit 331, a second encoding unit 332, a third encoding unit 333, and a fourth encoding unit. 334 and a connecting portion 341. When there are four intermediate codes included in one set (intermediate code set), the variable-length encoding unit 107 includes four variable-length encoding units 107, so the variable-length encoding unit 107 Includes a first encoding unit 331, a second encoding unit 332, a third encoding unit 333, and a fourth encoding unit 334.

第1符号部331、第2符号部332、第3符号部333、第4符号部334は、非ゼロ係数とゼロランレングスに基づき、例えば2次元ハフマンテーブルを参照してハフマン符号を出力する。第1符号部331、第2符号部332、第3符号部333、第4符号部334は、中間コードに含まれるIDの組み合わせに基づいて、前段のセレクタ321,322,323,324,325,326で切り替えて、入力A及び入力Zの入力処理を行う。   The first code unit 331, the second code unit 332, the third code unit 333, and the fourth code unit 334 output a Huffman code with reference to, for example, a two-dimensional Huffman table based on the non-zero coefficient and the zero run length. The first encoding unit 331, the second encoding unit 332, the third encoding unit 333, and the fourth encoding unit 334 are based on the combination of IDs included in the intermediate code, and the selectors 321, 322, 323, 324, 325 of the previous stage. Switching is performed at 326 to perform input processing of input A and input Z.

図10に示すように、第1符号部331の入力Aに入力される非ゼロ係数は、中間コードC1又はC0である。第1符号部331の入力Zに入力されるゼロランレングスは、値が0、中間コードC0又はC3_dである。第2符号部332の入力Aに入力される非ゼロ係数は、中間コードC3、C2又はコードC1である。第2符号部332の入力Zに入力されるゼロランレングスは、値が0、中間コードC2又はC1である。第3符号部333の入力Aに入力される非ゼロ係数は、中間コードC3又はC2である。第3符号部333の入力Zに入力されるゼロランレングスは、値が0又は中間コードC2である。第4符号部334の入力Aに入力される非ゼロ係数は、中間コードC3である。第4符号部334の入力Zに入力されるゼロランレングスは、値が0である。第4符号部334は、中間コードセットの中間コードC3,C2,C1,C0全てが非ゼロ係数であるときのみ動作し、ハフマン符号を出力する。   As shown in FIG. 10, the non-zero coefficient input to the input A of the first encoding unit 331 is the intermediate code C1 or C0. The zero run length input to the input Z of the first encoding unit 331 has a value of 0 and an intermediate code C0 or C3_d. The non-zero coefficient input to the input A of the second encoding unit 332 is the intermediate code C3, C2 or code C1. The zero run length input to the input Z of the second encoding unit 332 has a value of 0 and an intermediate code C2 or C1. The non-zero coefficient input to the input A of the third encoding unit 333 is the intermediate code C3 or C2. The zero run length input to the input Z of the third encoding unit 333 has a value of 0 or an intermediate code C2. The non-zero coefficient input to the input A of the fourth encoding unit 334 is the intermediate code C3. The zero run length input to the input Z of the fourth encoding unit 334 has a value of zero. The fourth encoding unit 334 operates only when all the intermediate codes C3, C2, C1, and C0 of the intermediate code set are non-zero coefficients, and outputs a Huffman code.

第1符号部331、第2符号部332、第3符号部333及び第4符号部334の入力Aは、非ゼロ係数である。4組の中間コードからなる中間コードセットのうち、非ゼロ係数は、下位側の非ゼロ係数から上位側の非ゼロ係数の順で、第1符号部331→第2符号部332→第3符号部333→第4符号部334の順番で入力Aの入力に割り当てられる。   The input A of the first code unit 331, the second code unit 332, the third code unit 333, and the fourth code unit 334 is a non-zero coefficient. Among the intermediate code set consisting of four sets of intermediate codes, the non-zero coefficients are the first code unit 331 → the second code unit 332 → the third code in the order of the low-order non-zero coefficient to the high-order non-zero coefficient. Assigned to input A in the order of part 333 → fourth encoding part 334.

第1符号部331の入力Zは、ゼロランレングスであり、第1符号部331の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。第2符号部332の入力Zは、ゼロランレングスであり、第2符号部332の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。第3符号部333の入力Zは、ゼロランレングスであり、第3符号部333の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。第4符号部334の入力Zは、ゼロランレングスであり、第4符号部334の入力Aに入力される非ゼロ係数の直前のゼロランレングスである。   The input Z of the first encoding unit 331 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the first encoding unit 331. The input Z of the second encoding unit 332 is a zero run length, which is the zero run length immediately before the non-zero coefficient input to the input A of the second encoding unit 332. The input Z of the third encoding unit 333 is a zero run length, and is the zero run length immediately before the non-zero coefficient input to the input A of the third encoding unit 333. The input Z of the fourth code unit 334 is a zero run length, and is the zero run length immediately before the non-zero coefficient input to the input A of the fourth code unit 334.

セレクタ321,322,323,324,325,326における入力の切り替えは、中間コードに含まれるIDに基づいて行われる。セレクタ321,322,323,324,325,326は、中間コードセットが入力されると、中間コードセットに含まれるID3、ID2、ID1、ID0、ID3_dの組み合わせによって、入力A及び入力Zの入力を切り替える。IDの組合せと、入力される中間コードの種類の関係を図11に示す。図11は、IDの組合せと、入力される中間コードの種類の関係を示す表である。   The input switching in the selectors 321, 322, 323, 324, 325, 326 is performed based on the ID included in the intermediate code. When the intermediate code set is input, the selectors 321, 322, 323, 324, 325, and 326 input the inputs A and Z according to the combination of ID3, ID2, ID1, ID0, and ID3_d included in the intermediate code set. Switch. FIG. 11 shows the relationship between the combination of IDs and the type of intermediate code to be input. FIG. 11 is a table showing the relationship between ID combinations and the types of intermediate codes that are input.

例えば、組合せが(ID3,ID2,ID1,ID0,ID2_d)=(1,0,1,1,0)であれば、C3が非ゼロ係数、C2がゼロランレングス、C1が非ゼロ係数、C0が非ゼロ係数、1クロック前のC3_dがゼロランレングスである。このとき、図11に示すように、第1符号部331には、入力AとしてC0が入力され、入力Zとして1クロック前のC3_dが入力される。第2符号部332には、入力AとしてC1が入力され、入力Zとして値0が入力される。第3符号部333には、入力AとしてC3が入力され、入力ZとしてC2が入力される。第4符号部334は使用しない。   For example, if the combination is (ID3, ID2, ID1, ID0, ID2_d) = (1, 0, 1, 1, 0), C3 is a non-zero coefficient, C2 is a zero-run length, C1 is a non-zero coefficient, C0 Is the non-zero coefficient, and C3_d one clock before is the zero run length. At this time, as shown in FIG. 11, C0 is input as the input A and C3_d one clock before is input as the input Z to the first encoding unit 331. The second encoding unit 332 receives C1 as input A and 0 as input Z. The third encoding unit 333 receives C3 as input A and C2 as input Z. The fourth code unit 334 is not used.

連結部341は、第1符号部331、第2符号部332、第3符号部333、第4符号部334から出力されたハフマン符号をビット単位での結合を行う。例えば、第1符号部331から出力されるハフマン符号が11bitであり、第2符号部332から出力されるハフマン符号が5bitであり、第3符号部333及び第4符号部334からハフマン符号が出力されないときは、連結部341は、16bitの結合したハフマン符号を出力する。   The concatenating unit 341 combines the Huffman codes output from the first encoding unit 331, the second encoding unit 332, the third encoding unit 333, and the fourth encoding unit 334 in units of bits. For example, the Huffman code output from the first encoding unit 331 is 11 bits, the Huffman code output from the second encoding unit 332 is 5 bits, and the Huffman codes are output from the third encoding unit 333 and the fourth encoding unit 334. If not, the connecting unit 341 outputs a 16-bit combined Huffman code.

本変更例によれば、可変長符号化の前段で、DCT係数の非ゼロ係数、ゼロランレングス及びそれぞれの識別子(ID)からなる中間コードを生成する。そして、中間コードを4つ組み合わせて1組の中間コードセットとし、符号部を4つ設けることによって、符号化に要する処理クロック数を1/3以下に抑えることができる。   According to this modification, an intermediate code including a non-zero coefficient of a DCT coefficient, a zero run length, and each identifier (ID) is generated before the variable length coding. Then, by combining four intermediate codes into one intermediate code set and providing four encoding units, the number of processing clocks required for encoding can be suppressed to 1/3 or less.

(第2の実施形態)
次に、図12を参照して、本発明の第2の実施形態に係る画像符号化装置200について説明する。図12は、本実施形態に係る画像符号化装置200の構成を示すブロック図である。
(Second Embodiment)
Next, an image encoding device 200 according to the second embodiment of the present invention will be described with reference to FIG. FIG. 12 is a block diagram illustrating a configuration of the image encoding device 200 according to the present embodiment.

画像符号化装置200は、例えば、2次元DCT部401と、第1バッファ402−1,402−2と、ジグザグスキャン部403−1,403−2と、量子化部404−1,404−2と、中間コード生成部405−1,405−2と、第2バッファ406−1,406−2と、可変長符号化部407などからなる。   The image coding apparatus 200 includes, for example, a two-dimensional DCT unit 401, first buffers 402-1 and 402-2, zigzag scanning units 403-1 and 403-2, and quantization units 404-1 and 404-2. And intermediate code generators 405-1 and 405-2, second buffers 406-1 and 406-2, a variable length encoder 407, and the like.

本実施形態の画像符号化装置200は、第1の実施形態の画像符号化装置100と異なり、第1バッファ402−1,402−2から、第2バッファ406−1,406−2までの各機能ブロックが並列して2系統で構成される。第1バッファ402−1,402−2と、ジグザグスキャン部403−1,403−2と、量子化部404−1,404−2と、中間コード生成部405−1,405−2と、第2バッファ406−1,406−2の構成及び作用は、第1の実施形態の第1バッファ102と、ジグザグスキャン部103と、量子化部104と、中間コード生成部105と、第2バッファ106と同様であるため、詳細な説明は省略する。   Unlike the image encoding device 100 according to the first embodiment, the image encoding device 200 according to the present embodiment includes each of the first buffers 402-1 and 402-2 to the second buffers 406-1 and 406-2. Functional blocks are composed of two systems in parallel. First buffers 402-1 and 402-2, zigzag scanning units 403-1 and 403-2, quantization units 404-1 and 404-2, intermediate code generation units 405-1 and 405-2, The configurations and operations of the two buffers 406-1 and 406-2 are the same as the first buffer 102, the zigzag scan unit 103, the quantization unit 104, the intermediate code generation unit 105, and the second buffer 106 of the first embodiment. Therefore, detailed description is omitted.

2次元DCT部401は、画像データをDCT変換して、8×8画素のブロック毎に8×8のDCT係数ブロックを生成する。2次元DCT部401は、生成したDCT係数ブロックを交互に第1バッファ402−1と第1バッファ402−2に出力する。図13は、本実施形態の画像符号化装置200の動作を示すタイミングチャートである。図13における「BLK」とはブロックの略である。   The two-dimensional DCT unit 401 performs DCT conversion on the image data to generate an 8 × 8 DCT coefficient block for each 8 × 8 pixel block. The two-dimensional DCT unit 401 alternately outputs the generated DCT coefficient block to the first buffer 402-1 and the first buffer 402-2. FIG. 13 is a timing chart showing the operation of the image encoding device 200 of the present embodiment. “BLK” in FIG. 13 is an abbreviation for block.

2次元DCT部401は、第1の実施形態の2次元DCT部101に比べて、例えば2倍速で行う。例えば2次元DCT部401は、1つのDCT係数ブロックを32クロック以内で処理する。   The two-dimensional DCT unit 401 performs, for example, double speed compared to the two-dimensional DCT unit 101 of the first embodiment. For example, the two-dimensional DCT unit 401 processes one DCT coefficient block within 32 clocks.

第1バッファ402−1,402−2から、第2バッファ406−1,406−2までの各機能ブロックが並列して2系統で構成されることで、ジグザグスキャンから中間コード生成までの処理について、実質1DCT係数ブロックを32クロック以内で処理できる。   The function blocks from the first buffer 402-1 and 402-2 to the second buffer 406-1 and 406-2 are configured in parallel in two systems, so that processing from zigzag scanning to intermediate code generation is performed. The 1 DCT coefficient block can be processed within 32 clocks.

そして、可変長符号化部407は、中間コードに基づいて、DCT係数をハフマン符号化する。可変長符号化部407は、第1の実施形態の可変長符号化部107と同様に、符号部を複数有するため、符号化に要するクロック数をデータ数の1/2以下に抑えることができる。従って、ジグザグスキャンから中間コード生成までの処理を、実質1DCT係数ブロックを32クロック以内で処理したとしても、可変長符号化部407は、1つのDCT係数ブロックの符号化を終えた後に、次のDCT係数ブロックの符号化を開始することができる。   Then, the variable length coding unit 407 performs Huffman coding of the DCT coefficient based on the intermediate code. Since the variable length encoding unit 407 includes a plurality of encoding units as in the variable length encoding unit 107 of the first embodiment, the number of clocks required for encoding can be suppressed to ½ or less of the number of data. . Therefore, even if the processes from zigzag scanning to intermediate code generation are processed within 32 clocks for a substantial 1 DCT coefficient block, the variable length encoding unit 407 finishes encoding one DCT coefficient block, Coding of the DCT coefficient block can be started.

よって、第2の実施形態によれば、第1の実施形態のように符号化だけでなく、例えばJPEG全体の符号化を2倍速で行うことができる。図14は、従来の画像符号化装置の動作を示すタイミングチャートである。従来は、可変長符号化の処理クロック数は、2次元DCTの処理クロック数と同じであった。   Therefore, according to the second embodiment, not only encoding as in the first embodiment but also, for example, encoding of the entire JPEG can be performed at double speed. FIG. 14 is a timing chart showing the operation of the conventional image coding apparatus. Conventionally, the number of processing clocks for variable length encoding is the same as the number of processing clocks for two-dimensional DCT.

なお、ジグザグスキャンから中間コード生成までの処理が並列して3系統以上で行われ、その系統数に合わせて、可変長符号化部407が符号部を3つ以上有する場合は、更に、JPEG全体の符号処理を短縮することができる。   If the processes from zigzag scanning to intermediate code generation are performed in three or more systems in parallel, and the variable length encoding unit 407 has three or more encoding units according to the number of systems, the entire JPEG Can be shortened.

以上、添付図面を参照しながら本発明の好適な実施形態について詳細に説明したが、本発明はかかる例に限定されない。本発明の属する技術の分野における通常の知識を有する者であれば、特許請求の範囲に記載された技術的思想の範疇内において、各種の変更例または修正例に想到し得ることは明らかであり、これらについても、当然に本発明の技術的範囲に属するものと了解される。   The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to such examples. It is obvious that a person having ordinary knowledge in the technical field to which the present invention pertains can come up with various changes or modifications within the scope of the technical idea described in the claims. Of course, it is understood that these also belong to the technical scope of the present invention.

本発明の第1の実施形態に係る画像符号化装置の構成を示すブロック図である。It is a block diagram which shows the structure of the image coding apparatus which concerns on the 1st Embodiment of this invention. 8×8のDCT係数ブロック、及びDCT係数ブロックにおけるジグザグスキャンを示す説明図である。It is explanatory drawing which shows the zigzag scan in an 8x8 DCT coefficient block and a DCT coefficient block. 同実施形態の第2バッファに格納される中間コードの配置を示す説明図である。It is explanatory drawing which shows arrangement | positioning of the intermediate code stored in the 2nd buffer of the embodiment. 時系列順に配置された量子化後のDCT係数(A)と、量子化後のDCT係数から生成した中間コード(B)を示す説明図である。It is explanatory drawing which shows the DCT coefficient (A) after the quantization arrange | positioned in time series order, and the intermediate code (B) produced | generated from the DCT coefficient after quantization. 第2バッファと、第2バッファから中間コードを読み出す可変長符号化部を示すブロック図である。It is a block diagram which shows the variable length encoding part which reads an intermediate code from a 2nd buffer and a 2nd buffer. 同実施形態の可変長符号化部を示すブロック図である。It is a block diagram which shows the variable length encoding part of the embodiment. IDの組合せと、入力される中間コードの種類の関係を示す表である。It is a table | surface which shows the relationship between the combination of ID, and the kind of intermediate code input. 同実施形態の可変長符号化部の変更例を示すブロック図である。It is a block diagram which shows the example of a change of the variable length encoding part of the embodiment. IDの組合せと、入力される中間コードの種類の関係を示す表である。It is a table | surface which shows the relationship between the combination of ID, and the kind of intermediate code input. 符号化を行う可変長符号化部の変更例を示すブロック図である。It is a block diagram which shows the example of a change of the variable-length encoding part which performs encoding. IDの組合せと、入力される中間コードの種類の関係を示す表である。It is a table | surface which shows the relationship between the combination of ID, and the kind of intermediate code input. 本発明の第2の実施形態に係る画像符号化装置の構成を示すブロック図である。It is a block diagram which shows the structure of the image coding apparatus which concerns on the 2nd Embodiment of this invention. 同実施形態の画像符号化装置の動作を示すタイミングチャートである。It is a timing chart which shows operation | movement of the image coding apparatus of the embodiment. 従来の画像符号化装置の動作を示すタイミングチャートである。It is a timing chart which shows operation | movement of the conventional image coding apparatus.

符号の説明Explanation of symbols

100,200 画像符号化装置
101,401 2次元DCT部
102,402−1,402−2 第1バッファ
103,403−1,403−2 ジグザグスキャン部
104,404−1,404−2 量子化部
105,405−1,405−2 中間コード生成部
106,406−1,406−2 第2バッファ
107,407 可変長符号化部
110 分離部
111 遅延部
121,122,221,222,223,224,321,322,323,324,325,326 セレクタ
131,231,331 第1符号部
132,232,332 第2符号部
141,241,341 連結部
233,333 第3符号部
334 第4符号部
100, 200 Image encoding device 101, 401 Two-dimensional DCT unit 102, 402-1, 402-2 First buffer 103, 403-1, 403-2 Zigzag scanning unit 104, 404-1, 404-2 Quantization unit 105, 405-1, 405-2 Intermediate code generation unit 106, 406-1, 406-2 Second buffer 107, 407 Variable length encoding unit 110 Separation unit 111 Delay unit 121, 122, 221, 222, 223, 224 , 321, 322, 323, 324, 325, 326 Selector 131, 231, 331 First code part 132, 232, 332 Second code part 141, 241, 341 Connection part 233, 333 Third code part 334 Fourth code part

Claims (3)

画像データを直交変換し直交変換係数を生成する直交変換部と、
前記直交変換係数を量子化し量子化係数を生成する量子化部と、
前記量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、前記ゼロ係数の後に続く、前記量子化係数の値がゼロでない非ゼロ係数とを検出する係数検出部と、
順次検出された前記非ゼロ係数又は前記ゼロランレングスを2以上の所定数毎に順次組み合わせると共に、前記非ゼロ係数及び前記ゼロランレングスのいずれであるかを識別する識別子を前記非ゼロ係数及び前記ゼロランレングス毎に付与して中間コードを生成する中間コード生成部と、
前記中間コードの前記非ゼロ係数又は前記ゼロランレングスと、前記識別子に基づいて、それぞれ1つの前記非ゼロ係数と1つの前記ゼロランレングスが入力されて可変長符号化処理する、前記所定数と同一数以上からなる複数の符号化部と
を有する、画像符号化装置。
An orthogonal transform unit that orthogonally transforms image data and generates orthogonal transform coefficients;
A quantization unit that quantizes the orthogonal transform coefficient to generate a quantization coefficient;
Coefficient detection for detecting a zero run length indicating the number of consecutive zero coefficients whose quantization coefficient value is zero (0) and a non-zero coefficient whose quantization coefficient value is not zero following the zero coefficient. And
The non-zero coefficient or the zero run length sequentially detected is sequentially combined every two or more predetermined numbers, and an identifier for identifying whether the non-zero coefficient or the zero run length is the non-zero coefficient and the zero run length. An intermediate code generation unit that generates an intermediate code by giving each zero run length;
Based on the non-zero coefficient or the zero-run length of the intermediate code, and the identifier, one non-zero coefficient and one zero-run length are respectively input and variable length coding is performed, and the predetermined number An image encoding apparatus having a plurality of encoding units including the same number or more.
前記量子化部、前記係数検出部及び前記中間コード生成部は、並列した複数の系統からなる、請求項1に記載の画像符号化装置。   The image coding apparatus according to claim 1, wherein the quantization unit, the coefficient detection unit, and the intermediate code generation unit include a plurality of systems in parallel. 直交変換部が、画像データを直交変換し直交変換係数を生成するステップと、
量子化部が、前記直交変換係数を量子化し量子化係数を生成するステップと、
係数検出部が、前記量子化係数の値がゼロ(0)であるゼロ係数の連続数を示すゼロランレングスと、前記ゼロ係数の後に続く、前記量子化係数の値がゼロでない非ゼロ係数とを検出するステップと、
中間コード生成部が、順次検出された前記非ゼロ係数又は前記ゼロランレングスを2以上の所定数毎に順次組み合わせると共に、前記非ゼロ係数及び前記ゼロランレングスのいずれであるかを識別する識別子を前記非ゼロ係数及び前記ゼロランレングス毎に付与して中間コードを生成するステップと、
前記所定数と同一数以上からなる複数の符号化部が、前記中間コードの前記非ゼロ係数又は前記ゼロランレングスと、前記識別子に基づいて、それぞれ1つの前記非ゼロ係数と1つの前記ゼロランレングスが入力されて可変長符号化処理するステップと
を有する、画像符号化方法。
An orthogonal transform unit orthogonally transforms the image data to generate an orthogonal transform coefficient;
A quantizing unit that quantizes the orthogonal transform coefficient to generate a quantized coefficient;
A coefficient detection unit includes a zero run length indicating the number of consecutive zero coefficients whose value of the quantization coefficient is zero (0), and a non-zero coefficient whose value of the quantization coefficient is not zero, which follows the zero coefficient. Detecting steps,
An intermediate code generation unit sequentially combines the detected non-zero coefficient or the zero-run length every two or more predetermined numbers, and an identifier for identifying whether the non-zero coefficient or the zero-run length is Providing an intermediate code for each non-zero coefficient and zero run length; and
A plurality of encoding units having the same number or more as the predetermined number are each configured to have one non-zero coefficient and one zero run based on the non-zero coefficient or the zero-run length of the intermediate code and the identifier, respectively. And a variable length encoding process by inputting a length.
JP2008301333A 2008-11-26 2008-11-26 Image coding apparatus and image coding method Expired - Fee Related JP5230375B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2008301333A JP5230375B2 (en) 2008-11-26 2008-11-26 Image coding apparatus and image coding method
KR20090068407A KR20100059665A (en) 2008-11-26 2009-07-27 Appratus for coding an image and method for coding the image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008301333A JP5230375B2 (en) 2008-11-26 2008-11-26 Image coding apparatus and image coding method

Publications (2)

Publication Number Publication Date
JP2010130213A true JP2010130213A (en) 2010-06-10
JP5230375B2 JP5230375B2 (en) 2013-07-10

Family

ID=42330299

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008301333A Expired - Fee Related JP5230375B2 (en) 2008-11-26 2008-11-26 Image coding apparatus and image coding method

Country Status (2)

Country Link
JP (1) JP5230375B2 (en)
KR (1) KR20100059665A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63132530A (en) * 1986-09-13 1988-06-04 フィリップス エレクトロニクス ネムローゼ フェンノートシャップ Method and apparatus for reducing bit-rate
JPH06237448A (en) * 1993-02-12 1994-08-23 Toshiba Corp Variable length coder and decoder
JP2003125362A (en) * 2001-10-15 2003-04-25 Nec Corp Additional information inserting device and additional information extracting device, and additional information inserting method and additional information extracting method
JP2003143604A (en) * 1990-02-27 2003-05-16 Qualcomm Inc Adaptive block size image compression method and system
JP2003174366A (en) * 2001-12-04 2003-06-20 Sony Corp Data decoding device and its method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63132530A (en) * 1986-09-13 1988-06-04 フィリップス エレクトロニクス ネムローゼ フェンノートシャップ Method and apparatus for reducing bit-rate
JP2003143604A (en) * 1990-02-27 2003-05-16 Qualcomm Inc Adaptive block size image compression method and system
JPH06237448A (en) * 1993-02-12 1994-08-23 Toshiba Corp Variable length coder and decoder
JP2003125362A (en) * 2001-10-15 2003-04-25 Nec Corp Additional information inserting device and additional information extracting device, and additional information inserting method and additional information extracting method
JP2003174366A (en) * 2001-12-04 2003-06-20 Sony Corp Data decoding device and its method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN7013000630; WEN-HSIUNG CHEN,WILLIAM K.PRATT: 'Scene Adaptive Coder' IEEE TRANSACTIONS ON COMMUNICATIONS Vol.Com-32,No.3, 198403, P.225-P.232, IEEE *

Also Published As

Publication number Publication date
KR20100059665A (en) 2010-06-04
JP5230375B2 (en) 2013-07-10

Similar Documents

Publication Publication Date Title
US11671599B2 (en) Data encoding and decoding
US11039142B2 (en) Encoding and decoding of significant coefficients in dependence upon a parameter of the significant coefficients
RU2417518C2 (en) Efficient coding and decoding conversion units
JP2016528789A (en) Data encoding and decoding
JP6045123B2 (en) Encoder, decoder and method
JP2007116436A (en) Coding device and decoding device
US9544599B2 (en) Context adaptive data encoding
GB2496209A (en) Entropy encoder with first and second, bypass encoding systems
JP2009021775A (en) Coder and coding method
WO2014131526A1 (en) Entropy modifier and method
JPH07170517A (en) Picture compression coder
JPH06350854A (en) Picture compression encoding device
WO2013068733A1 (en) Context adaptive data encoding
JP5230375B2 (en) Image coding apparatus and image coding method
KR101549740B1 (en) Binary data compression and decompression method and apparatus
KR100753282B1 (en) VLC table selection method for CAVLC decoding and CAVLC decoding method thereof
KR102109768B1 (en) Cabac binary arithmetic encoder for high speed processing of uhd imge
CN110431748B (en) Binary arithmetic decoder and binary arithmetic decoding device
KR101676420B1 (en) Data compression and restoration method and apparatus
JP2668900B2 (en) High efficiency coding device
JP2005176169A (en) Video coding method and apparatus
JP2004179752A (en) Huffman decoder
JPH10163880A (en) Data decoder
KR20170124004A (en) Compressed manchester line coding method and apparatus thereof by universal code

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20101005

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20111117

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130226

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130319

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

Free format text: PAYMENT UNTIL: 20160329

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 5230375

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees