Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP3715664B2 - Image processing method - Google Patents
[go: Go Back, main page]

JP3715664B2 - Image processing method - Google Patents

Image processing method Download PDF

Info

Publication number
JP3715664B2
JP3715664B2 JP20781294A JP20781294A JP3715664B2 JP 3715664 B2 JP3715664 B2 JP 3715664B2 JP 20781294 A JP20781294 A JP 20781294A JP 20781294 A JP20781294 A JP 20781294A JP 3715664 B2 JP3715664 B2 JP 3715664B2
Authority
JP
Japan
Prior art keywords
data
frame
code
macroblock
latch
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP20781294A
Other languages
Japanese (ja)
Other versions
JPH0879741A (en
Inventor
充 前田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP20781294A priority Critical patent/JP3715664B2/en
Publication of JPH0879741A publication Critical patent/JPH0879741A/en
Application granted granted Critical
Publication of JP3715664B2 publication Critical patent/JP3715664B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【産業上の利用分野】
本発明は、動画像の処理を行う画像処理方法に関するものである。
【0002】
【従来の技術】
近年、画像データの符号化技術の国際標準化が盛んに行われている。カラー多値画像の符号化方式として、JPEG(カラー静止画符号化)方式が国際標準となった。この方式は入力されたカラー多値画像をブロックに分割し、DCT変換を施した後、係数を量子化し、量子化結果にハフマン符号を割り当て、符号化する方式である。なお、詳細は「カラー静止画像符号化国際標準方式(JPEG)の概説(その1)(技術解説)」[画像電子学会誌第20巻第1号]に掲載されている。
【0003】
また、動画像に関しても国際標準化が進められている。TV会議を用途としたH.261(通信用動画符号化)方式や、蓄積メディアを用途としたMPEG(蓄積用動画像符号化)方式が標準となった。これらの符号化方式は基本となるフレームをフレーム内符号化し、その他のフレームを動き補償によって符号化する方式である。フレーム内符号化の基本はJPEG方式と同様にブロック分割とDCT変換である。また、動き補償においてもブロック単位に動きベクトルを算出し、その対象ブロックとの差分を求め、差分ブロックをDCT変換し、係数を量子化し、量子化結果にハフマン符号を割り当て、符号化する方式である。なお、詳細は「マルチメディア符号化の国際標準」[丸善(株)]に掲載されている。
【0004】
これらの標準化が進む一方で、これらの技術のLSI化が急速に実現しつつある。標準化の進められた順に、最初にJPEG方式のLSIが発表された。その後、JPEG方式の符号化を行うLSIが安価かつ大量に供給された。これにより、動画像の符号化方式であるMPEG方式が標準化される前に、動画像の各フレームをJPEG方式で符号化して磁気ディスク等に格納するアプリケーションが普及した。以下、動画像をJPEG方式により符号化したデータをMotionJPEGデータと称する。
【0005】
これらのアプリケーションでは、MPEG方式と比較してフレーム単位での編集が容易であり、取扱いが容易であるという特徴がある。一方、MPEG方式は、フレーム間符号化を採用しているために符号化効率が高いという特徴がある。
【0006】
また、これらのデータを処理するに際して、MotionJPEGデータをMPEGデータに変換する技術も必要となる。
【0007】
【発明が解決しようとする課題】
しかしながら、上述した例では、MotionJPEGデータをMPEGデータに変換する際に、MotionJPEGデータを復号化して画像データに一旦戻し、その復号化された画像データをMPEGデータに再符号化するため、次のような欠点があった。
【0008】
すなわち、JPEG方式の復号化とMPEG方式の符号化とを同時に実施するために装置の制御が複雑であり、処理量も大きくなる。例えば、JPEG復号器やMPEG符号化部をソフトウェアで実現すると、処理を行うのに非常に多くの時間がかかってしまう。また、MPEG方式で符号化する際に参照フレームを格納しておく作業用のフレームメモリが必要であり、装置全体のコストを下げる際の障害となる等の問題があった。
【0009】
そこで、本発明の目的は、JPEGデータのようなフレーム内符号化データをMPEGデータのようなフレーム間相関による符号化データに変換する際に、画像データに復号化するフレーム内符号化データを減らして効率よくデータの変換を行うことのできる画像処理方法を提供することにある。
【0010】
【課題を解決するための手段】
上記目的を達成するため、本発明の画像処理方法は、ブロック毎に第1の符号化方式でフレーム内符号化された第1のフレーム内符号化データを入力する入力工程と、前記第1のフレーム内符号化データを、復号することなくルックアップテーブルによって前記第1の符号化方式とは異なる第2の符号化方式で第2のフレーム内符号化データに、前記ブロックを複数集めたマクロブロック単位で変換する第1のデータ変換工程と、前記第1のフレーム内符号化データを復号化し、その復号された画像データを前記第2符号化方式のフレーム間相関によるフレーム間符号化データに、前記マクロブロック単位で変換する第2のデータ変換工程と、前記第1のフレーム内符号化データを復号することによって得られた第1の直交変換係数データと、前フレーム又は後フレームの第2の直交変換係数データとを、前記マクロブロック単位で比較する比較工程と、前記比較工程での比較結果に応じて、前記第2のフレーム内符号化データ及び該第2のフレーム内符号化データの前にスキップするマクロブロック数を示すマクロブロックアドレスインクリメント符号を出力する第1の処理と、前記フレーム間符号化データ及び該フレーム間符号化データの前にスキップするマクロブロック数を示すマクロブロックアドレスインクリメント符号を出力する第2の処理と、前記符号化データを出力しない第3の処理とを選択する選択工程とを有し、前記選択工程では、前記比較工程での比較結果に応じて、データ差が第1所定値より大きい場合に前記第1の処理を選択し、前記データ差が前記第1所定値以下で第2所定値より大きい場合に前記第2の処理を選択し、前記データ差が前記第2所定値以下の場合に前記第3の処理を選択することを特徴とする。
【0022】
【実施例】
以下、本発明の第1の実施例による画像符号化データ変換装置を図面を参照しながら説明する。図1は、本発明の一実施例による画像符号化データ変換装置の構成を示すブロック図である。
【0023】
以下の説明では、フレーム内符号化データを、JPEG方式で符号化されたMotionJPEGデータとし、フレーム間相関を用いた符号化データを、MPEG方式で符号化したデータとする。
【0024】
図1において、1は、MotionJPEGデータを格納する記憶装置であり、2は、JPEG方式の復号化を行うJPEG復号器である。3は、動画像のフレーム画像を格納するフレームメモリである。4は、フレームメモリ3に格納された画像データを表示するディスプレイである。5は、MotionJPEGデータをMPEG方式で符号化したデータに変換するデータ変換部である。6は、装置外部との通信を制御する通信インターフェースである。7は、コンピュータネットワークや公衆回線(例えばISDN回線)で構成される通信回線である。8は、MPEG方式で符号化されたMPEGデータを格納する記憶装置である。9は、装置全体を制御統括するCPUである。10は、ユーザが動画像表示の要求や指定をする入力装置である。
【0025】
JPEGデータのMPEGデータへの変換は以下の手順で行われる。すなわち、MotionJPEGデータは、記憶装置1からデータ変換部5に入力される。データ変換部5は、入力されたMotionJPEGデータをMPEGデータに変換する。
【0026】
図2にデータ変換部5のブロック図を示す。同図において、101は、MPEG方式の符号化単位分のMotionJPEGデータを格納するコードバッファである。ここで、MPEG方式の符号化単位をMPEG方式のマクロブロックとする。なお、マクロブロックは、左右及び上下に隣合った4つの輝度ブロックY0 、Y1 、Y2 、Y3 と画像上では同じ位置にあたる2つの色差ブロックCb、Crとの全部で6つのブロックで構成される。102は、1フレーム分のMotionJPEGデータを格納するコードメモリである。103は、MotionJPEGデータを入力してDCT係数を復号する復号器である。104、105、106は、量子化係数を格納するラッチである。107、108は、MPEG方式の1マクロブロック分の復号化されたDCT係数を格納するラッチである。
【0027】
109は、ブロック単位でDCT係数の絶対値差分を求め、各差分値をあらかじめ設定した閾値と比較して判定結果を出力する差分比較器である。110は、復号データからMPEGデータを生成する符号化器である。111は、MotionJPEGデータの符号化データをMPEGデータに変換するデータ変換器である。112は、差分比較器109の出力を元にMPEGデータを生成する符号化器である。113は、MPEGヘッダデータを生成する符号化器である。114は、差分比較器109の出力結果に基づき入力を選択して出力するセレクタである。115は、セレクタ114の出力を格納しておくコードバッファである。116は、MotionJPEGデータの各ヘッダデータを解析するヘッダ解析器である。117は、差分出力器109の出力を1マクロブロック分格納するラッチである。
【0028】
ここで、説明を容易にするために入力されるMotionJPEGデータは4:1:1のサブサンプリング比であるとする。また、MPEG方式のGOP(Group of Picture)の構成をフレーム内符号化(Intra )フレーム(以下Iフレームと略す)と時間的に前のフレームを参照する動き補償符号化(Predictive)フレーム(以下Pフレームと略す)とで構成されるものとする。
【0029】
MPEG方式のGOPの構成は、IフレームとPフレームとで構成されるものとし、1GOPの構成を15フレームとし、各フレームの符号化モードを、
I、P、P、P、P、P、P、P、P、P、P、P、P、P、P
とする。
【0030】
以下、図2における各構成部の動作について詳細に述べる。
まず、MotionJPEGデータからMPEGデータへの変換に先立ち、図1のCPU9によって図2に示す各構成部の初期化が実施される。
【0031】
次に、MotionJPEGデータの最初のフレームのヘッダデータが、コードバッファ101を経由してヘッダ解析器116に入力される。ヘッダ解析器116は、MotionJPEGデータのヘッダデータを解析し、画像サイズ等の画像の属性を得る。この結果は、符号化器113に入力される。符号化器113は、これらの属性と併せてCPU9から動画像としての属性、フレームレートや符号化レート等が入力され、これらに基づいてMPEGヘッダデータを生成する。生成されたMPEGヘッダデータは、セレクタ114を介してコードバッファ115に出力する。ここで生成されるMPEGヘッダデータは、シーケンススタートコード(SSC)で始まるシーケンスヘッダデータやGOPスタートコード(GSC)で始まるGOPヘッダデータなどから成る。また、ヘッダ解析器116はJPEG方式で用いた量子化テーブルから予め決められたデフォルト量子化テーブルを用いて量子化係数Q1を求める。求められた量子化係数Q1はラッチ105に入力される。デフォルト量子化テーブルは符号化して上記シーケンスヘッダデータに入れる。
【0032】
以下に、MotionJPEGデータからIフレームのMPEGデータへの変換について述べる。フレーム内符号化に先立ち、CPU9は、MPEG方式における符号化制御のために量子化係数Q2をラッチ106に格納する。また、符号化器113でフレームのヘッダデータ(ピクチャヘッダ)を生成する。ここで、符号化したフレームがIフレームであることが示されている。
【0033】
MPEG方式の符号化単位分のMotionJPEGデータが順に図1の記憶装置1から読み出され、コードバッファ101に入力される。フレーム内の位置関係は、JPEG符号化方式のマクロブロックとMPEG符号化方式のマクロブロックとは一致する。従って、1マクロブロックには輝度ブロックが4ブロックと色差ブロックが2ブロック含まれる。コードバッファ101に格納されたMotionJPEGデータは、コードメモリ102とデータ変換器111に入力される。コードメモリ102は、FIFOメモリ等で構成される。
【0034】
続いて、マクロブロックデータの処理を行う。もし、入力されたマクロブロックのデータがフレームの左端であれば、符号化器113は、スライスヘッダを生成し、セレクタ114を介してコードバッファ115に出力し格納する。スライスヘッダを生成する時に量子化係数Q2をラッチ106から読み出し、符号化してスライスヘッダに入れる。
【0035】
データ変換器111のブロック図を図3に示す。150は、量子化係数Q1、Q2を入力し、量子化倍数P1を求める演算器である。151は、入力された符号化データを選択信号に従って出力先を変えるセレクタである。152は、ROM等で構成されるマクロブロックヘッダ生成器である。153は、符号化データ等をアドレスとするROM等で構成される、DCT係数の直流成分の符号化データを変換するDC変換器である。154は、符号化データ等をアドレスとするROM等で構成される、DCT係数の交流成分の符号化データを変換するAC変換器である。155は、選択信号に従って、入力先を変えるセレクタである。
【0036】
最初に、データ変換器111は、マクロブロックのヘッダデータを出力する。このヘッダデータは、符号化するマクロブロックがフレーム内符号化すなわち Intraモードで符号化されることを表すヘッダデータである。CPU9は、セレクタ155の入力にマクロブロックヘッダ生成器152の出力を選択させ、マクロブロックヘッダデータをマクロブロックヘッダ生成器152から読み出し、出力する。
【0037】
続いて、データ変換器111は、ブロック単位でJPEGデータを入力する他にラッチ105とラッチ106から量子化係数Q1、Q2を入力する。最初に、ラッチ105から入力された量子化係数Q1とラッチ106から入力された量子化係数Q2とから量子化倍数P1を演算器150で、次式に従って求める。
P1=Q2/Q1 …… (1)
【0038】
続いて、各ブロックの処理を行う。
JPEGデータにおけるブロック単位の符号化データはDCT直流成分のDPCM結果と交流成分の量子化された結果と0ラン長のハフマン符号とで構成される。
【0039】
まず、直流成分の符号の変換について述べる。サブサンプリング比が4:1:1のJPEG方式とMPEG方式では同じ順でZ字でDPCMがかかる。従って、量子化倍数P1を用いて直流成分の変換を行う。例えば、入力された輝度成分の差分値D1が33であった場合、そのハフマン符号は“1110100001”である。ここで量子化倍数P1が3であれば、出力する差分値D2は、
D2=D1/P1 …… (2)
で求められる。
【0040】
この場合の差分値D2は11であり、従って、このハフマン符号は“1011011”と変換される。実際には、予めDC変換器153に量子化倍数P1の値とハフマン符号をアドレスとして変換結果を格納しておき、DC変換器153のROMから読み出して変換を行う。
【0041】
次に、交流成分の符号の変換について述べる。例えば、輝度成分のハフマン符号“11111111100010011000”は、0ラン長が2で量子化結果R1が16であることを示す。量子化倍数P1が3であれば出力する量子化結果R2は、
R2=R1/P1 …… (3)
から5となり、0ラン長が2で量子化結果が5を表すハフマン符号“1111110111101”に変換される。
【0042】
実際には、予めAC変換器154に量子化倍数P1の値とハフマン符号をアドレスとして変換結果を格納しておき、AC変換器154のLUTとしてのROMから読み出して変換を行う。
このように変換して得られたMPEGデータは、コードバッファ115に格納される。
【0043】
以下、マクロブロック単位の処理を行い、1フレームの処理が終了したら、コードバッファ115の内容を送出し、図1の記憶装置8に格納したり、通信インターフェース6を介して通信回線7に出力したりする。また、送出した符号長をCPU9に通報する。その後、コードバッファ115をクリアする。
【0044】
以上述べたように、本実施例によれば、MotionJPEGデータをIフレームのMPEGデータへ変換する場合に、従来のようにMotionJPEGデータを復号化して画像データに戻すことなく、MotionJPEGデータと量子化係数とから一次変換によって直接MPEGデータへ変換を行っているので、変換時間の短縮化が可能になる。
【0045】
次に、MotionJPEGデータからPフレームのMPEGデータへの変換について述べる。
動き補償符号化に先立ち、CPU9は、前フレームにかかった符号長から符号化制御のための量子化係数Q2を求め、ラッチ106に格納する。また、ラッチ105の量子化係数Q1′をラッチ104に移動させる。そして、JPEG方式で用いた量子化テーブルから予め決められたデフォルト量子化テーブルを用いて量子化係数Q1を求める。求められた量子化係数Q1はラッチ105に入力される。符号化器113でフレームのピクチャヘッダを生成する。ここで、符号化したフレームがPフレームであることが示されている。
【0046】
1マクロブロック分のMotionJPEGデータが順に記憶装置1から読み出され、コードバッファ101に入力される。コードバッファ101に格納されたJPEGデータは、コードメモリ102、復号器103、データ変換器111に入力される。そして、復号器103に入力されたJPEGデータを復号し、ラッチ105の量子化係数Q1を用いて各ブロック毎にDCT係数の直流成分と交流成分を生成し、ラッチ107に格納する。続いて、コードメモリ102から前フレームの同一位置のマクロブロックのJPEGデータを読み出し、復号器103でJPEGデータを復号してラッチ104の量子化係数Q1′を用いて各ブロック毎にDCT係数の直流成分と交流成分を生成し、ラッチ108に格納する。
【0047】
その後、差分比較器109は、ラッチ107とラッチ108とから各ブロック毎にDCT係数を読み出し、各DCT係数毎に差分を求めて絶対値を加算する。各ブロックの加算値A1からA6を求めた後、もし、全ての加算値が0であり、ラッチ117の内容が“10”または“00”であれば、比較差分器109はコード“10”を生成する。
【0048】
それ以外の場合、加算値A1からA6と予め決定された閾値T1とを比較し、全ての加算値で、
T1>Ai≧0 (i=1〜6)… (4)
であれば、差分比較器109はコード“00”を生成する。
また、1つでも(4)式の条件を満たさない場合はコード“01”を生成する。生成したコードは、セレクタ114に出力される。
【0049】
同時に、符号化器110は、マクロブロックのヘッダデータを生成する。すなわち、動きベクトルを(0、0)として動きベクトルの符号を生成する。また、符号化器110は、符号化するマクロブロックが動き補償符号化、すなわちPredictiveモードで符号化されることを表すヘッダデータを生成し、動きベクトル符号を挿入しておく。
【0050】
符号化器110は、ラッチ107から符号化するマクロブロックのDCT係数を読み込むとともに、ラッチ108から符号化するマクロブロックと前フレームの同一位置のマクロブロックのDCT係数を読み込み、ラッチ106から量子化係数Q2を読み込む。そして、符号化器110は、ラッチ107のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。続いて、ラッチ108のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。その後、各画素値の差分を求める。求めた差分値にDCT変換を施し、量子化係数Q2で量子化し、量子化結果を得る。直流成分に関しては、直前のマクロブロックの差分比較器109の出力コードが“00”であれば続いてDPCMし、そうでなければ新たにDPCMを初期化して始める。交流成分の量子化結果はMPEG方式に従って符号を割り当てておく。
【0052】
差分比較器109の出力コードが“00”であった場合、ラッチ117の内容が“10”であれば、セレクタ114は符号化器112の内容を出力した後、符号化器110の出力を入力してコードバッファ115に出力し、格納する。
【0053】
差分比較器109の出力コードが“01”であった場合、ラッチ117の内容が“10”であれば、セレクタ114は符号化器112の内容を出力した後、セレクタ114はデータ変換器111の出力を入力してコードバッファ115に出力し、格納する。
【0054】
差分比較器109の出力コードが“10”であった場合、その結果は符号化器112に入力される。このコードが発生したときは、MPEG符号化データは生成されず、符号化器112では連続して発生したコード“10”の回数をカウントし、その数を表現する符号(マクロブロックアドレスインクリメント符号)を生成する。
【0055】
マクロブロックの処理が終了したら、ラッチ107の内容を差分比較器109の出力に置き換える。
【0056】
以下、マクロブロック単位の処理を行い、1フレームの処理が終了したら、コードバッファ115の内容を送出し、図1の記憶装置8に格納したり、通信インターフェース6を介して通信回線7に出力したりする。また、送出した符号長をCPU9に通報する。その後、コードバッファ115をクリアする。
【0057】
以下、各フレームを予め決められた順にIフレームまたはPフレームとして符号化し、所望のフレーム数のMPEGデータを得る。その後、MPEG方式で決められたシーケンスエンドコード等の終了符号を符号化器113で生成し、セレクタ114を介してコードバッファ115を経て送出し、全ての動作を終了する。
【0058】
以上説明したように、本実施例によれば、フレーム内符号化のみで符号化された動画から動き補償符号化を用いる符号化データへの変換に際して、回路規模が大きく、処理に時間がかかる動きベクトル探索をすることなく、符号化データの変換が瞬時に行える効果がある。
【0059】
また、MPEG方式で符号化する際に参照フレームを格納しておく作業用のフレームメモリが不要であり、装置全体のコストを下げる効果がある。
【0060】
さらに、処理に時間がかかる直交変換を省略できるので処理時間を短縮できる効果がある。また、符号化データの変換をLUTで行うことにより、高速な変換が可能となる。
【0061】
なお、本実施例ではMPEG符号化方式を例にとって説明したが、H.261符号化方式であっても本実施例の構成をH.261の符号に適したものに置き換えることによって本発明を適用できる。
【0062】
次に、本発明の第2の実施例による画像符号化データ変換装置を図面を参照しながら説明する。
図4は、MotionJPEGデータを両方向動き補償符号化(Bidirectionaj Predictive)フレーム(以下、Bフレームと略す)を導入したMPEGデータに変換する場合の図1に示すデータ変換部5のブロック図である。
【0063】
データ変換部5は、入力されたMotionJPEGデータをMPEGデータに変換する。すなわち、図4において、201は、MPEG方式の1マクロブロック分のMotionJPEGデータを格納するコードバッファである。202、203は、1フレーム分のMotionJPEGデータを格納するコードメモリである。204、205、206は、MotionJPEGデータを入力してDCT係数に復号する復号器である。207は、MotionJPEGデータの各ヘッダデータを解析するヘッダ解析器である。208、209、210、211は、量子化係数を格納するラッチである。212、213、214は、マクロブロック分の復号化されたDCT係数を格納するラッチである。
【0064】
215は、ブロック単位でDCT係数の絶対値差分を求め、各差分値をあらかじめ設定した閾値と比較して判定結果を出力する差分比較器である。216は、差分比較器215の出力を1マクロブロック分格納するラッチである。217、218、219は、復号データからMPEGデータを生成する符号化器である。220は、JPEGデータの符号化データをMPEGデータに変換するデータ変換器である。221は、MPEGヘッダデータを生成する符号化器である。222は、差分比較器215の出力を元にMPEGデータを生成する符号化器である。223は、差分比較器215の出力結果に基づき入力を選択して出力するセレクタである。224は、セレクタ223の出力を格納しておくコードバッファである。
【0065】
ここで、説明を容易にするために入力されるMotionJPEGデータは4:1:1のサブサンプリング比であるとする。また、MPEG方式のGOPの構成は、1フレームとPフレームとBフレームで構成されるものとし、1GOPの構成を15フレームとし、各フレームの符号化モードを、
I、B、B、P、B、B、P、B、B、P、B、B、P、B、B
とする。
【0066】
以下、図4の各構成部の動作について詳細に述べる。
まず、MotionJPEGデータからMPEGデータへの変換に先立ち、CPU9によって図4の各構成部の初期化が実施される。
【0067】
次に、MotionJPEGデータの最初のフレームのヘッダデータが、コードバッファ201を経由してヘッダ解析器207に入力される。ヘッダ解析器207は、MotionJPEGデータのヘッダデータを解析し、画像サイズ等の画像の属性を得る。この結果は符号化器221に入力される。符号化器221は、これらの属性と併せてCPU9から動画像としての属性、フレームレートや符号化レート等が入力され、MPEGヘッダデータを生成し、セレクタ223を介してコードバッファ224に出力する。ここで生成されるヘッダデータは、シーケンススタートコードで始まるシーケンスヘッダとGOPスタートコードで始まるGOPヘッダデータである。また、JPEG方式で用いた量子化テーブルから予め決められたデフォルト量子化テーブルを用いて量子化係数Q3を求める。求められた量子化係数Q3はラッチ208に入力される。デフォルト量子化テーブルは、符号化してシーケンスヘッダデータに入れる。
【0068】
以下に、MotionJPEGデータからIフレームのMPEGデータへの変換について述べる。フレーム内符号化に先立ち、CPU9は、符号制御のために量子化係数Q4をラッチ211に格納する。また、符号化器221でピクチャヘッダを生成する。ここで、符号化したフレームがIフレームであることが示されている。
【0069】
まず、1マクロブロック分のMotionJPEGデータが順に記憶装置1から読み出され、コードバッファ201に入力される。コードバッファ201に格納されたJPEGデータは、コードメモリ202とデータ変換器220に入力される。入力されたJPEGデータは、コードメモリ202に格納される。同様に、コードメモリ202から入力されたのと同一位置のマクロブロックのMotionJPEGデータがコードメモリ203に格納される。コードメモリ202、203は、FIFOメモリで構成される。データ変換器220の構成は、第1の実施例のデータ変換器111と同様にLUTで構成されている。
【0070】
続いて、マクロブロックデータの処理を行う。もし、入力されたマクロブロックのデータがフレームの左端であれば、符号化器221はスライスヘッダを生成し、セレクタ223を介してコードバッファ224に出力し、格納する。また、スライスヘッダを生成する時に量子化係数Q4をラッチ211から読み出し、符号化してスライスヘッダに入れる。
【0071】
データ変換器220は、マクロブロックのヘッダデータを生成する。すなわち、データ変換器220は、Intra モードで符号化されたマクロブロックであることを表すヘッダデータを生成する。
【0072】
また、データ変換器220は、ブロック単位でJPEGデータを入力する他にラッチ208とラッチ211とから量子化係数Q3、Q4を入力する。最初にラッチ208から入力された量子化係数Q3とラッチ211から入力された量子化係数Q4とから量子化倍数P2を次式に従って求める。
P2=Q4/Q3 ……(5)
【0073】
続いて、各ブロックの処理を行う。
まず、直流成分の符号の変換について述べる。この場合、量子化倍数P2を用いて直流成分の変換を行う。例えば、入力された輝度成分の差分値D3が33であった場合、量子化倍数Pが1.5であれば、出力する差分値D4は、
【0074】
D4=D3/P2 ……(6)
で求められ、この場合の差分値D4は22である。従って、このハフマン符号は“11010110”と変換される。
【0075】
次に、交流成分の符号の変換について述べる。例えば、輝度成分のハフマン符号“11111111100010011000”は0ラン長が2で量子化結果R3が16であることを示す。量子化倍数P2が1.5であれば出力する量子化結果R4は、
R4=R3/P2 ……(7)
から10.6となり、四捨五入して0ラン長が2で量子化結果が11を表すハフマン符号“1111111101001011”に変換される。
【0076】
これらの変換は、ROM等で構成されるLUT(Look Up Table )を参照することによって行う。
このように変換して得られたMPEGデータは、コードバッファ224に格納される。
【0077】
以下、マクロブロック単位の処理を行い、1フレームの処理が終了したら、コードバッファ224の内容を送出し、図1の記憶装置8に格納したり、通信インターフェース6を介して通信回線7に出力したりする。また、送出した符号長をCPU9に通報する。その後、コードバッファ224をクリアする。
【0078】
次に、MotionJPEGデータからPフレームのMPEGデータへの変換について述べる。
Pフレームの符号化に先立ち、CPU9は、前フレームにかかった符号長から符号化制御のための量子化係数Q4を求め、ラッチ211に格納する。また、ラッチ209の量子化係数Q3′′をラッチ210に移動させるとともにラッチ208の量子化係数Q3′をラッチ209に移動させる。そして、JPEG方式で用いた量子化テーブルから予め決められたデフォルト量子化テーブルを用いて量子化係数Q3を求める。求められた量子化係数Q3はラッチ208に入力される。符号化器221でフレームのピクチャヘッダを生成する。ここで、符号化したフレームがPフレームであることが示されている。
【0079】
1マクロブロック分の Motion JPEGデータが順に記憶装置1から読み出され、コードバッファ201に入力される。コードバッファ201に格納されたJPEGデータはコードメモリ202、復号器204、データ変換器220に入力される。復号器204は、入力されたJPEGデータを復号し、ラッチ208の量子化係数Q3を用いて各ブロック毎にDCT係数の直流成分と交流成分を生成し、ラッチ212に格納する。同時に、コードメモリ202から前のIフレームまたはPフレームの同一位置のマクロブロックのJPEGデータを読み出し、復号器205で復号してラッチ209の量子化係数Q3′を用いて各ブロック毎にDCT係数の直流成分と交流成分を生成し、ラッチ213に格納する。また、読み出したJPEGデータはコードメモリ203にも入力される。
【0080】
その後、差分比較器215は、ラッチ212とラッチ213から各ブロック毎にDCT係数を読み出し、各DCT係数毎に差分を求めて絶対値を加算する。各ブロックの加算値A1からA6を求めた後、もし、全ての加算値が0であり、ラッチ216の内容が“110”または“000”であれば、比較差分器215はコード“110”を生成する。
【0081】
それ以外の場合、加算値A1からA6と予め決定された閾値T2と比較し、全ての加算値で、
T2>Ai≧0 (i=1〜6)……(8)
であれば、差分比較器215は、コード“000”を生成する。
【0082】
また、1つでも(8)式の条件を満たさない場合は、コード“100”を生成する。生成したコードは、セレクタ223に出力される。
【0083】
これと並行して、符号化器217とデータ変換器220が以下の動作を実行する。符号化器221は、マクロブロックのヘッダデータを生成する。すなわち、動きベクトルを(0、0)として動きベクトルの符号を生成する。また、符号化器221は、符号化するマクロブロックが Predictive モードで符号化されることを表すヘッダデータを生成し、動きベクトル符号を挿入しておく。
【0084】
符号化器217はまず、ラッチ212から符号化するマクロブロックのDCT係数を読み込むとともに、ラッチ214から符号化するマクロブロックと前のIフレームまたはPフレームの同一位置のマクロブロックのDCT係数を読み込み、ラッチ211から量子化係数Q4を読み込む。そして、ラッチ212のマクロブロックの各ブロックDCT係数を逆DCT変換して画素値を再生する。続いて、ラッチ214のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。その後、各画素値の差分を求め、求めた差分値にDCT変換を施し、量子化係数Q4で量子化し、量子化結果を得る。直流成分に関しては、直前のマクロブロックの差分比較器215の出力コードが“000”であれば続いてDPCMし、そうでなければ新たにDPCMを初期化して始める。交流成分の量子化結果は、MPEG方式に従って符号を割り当てておく。
【0085】
データ変化器220に入力されたJPEGデータはIntra フレームのマクロブロックと同様にJPEGデータからMPEGデータへと変換される。
【0086】
差分比較器215の出力コードが“000”であった場合、ラッチ216の内容が“110”であれば、セレクタ223は符号化器222の内容を出力した後、符号化器218の出力を入力してコードバッファ224に出力し、格納する。
【0087】
差分比較器215の出力コードが“100”であった場合、ラッチ216の内容が“110”であれば、セレクタ223は符号化器222の内容を出力した後、セレクタ223はデータ変換器220の出力を入力してコードバッファ224に出力し、格納する。
【0088】
差分比較器215の出力コードが“110”であった場合、その結果は符号化器222に入力される。このコードが発生したときは、MPEG符号化データは生成されず、符号化器222では連続して発生したコード“110”の回数をカウントし、マクロブロックアドレスインクリメント符号を生成する。
【0089】
マクロブロックの処理が終了したら、ラッチ216の内容を差分比較器215の出力に置き換える。
【0090】
以下、マクロブロック単位の処理を行い、1フレームの処理が終了したら、コードバッファ224の内容を送出し、図1の記憶装置8に格納したり、通信インターフェース6を介して通信回線7に出力したりする。また、送出した符号長をCPU9に通報する。その後、コードバッファ224をクリアする。
【0091】
最後に、MotionJPEGデータからBフレームのMPEGデータへの変換について述べる。
Bフレームの符号化に先立ち、CPU9は、前フレームにかかった符号長から符号化制御のための量子化係数Q4を求め、ラッチ211に格納する。また、ラッチ209の量子化係数Q3′′をラッチ210に移動させるとともにラッチ208の量子化係数Q3′をラッチ209に移動させる。そして、JPEG方式で用いた量子化テーブルから予め決められたデフォルト量子化テーブルを用いて量子化係数Q3を求める。求められた量子化係数Q3はラッチ208に入力される。また、符号化器221でフレームのピクチャヘッダを生成する。ここで、符号化したフレームがBフレームであることが示されている。
【0092】
1マクロブロック分のMotionJPEGデータが順に記憶装置1から読み出され、コードバッファ201に入力される。コードバッファ201に格納されたJPEGデータは、復号器204、データ変換器220に入力される。復号器204は、入力されたJPEGデータを復号し、ラッチ208の量子化係数Q3を用いて各ブロック毎にDCT係数の直流成分と交流成分を生成し、ラッチ212に格納する。同時に、コードメモリ202から後のIフレームまたはPフレームの同一位置のマクロブロックのJPEGデータを読み出し、コードメモリ203から前のIフレームまたはPフレームの同一位置のマクロブロックのJPEGデータを読み出す。コードメモリ202から読み出されたJPEGデータは、復号器205で復号してラッチ209の量子化係数Q3′を用いて各ブロック毎にDCTの直流成分と交流成分を生成し、ラッチ213に格納する。コードメモリ203から読み出されたJPEGデータは、復号器206で復号してラッチ210の量子化係数Q3′′を用いて各ブロック毎にDCTの直流成分と交流成分を生成し、ラッチ214に格納する。
【0093】
その後、差分比較器215は、ラッチ212、213、214から各ブロック毎にDCT係数を読み出し、各DCT係数毎に差分を求めて絶対値を加算する。すなわち、差分比較器215は、ラッチ212とラッチ213の各ブロックのDCT係数毎の差分の絶対値の加算値BA1からBA6を求める。また、ラッチ212とラッチ214の各ブロックのDCT係数毎の差分の絶対値の加算値FA1からFA6を求める。さらに、ラッチ213と214の各ブロックのDCT係数毎の平均値を求め、ラッチ212の各係数との差分の絶対値の加算値MA1からMA6を求める。
【0094】
もし、加算値FA1〜6の全ての加算値が0であった場合、ラッチ216の内容が“101”または“000”であれば、比較差分器215はコード“101”を生成する。
また、加算値BA1〜6の全ての加算値が0であった場合、ラッチ216の内容が“110”または“001”であれば、比較差分器215はコード“110”を生成する。
また、加算値MA1〜6の全ての加算値が0であった場合、ラッチ216の内容が“111”または“010”であれば、比較差分器215はコード“111”を生成する。
【0095】
それ以外の場合、加算値FA1〜6を全て加えた加算値FA、加算値BA1〜6を全て加えた加算値BA、加算値MA1〜6を全て加えた加算値MAの内、最小値SAを選択する。すなわち、最小値SAは、
SA=min(FA、BA、MA) …… (9)
と表される。
【0096】
その後、最小値SAと予め決定された閾値T5と比較し、最小値SAが、
T5>SA …… (10)
であって、加算値FAが最小であれば、差分比較器215はコード“000”を生成する。加算値BAが最小であれば、差分比較器215はコード“001”を生成する。加算値MAが最小であれば、差分比較器215はコード“010”を生成する。
【0097】
また、1つも(10)式の条件を満たさない場合は、差分比較器215はコード“011”を生成する。生成したコードは、セレクタ223に出力される。
【0098】
同時に、符号化器217、符号化器218、符号化器219、データ変換器220、符号化器221が、以下の動作を実行する。
【0099】
まず、符号化器221は、マクロブロックのヘッダデータを生成する。すなわち、時間的に前のフレームからの動きベクトルを(0、0)として動きベクトルの符号を生成する。この時、符号化器221は、符号化するマクロブロックがForward Predictiveモードで符号化されることを表すヘッダデータを生成し、動きベクトル符号を挿入しておく。
【0100】
そして、符号化器217はまず、ラッチ212から符号化するマクロブロックのDCT係数を、ラッチ214から符号化するマクロブロックと時間的に前のIフレームまたはPフレームの同一位置のマクロブロックのDCT係数を、ラッチ211から量子化係数Q4を読み込む。符号化器217はさらに、ラッチ212のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。続いて、ラッチ214のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。その後、各画素値の差分を求め、求めた差分値にDCT変換を施し、量子化係数Q4で量子化し、量子化結果を得る。直流成分に関しては、直前のマクロブロックの差分比較器215の出力コードが“000”であれば、続いてDPCMし、そうでなければ新たにDPCMを初期化して始める。交流成分の量子化結果は、MPEG方式に従って符号を割り当てておく。
【0101】
また、符号化器221は、マクロブロックのヘッダデータを生成する。すなわち、時間的に後のフレームからの動きベクトルを(0、0)として動きブクトルの符号を生成する。この時、符号化器221は、符号化するマクロブロックがBackword Predictive モードで符号化されることを表すヘッダデータを生成し、動きベクトル符号を挿入しておく。
【0102】
そして、符号化器218はまず、ラッチ212から符号化するマクロブロックのDCT係数を読み込むとともに、ラッチ213から符号化するマクロブロックと時間的に後のIフレームまたはPフレームの同一位置のマクロブロックのDCT係数を読み込み、ラッチ211から量子化係数Q4を読み込む。符号化器218はさらに、ラッチ212のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。続いて、ラッチ213のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。その後、各画素値の差分を求め、求めた差分値にDCT変換を施し、量子化係数Q4で量子化し、量子化結果を得る。直流成分に関しては、直前のマクロブロックの差分比較器215の出力コードが“001”であれば、続いてDPCMし、そうでなければ新たにDPCMを初期化して始める。交流成分の量子化結果は、MPEG方式に従って符号を割り当てておく。
【0103】
さらに、符号化器221は、マクロブロックのヘッダデータを生成する。すなわち、時間的に前後のフレームからの各動きベクトルを(0、0)として動きベクトルの符号を生成する。この時、符号化器221は、符号化するマクロブロックがBidirectional Predictiveモードで符号化されることを表すヘッダデータを生成し、両動きベクトル符号を挿入しておく。
【0104】
そして、符号化器219はまず、ラッチ212から符号化するマクロブロックのDCT係数を読み込むとともに、ラッチ213から符号化するマクロブロックと時間的に後のIフレームまたはPフレームの同一位置のマクロブロックのDCT係数を読み込み、ラッチ214から符号化するマクロブロックと時間的に前のIフレームまたはPフレームの同一位置のマクロブロックのDCT係数を読み込み、ラッチ211から量子化係数Q4を読み込む。符号化器219はさらに、ラッチ213のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生し、ラッチ214のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。各画素値で平均を求めておく。続いて、ラッチ212のマクロブロックの各ブロックのDCT係数を逆DCT変換して画素値を再生する。その後、画素毎に画素値と平均値の差分を求め、求めた差分値にDCT変換を施し、量子化係数Q4で量子化し、量子化結果を得る。直流成分に関しては、直前のマクロブロックの差分比較器215の出力コードが“010”であれば続いてDPCMし、そうでなければ新たにDPCMを初期化して始める。交流成分の量子化結果は、MPEG方式に従って符号を割り当てておく。
【0105】
データ変換器220に入力されたJPEGデータは、Intra フレームのマクロブロックと同様にJPEGデータからMPEGデータへと変換される。
【0106】
差分比較器215の出力コードが“000”であった場合、ラッチ216の内容が“101”または“110”または“111”であれば、セレクタ223は符号化器222の内容を出力した後、符号化器217の出力を入力してコードバッファ224に出力し、格納する。
【0107】
差分比較器215の出力コードが“001”であった場合、ラッチ216の内容が“101”または“110”または“111”であれば、セレクタ223は符号化器222の内容を出力した後、符号化器218の出力を入力してコードバッファ224に出力し、格納する。
【0108】
差分比較器215の出力コードが“010”であった場合、ラッチ216の内容が“101”または“110”または“111”であれば、セレクタ223は符号化器222の内容を出力した後、符号化器219の出力を入力してコードバッファ224に出力し、格納する。
【0109】
差分比較器215の出力コードが“011”であった場合、ラッチ216の内容が“101”または“110”または“111”であれば、セレクタ223は符号化器222の内容を出力した後、セレクタ223はデータ変換器220の出力を入力してコードバッファ224に出力し、格納する。
【0110】
差分比較器215の出力コードが“101”であった場合、その結果は符号化器222に入力される。このコードが発生したときは、MPEG符号化データは生成されず、符号化器222では連続して発生したコード“101”の回数をカウントし、マクロブロックアドレスインクリメント符号を生成する。
【0111】
差分比較器215の出力コードが“110”であった場合、その結果は符号化器222に入力される。このコードが発生したときは、MPEG符号化データは生成されず、符号化器222では連続して発生したコード“110”の回数をカウントし、マクロブロックアドレスインクリメント符号を生成する。
【0112】
差分比較器215の出力コードが“111”であった場合、その結果は符号化器222に入力される。このコードが発生したときは、MPEG符号化データは生成されず、符号化器222では連続して発生したコード“111”の回数をカウントし、マクロブロックアドレスインクリメント符号を生成する。
【0113】
マクロブロックの処理が終了したら、ラッチ216の内容を差分比較器215の出力に置き換える。
【0114】
以下、マクロブロック単位の処理を行い、1フレームの処理が終了したら、コードバッファ224の内容を送出し、図1の記憶装置8に格納したり、通信インターフェス6を介して通信回線7に出力したりする。また、送出した符号長をCPU9に通報する。その後、コードバッファ224をクリアする。
【0115】
以下、各フレームを予め決められた順にIフレームまたはPフレームとして符号化し、所望のフレーム数のMPEGデータを得る。その後、MPEG方式で決められたシーケンスエンドコード等の終了符号を符号化器221で生成し、セレクタ223を介してコードバッファ224を経て送出し、全ての動作を終了する。
【0116】
次に、本発明の第3の実施例による画像符号化データ変換装置について図5を参照しながら説明する。
本発明の第3の実施例は、演算装置でソフトウェアを用いてデータ処理する場合を示したもので、図5は、本発明の第3の実施例による画像符号化データ変換装置の構成を示すブロック図であり、図6〜図14は、本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。なお、図5において、図1と同一の構成のものには同一の符号を付して説明を省略した。
【0117】
図5で、301は、装置全体を制御統括し、MotionJPEGデータをMPEGデータに変換するCPUである。302は、データ処理をするためのソフトウェアを格納しておくプログラムメモリであり、303は、処理をするための作業領域を確保するための作業メモリである。
【0118】
説明を容易にするため、入力されるMotionJPEGデータは4:1:1のサブサンプリング比であるとする。また、MPEG方式のGOPは、IフレームとPフレームとで構成されるものとする。
【0119】
まず、図6のステップS01に示すように、CPU301は、プログラムメモリ302からMotionJPEGデータ/MPEGデータ変換のためのプログラムを読み込み、実行を開始する。
【0120】
次に、ステップS02に示すように、量子化倍数P3の値と直流成分のハフマン符号とをアドレスとする変換結果のLUT(直流成分変換LUT)を作業メモリ303に格納する。
【0121】
次に、ステップS03に示すように、量子化倍数P3の値と交流成分のハフマン符号とをアドレスとする変換結果のLUT(交流成分変換LUT)を作業メモリ303に格納する。
【0122】
次に、ステップS04に示すように、MotionJPEGデータのフレームのヘッダデータを読み込み、JPEGデータのヘッダデータを解析し、画像サイズ等の画像の属性を得る。
【0123】
次に、ステップS05に示すように、各属性、デフォルト量子化テーブルと併せて動画像としての属性を加え、MPEGデータのシーケンスヘッダとGOPヘッダデータを生成し、出力する。
【0124】
以下に、Iフレームの変換について述べる。
まず、ステップS09に示すように、生成するフレームがIフレームかPフレームかを判定し、Iフレームを生成する場合はステップS10に移る。
【0125】
次に、ステップS10に示すように、JPEG符号化データの量子化テーブルから、JPEG方式デフォルト量子化テーブルを用いて量子化係数Q8を求める。
【0126】
次に、ステップS11に示すように、MPEG方式における符号化制御のために量子化係数Q9を決定する。
【0127】
次に、図7のステップS12に示すように、Iフレームであることを示すピクチャヘッダを生成する。
【0128】
次に、ステップS14に示すように、1マクロブロック分のMotionJPEGデータが順に記憶装置1から読み出される。読み出されたMotionJPEGデータは、マクロブロック単位で作業メモリ303に格納される。
【0129】
もし、ステップS15に示すように、入力されたマクロブロックのデータがフレームの左端であれば、ステップS16に示すように、量子化係数Q9を読み出し、スライスヘッダを生成し、出力する。
【0130】
次に、ステップS17に示すように、マクロブロックの処理に先立ち、Intra モードで符号化することを表すマクロブロックのヘッダデータを生成し、出力する。
【0131】
次に、ステップS18に示すように、ブロック単位でJPEGデータを処理する。量子化係数Q8と量子化係数Q9とから量子化倍数P3を次式に従って求める。
P3=Q8/Q9…(11)
【0132】
次に、図8のステップS20に示すように、量子化倍数P3とハフマン符号から作業メモリ303の直流成分変換LUTを参照して、直流成分におけるJPEGデータからMPEGデータへの変換を行う。変換して得られた符号化データは出力される。
【0133】
例えば、輝度成分の直流成分のJPEGデータの差分値D5が20であった場合、そのハフマン符号は“11010100”である。ここで量子化倍数P3が2.5であれば、出力するMPEGデータの差分値D6は、
D6=D5/P3…(12)
で求められる。
【0134】
この場合は、差分値D6は4であり、従って、このハフマン符号は“100100”と変換される。変換して得られた符号化データは、作業メモリ303に一時格納する。
【0135】
次に、ステップS22に示すように、交流成分におけるJPEGデータからMPEGデータへの変換を、同様に量子化倍数P3とハフマン符号から作業メモリ303の交流成分変換LUTを参照して行う。変換して得られた符号化データは出力される。
【0136】
入力されたJPEGデータの量子化結果R5と量子化倍数P3とから変換後のMPEGデータの量子化結果R6は、
R6=R5/P3…(13)
で求められる。
【0137】
例えば、量子化倍数P3が7であって、0ラン長が5で量子化結果R5が3であることを示すハフマン符号“1111111011111”が入力されたとする。このときの量子化結果R6は、1以下になってしまうが、切り上げて1とする。従って、0ラン長が5で量子化結果が1を表すハフマン符号“11110101”に変換される。
【0138】
以上のような交流成分の変換を、ステップS21に示すように、全ての交流成分が終了するまで続け、終了したらステップS19に戻る。
【0139】
以下、ステップS19に示すように、マクロブロック単位の処理を行い、1フレームの処理が終了したら、図7のステップS13に示すように、次のフレームの処理に移る。
【0140】
図5において、もし、ステップS06に示すように、次のフレームがない場合には、動画像が終了したので、ステップS07に示すように、シーケンスの終了コードを生成して出力し、ステップS08に示すように、処理を終了する。
【0141】
次に、Pフレームのデータへの変換について述べる。
まず、ステップS09に示すように、生成するフレームがIフレームかPフレームかを判定し、Pフレームを生成する場合はステップS23に移る。
【0142】
次に、ステップS23に示すように、JPEG符号化データの量子化テーブルから、JPEG方式デフォルト量子化デーブルを用いて量子化係数Q10を求める。
【0143】
次に、ステップS24に示すように、前フレームのJPEGデータの量子化係数(前フレームがIフレームであれば前述の量子化係数Q8、Pフレームであれば前フレームの量子化係数Q10)を量子化係数Q11として保持しておく。
【0144】
次に、図9のステップS25に示すように、符号化制御のために量子化係数Q12を決定する。
【0145】
次に、ステップS26に示すように、Pフレームであることを示すピクチャヘッダを生成する。
【0146】
次に、ステップS28に示すように、1マクロブロック分のMotionJPEGデータが、順に記憶装置1から読み出される。読み出されたMotionJPEGデータは、マクロブロック単位で作業メモリ303に格納される。
【0147】
もし、ステップS29に示すように、入力されたマクロブロックのデータがフレームの左端であれば、ステップS30に示すように、量子化係数Q12を読み出し、スライスヘッダを生成し、出力する。
【0148】
続いて、マクロブロック単位でJPEGデータを処理する。
すなわち、図10のステップS32に示すように、JPEGデータを復号し、量子化係数Q10とJPEG方式デフォルト量子化テーブルを用いて各ブロックのDCTの直流成分と交流成分を生成する。
【0149】
次に、ステップS33に示すように、前フレームの同一位置のマクロブロックのJPEGデータを作業メモリ303から読み出して復号し、量子化係数Q11とJPEG方式デフォルト量子化テーブルを用いて各ブロックのDCT係数の直流成分と交流成分を生成する。
【0150】
次に、ステップS34に示すように、各ブロック毎にDCT係数毎の差分を求めて絶対値を加算する。これらの処理を6つのブロック全てについて行い、終了したらステップS35に移る。なお、加算の結果をブロックの順にAA1からAA6とする。
【0151】
もし、ステップS35に示すように、全ての加算値AA1〜6が0、すなわち、
AAi=0(i=1〜6) …(14)
であれば、動きベクトル(0,0)で符号が発生しないマクロブロックであることを示している。
【0152】
この場合は、もし、ステップS36に示すように、直前のマクロブロックの符号化モードがPredictiveモードであれば、スキップの処理を実施する。
【0153】
すなわち、ステップS37に示すように、スキップのマクロブロックを計数しておく。
【0154】
もし、ステップS36に示すように、直前のマクロブロックの符号化モードがPredictiveモードでなければ、図13のステップS53に示すように、動きベクトル(0,0)のPredictiveモードで符号化されることを表すマクロブロックヘッダを出力する。
【0155】
さらに、ステップS54に示すように、スキップするマクロブロックの計数値を0とする。
【0156】
もし、図10のステップS35に示すように、ブロックの加算値AA1〜6が全て0でなければ、図11のステップS38に示すように、加算値AA1からAA6と予め決定された閾値T3と比較し、全ての加算値で、
T3>AAi>0 (i=1〜6)… (15)
であれば、Predictiveモードの符号を生成する。
【0157】
次に、ステップS39に示すように、Predictiveモードで符号化されることを表すマクロブロックのヘッダデータを生成する。このヘッダデータには、動きベクトル(0,0)の符号と、加算値AA1〜6が0でないブロックの位置を表す符号を生成し、マクロブロックヘッダに入れて出力する。
【0158】
次に、ステップS41に示すように、符号化するフレームの加算値AAi(i=1〜6)が0でないブロックのDCT係数を逆DCT変換して画素値を再生する。
【0159】
次に、ステップS42に示すように、符号化する直前のフレームの同一位置のブロックの、加算値AAi(i=1〜6)が0でないブロックのDCT係数を逆DCT変換して画素値を再生する。
【0160】
その後、ステップS43に示すように、各画素値の差分を求める。
【0161】
次に、ステップS44に示すように、求めた差分値にDCT変換を施し、量子化係数Q12で量子化し、量子化結果を得る。以上の処理をステップS40に示すように、全てのブロックについて行い、終了したらステップS45に移る。
【0162】
もし、図12のステップS45に示すように、直流成分に関しては、直前のマクロブロックがPredictiveモードで符号化されていれば、ステップS46に示すように、DPCMを行い、MPEG方式の符号で符号化し、出力する。また、直前のマクロブロックのモードIntra モードであったり、左端のマクロブロックであれば、ステップS47に示すように、新たにDPCMを初期化して、ステップS48に示すように、直流成分の符号化を行う。
【0163】
次に、ステップS49に示すように、交流成分の量子化結果は、MPEG方式に従って符号を割り当て、出力する。
【0164】
次に、ステップS50に示すように、全てのブロックについてステップS51の直流成分の符号化及びステップS52の交流成分の符号化を行い、終了したらステップS27に戻る。
【0165】
また、図11のステップS38に示すように、1つでも(15)式の条件を満たさない場合は、Intra モードの符号に変換して出力する。
【0166】
変換に先立ち、直前のマクロブロックがスキップ処理がされていれば、ステップS55に示すように、計数値に見合ったマクロブロックアドレスインクリメント符号として出力する。
【0167】
変換の詳細は、図14のステップS56〜61のIフレームのマクロブロックの変換処理と同様の処理を実施する。
【0168】
以下、マクロブロック単位の処理を行い、図6のステップS06に示すように、1フレームの処理が終了したら、次のフレームの処理に移る。
【0169】
もし、次のフレームがない場合には動画像が終了したので、ステップS07に示すように、シーケンスの終了コードを生成して出力し、ステップS08に示すように、処理を終了する。
【0170】
なお、本実施例ではMPEG符号化方式を例にとって説明したが、H.261符号化方式であっても本実施例の構成をH.261の符号に適したものに置き換えることによって本発明を適用できる。また、MPEG方式のGOPがIフレームとPフレームとで構成される場合について説明したが、Bフレームを導入したMPEG方式への変換に本発明を適用してもよい。また、本実施例においては、Iフレームのマクロブロックの変換処理を行うに際しては、図14のステップS56〜61を用いたが、これに限らず他の処理としてもよい。
【0171】
また、動画像の符号化の例としてMPEG方式やH.261方式を例にとったが、動画像の符号化方式はこれに限定されず、動き補償をする符号化であれば良い。さらに、画像のサンプリングで4:1:1を例にとって説明したが、4:4:4や4:2:2を入力とした場合でも色度成分のみを再生してサブサンプリングした後符号化すれば良い。
【0172】
【発明の効果】
以上説明したように、本発明によれば、第1の符号化方式でフレーム内符号化された第1のフレーム内符号化データを、第2の符号化方式の第2のフレーム内及びフレーム間符号化データに効率よく変換することができ、データ量も大幅に削減することができる。
【図面の簡単な説明】
【図1】本発明の一実施例による画像符号化データ変換装置の構成を示すブロック図である。
【図2】本発明の第1実施例によるデータ変換部の構成を示すブロック図である。
【図3】本発明の一実施例によるデータ変換器の構成を示すブロック図である。
【図4】本発明の第2実施例によるデータ変換部の構成を示すブロック図である。
【図5】本発明の第3実施例による画像符号化データ変換装置の構成を示すブロック図である。
【図6】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図7】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図8】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図9】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図10】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図11】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図12】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図13】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【図14】本発明の第3実施例による画像符号化データ変換の手順を表すフローチャートである。
【符号の説明】
1、8 記憶装置
2 JPEG復号器
3 フレームメモリ
4 ディスプレイ
5 データ変換部
6 通信インターフェイス
7 通信回線
9、301 CPU
10 入力装置
101、115、201、224 コードバッファ
102、202、203 コードメモリ
103、204、205、206 復号器
104、105、106、107、108、117、208、209、210、211、212、213、214、216 ラッチ
109、215 差分比較器
110、112、113、217、218、219、221、222 符号化器
111、220 データ変換器
114、151、155、223 セレクタ
116、207 ヘッダ解析器
150 演算器
152 マクロブロックヘッダ生成器
153 DC変換器
154 AC変換器
302 プログラムメモリ
303 作業メモリ
[0001]
[Industrial application fields]
The present invention relates to an image processing method for processing a moving image.
[0002]
[Prior art]
In recent years, international standardization of image data encoding techniques has been actively performed. The JPEG (color still image coding) system has become an international standard as a coding system for color multilevel images. In this method, an input color multi-valued image is divided into blocks, subjected to DCT transform, quantized coefficients, assigned a Huffman code as a quantization result, and encoded. Details are described in "Outline of Color Still Image Coding International Standard System (JPEG) (Part 1) (Technical Explanation)" [Journal of Image Electronics Society, Vol. 20, No. 1].
[0003]
International standardization of moving images is also underway. H.TV for video conference applications The 261 (video coding for communication) method and the MPEG (moving image coding for storage) method using storage media have become standard. These encoding methods are methods in which a basic frame is encoded in the frame and other frames are encoded by motion compensation. The basics of intraframe coding are block division and DCT conversion as in the JPEG method. Also in motion compensation, a motion vector is calculated for each block, a difference from the target block is obtained, a difference block is DCT transformed, a coefficient is quantized, a Huffman code is assigned to a quantization result, and encoding is performed. is there. Details are published in "International Standard for Multimedia Coding" [Maruzen Co., Ltd.].
[0004]
While these standardizations are progressing, LSIs for these technologies are rapidly being realized. JPEG LSIs were first announced in the order of standardization. Later, LSIs that perform JPEG encoding were supplied in large quantities at low cost. As a result, before the MPEG method, which is a moving image encoding method, has been standardized, an application for encoding each frame of a moving image using the JPEG method and storing it on a magnetic disk or the like has become widespread. Hereinafter, data obtained by encoding a moving image by the JPEG method is referred to as Motion JPEG data.
[0005]
These applications are characterized in that editing in frame units is easier and handling is easier than in the MPEG system. On the other hand, the MPEG system is characterized by high coding efficiency because it employs interframe coding.
[0006]
Further, when processing these data, a technique for converting Motion JPEG data into MPEG data is also required.
[0007]
[Problems to be solved by the invention]
However, in the above-described example, when converting Motion JPEG data to MPEG data, the Motion JPEG data is decoded and returned to image data, and the decoded image data is re-encoded into MPEG data. There were some disadvantages.
[0008]
That is, since the JPEG decoding and the MPEG encoding are performed at the same time, the control of the apparatus is complicated, and the processing amount increases. For example, if a JPEG decoder or an MPEG encoding unit is realized by software, it takes a very long time to perform processing. In addition, there is a problem that a work frame memory for storing a reference frame is required when encoding in the MPEG system, which becomes an obstacle to reducing the cost of the entire apparatus.
[0009]
Therefore, an object of the present invention is to reduce intra-frame encoded data to be decoded into image data when converting intra-frame encoded data such as JPEG data into encoded data based on inter-frame correlation such as MPEG data. Another object of the present invention is to provide an image processing method capable of converting data efficiently.
[0010]
[Means for Solving the Problems]
In order to achieve the above object, an image processing method of the present invention includes an input step of inputting first intra-frame encoded data that is intra-frame encoded by a first encoding method for each block; A macroblock in which a plurality of blocks are collected in second intraframe encoded data in a second encoding scheme different from the first encoding scheme by a lookup table without decoding intraframe encoded data. A first data conversion step of converting in units, the first intra-frame encoded data is decoded, and the decoded image data is converted into the second data of Converted into inter-frame encoded data based on the inter-frame correlation of the encoding method for each macroblock. First 2 data conversion step, the first orthogonal transform coefficient data obtained by decoding the first intra-frame encoded data, and the second orthogonal transform coefficient data of the previous frame or the subsequent frame, A comparison step for comparing in units of macroblocks and the number of macroblocks to be skipped before the second intra-frame encoded data and the second intra-frame encoded data according to the comparison result in the comparison step The first to output the macroblock address increment code processing And outputting a macroblock address increment code indicating the number of macroblocks to be skipped before the interframe encoded data and the interframe encoded data. processing And a third that does not output the encoded data. processing In the selection step, when the data difference is larger than a first predetermined value according to the comparison result in the comparison step, the first step processing And when the data difference is less than the first predetermined value and greater than a second predetermined value, the second processing And when the data difference is less than or equal to the second predetermined value, the third processing It is characterized by selecting.
[0022]
【Example】
Hereinafter, an image encoded data conversion apparatus according to a first embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a configuration of an image encoded data conversion apparatus according to an embodiment of the present invention.
[0023]
In the following description, intra-frame encoded data is assumed to be Motion JPEG data encoded by the JPEG method, and encoded data using inter-frame correlation is assumed to be data encoded by the MPEG method.
[0024]
In FIG. 1, reference numeral 1 denotes a storage device that stores Motion JPEG data, and reference numeral 2 denotes a JPEG decoder that performs JPEG decoding. Reference numeral 3 denotes a frame memory for storing frame images of moving images. Reference numeral 4 denotes a display for displaying image data stored in the frame memory 3. A data conversion unit 5 converts Motion JPEG data into data encoded by the MPEG method. A communication interface 6 controls communication with the outside of the apparatus. Reference numeral 7 denotes a communication line constituted by a computer network or a public line (for example, an ISDN line). A storage device 8 stores MPEG data encoded by the MPEG method. A CPU 9 controls and controls the entire apparatus. An input device 10 is used by a user to request or specify a moving image display.
[0025]
Conversion of JPEG data to MPEG data is performed according to the following procedure. That is, Motion JPEG data is input from the storage device 1 to the data conversion unit 5. The data converter 5 converts the input Motion JPEG data into MPEG data.
[0026]
FIG. 2 shows a block diagram of the data converter 5. In the figure, reference numeral 101 denotes a code buffer for storing Motion JPEG data for an MPEG encoding unit. Here, an MPEG encoding unit is an MPEG macroblock. The macro block consists of four luminance blocks Y adjacent to each other on the left and right and top and bottom 0 , Y 1 , Y 2 , Y Three And two chrominance blocks Cb and Cr corresponding to the same position on the image are composed of six blocks. A code memory 102 stores Motion JPEG data for one frame. Reference numeral 103 denotes a decoder for inputting Motion JPEG data and decoding DCT coefficients. Reference numerals 104, 105, and 106 denote latches that store quantization coefficients. Reference numerals 107 and 108 denote latches for storing the decoded DCT coefficients for one macro block of the MPEG system.
[0027]
Reference numeral 109 denotes a difference comparator that calculates an absolute value difference of DCT coefficients in units of blocks, compares each difference value with a preset threshold value, and outputs a determination result. Reference numeral 110 denotes an encoder that generates MPEG data from decoded data. A data converter 111 converts encoded data of Motion JPEG data into MPEG data. Reference numeral 112 denotes an encoder that generates MPEG data based on the output of the difference comparator 109. Reference numeral 113 denotes an encoder that generates MPEG header data. Reference numeral 114 denotes a selector that selects and outputs an input based on the output result of the difference comparator 109. A code buffer 115 stores the output of the selector 114. Reference numeral 116 denotes a header analyzer that analyzes each header data of the Motion JPEG data. Reference numeral 117 denotes a latch that stores the output of the differential output unit 109 for one macroblock.
[0028]
Here, for ease of explanation, it is assumed that the input Motion JPEG data has a sub-sampling ratio of 4: 1: 1. In addition, the structure of an MPEG GOP (Group of Picture) includes an intra-frame coding (Intra) frame (hereinafter abbreviated as I frame) and a motion-compensated coding (Predictive) frame (hereinafter referred to as P (Abbreviated as “frame”).
[0029]
The configuration of an MPEG GOP is composed of I frames and P frames, the configuration of 1 GOP is 15 frames, and the encoding mode of each frame is
I, P, P, P, P, P, P, P, P, P, P, P, P, P, P
And
[0030]
Hereinafter, the operation of each component in FIG. 2 will be described in detail.
First, prior to conversion from Motion JPEG data to MPEG data, the CPU 9 in FIG. 1 initializes each component shown in FIG.
[0031]
Next, the header data of the first frame of the Motion JPEG data is input to the header analyzer 116 via the code buffer 101. The header analyzer 116 analyzes the header data of the Motion JPEG data and obtains image attributes such as an image size. This result is input to the encoder 113. The encoder 113 receives the attributes as a moving image, the frame rate, the encoding rate, and the like from the CPU 9 together with these attributes, and generates MPEG header data based on these. The generated MPEG header data is output to the code buffer 115 via the selector 114. The MPEG header data generated here includes sequence header data starting with a sequence start code (SSC), GOP header data starting with a GOP start code (GSC), and the like. In addition, the header analyzer 116 obtains the quantization coefficient Q1 using a predetermined default quantization table from the quantization table used in the JPEG method. The obtained quantization coefficient Q1 is input to the latch 105. The default quantization table is encoded and placed in the sequence header data.
[0032]
The conversion from Motion JPEG data to MPEG data of I frame will be described below. Prior to intra-frame coding, the CPU 9 stores the quantization coefficient Q2 in the latch 106 for coding control in the MPEG system. Further, the encoder 113 generates frame header data (picture header). Here, it is shown that the encoded frame is an I frame.
[0033]
Motion JPEG data for an MPEG encoding unit is sequentially read from the storage device 1 of FIG. 1 and input to the code buffer 101. The positional relationship in the frame is the same between the JPEG encoding macroblock and the MPEG encoding macroblock. Therefore, one macro block includes 4 luminance blocks and 2 color difference blocks. The Motion JPEG data stored in the code buffer 101 is input to the code memory 102 and the data converter 111. The code memory 102 is composed of a FIFO memory or the like.
[0034]
Subsequently, the macro block data is processed. If the input macroblock data is the left end of the frame, the encoder 113 generates a slice header, outputs it to the code buffer 115 via the selector 114, and stores it. When generating a slice header, the quantization coefficient Q2 is read from the latch 106, encoded, and placed in the slice header.
[0035]
A block diagram of the data converter 111 is shown in FIG. An arithmetic unit 150 receives the quantization coefficients Q1 and Q2 and obtains the quantization multiple P1. Reference numeral 151 denotes a selector that changes the output destination of input encoded data in accordance with a selection signal. Reference numeral 152 denotes a macroblock header generator composed of a ROM or the like. Reference numeral 153 denotes a DC converter configured to convert the encoded data of the DC component of the DCT coefficient, which is constituted by a ROM or the like having the encoded data as an address. Reference numeral 154 denotes an AC converter configured to convert the encoded data of the AC component of the DCT coefficient, which is composed of a ROM or the like having the encoded data as an address. Reference numeral 155 denotes a selector that changes the input destination in accordance with the selection signal.
[0036]
First, the data converter 111 outputs macroblock header data. This header data is header data indicating that a macroblock to be encoded is encoded by intraframe encoding, that is, Intra mode. The CPU 9 causes the input of the selector 155 to select the output of the macroblock header generator 152, reads the macroblock header data from the macroblock header generator 152, and outputs it.
[0037]
Subsequently, the data converter 111 inputs the quantization coefficients Q1 and Q2 from the latch 105 and the latch 106 in addition to inputting the JPEG data in block units. First, a quantization multiple P1 is obtained by the arithmetic unit 150 from the quantization coefficient Q1 input from the latch 105 and the quantization coefficient Q2 input from the latch 106 according to the following equation.
P1 = Q2 / Q1 (1)
[0038]
Subsequently, each block is processed.
The block unit encoded data in JPEG data is composed of a DCCM DC component DPCM result, an AC component quantized result, and a 0-run length Huffman code.
[0039]
First, the conversion of the DC component code will be described. In the JPEG system and MPEG system with a sub-sampling ratio of 4: 1: 1, DPCM is applied in the same order in a Z-shape. Therefore, the DC component is converted using the quantization multiple P1. For example, when the difference value D1 of the input luminance component is 33, the Huffman code is “1110100001”. If the quantization multiple P1 is 3, the output difference value D2 is
D2 = D1 / P1 (2)
Is required.
[0040]
In this case, the difference value D2 is 11, and thus the Huffman code is converted to “1011011”. Actually, the conversion result is stored in advance in the DC converter 153 using the value of the quantization multiple P1 and the Huffman code as an address, and the conversion is performed by reading from the ROM of the DC converter 153.
[0041]
Next, conversion of the AC component code will be described. For example, the luminance component Huffman code “111111111000100111000” indicates that the 0 run length is 2 and the quantization result R1 is 16. If the quantization multiple P1 is 3, the output quantization result R2 is
R2 = R1 / P1 (3)
To Huffman code “1111110111101” in which 0 run length is 2 and quantization result is 5.
[0042]
Actually, the conversion result is stored in advance in the AC converter 154 using the value of the quantization multiple P1 and the Huffman code as addresses, and the conversion is performed by reading from the ROM as the LUT of the AC converter 154.
The MPEG data obtained by such conversion is stored in the code buffer 115.
[0043]
Thereafter, processing is performed in units of macroblocks, and when the processing of one frame is completed, the contents of the code buffer 115 are transmitted and stored in the storage device 8 of FIG. 1 or output to the communication line 7 via the communication interface 6. Or The transmitted code length is reported to the CPU 9. Thereafter, the code buffer 115 is cleared.
[0044]
As described above, according to the present embodiment, when converting Motion JPEG data to MPEG data of I frame, the Motion JPEG data and the quantization coefficient can be used without decoding the Motion JPEG data and returning it to the image data as in the prior art. Since the data is directly converted into MPEG data by primary conversion, the conversion time can be shortened.
[0045]
Next, conversion from Motion JPEG data to MPEG data of P frames will be described.
Prior to motion compensation encoding, the CPU 9 obtains a quantization coefficient Q2 for encoding control from the code length applied to the previous frame and stores it in the latch 106. Further, the quantization coefficient Q1 ′ of the latch 105 is moved to the latch 104. Then, a quantization coefficient Q1 is obtained using a predetermined default quantization table from the quantization table used in the JPEG method. The obtained quantization coefficient Q1 is input to the latch 105. The encoder 113 generates a picture header for the frame. Here, it is shown that the encoded frame is a P frame.
[0046]
Motion JPEG data for one macroblock is sequentially read from the storage device 1 and input to the code buffer 101. The JPEG data stored in the code buffer 101 is input to the code memory 102, the decoder 103, and the data converter 111. Then, the JPEG data input to the decoder 103 is decoded, a DC component and an AC component of the DCT coefficient are generated for each block using the quantization coefficient Q 1 of the latch 105, and stored in the latch 107. Subsequently, the JPEG data of the macro block at the same position of the previous frame is read from the code memory 102, the JPEG data is decoded by the decoder 103, and the DCT coefficient DC is applied to each block using the quantization coefficient Q1 'of the latch 104. A component and an AC component are generated and stored in the latch 108.
[0047]
Thereafter, the difference comparator 109 reads the DCT coefficient for each block from the latch 107 and the latch 108, obtains the difference for each DCT coefficient, and adds the absolute value. After obtaining the addition values A1 to A6 of each block, if all the addition values are 0 and the content of the latch 117 is “10” or “00”, the comparison subtractor 109 sets the code “10”. Generate.
[0048]
Otherwise, the addition values A1 to A6 are compared with a predetermined threshold value T1, and for all addition values,
T1> Ai ≧ 0 (i = 1 to 6) (4)
If so, the difference comparator 109 generates a code “00”.
If even one of the conditions of the expression (4) is not satisfied, a code “01” is generated. The generated code is output to the selector 114.
[0049]
At the same time, the encoder 110 generates macroblock header data. That is, a motion vector code is generated with a motion vector of (0, 0). The encoder 110 generates header data indicating that the macroblock to be encoded is encoded in motion compensation encoding, that is, in predictive mode, and inserts a motion vector code.
[0050]
The encoder 110 reads the DCT coefficient of the macroblock to be encoded from the latch 107, reads the DCT coefficient of the macroblock to be encoded from the latch 108 and the macroblock at the same position in the previous frame, and the quantization coefficient from the latch 106. Read Q2. Then, the encoder 110 performs inverse DCT conversion on the DCT coefficient of each block of the macro block of the latch 107 to reproduce a pixel value. Subsequently, the DCT coefficient of each block of the macro block of the latch 108 is subjected to inverse DCT transform to reproduce the pixel value. Thereafter, the difference between the pixel values is obtained. The obtained difference value is subjected to DCT transformation and quantized with a quantization coefficient Q2, and a quantization result is obtained. Regarding the DC component, if the output code of the difference comparator 109 of the immediately preceding macroblock is “00”, the DPCM is subsequently performed, and if not, the DPCM is newly initialized. A code is assigned to the quantization result of the AC component in accordance with the MPEG system.
[0052]
If the output code of the difference comparator 109 is “00” and the content of the latch 117 is “10”, the selector 114 outputs the content of the encoder 112 and then inputs the output of the encoder 110. The code buffer 115 outputs the data and stores it.
[0053]
If the output code of the difference comparator 109 is “01” and the content of the latch 117 is “10”, the selector 114 outputs the content of the encoder 112, and then the selector 114 outputs the data converter 111. The output is input, output to the code buffer 115, and stored.
[0054]
When the output code of the difference comparator 109 is “10”, the result is input to the encoder 112. When this code is generated, MPEG encoded data is not generated, and the encoder 112 counts the number of consecutively generated codes “10”, and expresses the number (macroblock address increment code). Is generated.
[0055]
When the macroblock processing is completed, the contents of the latch 107 are replaced with the output of the difference comparator 109.
[0056]
Thereafter, processing is performed in units of macroblocks, and when the processing of one frame is completed, the contents of the code buffer 115 are transmitted and stored in the storage device 8 of FIG. 1 or output to the communication line 7 via the communication interface 6. Or The transmitted code length is reported to the CPU 9. Thereafter, the code buffer 115 is cleared.
[0057]
Thereafter, each frame is encoded as an I frame or a P frame in a predetermined order to obtain a desired number of MPEG data. After that, an end code such as a sequence end code determined by the MPEG system is generated by the encoder 113 and sent through the code buffer 115 via the selector 114, and all operations are completed.
[0058]
As described above, according to the present embodiment, when a moving image encoded only by intraframe encoding is converted to encoded data using motion compensation encoding, the circuit scale is large and processing takes time. There is an effect that the encoded data can be instantaneously converted without performing a vector search.
[0059]
In addition, there is no need for a working frame memory for storing reference frames when encoding in the MPEG system, which has the effect of reducing the overall cost of the apparatus.
[0060]
Furthermore, since the orthogonal transformation which takes time for processing can be omitted, there is an effect that processing time can be shortened. Also, high-speed conversion is possible by converting encoded data using an LUT.
[0061]
In this embodiment, the MPEG encoding method has been described as an example. Even in the H.261 encoding system, the configuration of this embodiment is the same as that of H.264. The present invention can be applied by substituting one suitable for the code of H.261.
[0062]
Next, an image encoded data conversion apparatus according to a second embodiment of the present invention will be described with reference to the drawings.
FIG. 4 is a block diagram of the data conversion unit 5 shown in FIG. 1 when converting Motion JPEG data into MPEG data into which a bi-directional motion compensation encoding (Bidirectionaj Predictive) frame (hereinafter abbreviated as B frame) is introduced.
[0063]
The data converter 5 converts the input Motion JPEG data into MPEG data. That is, in FIG. 4, reference numeral 201 denotes a code buffer that stores Motion JPEG data for one macroblock of the MPEG system. Reference numerals 202 and 203 denote code memories for storing Motion JPEG data for one frame. Reference numerals 204, 205, and 206 denote decoders that input Motion JPEG data and decode it into DCT coefficients. A header analyzer 207 analyzes each header data of the Motion JPEG data. 208, 209, 210, and 211 are latches for storing quantization coefficients. Reference numerals 212, 213, and 214 denote latches that store the decoded DCT coefficients for the macroblock.
[0064]
Reference numeral 215 denotes a difference comparator that calculates an absolute value difference of DCT coefficients in units of blocks, compares each difference value with a preset threshold value, and outputs a determination result. A latch 216 stores the output of the difference comparator 215 for one macroblock. Reference numerals 217, 218, and 219 denote encoders that generate MPEG data from the decoded data. A data converter 220 converts encoded data of JPEG data into MPEG data. Reference numeral 221 denotes an encoder that generates MPEG header data. Reference numeral 222 denotes an encoder that generates MPEG data based on the output of the difference comparator 215. Reference numeral 223 denotes a selector that selects and outputs an input based on the output result of the difference comparator 215. A code buffer 224 stores the output of the selector 223.
[0065]
Here, for ease of explanation, it is assumed that the input Motion JPEG data has a sub-sampling ratio of 4: 1: 1. Also, the MPEG GOP configuration is composed of 1 frame, P frame, and B frame, 1 GOP configuration is 15 frames, and the encoding mode of each frame is
I, B, B, P, B, B, P, B, B, P, B, B, P, B, B
And
[0066]
Hereinafter, the operation of each component in FIG. 4 will be described in detail.
First, prior to conversion from Motion JPEG data to MPEG data, the CPU 9 initializes each component shown in FIG.
[0067]
Next, the header data of the first frame of the Motion JPEG data is input to the header analyzer 207 via the code buffer 201. The header analyzer 207 analyzes the header data of the Motion JPEG data and obtains image attributes such as an image size. This result is input to the encoder 221. The encoder 221 receives the attributes of the moving image, the frame rate, the encoding rate, and the like from the CPU 9 together with these attributes, generates MPEG header data, and outputs the MPEG header data to the code buffer 224 via the selector 223. The header data generated here is a sequence header starting with a sequence start code and GOP header data starting with a GOP start code. Also, the quantization coefficient Q3 is obtained using a predetermined default quantization table from the quantization table used in the JPEG method. The obtained quantization coefficient Q3 is input to the latch 208. The default quantization table is encoded and put into sequence header data.
[0068]
The conversion from Motion JPEG data to MPEG data of I frame will be described below. Prior to intra-frame coding, the CPU 9 stores the quantization coefficient Q4 in the latch 211 for code control. Also, the encoder 221 generates a picture header. Here, it is shown that the encoded frame is an I frame.
[0069]
First, Motion JPEG data for one macroblock is sequentially read from the storage device 1 and input to the code buffer 201. The JPEG data stored in the code buffer 201 is input to the code memory 202 and the data converter 220. The input JPEG data is stored in the code memory 202. Similarly, the Motion JPEG data of the macro block at the same position as input from the code memory 202 is stored in the code memory 203. The code memories 202 and 203 are composed of FIFO memories. The configuration of the data converter 220 is configured by an LUT, similar to the data converter 111 of the first embodiment.
[0070]
Subsequently, the macro block data is processed. If the input macroblock data is the left end of the frame, the encoder 221 generates a slice header, outputs it to the code buffer 224 via the selector 223, and stores it. Further, when generating a slice header, the quantization coefficient Q4 is read from the latch 211, encoded, and placed in the slice header.
[0071]
The data converter 220 generates macroblock header data. That is, the data converter 220 generates header data indicating a macroblock encoded in the Intra mode.
[0072]
The data converter 220 inputs the quantization coefficients Q3 and Q4 from the latch 208 and the latch 211 in addition to inputting the JPEG data in units of blocks. First, a quantization multiple P2 is obtained from the quantization coefficient Q3 input from the latch 208 and the quantization coefficient Q4 input from the latch 211 according to the following equation.
P2 = Q4 / Q3 (5)
[0073]
Subsequently, each block is processed.
First, the conversion of the DC component code will be described. In this case, the DC component is converted using the quantization multiple P2. For example, if the difference value D3 of the input luminance component is 33, if the quantization multiple P is 1.5, the output difference value D4 is
[0074]
D4 = D3 / P2 (6)
The difference value D4 in this case is 22. Therefore, this Huffman code is converted to “11010110”.
[0075]
Next, conversion of the AC component code will be described. For example, the luminance component Huffman code “111111111000100111000” indicates that the 0 run length is 2 and the quantization result R3 is 16. If the quantization multiple P2 is 1.5, the output quantization result R4 is
R4 = R3 / P2 (7)
To 10.6, and is rounded off to be converted into a Huffman code “1111111101001011” in which the 0 run length is 2 and the quantization result is 11.
[0076]
These conversions are performed by referring to a LUT (Look Up Table) composed of a ROM or the like.
The MPEG data obtained by such conversion is stored in the code buffer 224.
[0077]
Thereafter, processing is performed in units of macroblocks, and when processing of one frame is completed, the contents of the code buffer 224 are transmitted and stored in the storage device 8 of FIG. 1 or output to the communication line 7 via the communication interface 6. Or The transmitted code length is reported to the CPU 9. Thereafter, the code buffer 224 is cleared.
[0078]
Next, conversion from Motion JPEG data to MPEG data of P frames will be described.
Prior to encoding the P frame, the CPU 9 obtains a quantization coefficient Q4 for encoding control from the code length applied to the previous frame and stores it in the latch 211. Further, the quantization coefficient Q3 ″ of the latch 209 is moved to the latch 210, and the quantization coefficient Q3 ′ of the latch 208 is moved to the latch 209. Then, a quantization coefficient Q3 is obtained using a predetermined default quantization table from the quantization table used in the JPEG method. The obtained quantization coefficient Q3 is input to the latch 208. The encoder 221 generates a frame picture header. Here, it is shown that the encoded frame is a P frame.
[0079]
Motion JPEG data for one macroblock is sequentially read from the storage device 1 and input to the code buffer 201. The JPEG data stored in the code buffer 201 is input to the code memory 202, the decoder 204, and the data converter 220. The decoder 204 decodes the input JPEG data, generates a DC component and an AC component of the DCT coefficient for each block using the quantization coefficient Q 3 of the latch 208, and stores them in the latch 212. At the same time, the JPEG data of the macroblock at the same position of the previous I frame or P frame is read from the code memory 202, decoded by the decoder 205, and the quantization coefficient Q3 'of the latch 209 is used to determine the DCT coefficient for each block. A DC component and an AC component are generated and stored in the latch 213. The read JPEG data is also input to the code memory 203.
[0080]
After that, the difference comparator 215 reads the DCT coefficient for each block from the latch 212 and the latch 213, calculates the difference for each DCT coefficient, and adds the absolute value. After obtaining the addition values A1 to A6 of each block, if all the addition values are 0 and the contents of the latch 216 are “110” or “000”, the comparison subtractor 215 sets the code “110”. Generate.
[0081]
In other cases, the addition values A1 to A6 are compared with a predetermined threshold value T2, and for all addition values,
T2> Ai ≧ 0 (i = 1 to 6) (8)
If so, the difference comparator 215 generates a code “000”.
[0082]
If even one of the conditions of equation (8) is not satisfied, code “100” is generated. The generated code is output to the selector 223.
[0083]
In parallel with this, the encoder 217 and the data converter 220 perform the following operations. The encoder 221 generates macroblock header data. That is, a motion vector code is generated with a motion vector of (0, 0). The encoder 221 generates header data indicating that the macroblock to be encoded is encoded in the predictive mode, and inserts a motion vector code.
[0084]
The encoder 217 first reads the DCT coefficient of the macroblock to be encoded from the latch 212, and also reads the DCT coefficient of the macroblock at the same position in the previous I frame or P frame from the latch 214, The quantization coefficient Q4 is read from the latch 211. Then, each block DCT coefficient of the macro block of the latch 212 is subjected to inverse DCT transform to reproduce a pixel value. Subsequently, the DCT coefficient of each block of the macro block of the latch 214 is subjected to inverse DCT transform to reproduce the pixel value. Thereafter, a difference between the respective pixel values is obtained, DCT transformation is performed on the obtained difference value, and quantization is performed with a quantization coefficient Q4 to obtain a quantization result. Regarding the DC component, if the output code of the difference comparator 215 of the immediately preceding macroblock is “000”, the DPCM is subsequently performed. Otherwise, the DPCM is newly initialized. A code is assigned to the quantization result of the AC component in accordance with the MPEG system.
[0085]
The JPEG data input to the data changer 220 is converted from JPEG data to MPEG data in the same manner as the Intra frame macroblock.
[0086]
If the output code of the difference comparator 215 is “000” and the content of the latch 216 is “110”, the selector 223 outputs the content of the encoder 222 and then inputs the output of the encoder 218. Then, it outputs to the code buffer 224 and stores it.
[0087]
If the output code of the difference comparator 215 is “100” and the content of the latch 216 is “110”, the selector 223 outputs the content of the encoder 222, and then the selector 223 outputs the data converter 220. The output is input, output to the code buffer 224, and stored.
[0088]
When the output code of the difference comparator 215 is “110”, the result is input to the encoder 222. When this code is generated, MPEG encoded data is not generated, and the encoder 222 counts the number of consecutively generated codes “110” to generate a macroblock address increment code.
[0089]
When the macroblock processing is completed, the contents of the latch 216 are replaced with the output of the difference comparator 215.
[0090]
Thereafter, processing is performed in units of macroblocks, and when processing of one frame is completed, the contents of the code buffer 224 are transmitted and stored in the storage device 8 of FIG. 1 or output to the communication line 7 via the communication interface 6. Or The transmitted code length is reported to the CPU 9. Thereafter, the code buffer 224 is cleared.
[0091]
Finally, conversion from Motion JPEG data to B frame MPEG data will be described.
Prior to encoding the B frame, the CPU 9 obtains a quantization coefficient Q4 for encoding control from the code length applied to the previous frame and stores it in the latch 211. Further, the quantization coefficient Q3 ″ of the latch 209 is moved to the latch 210, and the quantization coefficient Q3 ′ of the latch 208 is moved to the latch 209. Then, a quantization coefficient Q3 is obtained using a predetermined default quantization table from the quantization table used in the JPEG method. The obtained quantization coefficient Q3 is input to the latch 208. The encoder 221 generates a frame picture header. Here, it is shown that the encoded frame is a B frame.
[0092]
Motion JPEG data for one macroblock is sequentially read from the storage device 1 and input to the code buffer 201. The JPEG data stored in the code buffer 201 is input to the decoder 204 and the data converter 220. The decoder 204 decodes the input JPEG data, generates a DC component and an AC component of the DCT coefficient for each block using the quantization coefficient Q 3 of the latch 208, and stores them in the latch 212. At the same time, the JPEG data of the macro block at the same position of the subsequent I frame or P frame is read from the code memory 202, and the JPEG data of the macro block at the same position of the previous I frame or P frame is read from the code memory 203. The JPEG data read from the code memory 202 is decoded by the decoder 205, DCT DC components and AC components are generated for each block using the quantization coefficient Q 3 ′ of the latch 209, and stored in the latch 213. . The JPEG data read from the code memory 203 is decoded by the decoder 206, generates DCT DC components and AC components for each block using the quantization coefficient Q 3 ″ of the latch 210, and is stored in the latch 214. To do.
[0093]
Thereafter, the difference comparator 215 reads the DCT coefficient for each block from the latches 212, 213, and 214, obtains the difference for each DCT coefficient, and adds the absolute value. That is, the difference comparator 215 obtains the absolute value addition value BA1 to BA6 of the difference for each DCT coefficient of each block of the latch 212 and the latch 213. Further, FA6 is obtained from the added value FA1 of the absolute value of the difference for each DCT coefficient of each block of the latch 212 and the latch 214. Further, an average value for each DCT coefficient of each block of the latches 213 and 214 is obtained, and an addition value MA1 to MA6 of absolute values of differences from the respective coefficients of the latch 212 is obtained.
[0094]
If all the addition values FA1 to FA6 are 0, and the content of the latch 216 is “101” or “000”, the comparison subtractor 215 generates a code “101”.
If all the addition values BA1 to BA6 are 0 and the content of the latch 216 is “110” or “001”, the comparison subtractor 215 generates the code “110”.
If all the addition values MA1 to MA6 are 0 and the content of the latch 216 is “111” or “010”, the comparison subtractor 215 generates the code “111”.
[0095]
In other cases, the minimum value SA is selected from the addition value FA to which all the addition values FA1 to 6 are added, the addition value BA to which all the addition values BA1 to 6 are added, and the addition value MA to which all the addition values MA1 to 6 are added. select. That is, the minimum value SA is
SA = min (FA, BA, MA) (9)
It is expressed.
[0096]
After that, the minimum value SA is compared with a predetermined threshold value T5, and the minimum value SA is
T5> SA (10)
If the added value FA is minimum, the difference comparator 215 generates a code “000”. If the addition value BA is minimum, the difference comparator 215 generates a code “001”. If the added value MA is minimum, the difference comparator 215 generates a code “010”.
[0097]
Further, when none of the conditions of the expression (10) is satisfied, the difference comparator 215 generates a code “011”. The generated code is output to the selector 223.
[0098]
At the same time, the encoder 217, the encoder 218, the encoder 219, the data converter 220, and the encoder 221 perform the following operations.
[0099]
First, the encoder 221 generates macroblock header data. That is, a motion vector code is generated with the motion vector from the previous frame in time as (0, 0). At this time, the encoder 221 generates header data indicating that the macroblock to be encoded is encoded in the Forward Predictive mode, and inserts a motion vector code.
[0100]
The encoder 217 first converts the DCT coefficient of the macroblock to be encoded from the latch 212 into the DCT coefficient of the macroblock at the same position in the I frame or P frame temporally prior to the macroblock to be encoded from the latch 214. The quantization coefficient Q4 is read from the latch 211. The encoder 217 further reproduces a pixel value by performing inverse DCT conversion on the DCT coefficient of each block of the macro block of the latch 212. Subsequently, the DCT coefficient of each block of the macro block of the latch 214 is subjected to inverse DCT transform to reproduce the pixel value. Thereafter, a difference between the respective pixel values is obtained, DCT transformation is performed on the obtained difference value, and quantization is performed with a quantization coefficient Q4 to obtain a quantization result. Regarding the DC component, if the output code of the difference comparator 215 of the immediately preceding macroblock is “000”, then the DPCM is performed, otherwise the DPCM is newly initialized. A code is assigned to the quantization result of the AC component in accordance with the MPEG system.
[0101]
Also, the encoder 221 generates macroblock header data. That is, a motion vector code is generated with a motion vector from a temporally subsequent frame as (0, 0). At this time, the encoder 221 generates header data indicating that the macroblock to be encoded is encoded in the Backword Predictive mode, and inserts a motion vector code.
[0102]
The encoder 218 first reads the DCT coefficient of the macroblock to be encoded from the latch 212, and the macroblock at the same position in the I frame or the P frame later in time as the macroblock to be encoded from the latch 213. The DCT coefficient is read, and the quantization coefficient Q4 is read from the latch 211. The encoder 218 further performs inverse DCT conversion on the DCT coefficient of each block of the macro block of the latch 212 to reproduce a pixel value. Subsequently, the DCT coefficient of each block of the macro block of the latch 213 is subjected to inverse DCT transform to reproduce the pixel value. Thereafter, a difference between the respective pixel values is obtained, DCT transformation is performed on the obtained difference value, and quantization is performed with a quantization coefficient Q4 to obtain a quantization result. Regarding the DC component, if the output code of the difference comparator 215 of the immediately preceding macroblock is “001”, then the DPCM is performed, otherwise the DPCM is newly initialized. A code is assigned to the quantization result of the AC component in accordance with the MPEG system.
[0103]
Furthermore, the encoder 221 generates macroblock header data. That is, the motion vector code is generated with each motion vector from the previous and subsequent frames as (0, 0). At this time, the encoder 221 generates header data indicating that the macroblock to be encoded is encoded in the Bidirectional Predictive mode, and inserts both motion vector codes.
[0104]
The encoder 219 first reads the DCT coefficient of the macroblock to be encoded from the latch 212, and the macroblock at the same position in the I frame or P frame that is temporally later from the macroblock to be encoded from the latch 213. The DCT coefficient is read, the DCT coefficient of the macroblock at the same position in the previous I frame or P frame as the macroblock to be encoded is read from the latch 214, and the quantization coefficient Q4 is read from the latch 211. The encoder 219 further performs inverse DCT conversion on the DCT coefficient of each block of the macroblock of the latch 213 to reproduce a pixel value, and inverse DCT conversion of the DCT coefficient of each block of the macroblock of the latch 214. Reproduce. An average is obtained for each pixel value. Subsequently, the DCT coefficient of each block of the macro block of the latch 212 is subjected to inverse DCT transform to reproduce the pixel value. Thereafter, the difference between the pixel value and the average value is obtained for each pixel, the obtained difference value is subjected to DCT transform, and quantized with the quantization coefficient Q4 to obtain a quantization result. Regarding the DC component, if the output code of the difference comparator 215 of the immediately preceding macroblock is “010”, the DPCM is subsequently performed, otherwise the DPCM is newly initialized. A code is assigned to the quantization result of the AC component in accordance with the MPEG system.
[0105]
The JPEG data input to the data converter 220 is converted from JPEG data to MPEG data in the same manner as an intra frame macroblock.
[0106]
When the output code of the difference comparator 215 is “000”, if the content of the latch 216 is “101”, “110”, or “111”, the selector 223 outputs the content of the encoder 222, The output of the encoder 217 is input, output to the code buffer 224, and stored.
[0107]
When the output code of the difference comparator 215 is “001”, if the content of the latch 216 is “101”, “110”, or “111”, the selector 223 outputs the content of the encoder 222, The output of the encoder 218 is input, output to the code buffer 224, and stored.
[0108]
If the output code of the difference comparator 215 is “010” and the content of the latch 216 is “101”, “110” or “111”, the selector 223 outputs the content of the encoder 222, The output of the encoder 219 is input, output to the code buffer 224, and stored.
[0109]
When the output code of the difference comparator 215 is “011”, if the content of the latch 216 is “101”, “110”, or “111”, the selector 223 outputs the content of the encoder 222, The selector 223 receives the output of the data converter 220, outputs it to the code buffer 224, and stores it.
[0110]
When the output code of the difference comparator 215 is “101”, the result is input to the encoder 222. When this code is generated, MPEG encoded data is not generated, and the encoder 222 counts the number of consecutively generated codes “101” to generate a macroblock address increment code.
[0111]
When the output code of the difference comparator 215 is “110”, the result is input to the encoder 222. When this code is generated, MPEG encoded data is not generated, and the encoder 222 counts the number of consecutively generated codes “110” to generate a macroblock address increment code.
[0112]
When the output code of the difference comparator 215 is “111”, the result is input to the encoder 222. When this code is generated, MPEG encoded data is not generated, and the encoder 222 counts the number of consecutively generated codes “111” to generate a macroblock address increment code.
[0113]
When the macroblock processing is completed, the contents of the latch 216 are replaced with the output of the difference comparator 215.
[0114]
Thereafter, processing is performed in units of macroblocks, and when processing of one frame is completed, the contents of the code buffer 224 are transmitted and stored in the storage device 8 of FIG. 1 or output to the communication line 7 via the communication interface 6 To do. The transmitted code length is reported to the CPU 9. Thereafter, the code buffer 224 is cleared.
[0115]
Thereafter, each frame is encoded as an I frame or a P frame in a predetermined order to obtain a desired number of MPEG data. Thereafter, an end code such as a sequence end code determined by the MPEG method is generated by the encoder 221 and sent via the selector 223 via the code buffer 224, and all operations are completed.
[0116]
Next, an image encoded data conversion apparatus according to a third embodiment of the present invention will be described with reference to FIG.
The third embodiment of the present invention shows a case where data processing is performed using software in an arithmetic device, and FIG. 5 shows the configuration of an image encoded data conversion device according to the third embodiment of the present invention. FIG. 6 to FIG. 14 are flowcharts showing the procedure of image encoded data conversion according to the third embodiment of the present invention. In FIG. 5, the same components as those in FIG.
[0117]
In FIG. 5, reference numeral 301 denotes a CPU that controls the entire apparatus and converts Motion JPEG data into MPEG data. Reference numeral 302 denotes a program memory for storing software for data processing, and reference numeral 303 denotes a work memory for securing a work area for processing.
[0118]
For ease of explanation, it is assumed that the input Motion JPEG data has a sub-sampling ratio of 4: 1: 1. The MPEG GOP is composed of an I frame and a P frame.
[0119]
First, as shown in step S01 of FIG. 6, the CPU 301 reads a program for converting Motion JPEG data / MPEG data from the program memory 302 and starts execution.
[0120]
Next, as shown in step S <b> 02, a conversion result LUT (DC component conversion LUT) having the quantization multiple P <b> 3 and the DC component Huffman code as addresses is stored in the work memory 303.
[0121]
Next, as shown in step S <b> 03, a conversion result LUT (AC component conversion LUT) having the value of the quantization multiple P <b> 3 and the AC component Huffman code as addresses is stored in the work memory 303.
[0122]
Next, as shown in step S04, the header data of the frame of Motion JPEG data is read, the header data of JPEG data is analyzed, and image attributes such as image size are obtained.
[0123]
Next, as shown in step S05, the attribute as a moving image is added together with each attribute and default quantization table, and a sequence header and GOP header data of MPEG data are generated and output.
[0124]
Hereinafter, I frame conversion will be described.
First, as shown in step S09, it is determined whether the frame to be generated is an I frame or a P frame. If an I frame is to be generated, the process proceeds to step S10.
[0125]
Next, as shown in step S10, a quantization coefficient Q8 is obtained from the quantization table of JPEG encoded data using the JPEG default quantization table.
[0126]
Next, as shown in step S11, a quantization coefficient Q9 is determined for encoding control in the MPEG system.
[0127]
Next, as shown in step S12 of FIG. 7, a picture header indicating an I frame is generated.
[0128]
Next, as shown in step S <b> 14, Motion JPEG data for one macroblock is sequentially read from the storage device 1. The read Motion JPEG data is stored in the work memory 303 in units of macro blocks.
[0129]
If the input macroblock data is the left end of the frame as shown in step S15, the quantization coefficient Q9 is read out as shown in step S16, and a slice header is generated and output.
[0130]
Next, as shown in step S <b> 17, prior to processing the macroblock, macroblock header data representing encoding in the intra mode is generated and output.
[0131]
Next, as shown in step S18, JPEG data is processed in units of blocks. The quantization multiple P3 is obtained from the quantization coefficient Q8 and the quantization coefficient Q9 according to the following equation.
P3 = Q8 / Q9 (11)
[0132]
Next, as shown in step S20 of FIG. 8, conversion from JPEG data in the DC component to MPEG data is performed with reference to the DC component conversion LUT in the working memory 303 from the quantization multiple P3 and the Huffman code. The encoded data obtained by the conversion is output.
[0133]
For example, when the difference value D5 of the JPEG data of the direct current component of the luminance component is 20, the Huffman code is “11010100”. Here, if the quantization multiple P3 is 2.5, the difference value D6 of the output MPEG data is
D6 = D5 / P3 (12)
Is required.
[0134]
In this case, the difference value D6 is 4, and thus the Huffman code is converted to “100100”. The encoded data obtained by the conversion is temporarily stored in the work memory 303.
[0135]
Next, as shown in step S22, the conversion from the JPEG data to the MPEG data in the AC component is similarly performed by referring to the AC component conversion LUT in the working memory 303 from the quantization multiple P3 and the Huffman code. The encoded data obtained by the conversion is output.
[0136]
The quantization result R6 of the MPEG data after conversion from the quantization result R5 of the input JPEG data and the quantization multiple P3 is:
R6 = R5 / P3 (13)
Is required.
[0137]
For example, it is assumed that the Huffman code “1111111011111” indicating that the quantization multiple P3 is 7, the 0 run length is 5, and the quantization result R5 is 3 is input. The quantization result R6 at this time becomes 1 or less, but is rounded up to 1. Therefore, it is converted to a Huffman code “11110101” in which the 0 run length is 5 and the quantization result is 1.
[0138]
The conversion of the AC component as described above is continued until all AC components are completed as shown in Step S21, and when completed, the process returns to Step S19.
[0139]
Hereinafter, as shown in step S19, the processing is performed in units of macroblocks, and when the processing of one frame is completed, the processing moves to the next frame as shown in step S13 of FIG.
[0140]
In FIG. 5, if there is no next frame as shown in step S06, the moving picture has ended, so that a sequence end code is generated and output as shown in step S07, and the process goes to step S08. As shown, the process ends.
[0141]
Next, conversion of P frame data will be described.
First, as shown in step S09, it is determined whether the frame to be generated is an I frame or a P frame. If a P frame is to be generated, the process proceeds to step S23.
[0142]
Next, as shown in step S23, the quantization coefficient Q10 is obtained from the quantization table of JPEG encoded data using the JPEG default quantization table.
[0143]
Next, as shown in step S24, the quantization coefficient of the JPEG data of the previous frame (quantization coefficient Q8 described above if the previous frame is an I frame, quantization coefficient Q10 of the previous frame if the previous frame is P frame) is quantized. This is held as the conversion factor Q11.
[0144]
Next, as shown in step S25 of FIG. 9, a quantization coefficient Q12 is determined for encoding control.
[0145]
Next, as shown in step S26, a picture header indicating a P frame is generated.
[0146]
Next, as shown in step S <b> 28, Motion JPEG data for one macroblock is sequentially read from the storage device 1. The read Motion JPEG data is stored in the work memory 303 in units of macro blocks.
[0147]
If the input macroblock data is the left end of the frame as shown in step S29, the quantized coefficient Q12 is read out and a slice header is generated and output as shown in step S30.
[0148]
Subsequently, JPEG data is processed in macroblock units.
That is, as shown in step S32 of FIG. 10, the JPEG data is decoded, and the DCT DC component and AC component of each block are generated using the quantization coefficient Q10 and the JPEG default quantization table.
[0149]
Next, as shown in step S33, the JPEG data of the macroblock at the same position in the previous frame is read from the working memory 303 and decoded, and the DCT coefficient of each block using the quantization coefficient Q11 and the JPEG default quantization table. The direct current component and alternating current component of are generated.
[0150]
Next, as shown in step S34, a difference for each DCT coefficient is obtained for each block, and an absolute value is added. These processes are performed for all six blocks, and when the process is completed, the process proceeds to step S35. Note that the addition results are AA1 to AA6 in the order of blocks.
[0151]
If all the added values AA1 to AA6 are 0 as shown in step S35, that is,
AAi = 0 (i = 1 to 6) (14)
Is a macro block in which no code is generated with the motion vector (0, 0).
[0152]
In this case, as shown in step S36, if the encoding mode of the immediately preceding macroblock is the Predictive mode, a skip process is performed.
[0153]
That is, skip macroblocks are counted as shown in step S37.
[0154]
If the encoding mode of the immediately preceding macroblock is not Predictive mode as shown in Step S36, it is encoded in the Predictive mode of the motion vector (0, 0) as shown in Step S53 of FIG. A macro block header representing is output.
[0155]
Furthermore, as shown in step S54, the count value of the macroblock to be skipped is set to zero.
[0156]
If the block addition values AA1 to AA6 are not all 0 as shown in step S35 of FIG. 10, the addition values AA1 to AA6 are compared with a predetermined threshold T3 as shown in step S38 of FIG. And for all added values,
T3>AAi> 0 (i = 1 to 6) (15)
If so, a code in Predictive mode is generated.
[0157]
Next, as shown in step S39, macroblock header data indicating that encoding is performed in the predictive mode is generated. In this header data, a code representing the motion vector (0, 0) and a code representing the position of the block whose added values AA1 to AA6 are not 0 are generated and output in the macroblock header.
[0158]
Next, as shown in step S41, the DCT coefficient of the block in which the addition value AAi (i = 1 to 6) of the frame to be encoded is not 0 is subjected to inverse DCT transform to reproduce the pixel value.
[0159]
Next, as shown in step S42, the pixel value is reproduced by performing inverse DCT conversion on the DCT coefficient of the block at the same position of the frame immediately before encoding, in which the addition value AAi (i = 1 to 6) is not 0. To do.
[0160]
Thereafter, as shown in step S43, the difference between the pixel values is obtained.
[0161]
Next, as shown in step S44, the obtained difference value is subjected to DCT transformation and quantized with a quantization coefficient Q12 to obtain a quantization result. The above processing is performed for all the blocks as shown in step S40, and when finished, the process proceeds to step S45.
[0162]
As shown in step S45 of FIG. 12, for the DC component, if the immediately preceding macroblock is encoded in the predictive mode, DPCM is performed as shown in step S46, and encoding is performed using the MPEG code. ,Output. Also, if the mode is the previous macroblock mode Intra mode or if it is the leftmost macroblock, the DPCM is newly initialized as shown in step S47, and the DC component is encoded as shown in step S48. Do.
[0163]
Next, as shown in step S49, the AC component quantization result is assigned a code in accordance with the MPEG system and is output.
[0164]
Next, as shown in step S50, the encoding of the direct current component in step S51 and the encoding of the alternating current component in step S52 are performed for all the blocks, and when finished, the process returns to step S27.
[0165]
Also, as shown in step S38 of FIG. 11, if even one of the conditions of equation (15) is not satisfied, it is converted into an intra mode code and output.
[0166]
If the previous macroblock has been skipped prior to conversion, it is output as a macroblock address increment code corresponding to the count value, as shown in step S55.
[0167]
For details of the conversion, the same processing as the conversion processing of the macroblock of the I frame in steps S56 to S61 in FIG. 14 is performed.
[0168]
Thereafter, processing is performed in units of macroblocks, and when processing for one frame is completed as shown in step S06 of FIG. 6, the processing for the next frame is performed.
[0169]
If there is no next frame, the moving image is completed, so that a sequence end code is generated and output as shown in step S07, and the process is ended as shown in step S08.
[0170]
In this embodiment, the MPEG encoding method has been described as an example. Even in the H.261 encoding system, the configuration of this embodiment is the same as that of H.264. The present invention can be applied by substituting one suitable for the code of H.261. Further, the case where an MPEG GOP is composed of an I frame and a P frame has been described. However, the present invention may be applied to conversion to an MPEG system in which a B frame is introduced. Further, in this embodiment, when performing the macroblock conversion process of the I frame, steps S56 to S61 in FIG. 14 are used. However, the present invention is not limited to this, and other processes may be used.
[0171]
In addition, as an example of moving image encoding, MPEG and H.264 are used. Although the H.261 method is taken as an example, the moving image encoding method is not limited to this, and any encoding that performs motion compensation may be used. Further, the example of the image sampling of 4: 1: 1 has been described as an example, but even when 4: 4: 4 or 4: 2: 2 is input, only the chromaticity component is reproduced and sub-sampled before being encoded. It ’s fine.
[0172]
【The invention's effect】
As described above, according to the present invention, the first intra-frame encoded data that has been intra-frame encoded by the first encoding scheme is converted into the second frame and the inter-frame of the second encoding scheme. The data can be efficiently converted into encoded data, and the amount of data can be greatly reduced.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of an image encoded data conversion apparatus according to an embodiment of the present invention.
FIG. 2 is a block diagram showing a configuration of a data conversion unit according to the first embodiment of the present invention.
FIG. 3 is a block diagram showing a configuration of a data converter according to an embodiment of the present invention.
FIG. 4 is a block diagram illustrating a configuration of a data conversion unit according to a second embodiment of the present invention.
FIG. 5 is a block diagram showing a configuration of an image encoded data conversion apparatus according to a third embodiment of the present invention.
FIG. 6 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 7 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 8 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 9 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 10 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 11 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 12 is a flowchart showing the procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 13 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
FIG. 14 is a flowchart showing a procedure of image encoded data conversion according to the third embodiment of the present invention.
[Explanation of symbols]
1, 8 Storage device
2 JPEG decoder
3 frame memory
4 display
5 Data converter
6 Communication interface
7 Communication line
9, 301 CPU
10 Input device
101, 115, 201, 224 Code buffer
102, 202, 203 Code memory
103, 204, 205, 206 Decoder
104, 105, 106, 107, 108, 117, 208, 209, 210, 211, 212, 213, 214, 216 Latch
109,215 Difference comparator
110, 112, 113, 217, 218, 219, 221, 222 Encoder
111, 220 Data converter
114, 151, 155, 223 selector
116, 207 Header analyzer
150 calculator
152 Macroblock header generator
153 DC converter
154 AC converter
302 program memory
303 Working memory

Claims (1)

ブロック毎に第1の符号化方式でフレーム内符号化された第1のフレーム内符号化データを入力する入力工程と、
前記第1のフレーム内符号化データを、復号することなくルックアップテーブルによって前記第1の符号化方式とは異なる第2の符号化方式で第2のフレーム内符号化データに、前記ブロックを複数集めたマクロブロック単位で変換する第1のデータ変換工程と、
前記第1のフレーム内符号化データを復号化し、その復号された画像データを前記第2符号化方式のフレーム間相関によるフレーム間符号化データに、前記マクロブロック単位で変換する第2のデータ変換工程と、
前記第1のフレーム内符号化データを復号することによって得られた第1の直交変換係数データと、前フレーム又は後フレームの第2の直交変換係数データとを、前記マクロブロック単位で比較する比較工程と、
前記比較工程での比較結果に応じて、前記第2のフレーム内符号化データ及び該第2のフレーム内符号化データの前にスキップするマクロブロック数を示すマクロブロックアドレスインクリメント符号を出力する第1の処理と、前記フレーム間符号化データ及び該フレーム間符号化データの前にスキップするマクロブロック数を示すマクロブロックアドレスインクリメント符号を出力する第2の処理と、前記符号化データを出力しない第3の処理とを選択する選択工程とを有し、
前記選択工程では、前記比較工程での比較結果に応じて、データ差が第1所定値より大きい場合に前記第1の処理を選択し、前記データ差が前記第1所定値以下で第2所定値より大きい場合に前記第2の処理を選択し、前記データ差が前記第2所定値以下の場合に前記第3の処理を選択することを特徴とする画像処理方法。
An input step of inputting first intra-frame encoded data that is intra-frame encoded by the first encoding method for each block;
The first intra-frame encoded data is decoded into a second intra-frame encoded data in a second encoding scheme different from the first encoding scheme by a lookup table without decoding. A first data conversion step of converting in units of collected macroblocks;
Decoding the first intra-frame coded data, the inter-coded data and the decoded image data by inter-frame correlation of the second encoding method, the second that converts in the macroblock A data conversion process;
Comparison in which the first orthogonal transform coefficient data obtained by decoding the first intra-frame encoded data and the second orthogonal transform coefficient data of the previous frame or the subsequent frame are compared in units of the macroblock. Process,
A first macroblock address increment code indicating the number of macroblocks to be skipped before the second intra-frame encoded data and the second intra-frame encoded data is output according to the comparison result in the comparison step. A second process for outputting the inter-frame encoded data and a macro block address increment code indicating the number of macro blocks to be skipped before the inter-frame encoded data; and a third process for not outputting the encoded data. And a selection step for selecting the processing of
In the selection step, the first process is selected when the data difference is larger than a first predetermined value according to the comparison result in the comparison step. image processing method characterized by selecting the second processing when the value is greater than said data difference selects the third process if: the second predetermined value.
JP20781294A 1994-08-31 1994-08-31 Image processing method Expired - Fee Related JP3715664B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20781294A JP3715664B2 (en) 1994-08-31 1994-08-31 Image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20781294A JP3715664B2 (en) 1994-08-31 1994-08-31 Image processing method

Publications (2)

Publication Number Publication Date
JPH0879741A JPH0879741A (en) 1996-03-22
JP3715664B2 true JP3715664B2 (en) 2005-11-09

Family

ID=16545916

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20781294A Expired - Fee Related JP3715664B2 (en) 1994-08-31 1994-08-31 Image processing method

Country Status (1)

Country Link
JP (1) JP3715664B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008118693A (en) * 1997-11-05 2008-05-22 Sony Corp Digital signal conversion method and digital signal conversion apparatus
JP4672594B2 (en) * 2006-05-11 2011-04-20 日本電信電話株式会社 Encoded stream re-encoding method, encoded stream re-encoding device, encoded stream restoring method, encoded stream restoring device, encoded stream re-encoding program, encoded stream restoring program, and computer-readable recording of these programs Possible recording media
JP2008153771A (en) * 2006-12-14 2008-07-03 Mitsubishi Electric Corp Image coding method converter
JP5226089B2 (en) * 2011-01-06 2013-07-03 三菱電機株式会社 Image coding method converter

Also Published As

Publication number Publication date
JPH0879741A (en) 1996-03-22

Similar Documents

Publication Publication Date Title
JP4376302B1 (en) Moving picture decoding method and apparatus
KR101473278B1 (en) Image prediction encoding device, image prediction decoding device, image prediction encoding method, image prediction decoding method, image prediction encoding program, and image prediction decoding program
US20030095603A1 (en) Reduced-complexity video decoding using larger pixel-grid motion compensation
KR101090586B1 (en) Encoding/decoding device, encoding/decoding method and recording medium
JP2002532029A (en) Efficient macroblock header coding for video compression
JP3651941B2 (en) Image playback device
US20040013399A1 (en) Information processing method and apparatus
JP2004128749A (en) Moving picture encoding method and decoding method
JPH10322696A (en) Signal encoding device, signal encoding method, signal recording medium, and signal transmission method
JPH0818979A (en) Image processing device
US7346108B2 (en) Encoded-data converting apparatus and method for the same
US7933335B2 (en) Moving picture conversion apparatus
JP3715664B2 (en) Image processing method
WO2025157062A1 (en) Reference block searching method and circuit, chip, and device
JP3257052B2 (en) Highly efficient image signal encoding apparatus and method
JP2002344973A (en) Method for converting size of image coding data, transmission method for image coding data and image coding data size converter
JP3141149B2 (en) Image coding device
JP3690259B2 (en) High-speed moving image encoding apparatus and high-speed moving image encoding method
JP3240737B2 (en) Image signal encoding method and apparatus, decoding method and apparatus
JPH0984011A (en) Video coding system converter
JP4100067B2 (en) Image information conversion method and image information conversion apparatus
JPH11155147A (en) Image reproduction method, image encoding device, and image encoding method
JP5533885B2 (en) Moving picture encoding apparatus and moving picture decoding apparatus
JP3428549B2 (en) Video compression device
JP3188081B2 (en) Image encoding method and image encoding device

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050719

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050826

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090902

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090902

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100902

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110902

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110902

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120902

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120902

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130902

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees