JP2007116246A - Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium - Google Patents

Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium Download PDF

Info

Publication number
JP2007116246A
JP2007116246A JP2005302919A JP2005302919A JP2007116246A JP 2007116246 A JP2007116246 A JP 2007116246A JP 2005302919 A JP2005302919 A JP 2005302919A JP 2005302919 A JP2005302919 A JP 2005302919A JP 2007116246 A JP2007116246 A JP 2007116246A
Authority
JP
Japan
Prior art keywords
block
frame
residual
huffman
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.)
Withdrawn
Application number
JP2005302919A
Other languages
Japanese (ja)
Inventor
Tetsuya Murakami
哲也 村上
Tetsujiro Kondo
哲二郎 近藤
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.)
Sony Corp
Original Assignee
Sony Corp
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 Sony Corp filed Critical Sony Corp
Priority to JP2005302919A priority Critical patent/JP2007116246A/en
Publication of JP2007116246A publication Critical patent/JP2007116246A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To achieve efficient coding and decoding. <P>SOLUTION: A Huffman code discipline motion estimator 73 searches a motion block where a Huffman code is minimized for obtaining a motion vector. A residue calculator 74 calculates a residue from a block to be supplied, 1 frame, and the motion vector. A residue Huffman encoder 75 refers to a Huffman table stored in a Haffuman table storage 76 for changing the residue into a Huffman code. A Huffman code calculator 77 creates the frequency distribution of the residue, and updates the Huffman table stored in the Huffman table storage 76, based on the created frequency distribution which is applied to an encoder and a decoder handling a moving image. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、動きベクトル推定装置および方法、符号化装置および方法、復号化装置および方法、プログラム、並びに記録媒体に関し、特に、動き補償残差をハフマン符号化して符号化を行うとき、または、ハフマン符号化された動き補償残差を用いて復号化処理を行うとき、その残差に対応するハフマンコードが最小長となるようにした動きベクトル推定装置および方法、符号化装置および方法、復号化装置および方法、プログラム、並びに記録媒体に関する。   The present invention relates to a motion vector estimation apparatus and method, an encoding apparatus and method, a decoding apparatus and method, a program, and a recording medium, and in particular, when encoding by performing Huffman encoding on a motion compensation residual, or Huffman Motion vector estimation apparatus and method, encoding apparatus and method, and decoding apparatus in which Huffman code corresponding to the residual has a minimum length when decoding is performed using the encoded motion compensation residual And a method, a program, and a recording medium.

符号化処理には、一般的に分類すると可逆符号化と不可逆符号化とがある。可逆符号化は、符号化の対象とされたデータが同一のデータに復元可能であるように符号化する方式であり、不可逆符号化は、符号化の対象とされたデータが同一のデータには復元されない符号化の方式である。(例えば、特許文献1乃至3参照)   Encoding processes are generally classified into lossless encoding and irreversible encoding. Lossless encoding is a method of encoding so that the data to be encoded can be restored to the same data, and irreversible encoding is for data with the same data to be encoded. This is an encoding method that is not restored. (For example, see Patent Documents 1 to 3)

符号化の対象とされたデータを元データVan0とし、元データVan0が符号化されたデータを符号化データVcdとし、符号化データVcdが復号されたデータを復号データVan1とした場合、可逆符号化と不可逆符号化では、以下のような関係が成り立つ。
可逆符号化の場合
元データVan0=復号データVan1
不可逆符号化の場合
元データVan0≠復号データVan1
When the data to be encoded is the original data Van0, the data obtained by encoding the original data Van0 is the encoded data Vcd, and the data obtained by decoding the encoded data Vcd is the decoded data Van1, the lossless encoding is performed. In irreversible encoding, the following relationship holds.
In the case of lossless encoding, original data Van0 = decoded data Van1
In case of lossy encoding Original data Van0 ≠ decoded data Van1

可逆符号化の特徴としては、符号化によって失われる情報はなく、その為に、画質の劣化を防ぐことができるが、情報量が多くなってしまう(符号化データVcdのデータ量が大きくなってしまう)ことがあげられる。   As a characteristic of lossless encoding, there is no information lost by encoding, and therefore it is possible to prevent deterioration in image quality, but the amount of information increases (the amount of encoded data Vcd increases). )).

不可逆符号化の特徴としては、その処理の特性上、符号化の際に失われる情報が多いという点があげられる。符号化の際に失われた情報のため、ユーザによっては、復号化された画像を閲覧したときに、画像が劣化したと感じることがある。動画像の不可逆符号化の代表的な例としては、MPEG(Moving Picture Expert Group)がある。MPEG方式による符号化は、大幅な圧縮が可能ではあるが、高周波成分をカットすることでモスキートノイズが発生したり、ブロック処理のためブロックノイズが顕著であるといった問題点があった。   A characteristic of lossy encoding is that a large amount of information is lost during encoding due to the characteristics of the processing. Because of information lost during encoding, some users may feel that the image has deteriorated when viewing the decoded image. A typical example of irreversible encoding of moving images is MPEG (Moving Picture Expert Group). Although encoding by the MPEG method can be greatly compressed, there is a problem that mosquito noise is generated by cutting high-frequency components, and block noise is remarkable due to block processing.

このような不可逆符号化に対し、可逆符号化は、上記したように、その処理の特性上、符号化によって失われる情報はないが、その分、不可逆符号化に比べ冗長な情報量が存在していた(データ量が大きくなってしまった)。動画像の可逆符号化を行う装置について図1を参照して説明する。   In contrast to such irreversible coding, lossless coding, as described above, has no information lost due to coding due to its processing characteristics. However, there is a redundant amount of information compared to irreversible coding. (The amount of data has grown). An apparatus for performing lossless encoding of a moving image will be described with reference to FIG.

図1は、従来の符号化装置の構成例を示す図である。動画像を圧縮(符号化)するには時間方向の相関性を利用した、動き補償を利用するのが一般的であり、そのような符号化を行う符号化装置10である。   FIG. 1 is a diagram illustrating a configuration example of a conventional encoding device. In order to compress (encode) a moving image, motion compensation using correlation in the time direction is generally used, and the encoding apparatus 10 performs such encoding.

符号化装置10は、ブロック化部11、フレームメモリ12、SNR(signal power to noise power ratio)規範動き推定部13、残差算出部14、残差ハフマン符号化部15、ハフマンテーブル記憶部16、および、データ合成部17から構成されている。   The encoding device 10 includes a blocking unit 11, a frame memory 12, an SNR (signal power to noise power ratio) normative motion estimation unit 13, a residual calculation unit 14, a residual Huffman encoding unit 15, a Huffman table storage unit 16, The data composition unit 17 is also included.

符号化装置10に供給された画像デジタル信号Vdgは、ブロック化部11、フレームメモリ12、および、残差算出部14に供給される。ブロック化部11は、入力された画像デジタル信号Vdgに基づく1フレームを、所定の画素数から構成されるブロックに、ブロック化(分割)する。ブロック化部11によりブロック化されたブロックは、SNR動き推定部13に供給される。   The image digital signal Vdg supplied to the encoding device 10 is supplied to the blocking unit 11, the frame memory 12, and the residual calculation unit 14. The blocking unit 11 blocks (divides) one frame based on the input image digital signal Vdg into blocks each having a predetermined number of pixels. The blocks blocked by the blocking unit 11 are supplied to the SNR motion estimation unit 13.

SNR規範動き推定部13には、フレームメモリ12に記憶されているフレームの画像デジタル信号も供給される。SNR規範動き推定部13に供給されるフレームは、処理対象とされているフレーム(ブロック化部11によりブロック化されるフレーム)よりも1フレーム前のフレームである。SNR規範動き推定部13は、ブロック化部11からのブロックに類似するブロックが、1フレーム前のフレーム内で存在する位置を検出し、その検出されたブロックとの相対座標を求めることにより、動きベクトルを検出する。   The SNR standard motion estimation unit 13 is also supplied with the image digital signal of the frame stored in the frame memory 12. The frame supplied to the SNR reference motion estimation unit 13 is a frame one frame before the frame that is the processing target (the frame that is blocked by the blocking unit 11). The SNR normative motion estimation unit 13 detects a position where a block similar to the block from the blocking unit 11 is present in the previous frame, and obtains a relative coordinate with the detected block, thereby moving the motion. Detect vectors.

SNR規範動き推定部13からの動きベクトルは、残差算出部14に供給される。残差算出部14は、フレームメモリ12からも処理対象とされているフレームより1フレーム前のフレームが供給される。残差算出部14は、供給された動きベクトル、1フレーム前のフレーム、および現フレームから予測残差を算出する。   The motion vector from the SNR reference motion estimation unit 13 is supplied to the residual calculation unit 14. The residual calculation unit 14 is also supplied from the frame memory 12 with a frame one frame before the frame that is the processing target. The residual calculation unit 14 calculates a prediction residual from the supplied motion vector, the previous frame, and the current frame.

残差算出部14により算出された予測残差は、残差ハフマン符号化部15に供給される。残差ハフマン符号化部15は、ハフマンテーブル記憶部16に記憶されているハフマンテーブルを参照し、供給された予測残差をハフマン符号化する。ハフマンテーブル記憶部16に記憶されているハフマンテーブルは、自然画像から作成されたハフマンテーブルである。   The prediction residual calculated by the residual calculation unit 14 is supplied to the residual Huffman coding unit 15. The residual Huffman encoding unit 15 refers to the Huffman table stored in the Huffman table storage unit 16 and encodes the supplied prediction residual. The Huffman table stored in the Huffman table storage unit 16 is a Huffman table created from a natural image.

残差ハフマン符号化部15からのハフマン符号化された予測残差は、データ合成部17に供給される。データ合成部17には、SNR規範動き推定部13からの動きベクトルも供給される。データ合成部17は、ハフマン符号化された予測残差と動きベクトルを、データ合成し、符号データVcdとして、図示されていない他の装置(例えば、復号化装置)に出力する。   The Huffman-encoded prediction residual from the residual Huffman encoder 15 is supplied to the data synthesizer 17. The data synthesis unit 17 is also supplied with the motion vector from the SNR reference motion estimation unit 13. The data synthesizing unit 17 synthesizes the Huffman-encoded prediction residual and the motion vector, and outputs the synthesized data as code data Vcd to another device (not shown) (for example, a decoding device).

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

特開2001−16594号公報JP 2001-16594 A

特開2000−50279号公報JP 2000-50279 A

図1の符号化装置10において用いられるハフマンテーブルは、自然画像から作成されており、その作成の際に用いられた自然画像に依存するものである。換言すれば、処理対象とされる画像に依存するハフマンテーブルではなく、出現確率の異なる予測残差が反映されたテーブルではない。よって、残差ハフマン符号化部15により予測残差をハフマン符号化する際、ハフマン符号割り当てに冗長な部分が存在してしまう。また前段でのブロックマッチングは、上記したようにSNR最小規範で行っており、前段の処理結果が後段に反映されていない点が、圧縮率の低下の一因にもなっている。   The Huffman table used in the encoding device 10 in FIG. 1 is created from a natural image and depends on the natural image used in the creation. In other words, it is not a Huffman table depending on the image to be processed, and is not a table reflecting prediction residuals having different appearance probabilities. Therefore, when the residual Huffman coding unit 15 performs Huffman coding on the prediction residual, there is a redundant part in the Huffman code assignment. Further, the block matching in the previous stage is performed based on the SNR minimum norm as described above, and the fact that the processing result in the previous stage is not reflected in the subsequent stage also contributes to the decrease in the compression rate.

また、上記したように、動画像の不可逆符号化では、例えば、MPEG方式に代表されるように、大部幅な圧縮が可能ではあるが、その反面、高周波成分をカットすることでモスキートノイズが発生したり、ブロック化の処理のためブロックノイズが顕著であったりといったことが発生する可能性があった。   In addition, as described above, in irreversible encoding of a moving image, for example, as shown by the MPEG method, a wide compression is possible, but on the other hand, mosquito noise is generated by cutting high frequency components. There is a possibility that it may occur or block noise may be remarkable due to the block processing.

また、従来の動画像の可逆符号化では符号化によって情報は失われないが、その分、不可逆符号化に比べ、冗長な情報量が存在し、圧縮率が低下することがあった。   In addition, in conventional lossless encoding of moving images, information is not lost by encoding. However, there is a redundant amount of information and the compression rate may be reduced as compared with lossy encoding.

本発明は、このような状況に鑑みてなされたものであり、ハフマンテーブルを逐次更新しつつ後段のハフマン符号量が最小となるような動きベクトルを選択する処理を前段で行うことで、高品質、高圧縮を行うことができるようにするものである。   The present invention has been made in view of such a situation, and performs high-quality processing by selecting a motion vector that minimizes the amount of Huffman code in the subsequent stage while sequentially updating the Huffman table. In this way, high compression can be performed.

本発明の一側面の動きベクトル推定装置は、第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定装置であって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化手段と、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定手段と、前記第1のブロックと前記第2のブロックとの差分を算出する算出手段と、前記算出手段により算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換手段と、前記変換手段により変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定手段とを備える。   A motion vector estimation apparatus according to an aspect of the present invention is a motion vector estimation apparatus that performs motion estimation between a first frame and a second frame, and generates a first block by blocking the first frame. Calculating a difference between the first block and the second block; and a block setting unit configured to set a search area in the second frame and a second block in the search area. Calculating means for converting the difference calculated by the calculating means into a Huffman code using a Huffman table, and a second code length of the Huffman code converted by the converting means is minimized. The block is a block corresponding to the first block, and includes estimation means for estimating a motion vector of the first block.

前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、前記所定の動画像が処理されることにより作成されたハフマンテーブルであるようにすることができる。   The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image, and the first block is a predetermined moving image. If it is other than the first block of the first frame of the image, it can be a Huffman table created by processing the predetermined moving image.

本発明の一側面における動きベクトル推定方法は、第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定方法であって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、前記第1のブロックと前記第2のブロックとの差分を算出する算出ステップと、前記算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換ステップと、前記変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップとを含む。   A motion vector estimation method according to an aspect of the present invention is a motion vector estimation method that performs motion estimation between a first frame and a second frame, and generates the first block by blocking the first frame. Calculating a difference between the first block and the second block; and a step of setting a search area in the second frame, setting a second block in the search area, and calculating a difference between the first block and the second block A conversion step for converting the difference calculated in the calculation step into a Huffman code using a Huffman table; and a code length of the Huffman code converted in the conversion step is minimized. The second block is a block corresponding to the first block, and an estimation step of estimating a motion vector of the first block Including the.

本発明の一側面の動きベクトル推定装置に処理を実行させるプログラムは、第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定装置における処理を、コンピュータに行わせるプログラムであって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、前記第1のブロックと前記第2のブロックとの差分を算出する算出ステップと、前記算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換ステップと、前記変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップとを含む。   A program for causing a motion vector estimation device according to an aspect of the present invention to execute processing is a program that causes a computer to perform processing in a motion vector estimation device that performs motion estimation between a first frame and a second frame, A blocking step for blocking the first frame to generate a first block; a setting step for setting a search area in the second frame; and setting a second block in the search area; A calculating step for calculating a difference between the first block and the second block; a converting step for converting the difference calculated in the processing of the calculating step into a Huffman code using a Huffman table; and the converting step The second block having the minimum code length of the Huffman code converted by the above processing corresponds to the first block. And block, including an estimation step of estimating a motion vector of the first block.

本発明の一側面の符号化装置は、第1のフレームと第2のフレームを有する入力フレームを符号化する符号化装置であって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化手段と、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定手段と、前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出手段と、前記第1の算出手段により算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換手段と、前記第1の変換手段により変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定手段と前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出手段と、前記第2の算出手段により算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換手段と、前記推定手段により推定された前記動きベクトルと、前記第2の変換手段により変換された前記残差のハフマンコードを、符号化データとして出力する出力手段とを備える。   An encoding apparatus according to an aspect of the present invention is an encoding apparatus that encodes an input frame having a first frame and a second frame, and generates the first block by blocking the first frame. Calculating a difference between the first block and the second block; and a block setting unit configured to set a search area in the second frame and a second block in the search area. First calculating means, first converting means for converting the difference calculated by the first calculating means into a Huffman code using a Huffman table, and the first converting means converted by the first converting means. The second block having the minimum code length of the Huffman code is set as a block corresponding to the first block, and estimation means for estimating a motion vector of the first block is used as the motion vector. A second calculating unit that calculates a residual between the corresponding second block and the first block, and the residual calculated by the second calculating unit is converted into a Huffman code by referring to a Huffman table. A second conversion unit; and an output unit that outputs the motion vector estimated by the estimation unit and the residual Huffman code converted by the second conversion unit as encoded data.

前記第2の算出手段により算出された前記残差の度数分布を作成し、作成された前記度数分布に基づき、前記残差の出現確率分布を取得し、取得された出現確率分布から、残差毎にハフマンコードを割り当て、前記ハフマンテーブルを更新するようにすることができる。   Creating a frequency distribution of the residual calculated by the second calculating means, acquiring an appearance probability distribution of the residual based on the generated frequency distribution, and obtaining a residual from the acquired appearance probability distribution A Huffman code can be assigned every time and the Huffman table can be updated.

前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、更新された前記ハフマンテーブルであるようにすることができる。   The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image, and the first block is a predetermined moving image. If it is other than the first block of the first frame of the image, the updated Huffman table can be used.

前記出力手段は、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルも出力するようにすることができる。   The output means may output a Huffman table created in advance using a natural image when the first block is a head block of a head frame of a predetermined moving image.

本発明の一側面における符号化方法は、第1のフレームと第2のフレームを有する入力フレームを符号化する符号化方法であって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出ステップと、前記第1の算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換ステップと、前記第1の変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出ステップと、前記第2の算出ステップの処理で算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換ステップと、前記推定ステップの処理で推定された前記動きベクトルと、前記第2の変換ステップの処理で変換された前記残差のハフマンコードを、符号化データとして出力する出力ステップとを含む。   An encoding method according to an aspect of the present invention is an encoding method for encoding an input frame having a first frame and a second frame, and the first frame is generated by blocking the first frame. Calculating a difference between the first block and the second block; and a step of setting a search area in the second frame, setting a second block in the search area, and calculating a difference between the first block and the second block A first conversion step for converting the difference calculated in the process of the first calculation step into a Huffman code using a Huffman table, and a process of the first conversion step. The second block having the minimum code length of the converted Huffman code is set as a block corresponding to the first block, and the motion vector of the first block is estimated. The second calculation step for calculating the residual between the second block and the first block corresponding to the motion vector, and the residual calculated by the processing of the second calculation step are represented by Huffman A second conversion step for converting to a Huffman code with reference to the table, the motion vector estimated by the process of the estimation step, and the Huffman code of the residual converted by the process of the second conversion step And an output step of outputting as encoded data.

本発明の一側面における符号化装置に処理を実行させるプログラムは、第1のフレームと第2のフレームを有する入力フレームを符号化する符号化装置における処理を、コンピュータに行わせるプログラムであって、前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出ステップと、前記第1の算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換ステップと、前記第1の変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出ステップと、前記第2の算出ステップの処理で算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換ステップと、前記推定ステップの処理で推定された前記動きベクトルと、前記第2の変換ステップの処理で変換された前記残差のハフマンコードを、符号化データとして出力する出力ステップとを含む。   A program for causing an encoding device according to one aspect of the present invention to execute processing is a program that causes a computer to perform processing in an encoding device that encodes an input frame having a first frame and a second frame, A blocking step for blocking the first frame to generate a first block; a setting step for setting a search area in the second frame; and setting a second block in the search area; A first calculation step for calculating a difference between the first block and the second block, and the difference calculated in the processing of the first calculation step is converted into a Huffman code using a Huffman table. A first block, and a second block in which the code length of the Huffman code converted in the process of the first conversion step is minimized. A block corresponding to the first block, an estimation step for estimating a motion vector of the first block, and a second calculation step for calculating a residual between the second block and the first block corresponding to the motion vector A second conversion step of converting the residual calculated in the processing of the second calculation step into a Huffman code with reference to a Huffman table, and the motion vector estimated in the processing of the estimation step And an output step of outputting the residual Huffman code converted by the processing of the second conversion step as encoded data.

本発明の一側面の復号化装置は、符号化されている第1のフレームからの第1のブロックを復号化する復号化装置であって、残差に関するハフマンコードと動きベクトルを受信する受信手段と、ハフマンテーブルを参照して前記残差を復号化する残差復号化手段と、前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得手段と、前記残差復号化手段により復号化された前記残差を、前記取得手段により取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化手段と、前記ブロック復号手段により復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成手段とを備える。   A decoding device according to one aspect of the present invention is a decoding device for decoding a first block from a first frame that is encoded, and receiving means for receiving a Huffman code and a motion vector related to a residual A residual decoding means for decoding the residual with reference to a Huffman table, an acquisition means for acquiring a prediction block from the motion vector and the second frame decoded, and the residual decoding A block decoding unit for decoding the first block by combining the residual decoded by the converting unit with the prediction block acquired by the acquiring unit; and a decoding by the block decoding unit Frame generating means for generating the first frame by combining the first blocks.

前記残差復号化手段により復号化された前記残差の度数分布を作成し、作成された前記度数分布に基づき、前記残差の出現確率分布を取得し、取得された出現確率分布から、残差毎にハフマンコードを割り当て、前記ハフマンテーブルを更新するようにすることができる。   A frequency distribution of the residual decoded by the residual decoding means is created, an appearance probability distribution of the residual is obtained based on the created frequency distribution, and a residual probability distribution is obtained from the obtained appearance probability distribution. A Huffman code can be assigned for each difference, and the Huffman table can be updated.

前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、更新された前記ハフマンテーブルであるようにすることができる。   The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image, and the first block is a predetermined moving image. If it is other than the first block of the first frame of the image, the updated Huffman table can be used.

前記受信手段は、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルも受信するようにすることができる。   The receiving unit may receive a Huffman table created in advance using a natural image when the first block is a head block of a head frame of a predetermined moving image.

本発明の一側面の復号化方法は、符号化されている第1のフレームからの第1のブロックを復号化する復号化方法であって、残差に関するハフマンコードと動きベクトルの受信を制御する受信制御ステップと、ハフマンテーブルを参照して前記残差を復号化する残差復号化ステップと、前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得ステップと、前記残差復号化ステップの処理で復号化された前記残差を、前記取得ステップの処理で取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化ステップと、前記ブロック復号ステップの処理で復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成ステップとを含む。   A decoding method according to one aspect of the present invention is a decoding method for decoding a first block from an encoded first frame, and controls reception of a Huffman code and a motion vector related to a residual. A reception control step, a residual decoding step of decoding the residual with reference to a Huffman table, an acquisition step of acquiring a prediction block from the second frame being decoded with the motion vector, A block decoding step for decoding the first block by combining the residual decoded in the process of the residual decoding step with the prediction block acquired in the process of the acquiring step; A frame generation step for generating the first frame by combining the first blocks decoded in the block decoding step; No.

本発明の一側面の復号化装置に処理を実行させるプログラムは、符号化されている第1のフレームからの第1のブロックを復号化する復号化装置における処理を、コンピュータに行わせるプログラムであって、残差に関するハフマンコードと動きベクトルの受信を制御する受信制御ステップと、ハフマンテーブルを参照して前記残差を復号化する残差復号化ステップと、前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得ステップと、前記残差復号化ステップの処理で復号化された前記残差を、前記取得ステップの処理で取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化ステップと、前記ブロック復号ステップの処理で復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成ステップとを含む。   A program for causing a decoding device according to one aspect of the present invention to execute processing is a program that causes a computer to perform processing in a decoding device that decodes a first block from an encoded first frame. A reception control step for controlling reception of a Huffman code and a motion vector relating to the residual, a residual decoding step for decoding the residual with reference to a Huffman table, and a step of decoding the motion vector. By acquiring the prediction block from the frame of 2 and combining the residual decoded in the process of the residual decoding step with the prediction block acquired in the process of the acquisition step, A block decoding step for decoding the first block; and the first block decoded by the processing of the block decoding step. By combining includes a frame generation step of generating the first frame.

本発明の一側面の動きベクトル推定装置および方法、並びにプログラムにおいては、2つのブロックの差分にハフマンコードが割り当てられ、そのハフマンコードが最小となるブロック間の相対座標が算出されることにより動きベクトルが検出される。   In the motion vector estimation apparatus, method, and program according to one aspect of the present invention, a Huffman code is assigned to a difference between two blocks, and a relative coordinate between blocks at which the Huffman code is minimized is calculated. Is detected.

本発明の一側面の符号化装置および方法、並びにプログラムにおいては、2つのブロックの差分にハフマンコードが割り当てられ、そのハフマンコードが最小となるブロック間の相対座標が算出されることにより動きベクトルが検出され、予測されたブロックと符号化対象とされているブロックとの残差が、ハフマンテーブルが参照され、ハフマンコードに変換される。   In the encoding apparatus, method, and program according to one aspect of the present invention, a Huffman code is assigned to a difference between two blocks, and a relative coordinate between blocks that minimizes the Huffman code is calculated, whereby a motion vector is obtained. The residual between the detected and predicted block and the block to be encoded is converted into a Huffman code with reference to the Huffman table.

本発明の一側面の復号化装置および方法、並びにプログラムにおいては、ハフマンコードにされた残差が、ハフマンテーブルが参照されて復号化され、動きベクトルから予測ブロックが取得され、その予測ブロックに復号化された残差が結合されることにより、所定のフレームからのブロックが復号化される。   In the decoding apparatus and method and the program according to one aspect of the present invention, a residual converted to a Huffman code is decoded with reference to a Huffman table, a prediction block is obtained from a motion vector, and the prediction block is decoded. By combining the combined residuals, a block from a predetermined frame is decoded.

本発明の一側面によれば、ハフマン符号化またはハフマン復号化を行うことができる。   According to one aspect of the present invention, Huffman coding or Huffman decoding can be performed.

本発明の一側面によれば、符号化や復号化に用いられるハフマンテーブルを更新することができる。また、その更新は、符号化や復号化の対象とされている画像に依存させて行うことが可能となる。   According to one aspect of the present invention, a Huffman table used for encoding and decoding can be updated. In addition, the update can be performed depending on the image to be encoded or decoded.

本発明の一側面によれば、高画質、高圧縮を実現する符号化や復号化を行うことができる。   According to one aspect of the present invention, encoding and decoding that achieve high image quality and high compression can be performed.

以下に本発明の実施の形態を説明するが、本発明の構成要件と、明細書または図面に記載の実施の形態との対応関係を例示すると、次のようになる。この記載は、本発明をサポートする実施の形態が、明細書または図面に記載されていることを確認するためのものである。従って、明細書または図面中には記載されているが、本発明の構成要件に対応する実施の形態として、ここには記載されていない実施の形態があったとしても、そのことは、その実施の形態が、その構成要件に対応するものではないことを意味するものではない。逆に、実施の形態が構成要件に対応するものとしてここに記載されていたとしても、そのことは、その実施の形態が、その構成要件以外の構成要件には対応しないものであることを意味するものでもない。   Embodiments of the present invention will be described below. Correspondences between constituent elements of the present invention and the embodiments described in the specification or the drawings are exemplified as follows. This description is intended to confirm that the embodiments supporting the present invention are described in the specification or the drawings. Therefore, even if there is an embodiment which is described in the specification or the drawings but is not described here as an embodiment corresponding to the constituent elements of the present invention, that is not the case. It does not mean that the form does not correspond to the constituent requirements. Conversely, even if an embodiment is described here as corresponding to a configuration requirement, that means that the embodiment does not correspond to a configuration requirement other than the configuration requirement. It's not something to do.

本発明の一側面の動きベクトル推定装置(例えば、図3の符号化部42に含まれる図5のハフマンコード規範動き推定部73)は、第1のフレームをブロック化して第1のブロックを生成するブロック化手段(例えば、図3のブロック化部71)と、第2のフレームに探索領域を設定し、探索領域中に第2のブロックを設定する設定手段(例えば、図5の動き検索部112)と、第1のブロックと第2のブロックとの差分を算出する算出手段(例えば、図5の動き検索部112)と、算出手段により算出された差分を、ハフマンテーブルを用いてハフマンコードに変換する変換手段(例えば、図5の差分変換部113)と、変換手段により変換されたハフマンコードの符号長が最小になる第2のブロックを、第1のブロックに対応するブロックとし、第1のブロックの動きベクトルを推定する推定手段(例えば、図5の動きベクトル取得部114)とを備える。   The motion vector estimation apparatus according to one aspect of the present invention (for example, the Huffman code reference motion estimation unit 73 in FIG. 5 included in the encoding unit 42 in FIG. 3) generates a first block by blocking the first frame. Block setting means (for example, block forming section 71 in FIG. 3) and setting means for setting a search area in the second frame and setting the second block in the search area (for example, motion search section in FIG. 5) 112), a calculation means for calculating a difference between the first block and the second block (for example, the motion search unit 112 in FIG. 5), and a difference calculated by the calculation means is converted into a Huffman code using a Huffman table. And a second block with a minimum code length of the Huffman code converted by the conversion unit (for example, the difference conversion unit 113 in FIG. 5), and a block corresponding to the first block. And then, it comprises an estimation unit for estimating a motion vector of the first block (e.g., a motion vector acquisition unit 114 in FIG. 5).

本発明の一側面の符号化装置(例えば、図3の符号化部42)は第1のフレームをブロック化して第1のブロックを生成するブロック化手段(例えば、図3のブロック化部71)と、第2のフレームに探索領域を設定し、探索領域中に第2のブロックを設定する設定手段(例えば、図3のハフマンコード規範動き推定部73を構成する図5の動き検索部112)と、第1のブロックと第2のブロックとの差分を算出する算出手段(例えば、図5の動き検索部112)と、算出手段により算出された差分を、ハフマンテーブルを用いてハフマンコードに変換する変換手段(例えば、図5の差分変換部113)と、変換手段により変換されたハフマンコードの符号長が最小になる第2のブロックを、第1のブロックに対応するブロックとし、第1のブロックの動きベクトルを推定する推定手段(例えば、図5の動きベクトル取得部114)と、動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出手段(例えば、図3の残差算出部74)と、第2の算出手段により算出された残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換手段(例えば、図3の残差ハフマン符号化部75)と、推定手段により推定された動きベクトルと、第2の変換手段により変換された残差のハフマンコードを、符号化データとして出力する出力手段(例えば、図3のデータ合成部78)とを備える。   The encoding apparatus according to one aspect of the present invention (for example, the encoding unit 42 in FIG. 3) is a blocking unit that generates the first block by blocking the first frame (for example, the blocking unit 71 in FIG. 3). And setting means for setting a search region in the second frame and setting a second block in the search region (for example, the motion search unit 112 in FIG. 5 constituting the Huffman code reference motion estimation unit 73 in FIG. 3). And a calculating means (for example, the motion search unit 112 in FIG. 5) for calculating a difference between the first block and the second block, and converting the difference calculated by the calculating means into a Huffman code using a Huffman table. And a second block having a minimum code length of the Huffman code converted by the converting means (for example, the difference converting unit 113 in FIG. 5) as a block corresponding to the first block, Estimating means for estimating the motion vector of the block (for example, the motion vector acquisition unit 114 in FIG. 5), and second calculating means for calculating the residual between the second block and the first block corresponding to the motion vector (for example, 3, the residual calculation unit 74) and the second calculation unit that converts the residual calculated by the second calculation unit into a Huffman code with reference to the Huffman table (for example, the residual Huffman of FIG. 3). An encoding unit 75), an output unit that outputs the motion vector estimated by the estimation unit and the residual Huffman code converted by the second conversion unit as encoded data (for example, the data synthesis unit of FIG. 3). 78).

本発明の一側面の復号化装置(例えば、図18の復号化部51)は、残差に関するハフマンコードと動きベクトルを受信する受信手段(例えば、図18の入力端子310)と、ハフマンテーブルを参照して残差を復号化する残差復号化手段(例えば、図18の残差ハフマン復号化部316)と、動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得手段(例えば、図18のハフマンコード規範動き補償部313)と、残差復号化手段により復号化された残差を、取得手段により取得された予測ブロックに結合することにより、第1のブロックを復号化するブロック復号化手段(例えば、図18の残差結合部317)と、ブロック復号手段により復号化された第1のブロックを結合することにより、第1のフレームを生成するフレーム生成手段(例えば、図18のブロック結合部318)とを備える。   The decoding apparatus according to one aspect of the present invention (for example, the decoding unit 51 in FIG. 18) includes a receiving unit (for example, the input terminal 310 in FIG. 18) that receives a Huffman code and a motion vector related to a residual, Obtaining a prediction block from a residual decoding unit (for example, residual Huffman decoding unit 316 in FIG. 18) that decodes a residual with reference to a motion vector and a second frame that is decoded The first block is obtained by combining the residual decoded by the means (for example, the Huffman code reference motion compensation unit 313 in FIG. 18) and the residual decoding means by the prediction block obtained by the obtaining means. By combining the block decoding means for decoding (for example, the residual combining unit 317 in FIG. 18) and the first block decoded by the block decoding means, the first frame is obtained. Frame generating means for generating (e.g., block coupling portion 318 of FIG. 18) and a.

以下に、本発明の実施の形態について図面を参照して説明する。   Embodiments of the present invention will be described below with reference to the drawings.

[システムの構成について]
図2は、本発明を適用した符号化装置と復号化装置を含むシステムの一実施の形態の構成を示す図である。図2に示したシステムは、符号化装置31、復号化装置32、およびディスプレイ33を含む構成とされている。符号化装置31は、A/D(Analog/Digital)変換部41と符号化部42から構成されている。復号化装置32は、復号化部51とD/A変換部52から構成されている。
[System configuration]
FIG. 2 is a diagram showing a configuration of an embodiment of a system including an encoding device and a decoding device to which the present invention is applied. The system shown in FIG. 2 includes an encoding device 31, a decoding device 32, and a display 33. The encoding device 31 includes an A / D (Analog / Digital) conversion unit 41 and an encoding unit 42. The decoding device 32 includes a decoding unit 51 and a D / A conversion unit 52.

符号化装置31のA/D変換部41には、アナログの画像データVan0 が入力される。A/D変換部41は、入力されたアナログ画像データVan0を、デジタルの画像データVdg0 に変換し、符号化部42に供給する。符号化部42は、供給されたデジタルの画像データVdg0を符号化処理し、符号化信号Vcdを生成する。生成された符号化信号Vcdは、復号化装置32に供給(送信)される。   Analog image data Van0 is input to the A / D converter 41 of the encoding device 31. The A / D converter 41 converts the input analog image data Van0 into digital image data Vdg0 and supplies the digital image data Vdg0 to the encoder 42. The encoding unit 42 encodes the supplied digital image data Vdg0 to generate an encoded signal Vcd. The generated encoded signal Vcd is supplied (transmitted) to the decoding device 32.

復号化装置32の復号化部51は、受信された符号化信号Vcd を、デジタルの画像データVdg1 に復号化し、D/A 変換部52に供給する。D/A変換部52は、供給されたデジタルの画像データVdg1を、アナログの画像データVan1に変換し、ディスプレイ33に供給する。ディスプレイ33は、供給されたアナログ画像データVan1に基づく画像を表示する。   The decoding unit 51 of the decoding device 32 decodes the received encoded signal Vcd into digital image data Vdg1, and supplies the digital image data Vdg1 to the D / A conversion unit 52. The D / A converter 52 converts the supplied digital image data Vdg1 into analog image data Van1 and supplies the analog image data Van1 to the display 33. The display 33 displays an image based on the supplied analog image data Van1.

このシステムにおいては、可逆符号化が行われ、その可逆符号化に対応する復号化が行われるとして以下の説明をする。可逆符号化は、その処理の特性上、符号化によって情報は失われことがないため、符号化側で符号化対象とされた画像データと同様の画像データを復号化側で取得することが可能である。すなわち、
アナログの画像データVan0=アナログの画像データVan1
デジタルの画像データVdg0=デジタルの画像データVdg1
という関係が成り立つ。
In this system, lossless encoding is performed, and the following description will be made assuming that decoding corresponding to the lossless encoding is performed. In lossless encoding, due to the characteristics of the processing, information is not lost by encoding, so it is possible to acquire the same image data on the decoding side as the image data targeted for encoding on the encoding side It is. That is,
Analog image data Van0 = Analog image data Van1
Digital image data Vdg0 = Digital image data Vdg1
This relationship holds.

このような関係が成り立つ符号化と復号化について説明する。まず、符号化装置31の構成および符号化装置31により行われる符号化について説明し、その後、復号化装置32の構成および復号化装置32により行われる復号化について説明する。   The encoding and decoding in which such a relationship is satisfied will be described. First, the configuration of the encoding device 31 and the encoding performed by the encoding device 31 will be described, and then the configuration of the decoding device 32 and the decoding performed by the decoding device 32 will be described.

[符号化装置の構成および動作について]
図3は、符号化装置31の符号化部42の構成例を示す図である。符号化部42は、入力端子70、ブロック化部71、フレームメモリ72、ハフマンコード規範動き推定部73、残差算出部74、残差ハフマン符号化部75、ハフマンテーブル記憶部76、ハフマンコード算出部77、データ合成部77、および、出力端子79を含む構成とされている。
[Configuration and operation of encoding apparatus]
FIG. 3 is a diagram illustrating a configuration example of the encoding unit 42 of the encoding device 31. The encoding unit 42 includes an input terminal 70, a blocking unit 71, a frame memory 72, a Huffman code reference motion estimation unit 73, a residual calculation unit 74, a residual Huffman encoding unit 75, a Huffman table storage unit 76, and a Huffman code calculation. The unit 77, the data synthesis unit 77, and the output terminal 79 are included.

入力端子70には、A/D変換部41によりデジタルデータに変換された画像データVdg(以下、単に、画像データと記述する)が入力される。入力端子70に入力された画像データは、ブロック化部71とフレームメモリ72に供給される。ブロック化部71は、入力された画像データに基づく画像を複数のブロックに分割する(1フレームを所定の画素数(例えば、64画素)から構成されるブロックに分割する)。   Image data Vdg (hereinafter simply referred to as image data) converted into digital data by the A / D converter 41 is input to the input terminal 70. The image data input to the input terminal 70 is supplied to the blocking unit 71 and the frame memory 72. The blocking unit 71 divides an image based on the input image data into a plurality of blocks (divides one frame into blocks each having a predetermined number of pixels (for example, 64 pixels)).

分割されたブロックは、順次、ハフマンコード規範動き推定部73と残差算出部74に供給される。ハフマンコード規範動き推定部73には、フレームメモリ72からもフレーム(以下、適宜、フレームと記述するが、フレームとの記載は、そのフレームの画像データであるとの意味も含む)も供給される。フレームメモリ72が供給するフレームは、ブロック化部71でブロック化されるフレームよりも1フレーム前のフレームである。   The divided blocks are sequentially supplied to the Huffman code reference motion estimation unit 73 and the residual calculation unit 74. The Huffman code reference motion estimation unit 73 is also supplied with a frame from the frame memory 72 (hereinafter referred to as a frame as appropriate, but the description of a frame includes the meaning of image data of the frame). . The frame supplied by the frame memory 72 is a frame one frame before the frame blocked by the blocking unit 71.

ハフマンコード規範動き推定部73は、ブロック化部71によりブロック化されたブロック、フレームメモリ72から供給されるフレーム、および、ハフマンテーブル記憶部76に記憶されているハフマンテーブルを用いて、ハフマン符号量が最小となる動きベクトルを検出する(詳細は後述する)。検出された動きベクトルは、残差算出部74に供給される。残差算出部74には、入力端子70を介したフレーム(フレームNとする)からブロック化部71によりブロック化されたブロックと、フレームメモリ72からフレームNより1フレーム前のフレーム(フレームN−1とする)が供給される。   The Huffman code reference motion estimator 73 uses the block formed by the blocking unit 71, the frame supplied from the frame memory 72, and the Huffman table stored in the Huffman table storage unit 76 to use the Huffman code amount Is detected (details will be described later). The detected motion vector is supplied to the residual calculation unit 74. The residual calculation unit 74 includes a block that is blocked by the blocking unit 71 from a frame (referred to as frame N) via the input terminal 70 and a frame (frame N−) that is one frame before the frame N from the frame memory 72. 1) is supplied.

残差算出部74は、供給されたデータを用いて残差を算出し、残差ハフマン符号化部75に出力する。残差ハフマン符号化部75は、供給された残差を、ハフマンテーブル記憶部76に記憶されているハフマンテーブルを参照し、符号化し、データ合成部78とハフマンコード算出部77に供給する。ハフマンコード算出部77は、符号化された残差にハフマンコードを割り当てる。割り当てられたハフマンコードにより、ハフマンテーブル記憶部76に記憶されているハフマンテーブルが更新される。   The residual calculation unit 74 calculates a residual using the supplied data and outputs the residual to the residual Huffman coding unit 75. The residual Huffman encoding unit 75 encodes the supplied residual with reference to the Huffman table stored in the Huffman table storage unit 76, and supplies the encoded residual to the data synthesis unit 78 and the Huffman code calculation unit 77. The Huffman code calculation unit 77 assigns a Huffman code to the encoded residual. The Huffman table stored in the Huffman table storage unit 76 is updated with the assigned Huffman code.

データ合成部78には、残差ハフマン符号化部75から符号化された残差と、ハフマンコード規範動き推定部73から動きベクトルとが、供給される。データ合成部78は、供給されたこれらのデータを合成し、復号化装置32(図2)に対して供給する。   The data synthesizing unit 78 is supplied with the residual encoded from the residual Huffman encoding unit 75 and the motion vector from the Huffman code reference motion estimation unit 73. The data synthesizing unit 78 synthesizes the supplied data and supplies the synthesized data to the decoding device 32 (FIG. 2).

次に、符号化部42を構成する各部の構成について説明する。   Next, the structure of each part which comprises the encoding part 42 is demonstrated.

図4は、ブロック化部71の内部構成例を示す図である。ブロック化部71は、オフセット部91とブロック化部92とを含む構成とされている。A/D変換部41からのデジタル画像データは、オフセット部91に供給される。オフセット部91は、入力された画像データ(フレーム)にオフセット処理を施し、ブロック化部92に供給する。ブロック化部92は、供給されたフレームを所定の画素数毎にブロック化し、ハフマンコード規範動き推定部73に供給する。   FIG. 4 is a diagram illustrating an internal configuration example of the blocking unit 71. The blocking unit 71 includes an offset unit 91 and a blocking unit 92. The digital image data from the A / D conversion unit 41 is supplied to the offset unit 91. The offset unit 91 performs offset processing on the input image data (frame) and supplies the processed image data (frame) to the blocking unit 92. The blocking unit 92 blocks the supplied frame for each predetermined number of pixels and supplies the block to the Huffman code reference motion estimation unit 73.

図5は、ハフマンコード規範動き推定部73の内部構成例を示す図である。ハフマンコード規範動き推定部73は、初期ハフマンコード算出部111、動き探索部112、差分変換部113、動きベクトル取得部114、および、累計型ハフマンコード算出部115から構成されている。累計型ハフマンコード算出部115は、処理を行った結果(ハフマンコード)が累積されたハフマンテーブルを用い、初期ハフマンコード算出部111には、ハフマンコードが累積されていない状態のとき(例えば、初めのフレームを処理するとき)に用いられる初期ハフマンテーブルを用い、符号化を行う。   FIG. 5 is a diagram illustrating an internal configuration example of the Huffman code reference motion estimation unit 73. The Huffman code reference motion estimation unit 73 includes an initial Huffman code calculation unit 111, a motion search unit 112, a difference conversion unit 113, a motion vector acquisition unit 114, and a cumulative Huffman code calculation unit 115. The cumulative Huffman code calculation unit 115 uses a Huffman table in which processing results (Huffman codes) are accumulated. When the Huffman code is not accumulated in the initial Huffman code calculation unit 111 (for example, first Encoding is performed using the initial Huffman table used in the processing of the first frame.

動き探索部112は、ブロック化部71から供給されるフレームNからのブロックと、フレームメモリ72からフレームN−1が供給される。動き探索部112と差分変換部113は、フレームNからのブロックと、フレームN−1内(フレームN―1内の所定のサーチ範囲内)のブロックとをブロックマッチングし、その結果を、ハフマン符号化する。差分変換部113が、ハフマン符号化を行う際、例えば、初めのフレームのときには、初期ハフマンコード算出部111からのコードが用いられ、その他のときには、累計型ハフマンコード算出部115からのコードが用いられる。   The motion search unit 112 is supplied with the block from the frame N supplied from the blocking unit 71 and the frame N−1 from the frame memory 72. The motion search unit 112 and the difference conversion unit 113 perform block matching between the block from the frame N and the block in the frame N-1 (within a predetermined search range in the frame N-1), and the result is represented by a Huffman code. Turn into. When the difference conversion unit 113 performs Huffman encoding, for example, the code from the initial Huffman code calculation unit 111 is used in the first frame, and the code from the cumulative Huffman code calculation unit 115 is used in other cases. It is done.

動きベクトル取得部114は、差分変換部113からのハフマン符号量が最小となるブロックを判断することにより動きベクトルを取得(検出)する。検出された動きベクトルは、残差算出回路74に供給される。   The motion vector acquisition unit 114 acquires (detects) a motion vector by determining a block that minimizes the Huffman code amount from the difference conversion unit 113. The detected motion vector is supplied to the residual calculation circuit 74.

図6は、残差算出回路74の内部構成例を示す図である。残差算出部74は、予測ブロック獲得部131と残差獲得部132から構成されている。予測ブロック獲得部131には、ハフマンコード規範動き推定部73から動きベクトルと、フレームメモリ72からフレームN−1が供給される。予測ブロック獲得部131は、供給された動きベクトルとフレームN−1から、フレームN−1内で、処理対象とされているフレームNからのブロックに対応するブロック(予測ブロック)を獲得する。   FIG. 6 is a diagram illustrating an internal configuration example of the residual calculation circuit 74. The residual calculation unit 74 includes a prediction block acquisition unit 131 and a residual acquisition unit 132. The prediction block acquisition unit 131 is supplied with the motion vector from the Huffman code reference motion estimation unit 73 and the frame N−1 from the frame memory 72. The prediction block acquisition unit 131 acquires a block (prediction block) corresponding to a block from the frame N to be processed in the frame N-1 from the supplied motion vector and the frame N-1.

残差獲得部132には、予測ブロック獲得部131からの予想ブロックと、ブロック化部71からのブロックから供給される。そして、それらのブロックから残差が求められ、残差ハフマン符号化部75に出力される。   The residual acquisition unit 132 is supplied from the prediction block from the prediction block acquisition unit 131 and the block from the blocking unit 71. Then, a residual is obtained from these blocks and output to the residual Huffman encoding unit 75.

図7は、残差ハフマン符号化部75の内部構成例を示す図である。残差ハフマン符号化部75は、度数分布作成部151とハフマン符号割り当て部152から構成されている。度数分布作成部151には、残差算出部74からの残差が供給される。度数分布作成部151は、供給された残差を加えた度数分布を作成し、記憶するとともに、ハフマンコード算出部77にも供給する。   FIG. 7 is a diagram illustrating an internal configuration example of the residual Huffman coding unit 75. The residual Huffman encoding unit 75 includes a frequency distribution creating unit 151 and a Huffman code assigning unit 152. The frequency distribution creating unit 151 is supplied with the residual from the residual calculating unit 74. The frequency distribution creation unit 151 creates and stores a frequency distribution to which the supplied residual is added, and also supplies it to the Huffman code calculation unit 77.

ハフマン符号割り当て部152には、残差算出部74からの残差と、ハフマンテーブル記憶部76に記憶されているハフマンテーブルとが供給される。ハフマン符号割り当て部152は、ハフマンテーブルを参照し、供給された残差にハフマンコードを割り当て、その割り当てたハフマンコード(ハフマン符号)を、ハフマンコード算出部77に供給する。   The Huffman code assignment unit 152 is supplied with the residual from the residual calculation unit 74 and the Huffman table stored in the Huffman table storage unit 76. The Huffman code assigning unit 152 refers to the Huffman table, assigns a Huffman code to the supplied residual, and supplies the assigned Huffman code (Huffman code) to the Huffman code calculating unit 77.

図8は、ハフマンコード算出部76の内部構成例を示す図である。ハフマンコード算出部76は、バッファ171、度数分布マージ部172、出現確率分布取得部173、および、ハフマンコード割り当て部174を含む構成とされている。バッファ171は、度数分布マージ部172からの出力を一旦記憶する。バッファ171に記憶されているデータは、度数分布マージ部172に供給される。   FIG. 8 is a diagram illustrating an internal configuration example of the Huffman code calculation unit 76. The Huffman code calculation unit 76 includes a buffer 171, a frequency distribution merge unit 172, an appearance probability distribution acquisition unit 173, and a Huffman code allocation unit 174. The buffer 171 temporarily stores the output from the frequency distribution merging unit 172. The data stored in the buffer 171 is supplied to the frequency distribution merging unit 172.

度数分布マージ部172は、残差ハフマン符号化部75からの残差の度数分布も供給される。度数分布マージ部172は、供給された度数分布を用いて、バッファ171に記憶されている度数分布を更新する。更新された度数分布は、バッファ171と出現確率分布出力部173に供給される。出現確率分布取得部173は、供給された度数分布から、残差毎に出現する回数(確率)を求め、その分布を作成し、ハフマンコード割り当て部174に供給する。   The frequency distribution merging unit 172 is also supplied with the residual frequency distribution from the residual Huffman encoding unit 75. The frequency distribution merging unit 172 updates the frequency distribution stored in the buffer 171 using the supplied frequency distribution. The updated frequency distribution is supplied to the buffer 171 and the appearance probability distribution output unit 173. The appearance probability distribution acquisition unit 173 obtains the number of occurrences (probability) for each residual from the supplied frequency distribution, creates the distribution, and supplies the distribution to the Huffman code assignment unit 174.

ハフマンコード割り当て部174は、残差毎にハフマンコードを割り当て、ハフマンテーブル記憶部76に供給する。ハフマンテーブル記憶部76は、供給されたハフマンコードにより記憶しているハフマンテーブルを更新する。   The Huffman code assigning unit 174 assigns a Huffman code for each residual and supplies it to the Huffman table storage unit 76. The Huffman table storage unit 76 updates the stored Huffman table with the supplied Huffman code.

次に、符号化部42の動作について説明する。図9のフローチャートを参照し、符号化部42の動作について説明する。   Next, the operation of the encoding unit 42 will be described. The operation of the encoding unit 42 will be described with reference to the flowchart of FIG.

ステップS11において、ブロック化部71は、入力端子70を介して入力される画像データに基づく1フレームを所定の画素数のブロックに分割する。このブロック化の処理について、図10のフローチャートを参照して説明する。ステップS31において、ブロック化部71のオフセット部91は、A/D変換部41(図2)によりデジタルデータに変換された入力画像データを読み込む。   In step S11, the blocking unit 71 divides one frame based on the image data input via the input terminal 70 into blocks having a predetermined number of pixels. This blocking process will be described with reference to the flowchart of FIG. In step S31, the offset unit 91 of the blocking unit 71 reads input image data converted into digital data by the A / D conversion unit 41 (FIG. 2).

ステップS32において、入力された画像データ(フレームN)のうち、オフセット分だけ処理対象とされる部分(ブロックとして切り出される部分)まで移動される。オフセット処理が施されたフレームNは、ブロック化部92に供給される。ブロック化部92は、ステップS33において、指定されている(予め設定されている)画素数のブロックサイズで分割を行う。   In step S32, the input image data (frame N) is moved to a portion to be processed (a portion cut out as a block) by an offset amount. The frame N that has been subjected to the offset processing is supplied to the blocking unit 92. In step S <b> 33, the blocking unit 92 performs division with a block size of the designated (preset) number of pixels.

ブロック化部92において行われるブロック化について、図11を参照して説明する。ブロック化部92には、1フレーム分の画像データ(有効画面を構成する画面の画像データ)が供給される。なお、ステップS32において行われるオフセットの処理は、有効画面を構成する画面の部分まで処理の開始位置を移動させることである。   Blocking performed in the blocking unit 92 will be described with reference to FIG. The block forming unit 92 is supplied with image data for one frame (image data of a screen constituting an effective screen). Note that the offset processing performed in step S32 is to move the processing start position to the portion of the screen constituting the effective screen.

図11は、供給されるフレームNの一部分を示している。図11において、「○」はブロックを構成する画素データを示している。1フレームは、水平方向8画素、垂直方向8画素で構成される64画素毎のブロック(図11において、線で囲んだ部分)に分割される。   FIG. 11 shows a part of the frame N to be supplied. In FIG. 11, “◯” indicates pixel data constituting the block. One frame is divided into blocks each having 64 pixels each composed of 8 pixels in the horizontal direction and 8 pixels in the vertical direction (portions surrounded by lines in FIG. 11).

ここでは、このように、1ブロックは8×8の64画素で構成されるとして説明を続けるが、他の画素数で構成されるようにしても良い。ブロック化部92によりブロック化されたブロックは、ハフマンコード規範動き推定部73に供給される。   Here, the description is continued assuming that one block is composed of 64 pixels of 8 × 8, but may be composed of other numbers of pixels. The blocks blocked by the blocking unit 92 are supplied to the Huffman code reference motion estimation unit 73.

図9のフローチャートの説明に戻り、ステップS11において、ブロック化処理が実行されることによりブロックに分割されると、ステップS12において、動きベクトルの検出処理が実行される。動きベクトルの検出処理は、ハフマンコード規範動き推定部73において実行される。ハフマンコード規範動き推定部73において実行される動きベクトル検出について、図12のフローチャートを参照して説明する。   Returning to the description of the flowchart of FIG. 9, when the block is divided into blocks by executing the blocking process in step S11, a motion vector detection process is executed in step S12. The motion vector detection process is executed by the Huffman code reference motion estimation unit 73. The motion vector detection executed in the Huffman code reference motion estimation unit 73 will be described with reference to the flowchart of FIG.

ステップS51において、ハフマンコード規範動き推定部73の動き探索部112(図5)は、サーチ範囲内を動き探索する。サーチ範囲について、図13A,Bを参照して説明する。図13Aに示すように、ブロック化部71によりブロック化され、処理対象とされるフレームN内の64画素が注目ブロック201とされている。図13Bに示すように、注目ブロック201がフレームN内で存在する位置と同一の位置に相当する位置で、フレームメモリ72内に記憶されているフレームN―1内の64画素が領域202とされる。   In step S51, the motion search unit 112 (FIG. 5) of the Huffman code reference motion estimation unit 73 searches for a motion within the search range. The search range will be described with reference to FIGS. 13A and 13B. As shown in FIG. 13A, 64 pixels in a frame N that is blocked by the blocking unit 71 and is a processing target is the target block 201. As shown in FIG. 13B, at the position corresponding to the same position as the position where the block of interest 201 exists in the frame N, 64 pixels in the frame N-1 stored in the frame memory 72 are defined as the area 202. The

この領域202より大きな所定の領域が、サーチ範囲203として設定される。サーチ範囲203は、例えば、領域202よりも、水平方向(図中左右方向)に、−8画素〜+8画素、垂直方向(図中上下方向)に−8画素〜+8画素、大きな領域とされる。   A predetermined area larger than this area 202 is set as the search range 203. The search range 203 is, for example, a region larger than the region 202 by −8 to +8 pixels in the horizontal direction (left and right in the drawing) and −8 to +8 pixels in the vertical direction (up and down in the drawing). .

動き探索部112は、サーチ範囲203内で、領域を順次移動し、注目ブロック201との差分を算出する。まず、動き探索部112は、ステップS51において、サーチ範囲203内の所定の領域(例えば、サーチ範囲203内の左上の64画素)を、差分を算出する領域(以下、適宜、設定領域と記述する)に設定し、ステップS52において、その位置での差分を算出する。算出された差分は、差分変換部113(図5)に供給される。   The motion search unit 112 sequentially moves the region within the search range 203 and calculates a difference from the block of interest 201. First, in step S51, the motion search unit 112 describes a predetermined area in the search range 203 (for example, the upper left 64 pixels in the search range 203) as an area for calculating a difference (hereinafter, appropriately set area). In step S52, the difference at that position is calculated. The calculated difference is supplied to the difference conversion unit 113 (FIG. 5).

差分変換部113は、ステップS53において、先頭フレームの先頭ブロックに対する動き探索であるか否かを判断する。ステップS53において、先頭フレームの先頭ブロックに対する動き探索であると判断された場合、ステップS54に進められる。ステップS54において、初期ハフマンコード算出部111で算出されるハフマンテーブルが利用されるように設定される。   In step S53, the difference conversion unit 113 determines whether or not the motion search is for the first block of the first frame. If it is determined in step S53 that the motion search is for the first block of the first frame, the process proceeds to step S54. In step S54, the Huffman table calculated by the initial Huffman code calculation unit 111 is set to be used.

一方、ステップS53において、先頭フレームの先頭ブロックに対する動き探索ではないと判断された場合、ステップS55に進められる。ステップS55において、差分変換部113は、累積型ハフマンテーブル算出部115で算出されるハフマンテーブルが利用されるように設定される。このようにして、処理されたフレームがある場合には、過去のフレームを処理したことにより得られるハフマンテーブルが利用される   On the other hand, if it is determined in step S53 that the motion search is not for the first block of the first frame, the process proceeds to step S55. In step S55, the difference conversion unit 113 is set so that the Huffman table calculated by the cumulative Huffman table calculation unit 115 is used. In this way, when there is a processed frame, a Huffman table obtained by processing a past frame is used.

初期ハフマンコード算出部111や累計型ハフマンテーブル算出部115には、それぞれ、ハフマンテーブル記憶部76に記憶されているハフマンテーブルが供給され、その供給されるハフマンテーブルが利用される。   The initial Huffman code calculation unit 111 and the cumulative Huffman table calculation unit 115 are each supplied with a Huffman table stored in the Huffman table storage unit 76 and use the supplied Huffman table.

ステップS54またはステップS55において、設定されたハフマンテーブルを元に、ステップS56において、供給された差分がハフマン符号化される(差分に対応するハフマンコードに変換される)。ステップS57において、サーチ範囲203内の探索が終了されたか否かが判断される。上記したように、動き探索部112は、サーチ範囲203内で設定領域を順次移動させ、差分を算出し、差分変換部113によりその差分がハフマンコードに変換される。   In step S54 or step S55, based on the set Huffman table, in step S56, the supplied difference is Huffman encoded (converted to a Huffman code corresponding to the difference). In step S57, it is determined whether or not the search within the search range 203 has been completed. As described above, the motion search unit 112 sequentially moves the setting area within the search range 203, calculates a difference, and the difference conversion unit 113 converts the difference into a Huffman code.

このような処理がサーチ範囲203内の全てに対して行われたか否かが、ステップS57において判断される。ステップS57において、サーチ範囲203内の探索は終了していないと判断された場合、ステップS51に戻り、それ以降の処理が繰り返される。   In step S57, it is determined whether or not such processing has been performed for all of the search range 203. If it is determined in step S57 that the search within the search range 203 has not ended, the process returns to step S51, and the subsequent processing is repeated.

一方、ステップS57において、サーチ範囲203内の探索は終了したと判断された場合、ステップS58において、動きベクトル取得部114により、最小のハフマンコードが抽出される。すなわち、上記処理が行われることにより、複数の差分が算出され、ハフマンコードに変換されるが、その変換された複数のハフマンコードの内、最も小さい値を有するハフマンコードが抽出される。また、その抽出されたハフマンコードに対応するブロック(サーチ範囲203のうち、最小のハフマンコードに変換されたときに領域202が位置していた領域(図14における検出ブロック204)も抽出される。   On the other hand, if it is determined in step S57 that the search within the search range 203 has been completed, the minimum Huffman code is extracted by the motion vector acquisition unit 114 in step S58. That is, by performing the above processing, a plurality of differences are calculated and converted into a Huffman code. Among the plurality of converted Huffman codes, a Huffman code having the smallest value is extracted. Further, the block corresponding to the extracted Huffman code (the region (detection block 204 in FIG. 14) where the region 202 is located when converted to the minimum Huffman code in the search range 203) is also extracted.

ステップS59において、注目ブロック201と検出ブロック204とから、動きベクトル205が検出される。すなわち、領域202と検出ブロック204との相対座標が求められることにより、動きベクトル205が算出される。このようにして、動きベクトル検出処理が実行され、検出された動きベクトルが、残差算出部74に供給される。   In step S <b> 59, the motion vector 205 is detected from the target block 201 and the detection block 204. That is, the motion vector 205 is calculated by obtaining the relative coordinates between the region 202 and the detection block 204. In this way, the motion vector detection process is executed, and the detected motion vector is supplied to the residual calculation unit 74.

このように、ハフマンコード規範動き推定部73は、第1のフレームからの第1のブロック(フレームNからの注目ブロック201)と、第2のフレーム内に設定された探索領域内に設定された第2のブロック(フレームN−1内に設定されたサーチ範囲203内に設定された領域202)との差分を算出し、その差分をハフマンコードに変換する。   As described above, the Huffman code reference motion estimation unit 73 is set in the first block from the first frame (the target block 201 from the frame N) and the search region set in the second frame. The difference from the second block (the area 202 set in the search range 203 set in the frame N-1) is calculated, and the difference is converted into a Huffman code.

差分がハフマンコードに変換される際、ハフマンテーブルが参照されるが、差分が算出される第1のブロックが、処理対象とされている動画像の先頭フレームの先頭ブロックであった場合、自然画像を用いて予め作成されたハフマンテーブルが参照され、第1のブロックが、処理対象とされている動画像の先頭フレームの先頭ブロックで以外であった場合、後述する処理により、ブロックが処理される毎に更新されるハフマンテーブルが参照される。   When the difference is converted into the Huffman code, the Huffman table is referred to. When the first block for which the difference is calculated is the first block of the first frame of the moving image to be processed, a natural image When the first block is other than the first block of the first frame of the moving image to be processed, the block is processed by the process described later. The Huffman table updated every time is referred to.

ハフマンコード規範動き推定部73は、ハフマンコードの符号長が最小となる第2のブロックを、第1のブロックに対応するブロックとして設定する(検出ブロック204として設定する)。そして、第1のブロックに対応するとして設定された第2のブロックと、第1のブロックとの相対座標が求められることにより、第1のブロックの動きベクトルが推定される。推定された(検出された)動きベクトルは、残差算出部74に供給される。   The Huffman code reference motion estimation unit 73 sets the second block having the minimum code length of the Huffman code as a block corresponding to the first block (set as the detection block 204). Then, by obtaining the relative coordinates between the second block set to correspond to the first block and the first block, the motion vector of the first block is estimated. The estimated (detected) motion vector is supplied to the residual calculation unit 74.

残差算出部74は、ステップS13(図9)において、残差を算出する。ステップS13において実行される残差算出処理について、図15のフローチャートを参照して説明する。   The residual calculation unit 74 calculates a residual in step S13 (FIG. 9). The residual calculation process executed in step S13 will be described with reference to the flowchart of FIG.

ステップS71において、予測ブロックが獲得される。残差算出部74の予測ブロック獲得部131(図6)には、ハフマンコード規範動き推定部73から動きベクトルと、フレームメモリ72から、フレームN−1の画像データが、それぞれ供給される。予測ブロック獲得部131は、供給されたフレームN−1内の所定のブロック(予測ブロック)の位置を、動きベクトルを用いて確定し、その確定した予測ブロックの画像データを獲得する。   In step S71, a prediction block is obtained. The prediction block acquisition unit 131 (FIG. 6) of the residual calculation unit 74 is supplied with the motion vector from the Huffman code reference motion estimation unit 73 and the image data of the frame N−1 from the frame memory 72, respectively. The prediction block acquisition unit 131 determines the position of a predetermined block (prediction block) in the supplied frame N-1 using the motion vector, and acquires image data of the determined prediction block.

獲得された予測ブロックの画像データは、残差獲得部132に供給される。残差獲得部132には、ブロック化部71から処理対象とされているブロック(注目ブロック)も供給される。残差獲得部132は、予測ブロックと注目ブロックとの残差を算出することにより、残差を獲得する。すなわち、予測値と真値との残差が算出される。獲得された残差は、残差ハフマン符号化部75(図3)に供給される。   The acquired image data of the prediction block is supplied to the residual acquisition unit 132. The residual acquisition unit 132 is also supplied with the block (target block) that is the processing target from the blocking unit 71. The residual acquisition unit 132 acquires the residual by calculating the residual between the prediction block and the target block. That is, the residual between the predicted value and the true value is calculated. The acquired residual is supplied to the residual Huffman encoder 75 (FIG. 3).

残差ハフマン符号化部75は、ステップS14において、残差ハフマン符号化処理を実行する。ステップS14において、残差ハフマン符号化部75により実行される残差ハフマン符号化処理について、図16のフローチャートを参照して説明する。   The residual Huffman encoding unit 75 executes a residual Huffman encoding process in step S14. The residual Huffman encoding process executed by the residual Huffman encoding unit 75 in step S14 will be described with reference to the flowchart of FIG.

ステップS91において、ブロック化された残差が読み込まれる。残差ハフマン符号化部75のハフマン符号割り当て部152(図7)は、残差算出部74からの残差を取得する。ステップS92において、取得された残差は、先頭フレームの先頭ブロックからの残差であるか否かが判断される。ステップS92において、先頭フレームの先頭ブロックからの残差であると判断された場合、ステップS93に処理が進められ、先頭フレームの先頭ブロックからの残差ではないと判断された場合、ステップS94に処理が進められる。   In step S91, the blocked residual is read. The Huffman code assigning unit 152 (FIG. 7) of the residual Huffman coding unit 75 acquires the residual from the residual calculation unit 74. In step S92, it is determined whether or not the acquired residual is a residual from the first block of the first frame. If it is determined in step S92 that the residual is the residual from the top block of the top frame, the process proceeds to step S93. If it is determined that the residual is not the residual from the top block of the top frame, the process proceeds to step S94. Is advanced.

ステップS93に処理が進められた場合、ハフマン符号割り当て部152は、ハフマンテーブル記憶部76から、初期ハフマンテーブルを読み込む。この処理は、図12のステップS54において初期ハフマンコード算出部111(図5)により実行される処理と基本的に同様である。   When the process proceeds to step S <b> 93, the Huffman code assignment unit 152 reads the initial Huffman table from the Huffman table storage unit 76. This process is basically the same as the process executed by the initial Huffman code calculation unit 111 (FIG. 5) in step S54 of FIG.

ステップS94に処理が進められた場合、ハフマン符号割り当て部152は、ハフマンテーブル記憶部76から、累計型ハフマンテーブルを読み込む。この処理は、図12のステップS55において累計型ハフマンコード算出部115(図5)により実行される処理と基本的に同様である。   When the process proceeds to step S <b> 94, the Huffman code assignment unit 152 reads the cumulative Huffman table from the Huffman table storage unit 76. This process is basically the same as the process executed by the cumulative Huffman code calculation unit 115 (FIG. 5) in step S55 of FIG.

ステップS95において、ハフマン符号割り当て部152は、供給された残差に、ハフマンテーブルを参照し、ハフマン符号を割り当てる。ステップS96において、度数分布作成部151(図7)は、残差の度数分布を作成する。ステップS97において、ハフマン符号化された残差と、作成された度数分布が送信される。残差は、データ合成部78に供給され、度数分布は、ハフマンコード算出部77に供給される。   In step S95, the Huffman code assigning unit 152 assigns a Huffman code to the supplied residual by referring to the Huffman table. In step S96, the frequency distribution creating unit 151 (FIG. 7) creates a residual frequency distribution. In step S97, the Huffman-encoded residual and the created frequency distribution are transmitted. The residual is supplied to the data synthesis unit 78, and the frequency distribution is supplied to the Huffman code calculation unit 77.

データ合成部78は、ステップS15(図9)において、残差ハフマン符号化75からの残差に関するハフマンコードと、ハフマンコード規範動き推定部73からの動きベクトルを合成し、その合成データを他の装置、例えば、復号化装置32(図2)に送信する。   In step S15 (FIG. 9), the data synthesizing unit 78 synthesizes the Huffman code related to the residual from the residual Huffman coding 75 and the motion vector from the Huffman code reference motion estimating unit 73, and the synthesized data is combined with the other data. Transmit to a device, for example, the decryption device 32 (FIG. 2).

ステップS54(図12)やステップS93(図16)の処理が実行された場合、すなわち、初期ハフマンテーブルが用いられ、差分や残差がハフマンコードに変換された場合、ステップS15において、合成データが復号化装置32に送信されるときに、あわせて、初期ハフマンテーブルも送信されるようにしても良い。初期ハフマンテーブルが送信されるようにした場合、復号化装置32は、初期ハフマンテーブルを記憶しておく必要がない(後述するように、復号化装置32は、符号化装置31と同じ初期ハフマンテーブルを有する必要がある)。   When the processing of step S54 (FIG. 12) or step S93 (FIG. 16) is executed, that is, when the initial Huffman table is used and the difference or residual is converted into a Huffman code, the synthesized data is obtained in step S15. When the data is transmitted to the decryption device 32, an initial Huffman table may also be transmitted. When the initial Huffman table is transmitted, the decoding device 32 does not need to store the initial Huffman table (as will be described later, the decoding device 32 has the same initial Huffman table as the encoding device 31). Need to have).

初期ハフマンテーブルを送信するようにしたとしても、送信されるのは初期ハフマンテーブルだけであるので(復号化装置32側で、初期ハフマンテーブルがあれば、累積型ハフマンテーブルを作成することができるので、復号化装置32に、累積型ハフマンテーブルを送信する必要はない)、符号化の効率を低下させてしまう(データ量を増加させてしまう)ようなことは防ぐことができる。   Even if the initial Huffman table is transmitted, only the initial Huffman table is transmitted (if the initial Huffman table exists on the decoding device 32 side, a cumulative Huffman table can be created. Therefore, it is not necessary to transmit the cumulative Huffman table to the decoding device 32), and it is possible to prevent a decrease in encoding efficiency (an increase in the amount of data).

ステップ16において、ハフマンコード算出部77は、ハフマンコード算出処理を実行する。ハフマンコード算出部77において実行されるハフマンコード算出処理について、図17のフローチャートを参照して説明する。   In step 16, the Huffman code calculation unit 77 executes a Huffman code calculation process. Huffman code calculation processing executed in the Huffman code calculation unit 77 will be described with reference to the flowchart of FIG.

ステップS111において、ハフマンコード算出部76のバッファ171(図8)に保持されている度数分布が、度数分布マージ部172により読み込まれる。バッファ171は、度数分布マージ部172に供給される度数分布より前の時点の度数分布が記憶されている。その記憶されている度数分布が、バッファ171から読み出される。   In step S111, the frequency distribution held in the buffer 171 (FIG. 8) of the Huffman code calculation unit 76 is read by the frequency distribution merging unit 172. The buffer 171 stores a frequency distribution at a time point before the frequency distribution supplied to the frequency distribution merging unit 172. The stored frequency distribution is read from the buffer 171.

ステップS112において、度数分布マージ部172は、残差ハフマン符号化部75から送られてきた度数分布と、バッファ171から読み出された度数分布をマージ(Merge)する。すなわち、送信されてきた度数分布と読み出された度数分布という2つの度数分布が1つの度数分布にまとめられる。   In step S112, the frequency distribution merging unit 172 merges the frequency distribution sent from the residual Huffman encoding unit 75 and the frequency distribution read from the buffer 171. That is, two frequency distributions of the transmitted frequency distribution and the read frequency distribution are combined into one frequency distribution.

ステップS113において、度数分布マージ部172は、マージした度数分布をバッファ171に書き込む(上書きする)。マージされた度数分布は、出現確率分布取得部173にも供給される。出現確率分布取得部173は、ステップS114において、供給された度数分布を用いて、出現確率分布を作成(取得)する。作成された出現確率分布は、ハフマンコード割り当て部174に供給される。   In step S113, the frequency distribution merging unit 172 writes (overwrites) the merged frequency distribution in the buffer 171. The merged frequency distribution is also supplied to the appearance probability distribution acquisition unit 173. In step S114, the appearance probability distribution acquisition unit 173 creates (acquires) an appearance probability distribution using the supplied frequency distribution. The created appearance probability distribution is supplied to the Huffman code assigning unit 174.

ハフマンコード割り当て部174は、ステップS115において、供給された出現確率分布を用いて、残差に対して、ハフマンコードを割り当てる。そして、ステップS116において、割り当てられたハフマンコードを元に、ハフマンテーブル記憶部76に記憶されているハフマンテーブルが更新される。   In step S115, the Huffman code assigning unit 174 assigns a Huffman code to the residual using the supplied appearance probability distribution. In step S116, the Huffman table stored in the Huffman table storage unit 76 is updated based on the assigned Huffman code.

ハフマンテーブル記憶部76には、このような更新により作成されたハフマンテーブルが記憶されている。このようなハフマンテーブルを累積型ハフマンテーブルと称する。この累計型ハフマンテーブルは、上述した説明において、例えば、ハフマンコード規範動き推定部73の累計型ハフマンコード算出部115(図5)が参照するハフマンテーブルである。   The Huffman table storage unit 76 stores a Huffman table created by such an update. Such a Huffman table is referred to as a cumulative Huffman table. This cumulative Huffman table is a Huffman table referred to by the cumulative Huffman code calculation unit 115 (FIG. 5) of the Huffman code reference motion estimation unit 73 in the above description, for example.

また、ハフマンテーブル記憶部76には、累積型ハフマンテーブルが作成されていないときに参照される初期ハフマンテーブルも記憶されている。累積型ハフマンコードは、上述してきたように、フレーム内のブロックが処理される毎に算出される残差に対してハフマンコードが割り当てられる毎に、更新されるテーブルである。よって、累積型ハフマンテーブルは、所定のブロック数が処理されないと作成されない(存在しない)テーブルである。   The Huffman table storage unit 76 also stores an initial Huffman table that is referred to when a cumulative Huffman table is not created. As described above, the cumulative Huffman code is a table that is updated each time a Huffman code is assigned to a residual calculated every time a block in a frame is processed. Therefore, the cumulative Huffman table is a table that is not created (does not exist) unless a predetermined number of blocks are processed.

累積型ハフマンテーブルが利用できないとき(上述した説明においては、先頭フレームの先頭ブロックが処理されるとき)に用いられるのが初期ハフマンテーブルである。初期ハフマンテーブルは、予め複数の自然画像を利用して作成されたテーブルである。   The initial Huffman table is used when the cumulative Huffman table cannot be used (in the above description, when the first block of the first frame is processed). The initial Huffman table is a table created in advance using a plurality of natural images.

このようにして、ハフマンテーブル記憶部76に記憶されている累積型ハフマンテーブルが更新されると、ステップS17(図9)において、最終ブロックであるか否かが判断される。説明してきたように、処理は、ブロック単位で行われる。そこで、処理対象とされているフレームN内から分割されたブロック全てに対して、処理が終了されたか否かが判断される。   In this way, when the cumulative Huffman table stored in the Huffman table storage unit 76 is updated, it is determined in step S17 (FIG. 9) whether or not it is the final block. As described above, processing is performed in units of blocks. Therefore, it is determined whether or not the processing has been completed for all the blocks divided from the frame N to be processed.

ステップS17において、最終ブロックではないと判断された場合、ステップS11に処理が戻され、それ以降の処理が繰り返される。一方、ステップS17において、最終ブロックであると判断された場合、1フレームの処理が終了されたことを意味しているため、図9に示した1フレームに対する符号化処理は終了される。   If it is determined in step S17 that the block is not the final block, the process returns to step S11, and the subsequent processes are repeated. On the other hand, if it is determined in step S17 that the block is the last block, it means that the processing for one frame has been completed, and thus the encoding processing for one frame shown in FIG. 9 is ended.

ハフマン符号化について、一般的な説明を加えると、“与えられた情報源の状態を、その生起確率に従って平均符号長が最も短くなるように符号を構成していく方式”である。本実施の形態においては、残差がハフマン符号化されるわけだが、残差として出現する確率(生起確率)が高い残差に対して、短い符号長が割り当てられれば、効率良く符号化が行われることを意味する。   A general description of Huffman coding is “a system in which a code is configured so that an average code length is the shortest according to the occurrence probability of a given information source state”. In this embodiment, the residual is Huffman-coded, but if a short code length is assigned to a residual that has a high probability of occurrence as a residual (occurrence probability), efficient encoding is performed. Means that

従来、図1に示したような符号化装置10においては、ハフマンテーブル記憶部16に記憶されているハフマンテーブルが用いられて符号化が行われていたが、このハフマンテーブル記憶部16に記憶されているハフマンテーブルは更新されることがなかった。換言すれば、ハフマンテーブル記憶部16に記憶されているハフマンテーブルは、自然画像を用いて予め作成されたハフマンテーブルであった。さらに換言するならば、ハフマンテーブル記憶部16に記憶されているハフマンテーブルは、符号化装置10で符号化対象とされている画像とは関係のない画像から生成されたハフマンテーブルであった。   Conventionally, in the encoding device 10 as shown in FIG. 1, encoding is performed using the Huffman table stored in the Huffman table storage unit 16, but the Huffman table storage unit 16 stores the encoding. The Huffman table that was never updated. In other words, the Huffman table stored in the Huffman table storage unit 16 is a Huffman table created in advance using a natural image. In other words, the Huffman table stored in the Huffman table storage unit 16 is a Huffman table generated from an image unrelated to the image to be encoded by the encoding device 10.

そのために、ハフマンテーブルの作成に用いられた自然画像と、符号化の対象とされている画像と大きく異なるような場合、残差に対して割り当てられるハフマンコードが、符号長が長いハフマンコードが割り当てられてしまい、効率良く符号化を行う(データ量を小さくするような符号化を行う)ことができないことがあった。   Therefore, if the natural image used to create the Huffman table is significantly different from the image to be encoded, the Huffman code assigned to the residual is assigned a Huffman code with a long code length. As a result, it may not be possible to perform efficient encoding (encoding that reduces the amount of data).

しかしながら、本実施の形態においては、上述したように、ハフマンテーブル記憶部76(図3)に記憶されるハフマンテーブルは、更新されるようにされている。またその更新は、処理されている画像に基づいて、符号化の処理とともに、順次更新される。よって、ハフマンテーブル記憶部76に記憶されているハフマンテーブルは、符号化の対象とされている画像に依存したテーブルとすることができる。   However, in the present embodiment, as described above, the Huffman table stored in the Huffman table storage unit 76 (FIG. 3) is updated. The update is sequentially updated along with the encoding process based on the image being processed. Therefore, the Huffman table stored in the Huffman table storage unit 76 can be a table depending on an image to be encoded.

よって、符号化の対象とされている画像に、多く発生する残差には、短い符号長のハフマンコードが割り当てられることになり、効率良く、データ量を小さくすることができる符号化を行うことが可能となる。よって、可逆符号化において高品質、高圧縮を行うことができる。   Therefore, a Huffman code having a short code length is assigned to a residual that occurs frequently in an image to be encoded, and encoding that can efficiently reduce the amount of data is performed. Is possible. Therefore, high quality and high compression can be performed in lossless encoding.

すなわち、本実施の形態におけるハフマンテーブル(ハフマンコード)は、処理された画像から作成されるため、処理されている画像に依存するものとすることができる。また、処理が進むにつれて、処理対象とされている画像により依存したハフマンテーブルとされていくため、処理対象とされている画像に最適化されたハフマンテーブルを作成することが可能となる。   That is, the Huffman table (Huffman code) in the present embodiment is created from the processed image, and can therefore depend on the image being processed. Further, as the process proceeds, the Huffman table depending on the image to be processed is made dependent, so that it is possible to create a Huffman table optimized for the image to be processed.

よって、例えば、処理されている画像とは関係のない自然画像から作成されたハフマンテーブルを用いて符号化を行うときと比べて、処理されている画像に依存するハフマンテーブルを用いた符号化を行う本実施の形態における符号化を行うときの方が、符号化された後のデータ量を小さくすることが可能となる。   Thus, for example, compared to encoding using a Huffman table created from a natural image unrelated to the image being processed, encoding using a Huffman table that depends on the image being processed is performed. When encoding is performed in the present embodiment, the amount of data after encoding can be reduced.

[復号化装置の構成および動作]
このような符号化が行われた画像データを受信し、復号化する復号化装置の構成と動作について、次に説明する。
[Configuration and Operation of Decoding Device]
Next, the configuration and operation of a decoding apparatus that receives and decodes such encoded image data will be described.

図18は、復号化装置の構成例を示す図である。復号化装置51は、入力端子310、データ分解部311、フレームメモリ312、ハフマンコード規範動き補償部313、ハフマンテーブル記憶部314、ハフマンコード算出部315、残差ハフマン符号化部316、残差結合部317、ブロック結合部318、および、出力端子319を含む構成とされている。   FIG. 18 is a diagram illustrating a configuration example of a decoding device. The decoding device 51 includes an input terminal 310, a data decomposition unit 311, a frame memory 312, a Huffman code reference motion compensation unit 313, a Huffman table storage unit 314, a Huffman code calculation unit 315, a residual Huffman encoding unit 316, and a residual combination. A portion 317, a block coupling portion 318, and an output terminal 319 are included.

入力端子310には、符号化装置31から動きベクトルのデータと、ハフマン符号化された残差のデータが合成された合成データが供給される。入力端子310に供給された合成データは、データ分解部311に供給される。データ分解部311は、合成データを分解し、動きベクトルのデータを、ハフマンコード規範動き補償部313に、残差のデータを、残差ハフマン復号部316に、それぞれ供給する。   The input terminal 310 is supplied with combined data obtained by combining the motion vector data and the Huffman-encoded residual data from the encoding device 31. The combined data supplied to the input terminal 310 is supplied to the data decomposing unit 311. The data decomposition unit 311 decomposes the combined data, and supplies motion vector data to the Huffman code reference motion compensation unit 313 and residual data to the residual Huffman decoding unit 316, respectively.

ハフマンコード規範動き補償部313には、フレームメモリ312に記憶されているフレームも供給される。ハフマンコード規範動き補償部313は、動きベクトルとフレームを用いて、また、ハフマンテーブル記憶部314に記憶されているハフマンテーブルを参照し、処理対象(復号化対象)とされるブロック(予測ブロック)を特定し、残差結合部317に供給する。   The frame stored in the frame memory 312 is also supplied to the Huffman code reference motion compensation unit 313. The Huffman code reference motion compensation unit 313 uses a motion vector and a frame, and refers to a Huffman table stored in the Huffman table storage unit 314 to be a block (prediction block) to be processed (decoded). Is specified and supplied to the residual combining unit 317.

残差ハフマン復号化部316は、データ分解部311からの残差をハフマンテーブル記憶部314に記憶されているハフマンテーブルを参照し、復号化する。復号化された残差は、残差結合部317に供給される。また、残差ハフマン復号化部316は、後述するように、残差の度数分布を作成し、ハフマンコード算出部315に供給する。   The residual Huffman decoding unit 316 decodes the residual from the data decomposition unit 311 with reference to the Huffman table stored in the Huffman table storage unit 314. The decoded residual is supplied to the residual combining unit 317. Also, the residual Huffman decoding unit 316 creates a frequency distribution of residuals and supplies it to the Huffman code calculation unit 315, as will be described later.

ハフマンコード算出部315は、供給された度数分布を元に、ハフマンテーブル記憶部314に記憶されているハフマンテーブルを更新する。   The Huffman code calculation unit 315 updates the Huffman table stored in the Huffman table storage unit 314 based on the supplied frequency distribution.

残差結合部317は、ハフマンコード規範動き補償部313からの予測ブロックと、残差ハフマン復号化部316からの残差とから、復元されたブロック(真値ブロック)を生成し、ブロック結合部318に供給する。ブロック結合部318は、供給されたブロックを結合し、1フレームを生成する。生成されたフレームは、出力端子319とフレームメモリ312に対して供給される。   The residual combining unit 317 generates a restored block (true value block) from the prediction block from the Huffman code reference motion compensation unit 313 and the residual from the residual Huffman decoding unit 316, and generates a block combining unit. 318. The block combination unit 318 combines the supplied blocks to generate one frame. The generated frame is supplied to the output terminal 319 and the frame memory 312.

出力端子319に供給されたフレームは、ディスプレイ33(図2)に供給される。また、フレームメモリ312に供給されたフレームは、記憶されていたフレームに上書きされる。   The frame supplied to the output terminal 319 is supplied to the display 33 (FIG. 2). The frame supplied to the frame memory 312 is overwritten on the stored frame.

次に、復号化部51を構成する各部について、必要に応じ説明を加える。図19は、ハフマンコード規範動き補償部313の内部構成例を示す図である。ハフマンコード規範動き補償部313は、動きベクトル取得部331と予測ブロック獲得部332から構成されている。   Next, description will be added as necessary to each unit constituting the decoding unit 51. FIG. 19 is a diagram illustrating an internal configuration example of the Huffman code reference motion compensation unit 313. The Huffman code standard motion compensation unit 313 includes a motion vector acquisition unit 331 and a prediction block acquisition unit 332.

動きベクトル取得部331は、データ分解部311から動きベクトルが供給され、その供給された動きベクトルを予測ブロック獲得部332に供給する。予測ブロック獲得部332には、フレームメモリ312からフレームも供給される。フレームメモリ312から供給されるフレームは、既に復号化されているフレーム(過去のフレーム)であり、処理対象とされているフレーム(入力端子310に入力される合成データが作成されたフレーム(フレームNとする))よりも1フレーム前のフレーム(以下、フレームN−1とする)である。   The motion vector acquisition unit 331 is supplied with the motion vector from the data decomposition unit 311 and supplies the supplied motion vector to the prediction block acquisition unit 332. A frame is also supplied from the frame memory 312 to the prediction block acquisition unit 332. A frame supplied from the frame memory 312 is a frame that has already been decoded (past frame), and is a frame to be processed (a frame in which composite data to be input to the input terminal 310 is created (frame N). ))) One frame before (hereinafter referred to as frame N-1).

予測ブロック獲得部332は、フレームN−1内から、予測ブロックを動きベクトルを用いて抽出する。抽出された予測ブロックは、残差結合部317に供給される。   The prediction block acquisition unit 332 extracts a prediction block from the frame N-1 using a motion vector. The extracted prediction block is supplied to the residual combining unit 317.

図20は、残差ハフマン復号化部316の内部構成例を示す図である。残差ハフマン復号化部316は、残差取得部351と度数分布作成部352から構成されている。残差取得部351には、データ分解部311から残差が供給され、ハフマンテーブル記憶部314からハフマンテーブルが供給される。残差取得部351に供給される残差は、ハフマン符号化されているため残差取得部251は、供給された残差を、ハフマンテーブルを参照することにより復号化する。   FIG. 20 is a diagram illustrating an internal configuration example of the residual Huffman decoding unit 316. The residual Huffman decoding unit 316 includes a residual acquisition unit 351 and a frequency distribution creation unit 352. The residual acquisition unit 351 is supplied with the residual from the data decomposition unit 311 and is supplied with the Huffman table from the Huffman table storage unit 314. Since the residual supplied to the residual acquisition unit 351 is Huffman encoded, the residual acquisition unit 251 decodes the supplied residual by referring to the Huffman table.

復号化された残差は、度数分布作成部352と残差結合部317(図18)に供給される。度数分布作成部352は、残差の度数分布を作成し、ハフマンコード算出部315(図18)に供給する。   The decoded residual is supplied to the frequency distribution creating unit 352 and the residual combining unit 317 (FIG. 18). The frequency distribution creation unit 352 creates a residual frequency distribution and supplies it to the Huffman code calculation unit 315 (FIG. 18).

図21は、ハフマンコード算出部315の内部構成例を示す図である。ハフマンコード算出部315は、バッファ371、度数分布マージ部372、出現確率分布取得部373、および、ハフマンコード割り当て部374を含む構成とされている。バッファ371は、度数分布マージ部372からの出力を一旦記憶する。バッファ371に記憶されているデータは、度数分布マージ部372に供給される。   FIG. 21 is a diagram illustrating an internal configuration example of the Huffman code calculation unit 315. The Huffman code calculation unit 315 includes a buffer 371, a frequency distribution merge unit 372, an appearance probability distribution acquisition unit 373, and a Huffman code allocation unit 374. The buffer 371 temporarily stores the output from the frequency distribution merging unit 372. The data stored in the buffer 371 is supplied to the frequency distribution merging unit 372.

度数分布マージ部372は、残差ハフマン復号化部316からの残差の度数分布も供給される。度数分布マージ部372は、供給された度数分布を用いて、バッファ371に記憶されている度数分布を更新する。更新された度数分布は、バッファ371と出現確率分布出力部373に供給される。出現確率分布取得部373は、供給された度数分布から、所定の残差が出現する確率の分布を作成し、ハフマンコード割り当て部374に供給する。   The frequency distribution merging unit 372 is also supplied with the residual frequency distribution from the residual Huffman decoding unit 316. The frequency distribution merging unit 372 updates the frequency distribution stored in the buffer 371 using the supplied frequency distribution. The updated frequency distribution is supplied to the buffer 371 and the appearance probability distribution output unit 373. The appearance probability distribution acquisition unit 373 creates a probability distribution that a predetermined residual appears from the supplied frequency distribution, and supplies the probability distribution to the Huffman code assignment unit 374.

ハフマンコード割り当て部374は、残差にハフマンコードを割り当て、ハフマンテーブル記憶部314に供給する。ハフマンテーブル記憶部314は、供給されたハフマンコードにより記憶しているハフマンテーブルを更新する。   The Huffman code assigning unit 374 assigns a Huffman code to the residual and supplies it to the Huffman table storage unit 314. The Huffman table storage unit 314 updates the stored Huffman table with the supplied Huffman code.

図22は、残差結合部317の内部構成例を示す図である。残差結合部317は、残差結合処理部391を含む構成とされている。残差結合部317の残差結合処理部391には、ハフマンコード規範動き補償部313から予測ブロックと、残差ハフマン復号化部316から残差が供給される。残差結合処理部391は、供給された予測ブロックと残差から、真値ブロック(すなわち、復号化されたブロック)を生成し、ブロック結合部318に供給する。   FIG. 22 is a diagram illustrating an internal configuration example of the residual combining unit 317. The residual combining unit 317 includes a residual combining processing unit 391. The residual combination processing unit 391 of the residual combination unit 317 is supplied with the prediction block from the Huffman code reference motion compensation unit 313 and the residual from the residual Huffman decoding unit 316. The residual combination processing unit 391 generates a true value block (that is, a decoded block) from the supplied prediction block and residual and supplies the true value block to the block combining unit 318.

次に、復号化部51の動作について説明する。まず、図23のフローチャートを参照し、復号化部51の動作について説明する。   Next, the operation of the decoding unit 51 will be described. First, the operation of the decoding unit 51 will be described with reference to the flowchart of FIG.

ステップS211において、データ分解部311(図18)は、入力端子310を介して入力された符号化装置31からの合成データを受信する。受信される合成データは、動きベクトルと残差が合成された合成データである。データ分解部311は、受信された合成データを、動きベクトルのデータと残差のデータとに分解する。分解されたデータの内、動きベクトルのデータは、ハフマンコード規範動き補償部313に、残差は、残差ハフマン復号化部316に供給される。   In step S <b> 211, the data decomposing unit 311 (FIG. 18) receives the composite data from the encoding device 31 input via the input terminal 310. The received synthesized data is synthesized data in which the motion vector and the residual are synthesized. The data decomposing unit 311 decomposes the received combined data into motion vector data and residual data. Of the decomposed data, motion vector data is supplied to the Huffman code reference motion compensation unit 313, and the residual is supplied to the residual Huffman decoding unit 316.

符号化装置31側で、ステップS54(図12)やステップS93(図16)の処理が実行された場合、すなわち、初期ハフマンテーブルが用いられ、差分や残差がハフマンコードに変換された場合、合成データの他に、初期ハフマンテーブルも送信されるように構成されても良いと上述した。このように符号化装置31が構成されていた場合には、ステップS211において、初期ハフマンテーブルも、合成データとともに、受信される可能性がある。   When the processing of step S54 (FIG. 12) or step S93 (FIG. 16) is executed on the encoding device 31 side, that is, when an initial Huffman table is used and a difference or residual is converted into a Huffman code, As described above, the initial Huffman table may be transmitted in addition to the synthesized data. When the encoding device 31 is configured in this way, in step S211, the initial Huffman table may be received together with the synthesized data.

ステップS211において、初期ハフマンテーブルも受信された場合、その受信された初期ハフマンテーブルは、ハフマンテーブル記憶314に供給され、記憶される。   In step S211, when the initial Huffman table is also received, the received initial Huffman table is supplied to and stored in the Huffman table storage 314.

ステップS212において、ハフマンコード規範動き補償部313は、動きベクトル予測値算出処理を実行する。ステップS212において実行される動きベクトル予測値算出処理について、図24のフローチャートを参照して説明する。   In step S212, the Huffman code reference motion compensation unit 313 executes a motion vector prediction value calculation process. The motion vector prediction value calculation process executed in step S212 will be described with reference to the flowchart in FIG.

ステップS231において、ハフマンコード規範動き補償部313の動きベクトル取得部331(図19)は、データ分解部311からの動きベクトルを取得する。取得された動きベクトルは、予測ブロック獲得部332に供給される。予測ブロック獲得部332は、ステップS232において、1フレーム前の画像を読み込む。すなわち、フレームメモリ312(図18)には、既に復号化された画像データが記憶されており、その画像データが読み出される。   In step S231, the motion vector acquisition unit 331 (FIG. 19) of the Huffman code reference motion compensation unit 313 acquires the motion vector from the data decomposition unit 311. The acquired motion vector is supplied to the prediction block acquisition unit 332. In step S232, the prediction block acquisition unit 332 reads the image one frame before. That is, the image data that has already been decoded is stored in the frame memory 312 (FIG. 18), and the image data is read out.

また、読み出されるデータは、復号対象とされているフレームをフレームNとしたとき、そのフレームNに対して1フレーム前のフレームである(フレームN−1とする)。予測ブロック獲得部332は、フレームN−1の画像データと動きベクトルから予測ブロックを取得する。   Further, when the frame to be decoded is a frame N, the data to be read is a frame one frame before the frame N (referred to as a frame N-1). The prediction block acquisition unit 332 acquires a prediction block from the image data and the motion vector of the frame N-1.

予測ブロック獲得部332は、符号化装置31の残差算出部74の予測ブロック獲得部131(図6)と同様の処理により、予測ブロックを取得する。符号化装置31の予測ブロック獲得部131も、フレームN−1と動きベクトルが供給され、それらのデータから予測ブロックを取得するが、復号化装置32の予測ブロック獲得部332も、供給されるフレームN−1と動きベクトルから予測ブロックを取得する。   The prediction block acquisition unit 332 acquires a prediction block by the same process as the prediction block acquisition unit 131 (FIG. 6) of the residual calculation unit 74 of the encoding device 31. The prediction block acquisition unit 131 of the encoding device 31 is also supplied with the frame N-1 and the motion vector, and acquires the prediction block from those data. The prediction block acquisition unit 332 of the decoding device 32 also receives the supplied frame. A prediction block is acquired from N-1 and a motion vector.

例えば、符号化装置31(図3)で符号化の対象とされたフレームがフレームNであり、その符号化されたフレームNを復号化装置32側で復号するときに、復号化装置32のフレームメモリ312に記憶されているフレームN−1は、符号化装置31でフレームNを符号化するときにフレームメモリ72に記憶されているフレームN−1と同じである。また、動きベクトルは、同じフレームN−1から取得された動きベクトルであるので、同一である。よって、同一のデータを用いて取得される予測ブロックは、符号化装置31と復号化装置32とで同一のものとなる。   For example, the frame that is the target of encoding by the encoding device 31 (FIG. 3) is the frame N, and when the encoded frame N is decoded on the decoding device 32 side, the frame of the decoding device 32 The frame N-1 stored in the memory 312 is the same as the frame N-1 stored in the frame memory 72 when the encoding device 31 encodes the frame N. The motion vectors are the same because they are motion vectors acquired from the same frame N-1. Therefore, the prediction block acquired using the same data is the same in the encoding device 31 and the decoding device 32.

このように、また、後述するように、符号化装置31と復号化装置32とで同一のデータが用いられて符号化や復号化が行われるため、結果的に、符号化の段階で情報が欠落する(例えば、不可逆符号化のときのように)といったことがなく、高画質を維持した符号化や復号化を行うことが可能となる。   In this way, as will be described later, since the same data is used in the encoding device 31 and the decoding device 32, encoding and decoding are performed. As a result, information is obtained at the encoding stage. There is no loss (for example, as in the case of irreversible encoding), and encoding and decoding with high image quality can be performed.

予測ブロック獲得部332により獲得された予測ブロックは、残差結合部317に供給される。   The prediction block acquired by the prediction block acquisition unit 332 is supplied to the residual combination unit 317.

図23のフローチャートの説明に戻り、ステップS213において、残差ハフマン復号化部316において残差ハフマン復号化処理が実行される。ステップS213において実行される残差ハフマン復号化処理について、図25のフローチャートを参照して説明する。   Returning to the description of the flowchart of FIG. 23, in step S213, the residual Huffman decoding unit 316 performs residual Huffman decoding processing. The residual Huffman decoding process executed in step S213 will be described with reference to the flowchart of FIG.

ステップS251において、残差ハフマン復号化部316の残差取得部351(図20)は、データ分解部311から供給される残差のデータを読み込む。読み込まれる残差のデータは、ハフマン符号化されている。ステップS252において、読み込まれた残差は、先頭フレームの先頭ブロックからの残差であるか否かが判断される。   In step S251, the residual acquisition unit 351 (FIG. 20) of the residual Huffman decoding unit 316 reads the residual data supplied from the data decomposition unit 311. The read residual data is Huffman encoded. In step S252, it is determined whether the read residual is a residual from the first block of the first frame.

ステップS252において、先頭フレームの先頭ブロックからの残差であると判断された場合、ステップS253に処理が進められる。ステップS253において、ハフマンテーブル記憶部314から、初期ハフマンテーブルが読み出される。   If it is determined in step S252 that the first frame is a residual from the first block, the process proceeds to step S253. In step S253, the initial Huffman table is read from the Huffman table storage unit 314.

一方、ステップS252において、先頭フレームの先頭ブロックからの残差ではないと判断された場合、ステップS254に処理が進められる。ステップS254において、ハフマンテーブル記憶部314から、累積型ハフマンテーブルが読み出される。   On the other hand, if it is determined in step S252 that there is no residual from the first block of the first frame, the process proceeds to step S254. In step S254, the cumulative Huffman table is read from the Huffman table storage unit 314.

この初期ハフマンテーブルは、符号化部42のハフマンテーブル記憶部76(図3)に記憶されている初期ハフマンテーブルと同様のテーブルである。また、符号化部42で符号化対象とされているブロック(ブロックAとする)が符号化され、復号化部51の復号の対象となっているときの累積型ハフマンテーブルは、符号化部42でブロックAが符号化されるときに、ハフマンテーブル記憶部76に記憶されている累積型ハフマンテーブルと同様のテーブルである。   This initial Huffman table is the same table as the initial Huffman table stored in the Huffman table storage unit 76 (FIG. 3) of the encoding unit 42. The cumulative Huffman table when the block (referred to as block A) to be encoded by the encoding unit 42 is encoded and is to be decoded by the decoding unit 51 is the encoding unit 42. This is a table similar to the cumulative Huffman table stored in the Huffman table storage unit 76 when the block A is encoded.

すなわち、符号化側と復号側で、扱うブロックが同一であるときには、同一のハフマンテーブルが読み出され、処理されるように構成されている。   That is, the same Huffman table is read and processed when the same block is handled on the encoding side and the decoding side.

ステップS255において、残差取得部351は、ステップS253またはステップS254において読み出されたハフマンテーブルを用いて、ハフマン符号化されている残差を復号化する。すなわち、残差取得部351は、ハフマン符号化されている残差を、読み出したハフマンテーブルを参照し、復号化を行う。復号化された残差は、度数分布作成部352に供給される。   In step S255, the residual acquisition unit 351 decodes the Huffman-encoded residual using the Huffman table read in step S253 or step S254. That is, the residual acquisition unit 351 decodes the Huffman-encoded residual with reference to the read Huffman table. The decoded residual is supplied to the frequency distribution creation unit 352.

度数分布作成部352は、ステップS256において、残差取得部351から供給された残差を含めた度数分布を作成する。度数分布作成部352は、符号化部51の残差ハフマン符号化部75の度数分布作成部151(図7)と同様に、供給された残差を含めた度数分布を作成する。   In step S256, the frequency distribution creation unit 352 creates a frequency distribution including the residual supplied from the residual acquisition unit 351. The frequency distribution creating unit 352 creates a frequency distribution including the supplied residual, similarly to the frequency distribution creating unit 151 (FIG. 7) of the residual Huffman coding unit 75 of the coding unit 51.

ステップS257において、残差取得部351により復号化された残差が、残差結合部317に供給され、度数分布作成部352により作成された度数分布が、ハフマンコード算出部315に供給される。   In step S257, the residual decoded by the residual acquisition unit 351 is supplied to the residual combination unit 317, and the frequency distribution created by the frequency distribution creation unit 352 is supplied to the Huffman code calculation unit 315.

度数分布が供給されるハフマンコード算出部315の動作について説明する。ハフマンコード算出部315は、ステップS214(図23)において、ハフマンコード算出処理を実行する。   The operation of the Huffman code calculation unit 315 to which the frequency distribution is supplied will be described. The Huffman code calculation unit 315 executes a Huffman code calculation process in step S214 (FIG. 23).

ハフマンコード算出部315の構成は、符号化部42のハフマンコード算出部77と同様である。また、ハフマンコード算出部315に供給されるのは、残差であるという点も同じである。よって、ハフマンコード算出部315は、図17に示したフローチャートの処理(符号化部42のハフマンコード算出部77が実行する処理)と同様の処理を実行する。   The configuration of the Huffman code calculation unit 315 is the same as that of the Huffman code calculation unit 77 of the encoding unit 42. Also, the same is true in that it is the residual that is supplied to the Huffman code calculation unit 315. Therefore, the Huffman code calculation unit 315 performs the same processing as the processing of the flowchart shown in FIG. 17 (processing executed by the Huffman code calculation unit 77 of the encoding unit 42).

このように、復号化部51のハフマンコード算出部315は、符号化部42のハフマンコード算出部77と同様の構成とされ、同様のデータが供給され、同様の処理を行うことにより、ハフマンテーブル記憶部314に記憶されている累積ハフマンテーブルを更新する。このように、ハフマンテーブル記憶部314に記憶されているハフマンテーブルは、符号化部42のハフマンテーブル記憶部76と同様に更新される。よって、符号化部42で符号化が行われたときと同様のテーブルが、復号化部51で復号化が行われるときに記憶されているようにすることができる。   In this way, the Huffman code calculation unit 315 of the decoding unit 51 has the same configuration as the Huffman code calculation unit 77 of the encoding unit 42, and is supplied with the same data and performs the same processing, thereby performing the Huffman table. The cumulative Huffman table stored in the storage unit 314 is updated. As described above, the Huffman table stored in the Huffman table storage unit 314 is updated in the same manner as the Huffman table storage unit 76 of the encoding unit 42. Therefore, the same table as when the encoding unit 42 performs the encoding can be stored when the decoding unit 51 performs the decoding.

このように更新されるハフマンテーブルが用いられて、ハフマン符号化されている残差が復号化されるので、符号長が短くなるように符号化された残差を、正確に復号化することができる。   Since the Huffman table updated in this way is used to decode the Huffman-encoded residual, it is possible to accurately decode the residual encoded so as to shorten the code length. it can.

このようにして、ハフマンコード算出部315がハフマンコード算出処理を実行すると、ステップS215(図23)に処理が進められる。ステップS215において、残差結合部317(図22)により、真値算出処理が実行される。ステップS215における真値算出処理について、図26のフローチャートを参照して説明する。   In this way, when the Huffman code calculation unit 315 executes the Huffman code calculation process, the process proceeds to step S215 (FIG. 23). In step S215, the true value calculation process is executed by the residual combining unit 317 (FIG. 22). The true value calculation process in step S215 will be described with reference to the flowchart in FIG.

ステップS271において、残差結合部317の残差結合処理部391は、残差と予測値を結合する。残差結合処理部391には、ハフマンコード規範動き補償部313から予測ブロック(予測値)と、残差ハフマン復号化部316から残差が供給される。残差結合処理部391は、供給された予測ブロック(予測値)と残差を結合することにより、真値(真値ブロック)を算出する。このようにして、所定フレーム内の所定のブロックが復号化される。   In step S271, the residual combination processing unit 391 of the residual combining unit 317 combines the residual and the predicted value. The residual combination processing unit 391 is supplied with the prediction block (predicted value) from the Huffman code reference motion compensation unit 313 and the residual from the residual Huffman decoding unit 316. The residual combination processing unit 391 calculates a true value (true value block) by combining the supplied prediction block (prediction value) and the residual. In this way, a predetermined block in a predetermined frame is decoded.

ステップS272において、復号化されたブロック(算出された真値)は、ブロック結合部318(図18)に供給される。   In step S272, the decoded block (calculated true value) is supplied to the block combining unit 318 (FIG. 18).

ブロック結合部318は、ステップS216(図23)において、供給されたブロックの結合処理を実行する。ブロック結合部318には、上述した処理が繰り返されることにより、順次、復号化されたブロックが供給される。図11に示したように、符号化される際、所定のフレーム(フレームN)は、所定の画素数から構成されるブロックにブロック化され、ブロック単位で符号化が行われた。よって、復号化される際も、ブロック単位で復号化される。その結果、ブロック結合部318には、復号化されたブロックが、順次供給されることになる。   In step S216 (FIG. 23), the block combination unit 318 executes the combination process of the supplied blocks. The block combination unit 318 is sequentially supplied with the decoded blocks by repeating the above-described processing. As shown in FIG. 11, when encoding, a predetermined frame (frame N) was blocked into blocks each having a predetermined number of pixels, and encoding was performed in units of blocks. Therefore, also when decoding, it decodes per block. As a result, the block combination unit 318 is sequentially supplied with the decoded blocks.

ブロック結合部318は、順次供給されるブロックを結合し、1フレームを生成するための処理を実行する。   The block combining unit 318 combines the sequentially supplied blocks and executes a process for generating one frame.

ステップS217において、処理対象とされた(結合された)ブロックは、最終ブロックであったか否かが判断される。換言すれば、1フレームを構成できたか否かが判断される。ステップS217において、処理対象とされたブロックは、最終ブロックではないと判断された場合、ステップS211に処理が戻され、それ以降の処理が繰り返される。   In step S217, it is determined whether the block to be processed (combined) is the last block. In other words, it is determined whether one frame has been constructed. If it is determined in step S217 that the block to be processed is not the final block, the process returns to step S211 and the subsequent processes are repeated.

一方、ステップS217において、処理対象とされたブロックは、最終ブロックであると判断された場合、すなわち、1フレームが構成されたと判断された場合、1フレームを復号化するための処理である、図23に示したフローチャートの処理は終了される。   On the other hand, if it is determined in step S217 that the block to be processed is the final block, that is, if it is determined that one frame is configured, this is a process for decoding one frame. The process of the flowchart shown in FIG.

このように、本実施の形態における復号化部51においては、ハフマンテーブルが、処理されている画像に応じて更新される。よって、効率良い符号化が行われた残差を、効率良く復号化することが可能である。   Thus, in decoding section 51 in the present embodiment, the Huffman table is updated according to the image being processed. Therefore, it is possible to efficiently decode the residual that has been efficiently encoded.

本発明を適用することで、高画質で、高圧縮な符号化および復号化を行うことが可能となる。   By applying the present invention, it is possible to perform encoding and decoding with high image quality and high compression.

なお、上述した実施の形態においては、符号化および復号化の処理が実行される際、ブロックが処理される毎に、ハフマンテーブルが更新されるとして説明した。しかしながら、ハフマンテーブルの更新は、ブロックが処理される毎に行われなくても良い。例えば、1フレーム処理される毎に、ハフマンテーブルが更新されるようにしても良い。更新の頻度は、適宜、設計段階などに適切に設定されることが可能である。   In the above-described embodiment, it has been described that the Huffman table is updated each time a block is processed when the encoding and decoding processes are executed. However, the Huffman table need not be updated every time a block is processed. For example, the Huffman table may be updated every time one frame is processed. The frequency of updating can be appropriately set at the design stage as appropriate.

[記録媒体について]
図27は、上述した一連の処理をプログラムにより実行するパーソナルコンピュータの構成の例を示すブロック図である。CPU(Central Processing Unit)401は、ROM(Read Only Memory)402、または記憶部408に記憶されているプログラムに従って各種の処理を実行する。RAM(Random Access Memory)403には、CPU401が実行するプログラムやデータなどが適宜記憶される。これらのCPU401、ROM402、およびRAM403は、バス404により相互に接続されている。
[About recording media]
FIG. 27 is a block diagram showing an example of the configuration of a personal computer that executes the above-described series of processing by a program. A CPU (Central Processing Unit) 401 executes various processes according to a program stored in a ROM (Read Only Memory) 402 or a storage unit 408. A RAM (Random Access Memory) 403 appropriately stores programs executed by the CPU 401 and data. These CPU 401, ROM 402, and RAM 403 are mutually connected by a bus 404.

CPU401にはまた、バス404を介して入出力インタフェース405が接続されている。入出力インタフェース405には、キーボード、マウス、マイクロホンなどよりなる入力部406、ディスプレイ、スピーカなどよりなる出力部407が接続されている。CPU401は、入力部406から入力される指令に対応して各種の処理を実行する。そして、CPU401は、処理の結果を出力部407に出力する。   An input / output interface 405 is also connected to the CPU 401 via the bus 404. Connected to the input / output interface 405 are an input unit 406 made up of a keyboard, mouse, microphone, and the like, and an output unit 407 made up of a display, a speaker, and the like. The CPU 401 executes various processes in response to commands input from the input unit 406. Then, the CPU 401 outputs the processing result to the output unit 407.

入出力インタフェース405に接続されている記憶部408は、例えばハードディスクからなり、CPU401が実行するプログラムや各種のデータを記憶する。通信部409は、インターネットやローカルエリアネットワークなどのネットワークを介して外部の装置と通信する。   A storage unit 408 connected to the input / output interface 405 includes, for example, a hard disk, and stores programs executed by the CPU 401 and various data. A communication unit 409 communicates with an external device via a network such as the Internet or a local area network.

また、通信部409を介してプログラムを取得し、記憶部408に記憶してもよい。   A program may be acquired via the communication unit 409 and stored in the storage unit 408.

入出力インタフェース405に接続されているドライブ410は、磁気ディスク、光ディスク、光磁気ディスク、あるいは半導体メモリなどのリムーバブルメディア411が装着されたとき、それらを駆動し、そこに記録されているプログラムやデータなどを取得する。取得されたプログラムやデータは、必要に応じて記憶部408に転送され、記憶される。   A drive 410 connected to the input / output interface 405 drives a removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, and drives the program or data recorded therein. Get etc. The acquired program and data are transferred to and stored in the storage unit 408 as necessary.

上述した一連の処理は、ハードウエアにより実行させることもできるし、ソフトウエアにより実行させることもできる。一連の処理をソフトウエアにより実行させる場合には、そのソフトウエアを構成するプログラムが、専用のハードウエアに組み込まれているコンピュータ、または、各種のプログラムをインストールすることで、各種の機能を実行することが可能な、例えば汎用のパーソナルコンピュータなどに、プログラム格納媒体からインストールされる。   The series of processes described above can be executed by hardware or can be executed by software. When a series of processing is executed by software, a program constituting the software executes various functions by installing a computer incorporated in dedicated hardware or various programs. For example, the program is installed in a general-purpose personal computer from the program storage medium.

コンピュータにインストールされ、コンピュータによって実行可能な状態とされるプログラムを格納するプログラム格納媒体は、図27に示すように、磁気ディスク(フレキシブルディスクを含む)、光ディスク(CD-ROM(Compact Disc-Read Only Memory),DVD(Digital Versatile Disc)を含む)、光磁気ディスク(MD(Mini-Disc)を含む)、もしくは半導体メモリなどよりなるパッケージメディアであるリムーバブルメディア411、または、プログラムが一時的もしくは永続的に格納されるROM402や、記憶部408を構成するハードディスクなどにより構成される。プログラム格納媒体へのプログラムの格納は、必要に応じてルータ、モデムなどのインタフェースである通信部409を介して、ローカルエリアネットワーク、インターネット、デジタル衛星放送といった、有線または無線の通信媒体を利用して行われる。   As shown in FIG. 27, a program storage medium that stores a program that is installed in a computer and can be executed by the computer includes a magnetic disk (including a flexible disk), an optical disk (CD-ROM (Compact Disc-Read Only). Memory), DVD (including Digital Versatile Disc)), magneto-optical disk (including MD (Mini-Disc)), or removable media 411, which is a package medium made of semiconductor memory, or the program is temporary or permanent Are configured by a ROM 402 stored in the hard disk, a hard disk constituting the storage unit 408, and the like. The program is stored in the program storage medium using a wired or wireless communication medium such as a local area network, the Internet, or digital satellite broadcasting via a communication unit 409 that is an interface such as a router or a modem as necessary. Done.

なお、本明細書において、プログラム格納媒体に格納されるプログラムを記述するステップは、記載された順序に沿って時系列的に行われる処理はもちろん、必ずしも時系列的に処理されなくとも、並列的あるいは個別に実行される処理をも含むものである。   In the present specification, the step of describing the program stored in the program storage medium is not limited to the processing performed in time series according to the described order, but is not necessarily performed in time series. Or the process performed separately is also included.

また、本明細書において、システムとは、複数の装置により構成される装置全体を表すものである。   Further, in this specification, the system represents the entire apparatus constituted by a plurality of apparatuses.

なお、本発明の実施の形態は、上述した実施の形態に限定されるものではなく、本発明の要旨を逸脱しない範囲において種々の変更が可能である。   The embodiment of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the gist of the present invention.

従来の符号化装置の一例の構成を示す図である。It is a figure which shows the structure of an example of the conventional encoding apparatus. 本発明のシステムの一実施の形態の構成を示す図である。It is a figure which shows the structure of one Embodiment of the system of this invention. 符号化部の構成例を示す図である。It is a figure which shows the structural example of an encoding part. ブロック化部の構成例を示す図である。It is a figure which shows the structural example of a blocking part. ハフマンコード規範動き推定部の構成例を示す図である。It is a figure which shows the structural example of a Huffman code normative motion estimation part. 残差算出部の構成例を示す図である。It is a figure which shows the structural example of a residual calculation part. 残差ハフマン符号化部の構成例を示す図である。It is a figure which shows the structural example of a residual Huffman encoding part. ハフマンコード算出部の構成例を示す図である。It is a figure which shows the structural example of a Huffman code calculation part. 符号化処理について説明するフローチャートである。It is a flowchart explaining an encoding process. ブロック化処理について説明するフローチャートである。It is a flowchart explaining a blocking process. ブロック化について説明する図である。It is a figure explaining blocking. 動きベクトル検出処理について説明するフローチャートである。It is a flowchart explaining a motion vector detection process. 動きベクトルについて説明する図である。It is a figure explaining a motion vector. 動きベクトルについて説明する図である。It is a figure explaining a motion vector. 残差算出処理について説明するフローチャートである。It is a flowchart explaining a residual calculation process. 残差ハフマン符号化処理について説明するフローチャートである。It is a flowchart explaining a residual Huffman encoding process. ハフマンコード算出処理について説明するフローチャートである。It is a flowchart explaining a Huffman code calculation process. 復号化部の構成例を示す図である。It is a figure which shows the structural example of a decoding part. ハフマンコード規範動き補償部の構成例を示す図である。It is a figure which shows the structural example of a Huffman code norm motion compensation part. 残差ハフマン復号化部の構成例を示す図である。It is a figure which shows the structural example of a residual Huffman decoding part. ハフマンコード算出部の構成例を示す図である。It is a figure which shows the structural example of a Huffman code calculation part. 残差結合部の構成例を示す図である。It is a figure which shows the structural example of a residual coupling | bond part. 復号処理について説明するフローチャートである。It is a flowchart explaining a decoding process. 動きベクトル予測値算出処理について説明するフローチャートである。It is a flowchart explaining a motion vector prediction value calculation process. 残差ハフマン復号化処理について説明するフローチャートである。It is a flowchart explaining a residual Huffman decoding process. 真値算出処理について説明するフローチャートである。It is a flowchart explaining a true value calculation process. パーソナルコンピュータの構成例を示す図である。It is a figure which shows the structural example of a personal computer.

符号の説明Explanation of symbols

42 符号化部, 51 復号化部, 70 入力端子, 71 ブロック化部, 72 フレームメモリ, 73 ハフマンコード規範動き推定部, 74 残差算出部, 75 残差ハフマン復号化部, 76 ハフマンテーブル記憶部, 77 ハフマンコード算出部, 78 データ合成部, 79 出力端子, 310 入力端子, 311 データ分解部, 312 フレームメモリ, 313 ハフマンコード動き補償部, 314 ハフマンテーブル記憶部, 315 ハフマンコード算出部, 316 残差ハフマン復号化部, 317 残差結合部, 318 ブロック結合部, 319 出力端子 42 encoding unit, 51 decoding unit, 70 input terminal, 71 blocking unit, 72 frame memory, 73 Huffman code reference motion estimation unit, 74 residual calculation unit, 75 residual Huffman decoding unit, 76 Huffman table storage unit , 77 Huffman code calculation unit, 78 data composition unit, 79 output terminal, 310 input terminal, 311 data decomposition unit, 312 frame memory, 313 Huffman code motion compensation unit, 314 Huffman table storage unit, 315 Huffman code calculation unit, 316 remaining Difference Huffman decoding unit, 317 residual combination unit, 318 block combination unit, 319 output terminal

Claims (17)

第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定装置において、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化手段と、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定手段と、
前記第1のブロックと前記第2のブロックとの差分を算出する算出手段と、
前記算出手段により算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換手段と、
前記変換手段により変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定手段と
を備える動きベクトル推定装置。
In a motion vector estimation device that performs motion estimation between a first frame and a second frame,
Blocking means for generating a first block by blocking the first frame;
Setting means for setting a search area in the second frame and setting a second block in the search area;
Calculating means for calculating a difference between the first block and the second block;
Conversion means for converting the difference calculated by the calculation means into a Huffman code using a Huffman table;
A second block having a minimum code length of the Huffman code converted by the conversion means is a block corresponding to the first block, and an estimation means for estimating a motion vector of the first block. Motion vector estimation device.
前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、
前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、前記所定の動画像が処理されることにより作成されたハフマンテーブルである
請求項1に記載の動きベクトル推定装置。
The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image.
The motion vector estimation device according to claim 1, wherein when the first block is other than a head block of a head frame of a predetermined moving image, the Huffman table is created by processing the predetermined moving image. .
第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定方法において、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、
前記第1のブロックと前記第2のブロックとの差分を算出する算出ステップと、
前記算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換ステップと、
前記変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと
を含む動きベクトル推定方法。
In a motion vector estimation method for performing motion estimation between a first frame and a second frame,
A blocking step of blocking the first frame to generate a first block;
Setting a search area in the second frame and setting a second block in the search area;
A calculating step for calculating a difference between the first block and the second block;
A conversion step of converting the difference calculated in the calculation step into a Huffman code using a Huffman table;
An estimation step of estimating a motion vector of the first block, with the second block having the minimum code length of the Huffman code converted by the processing of the conversion step being a block corresponding to the first block; A motion vector estimation method including:
第1のフレームと第2のフレーム間で動き推定を行う動きベクトル推定装置における処理を、コンピュータに行わせるプログラムにおいて、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、
前記第1のブロックと前記第2のブロックとの差分を算出する算出ステップと、
前記算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する変換ステップと、
前記変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと
を含むプログラム。
In a program for causing a computer to perform processing in a motion vector estimation device that performs motion estimation between a first frame and a second frame,
A blocking step of blocking the first frame to generate a first block;
Setting a search area in the second frame and setting a second block in the search area;
A calculating step for calculating a difference between the first block and the second block;
A conversion step of converting the difference calculated in the calculation step into a Huffman code using a Huffman table;
An estimation step of estimating a motion vector of the first block, with the second block having the minimum code length of the Huffman code converted by the processing of the conversion step being a block corresponding to the first block; Including programs.
第1のフレームと第2のフレームを有する入力フレームを符号化する符号化装置において、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化手段と、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定手段と、
前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出手段と、
前記第1の算出手段により算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換手段と、
前記第1の変換手段により変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定手段と
前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出手段と、
前記第2の算出手段により算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換手段と、
前記推定手段により推定された前記動きベクトルと、前記第2の変換手段により変換された前記残差のハフマンコードを、符号化データとして出力する出力手段と
を備える符号化装置。
In an encoding device for encoding an input frame having a first frame and a second frame,
Blocking means for generating a first block by blocking the first frame;
Setting means for setting a search area in the second frame and setting a second block in the search area;
First calculation means for calculating a difference between the first block and the second block;
First conversion means for converting the difference calculated by the first calculation means into a Huffman code using a Huffman table;
Estimating means for estimating a motion vector of the first block, with the second block having the minimum code length of the Huffman code converted by the first converting means as a block corresponding to the first block And a second calculating means for calculating a residual between the second block corresponding to the motion vector and the first block;
Second conversion means for converting the residual calculated by the second calculation means into a Huffman code with reference to a Huffman table;
An encoding apparatus comprising: the motion vector estimated by the estimation unit; and an output unit that outputs the residual Huffman code converted by the second conversion unit as encoded data.
前記第2の算出手段により算出された前記残差の度数分布を作成し、
作成された前記度数分布に基づき、前記残差の出現確率分布を取得し、
取得された出現確率分布から、残差毎にハフマンコードを割り当て、前記ハフマンテーブルを更新する
請求項5に記載の符号化装置。
Creating a frequency distribution of the residual calculated by the second calculating means;
Based on the created frequency distribution, obtain the appearance probability distribution of the residual,
The encoding apparatus according to claim 5, wherein a Huffman code is assigned for each residual from the acquired appearance probability distribution, and the Huffman table is updated.
前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、
前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、更新された前記ハフマンテーブルである
請求項6に記載の符号化装置。
The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image.
The encoding apparatus according to claim 6, wherein the first block is the updated Huffman table when the first block is other than the first block of the first frame of a predetermined moving image.
前記出力手段は、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルも出力する
請求項7に記載の符号化装置。
The encoding device according to claim 7, wherein the output means also outputs a Huffman table created in advance using a natural image when the first block is a head block of a head frame of a predetermined moving image.
第1のフレームと第2のフレームを有する入力フレームを符号化する符号化方法において、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、
前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出ステップと、
前記第1の算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換ステップと、
前記第1の変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと
前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出ステップと、
前記第2の算出ステップの処理で算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換ステップと、
前記推定ステップの処理で推定された前記動きベクトルと、前記第2の変換ステップの処理で変換された前記残差のハフマンコードを、符号化データとして出力する出力ステップと
を含む符号化方法。
In an encoding method for encoding an input frame having a first frame and a second frame,
A blocking step of blocking the first frame to generate a first block;
Setting a search area in the second frame and setting a second block in the search area;
A first calculation step of calculating a difference between the first block and the second block;
A first conversion step of converting the difference calculated in the processing of the first calculation step into a Huffman code using a Huffman table;
The second block having the minimum code length of the Huffman code converted by the processing of the first conversion step is set as a block corresponding to the first block, and the motion vector of the first block is estimated. An estimation step; a second calculation step of calculating a residual between the second block and the first block corresponding to the motion vector;
A second conversion step of converting the residual calculated in the processing of the second calculation step into a Huffman code with reference to a Huffman table;
An output method comprising: outputting the motion vector estimated by the process of the estimation step and the Huffman code of the residual converted by the process of the second conversion step as encoded data.
第1のフレームと第2のフレームを有する入力フレームを符号化する符号化装置における処理を、コンピュータに行わせるプログラムにおいて、
前記第1のフレームをブロック化して第1のブロックを生成するブロック化ステップと、
前記第2のフレームに探索領域を設定し、前記探索領域中に第2のブロックを設定する設定ステップと、
前記第1のブロックと前記第2のブロックとの差分を算出する第1の算出ステップと、
前記第1の算出ステップの処理で算出された前記差分を、ハフマンテーブルを用いてハフマンコードに変換する第1の変換ステップと、
前記第1の変換ステップの処理で変換された前記ハフマンコードの符号長が最小になる第2のブロックを、前記第1のブロックに対応するブロックとし、前記第1のブロックの動きベクトルを推定する推定ステップと
前記動きベクトルに対応する第2のブロックと第1のブロックの残差を算出する第2の算出ステップと、
前記第2の算出ステップの処理で算出された前記残差を、ハフマンテーブルを参照し、ハフマンコードに変換する第2の変換ステップと、
前記推定ステップの処理で推定された前記動きベクトルと、前記第2の変換ステップの処理で変換された前記残差のハフマンコードを、符号化データとして出力する出力ステップと
を含むプログラム。
In a program for causing a computer to perform processing in an encoding device that encodes an input frame having a first frame and a second frame,
A blocking step of blocking the first frame to generate a first block;
Setting a search area in the second frame and setting a second block in the search area;
A first calculation step of calculating a difference between the first block and the second block;
A first conversion step of converting the difference calculated in the processing of the first calculation step into a Huffman code using a Huffman table;
The second block having the minimum code length of the Huffman code converted by the processing of the first conversion step is set as a block corresponding to the first block, and the motion vector of the first block is estimated. An estimation step; a second calculation step of calculating a residual between the second block and the first block corresponding to the motion vector;
A second conversion step of converting the residual calculated in the processing of the second calculation step into a Huffman code with reference to a Huffman table;
An output step for outputting the motion vector estimated in the process of the estimation step and the Huffman code of the residual converted in the process of the second conversion step as encoded data.
符号化されている第1のフレームからの第1のブロックを復号化する復号化装置において、
残差に関するハフマンコードと動きベクトルを受信する受信手段と、
ハフマンテーブルを参照して前記残差を復号化する残差復号化手段と、
前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得手段と、
前記残差復号化手段により復号化された前記残差を、前記取得手段により取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化手段と、
前記ブロック復号手段により復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成手段と
を備える復号化装置。
In a decoding device for decoding a first block from an encoded first frame,
Receiving means for receiving a Huffman code and a motion vector relating to the residual;
Residual decoding means for decoding the residual with reference to a Huffman table;
Obtaining means for obtaining a prediction block from the motion vector and the second frame being decoded;
Block decoding means for decoding the first block by combining the residual decoded by the residual decoding means with the prediction block obtained by the obtaining means;
A decoding device comprising: frame generating means for generating the first frame by combining the first blocks decoded by the block decoding means.
前記残差復号化手段により復号化された前記残差の度数分布を作成し、
作成された前記度数分布に基づき、前記残差の出現確率分布を取得し、
取得された出現確率分布から、残差毎にハフマンコードを割り当て、前記ハフマンテーブルを更新する
請求項11に記載の符号化装置。
Creating a frequency distribution of the residual decoded by the residual decoding means;
Based on the created frequency distribution, obtain the appearance probability distribution of the residual,
The encoding apparatus according to claim 11, wherein a Huffman code is assigned for each residual from the acquired appearance probability distribution, and the Huffman table is updated.
前記ハフマンテーブルは、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルであり、
前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロック以外である場合、更新された前記ハフマンテーブルである
請求項12に記載の符号化装置。
The Huffman table is a Huffman table created in advance using a natural image when the first block is the first block of the first frame of a predetermined moving image.
The encoding device according to claim 12, wherein the first block is the updated Huffman table when the first block is other than the first block of the first frame of a predetermined moving image.
前記受信手段は、前記第1のブロックが、所定の動画像の先頭フレームの先頭ブロックである場合、自然画像を用いて予め作成されたハフマンテーブルも受信する
請求項13に記載の符号化装置。
The encoding device according to claim 13, wherein the reception unit also receives a Huffman table created in advance using a natural image when the first block is a head block of a head frame of a predetermined moving image.
符号化されている第1のフレームからの第1のブロックを復号化する復号化方法において、
残差に関するハフマンコードと動きベクトルの受信を制御する受信制御ステップと、
ハフマンテーブルを参照して前記残差を復号化する残差復号化ステップと、
前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得ステップと、
前記残差復号化ステップの処理で復号化された前記残差を、前記取得ステップの処理で取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化ステップと、
前記ブロック復号ステップの処理で復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成ステップと
を含む復号化方法。
In a decoding method for decoding a first block from an encoded first frame,
A reception control step for controlling reception of a Huffman code and a motion vector related to the residual;
A residual decoding step of decoding the residual with reference to a Huffman table;
Obtaining a prediction block from the motion vector and the second frame being decoded;
A block decoding step of decoding the first block by combining the residual decoded in the processing of the residual decoding step with the prediction block acquired in the processing of the acquisition step; ,
A frame generation step of generating the first frame by combining the first blocks decoded in the block decoding step.
符号化されている第1のフレームからの第1のブロックを復号化する復号化装置における処理を、コンピュータに行わせるプログラムにおいて、
残差に関するハフマンコードと動きベクトルの受信を制御する受信制御ステップと、
ハフマンテーブルを参照して前記残差を復号化する残差復号化ステップと、
前記動きベクトルと復号化されている第2のフレームから、予測ブロックを取得する取得ステップと、
前記残差復号化ステップの処理で復号化された前記残差を、前記取得ステップの処理で取得された前記予測ブロックに結合することにより、前記第1のブロックを復号化するブロック復号化ステップと、
前記ブロック復号ステップの処理で復号化された前記第1のブロックを結合することにより、前記第1のフレームを生成するフレーム生成ステップと
を含むプログラム。
In a program for causing a computer to perform processing in a decoding device that decodes a first block from a first frame that is encoded,
A reception control step for controlling reception of a Huffman code and a motion vector related to the residual;
A residual decoding step of decoding the residual with reference to a Huffman table;
Obtaining a prediction block from the motion vector and the second frame being decoded;
A block decoding step of decoding the first block by combining the residual decoded in the processing of the residual decoding step with the prediction block acquired in the processing of the acquisition step; ,
A frame generation step of generating the first frame by combining the first blocks decoded in the block decoding step.
請求項4、請求項10、または、請求項16に記載のプログラムが記録されている記録媒体。   A recording medium on which the program according to claim 4, 10, or 16 is recorded.
JP2005302919A 2005-10-18 2005-10-18 Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium Withdrawn JP2007116246A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005302919A JP2007116246A (en) 2005-10-18 2005-10-18 Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005302919A JP2007116246A (en) 2005-10-18 2005-10-18 Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium

Publications (1)

Publication Number Publication Date
JP2007116246A true JP2007116246A (en) 2007-05-10

Family

ID=38098068

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005302919A Withdrawn JP2007116246A (en) 2005-10-18 2005-10-18 Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium

Country Status (1)

Country Link
JP (1) JP2007116246A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640857A (en) * 2022-05-06 2022-06-17 江苏游隼微电子有限公司 Image compression method and 3D noise reduction method based on improved Huffman coding
CN116634168A (en) * 2023-07-26 2023-08-22 上海方诚光电科技有限公司 Image lossless processing method and system based on industrial camera

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640857A (en) * 2022-05-06 2022-06-17 江苏游隼微电子有限公司 Image compression method and 3D noise reduction method based on improved Huffman coding
CN114640857B (en) * 2022-05-06 2023-05-12 江苏游隼微电子有限公司 Image compression method and 3D noise reduction method based on improved Huffman coding
CN116634168A (en) * 2023-07-26 2023-08-22 上海方诚光电科技有限公司 Image lossless processing method and system based on industrial camera
CN116634168B (en) * 2023-07-26 2023-10-24 上海方诚光电科技有限公司 Image lossless processing method and system based on industrial camera

Similar Documents

Publication Publication Date Title
US11315320B2 (en) Information processing apparatus and method
JP3169783B2 (en) Video encoding / decoding system
US9277238B2 (en) Moving image encoding and decoding system
US20070036449A1 (en) Data processing apparatus and method and recording medium
US20100220792A1 (en) Encoding device and decoding device
US6859155B2 (en) Data processing device
JP2010517405A (en) Video encoding method and apparatus, video decoding method and apparatus
JP2009501479A (en) Image coder for texture areas
JP2008092352A (en) Image predictive coder, image predictive coding method, image predictive coding program, image prediction decoder, image predictive decoding method, and image predictive decoding program
US20080219348A1 (en) Data embedding apparatus, data extracting apparatus, data embedding method, and data extracting method
Skorupa et al. Efficient low-delay distributed video coding
US20240048738A1 (en) Methods, apparatuses, computer programs and computer-readable media for processing configuration data
JPWO2008072500A1 (en) Moving picture encoding apparatus and moving picture decoding apparatus
JP4835855B2 (en) Apparatus, method and program for moving picture encoding, and apparatus method and program for moving picture decoding
JP2008061135A (en) Image encoding apparatus and image encoding method
JP2007116246A (en) Motion vector estimating device and method, encoding device and method, decoding device and method, program, and recording medium
JP2011077879A (en) Moving image encoding apparatus and program, moving image decoding apparatus and program, and, moving image distribution system
US20010043750A1 (en) Embedded coding unit and embedded coding method, decoding unit and decoding method, and storage medium
TW201412131A (en) Receiving device, transmission device, and image transmission method
JP2007288761A (en) Image distribution system, image processing apparatus and method, distribution device and method, and program
JP2003244696A (en) Encoding processor, decoding processor, method therefor and computer program
JP2007074306A (en) Apparatus for generating supplementary pixel, decoding system, decoding method, image coding communication system, decoding program and computer-readable recording medium
JP4120916B2 (en) Information processing apparatus and method, recording medium, and program
JP4743884B2 (en) Image coding apparatus and control method thereof
JP4374712B2 (en) Data processing apparatus, data processing method, and recording medium

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090106