JP2004088157A - Data conversion method, data converter circuit, and data conversion program - Google Patents
Data conversion method, data converter circuit, and data conversion program Download PDFInfo
- Publication number
- JP2004088157A JP2004088157A JP2002242471A JP2002242471A JP2004088157A JP 2004088157 A JP2004088157 A JP 2004088157A JP 2002242471 A JP2002242471 A JP 2002242471A JP 2002242471 A JP2002242471 A JP 2002242471A JP 2004088157 A JP2004088157 A JP 2004088157A
- Authority
- JP
- Japan
- Prior art keywords
- data
- conversion
- bit
- converted
- output
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Landscapes
- Picture Signal Circuits (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、入力データを変換して出力データを生成するデータ変換方法、データ変換回路及びデータ変換プログラムに関し、特に、入力データをガンマ変換して出力データを生成するデータ変換方法等に関する。
【0002】
【従来の技術】
一般に、CRT等の受像管において、駆動電圧Eとカソード電流Iとの間には、次式で表すような関係が存在する。
I=KEγ
この関係はガンマ(γ)特性と呼ばれる。ガンマの値は一般に1.6〜3程度であるので、カソード電流Iは駆動電圧Eに対して非直線性を有する。受像管においてγ=1とすることは困難なので、送像側にガンマ補正回路を設けて総合的にγ=1とすることが行われている。本願においては、このようなガンマ補正のために画像信号に対して行う変換のことをガンマ変換という。
【0003】
画像読み取り装置や画像表示装置等に用いられる画像処理LSI等において、画像データのガンマ変換が行われる。ガンマ変換は、入力をx、出力をyとすると、次式によって表される。
【数1】
【0004】
図25に、γ=1.8とした場合の式(1)のグラフを示す。ガンマ変換は、このようにべき関数であるため、その演算には多くの時間が必要である。ところが、ガンマ変換は、画像読み取り装置等の高速動作のために、高速に行われることが要求される。そのため、従来より、入力データに対応する変換データを有する変換テーブルをSRAM等の高速記憶素子に格納し、入力データに対応する変換データを変換テーブルから読み出すことが行われている。図26は、このような従来のガンマ変換回路を示す図である。図26に示すように、従来のガンマ変換回路100は、入力データに対応する変換データを有する変換テーブルを格納する変換テーブル格納部101を具備しており、入力データに対応する変換データを出力する。ここで、変換テーブル格納部101は、SRAM等の高速記憶素子によって構成される。
【0005】
ガンマ変換回路100においては、例えば、入力データが12ビットのデータであり、出力データが8ビットのデータである場合には、変換テーブルのサイズは、4096ワード(ここでは、1ワード=8ビット)となり、変換テーブル格納部101の記憶容量も4096ワード必要となる。また、入力データが16ビットのデータであり、出力データが12ビットのデータである場合には、変換テーブルのサイズは、65536ワード(ここでは、1ワード=12ビット)となり、変換テーブル格納部101の記憶容量も65536ワード必要となる。このように大きなサイズの変換テーブルを格納するための大容量のSRAMを画像処理LSIに集積することは、極めて困難である。また、このような大容量のSRAMを画像処理LSIに集積できた場合であっても、画像処理LSIの大幅なコストアップを招くこととなる。
【0006】
また、変換テーブルを小さくするため、所定間隔(例えば、16)毎の入力データに対応する変換データを有する変換テーブルをSRAM等に格納し、対応する変換データが変換テーブルに格納されている入力データが入力された場合には該変換データを出力し、対応する変換データが変換テーブルに格納されていない入力データが入力された場合には、該入力データの前後の入力データであって対応する変換データが変換テーブルに格納されている入力データに対応する変換データに補間処理を行って得られたデータを出力することが行われている。図27は、このような従来のガンマ変換回路を示す図である。図27に示すように、従来のガンマ変換回路110は、所定間隔毎の入力データに対応する変換データを有する変換テーブルを格納する変換テーブル格納部111及び変換テーブル格納部111の出力データに補間処理を行う補間処理部112を具備している。ここで、変換テーブル格納部111は、SRAM等の高速記憶素子によって構成される。
【0007】
ガンマ変換回路110においては、例えば、入力データが12ビットのデータであり、出力データが8ビットのデータであり、対応する変換データが格納される入力データの間隔が16である場合には、変換テーブルのサイズは、256ワード(ここでは、1ワード=8ビット)となり、変換テーブル格納部111に必要とされる記憶容量も256ワードに低減される。また、入力データが16ビットのデータであり、出力データが12ビットのデータで、入力データの間隔が16である場合には、変換テーブルのサイズは、4096ワード(ここでは、1ワード=12ビット)となり、変換テーブル格納部111に必要とされる記憶容量も4096ワードに低減される。
【0008】
【発明が解決しようとする課題】
しかしながら、ガンマ変換回路110の出力データは、補間処理により算出されるため、誤差を有することとなる。図28は、入力データが16ビットのデータであり、出力データが16ビットのデータであり、対応する変換データが格納される入力データの間隔が16であるとした場合におけるガンマ変換回路110の出力データと式(1)により算出される値との誤差を示す図である。図28に示すように、ガンマ変換回路110の出力データは、最大で約130の誤差を有する。
【0009】
そこで、上記の点に鑑み、本発明は、変換データを格納する回路の記憶容量を小さくすると共に、出力データの誤差を小さくすることができるデータ変換方法、データ変換回路及びデータ変換プログラムを提供することを目的とする。
【0010】
【課題を解決するための手段】
以上の課題を解決するため、本発明の第1の観点に係るデータ変換方法は、入力データを変換して出力データを生成するデータ変換方法であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(c)において求められた第2のデータに対応する第2の変換データを読み出すステップ(d)と、第1の変換データと第2の変換データとに基づいて出力データを生成するステップ(e)とを具備する。
【0011】
ここで、ステップ(e)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、ステップ(d)が、第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(e)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、ステップ(c)が、入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより第2のデータを求めるようにしても良い。
【0012】
また、本発明の第2の観点に係るデータ変換方法は、入力データを変換して出力データを生成するデータ変換方法であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、第2のデータに所定の操作を施すことにより第3のデータを求めるステップ(d)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(d)において求められた第3のデータに対応する第2の変換データを読み出すステップ(e)と、第1の変換データと第2の変換データとに基づいて出力データを生成するステップ(f)とを具備する。
【0013】
ここで、ステップ(f)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、ステップ(e)が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(f)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、ステップ(d)が、第i群に属するデータの数をViとしたときにV0≦V1≦…≦VNとなるように、第2のデータ0〜(2p−1)をN群に分割することにより第3のデータを求めるようにしても良い。
【0014】
さらに、本発明の第3の観点に係るデータ変換方法は、入力データを変換して出力データを生成するデータ変換方法であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、pビット幅の第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求めるステップ(d)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(d)において求められた第3のデータに対応する第2の変換データを読み出すステップ(e)と、第1の変換データと第2の変換データとに基づいて出力データを生成するステップ(f)とを具備する。
【0015】
ここで、ステップ(f)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、ステップ(e)が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(f)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。
【0016】
以上において、補間処理が線形補間処理であることとしても良いし、第1の変換が、2−Kをガンマ変換し、第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換するすることとしても良い。
【0017】
本発明の第1の観点に係るデータ変換回路は、入力データを変換して出力データを生成するデータ変換回路であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、第3の手段が求めた第2のデータに対応する第2の変換データを読み出す第4の手段と、第1の変換データと第2の変換データとに基づいて出力データを生成する第5の手段とを具備する。
【0018】
ここで、第5の手段が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、第4の手段が、第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、第5の手段が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、第3の手段が、入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより第2のデータを求めるようにしても良い。
【0019】
また、本発明の第2の観点に係るデータ変換回路は、入力データを変換して出力データを生成するデータ変換回路であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、第2のデータに所定の操作を施すことにより第3のデータを求める第4の手段と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、第4の手段が求めた第3のデータに対応する第2の変換データを読み出す第5の手段と、第1の変換データと第2の変換データとに基づいて出力データを生成する第6の手段とを具備する。
【0020】
ここで、第6の手段が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、第5の手段が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、第6の手段が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、第4の手段が、第i群に属するデータの数をViとしたときにV0≦V1≦…≦VNとなるように、第2のデータ0〜(2p−1)をN群に分割することにより第3のデータを求めるようにしても良い。
【0021】
さらに、本発明の第3の観点に係るデータ変換回路は、入力データを変換して出力データを生成するデータ変換回路であって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、pビット幅の第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求める第4の手段と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、第4の手段が求めた第3のデータに対応する第2の変換データを読み出す第5の手段と、第1の変換データと第2の変換データとに基づいて出力データを生成する第6の手段とを具備する。
【0022】
ここで、第6の手段が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、第5の手段が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、第6の手段が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。
【0023】
以上において、補間処理が線形補間処理であることとしても良いし、第1の変換が、2−Kをガンマ変換し、第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換することとしても良い。
【0024】
本発明の第1の観点に係るデータ変換プログラムは、入力データを変換して出力データを生成するデータ変換プログラムであって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、手順(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(c)において求められた第2のデータに対応する第2の変換データを読み出す手順(d)と、第1の変換データと第2の変換データとに基づいて出力データを生成する手順(e)とを具備する。
【0025】
ここで、手順(e)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、手順(d)が、第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(e)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、手順(c)が、入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより第2のデータを求めることとしても良い。
【0026】
また、本発明の第2の観点に係るデータ変換プログラムは、入力データを変換して出力データを生成するデータ変換プログラムであって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、第2のデータに所定の操作を施すことにより第3のデータを求める手順(d)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(d)において求められた第3のデータに対応する第2の変換データを読み出す手順(e)と、第1の変換データと第2の変換データとに基づいて出力データを生成する手順(f)とを具備する。
【0027】
ここで、手順(f)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、手順(e)が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(f)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。また、手順(d)が、第i群に属するデータの数をViとしたときにV0≦V1≦…≦VNとなるように、第2のデータ0〜(2p−1)をN群に分割することにより第3のデータを求めるようにしても良い。
【0028】
さらに、本発明の第3の観点に係るデータ変換プログラムは、入力データを変換して出力データを生成するデータ変換プログラムであって、nビット幅の入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、手順(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、pビット幅の第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求める手順(d)と、予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(d)において求められた第3のデータに対応する第2の変換データを読み出す手順(e)と、第1の変換データと第2の変換データとに基づいて出力データを生成する手順(f)とを具備する。
【0029】
ここで、手順(f)が、第1の変換データに第2の変換データを乗ずることにより出力データを生成しても良いし、手順(e)が、第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(f)が、第2及び第3の変換データに基づいて補間処理をしたデータに第1の変換データを乗ずることにより出力データを生成しても良い。
【0030】
以上において、補間処理が線形補間処理であることとしても良いし、第1の変換が、2−Kをガンマ変換し、第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換することとしても良い。
【0031】
本発明によれば、変換データを格納する回路の記憶容量を小さくすると共に、出力データの誤差を小さくすることができる。
【0032】
【発明の実施の形態】
以下、図面に基づいて本発明の実施の形態について説明する。なお、同一の構成要素には同一の参照番号を付して、説明を省略する。
図1は、本発明の第1の実施形態に係るデータ変換回路の構成を示す図である。本実施形態は、本発明をガンマ変換回路に適用したものである。本実施形態においては、入力データは16ビット幅であり、出力データは12ビット幅であるものとする。
図1において、ガンマ変換回路10は、プライオリティエンコーダ11と、減算器12と、変換テーブル格納部13と、シフタ14と、ビット抽出部15と、テーブルアドレス作成部16と、補間用変換テーブル格納部17と、マルチプレクサ18と、乗算器19と、線形補間部20とを具備している。また、線形補間部20は、レジスタ21と、減算器22と、乗算器23と、シフタ24と、加算器25とを含んでいる。
【0033】
プライオリティエンコーダ11は、16ビット幅の入力データを入力し、入力データ中の最上位に位置する「1」のビットを検出し、検出したビットのビット番号を4ビット幅のLデータとして出力する。なお、一般に、ビット番号は、最下位ビットを0とし、上位ビットに向かってカウントする。本実施形態においては、一般にならい、最下位ビットのビット番号を0とし、最上位ビットのビット番号を15とする。例えば、プライオリティエンコーダ11は、入力データが「16’h0001」(ここで、「16’」は16ビット幅のデータであることを示し、「h」は16進表示であることを示し、「0001」は入力データの値を示す)の場合には、「4’h0」(ここで、「4’」は4ビット幅のデータであることを示し、「h」は16進表示であることを示し、「0」はLデータの値を示す)のLデータを出力し、入力データが「16’h0002」の場合には、「4’h1」のLデータを出力し、入力データが「16’h0003」の場合には、「4’h1」のLデータを出力する。また、プライオリティエンコーダ11は、入力データ中に「1」のビットがない場合、すなわち入力データが「16’h0000」である場合には、「4’h0」のLデータを出力すると共に、ハイレベルのzero信号を出力する。
【0034】
減算器12は、「4’hf」からLデータを減じて4ビット幅のKデータとして出力する。例えば、減算器12は、Lデータが「4’h3」である場合には、「4’hc」のKデータを出力する。あるいは、16ビット幅の入力データをデコードすることで、直接4ビット幅のKデータを作成しても良い。
【0035】
変換テーブル格納部13は、Kデータをテーブルアドレスとし、2−Kをガンマ変換した12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
【0036】
シフタ14は、入力データを減算器の出力するKデータの値分だけ左シフトしてMデータを出力する。例えば、入力データが「16’h0008」である場合には、入力データ「16’h0008」をKデータ「4’hc」だけ左シフトした「16’h8000」のMデータを出力し、入力データが「16’h000a」である場合には、入力データ「16’h000a」をKデータ「4’hc」だけ左シフトした「16’ha000」のMデータを出力する。
【0037】
ビット抽出部15は、Mデータを入力し、ビット番号14,13の2ビットをNデータとして出力する。例えば、ビット抽出部15は、Mデータが「16’h8000」である場合には、「2’b00」(ここで、「2’」は2ビット幅のデータであることを示し、「b」は2進表示であることを示し、「00」はデータの値を示す)のNデータを出力し、Mデータが「16’ha000」である場合には、「2’b01」のNデータを出力する。あるいは、16ビット幅の入力データをデコードすることで、直接2ビット幅のNデータを作成しても良い。
【0038】
また、ビット抽出部15は、Mデータ中のビット番号12〜0の13ビットを16ビット幅にゼロ拡張したPデータを乗算器23に出力する。例えば、ビット抽出部15は、Mデータが「16’h8001」である場合に、Mデータの下位13ビットの上位に3ビットの0を付加した「16’h0001」をPデータとして乗算器23に出力する。また、例えば、ビット抽出部15は、Mデータが「16’h8003」である場合に、Mデータの下位13ビットである「13’b0000000000011」の上位に3ビットの0を付加した「16’h0003」をPデータとして乗算器23に出力する。
【0039】
テーブルアドレス作成部16は、入力した2ビット幅のNデータを第1のテーブルアドレスとして出力し、所定時間経過後に、Nデータをインクリメント(又はデクリメント)した第2のテーブルアドレスを出力する。例えば、テーブルアドレス作成部16は、Nデータが「2’b00」である場合には、「2’b00」を第1のテーブルアドレスとして出力し、所定時間経過後に、「2’b01」を第2のテーブルアドレスとして出力する。
【0040】
補間用変換テーブル格納部17は、Nデータの上位に「1」、下位に「13’b0000000000000」を付加した16ビット幅のデータをガンマ変換した12ビット幅の補間用変換データをテーブルアドレスに対応させた補間用変換テーブルを格納しており、第1及び第2のテーブルアドレスに応じて第1及び第2の補間用変換データを出力する。
【0041】
図2は、入力データ、Lデータ、Mデータ、Nデータ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。図2において、y00は、入力データ「16’h0001」に対応するNデータ「2’b00」の上位に「1」、下位に「13’b0000000000000」を付加したデータをガンマ変換した12ビット幅のデータであり、y10は、入力データ「16’h0003」に対応するNデータ「2’b10」の上位に「1」、下位に「13’b0000000000000」を付加したデータをガンマ変換した12ビット幅のデータであり、y01は、入力データ「16’h0005」に対応するNデータ「2’b01」の上位に「1」、下位に「13’b0000000000000」を付加したデータをガンマ変換した12ビット幅のデータであり、y11は、入力データ「16’h0007」に対応するNデータ「2’b11」の上位に「1」、下位に「13’b0000000000000」を付加したデータをガンマ変換した12ビット幅のデータである。
【0042】
図2に示すように、例えば、入力データが「16’h0001」の場合に、テーブルアドレスは、「2’b00」となり、入力データが「16’h0002」の場合にも、テーブルアドレスは、「2’b00」となる。この場合、補間用変換テーブル格納部17は、入力データ「16’h0001」に対応するNデータ「2’b00」を16ビット幅にゼロ拡張し、ビット番号2のビットを「1」とし、13ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データy00をテーブルアドレス「2’b00」に対応させて格納し、入力データ「16’h0002」に対応するNデータ「2’b00」を16ビット幅にゼロ拡張し、ビット番号2のビットを「1」とし、13ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データy00は格納しない。このように、複数の入力データから同一のテーブルアドレスが生成される場合には、補間用変換テーブル格納部17は、複数の入力データの内の最小の入力データに対応するNデータを16ビット幅にゼロ拡張し、ビット番号2のビットを「1」とし、13ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データのみを格納する。
【0043】
図3は、入力データ、テーブルアドレス、及び、補間用変換データの対応を示す図である。図2において、対応する補間用変換データが補間用変換テーブル格納部17に格納されない入力データの表示は、図3においては省かれている。図2に示すように、入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、補間用変換データは、y00,y10,y01,y11の4データとなる。従って、補間用変換テーブル格納部17は、4ワード(ここでは、1ワード=12ビット)の記憶容量を有すれば良いこととなる。
【0044】
即ち、図3に示すように、補間用変換テーブル格納部17は、入力データ「16’h0001」、「16’h0003」、「16’h0005」、「16’h0007」にそれぞれ対応する補間用変換データy00、y10、y01、及び、y11を格納する。
【0045】
再び図1を参照すると、マルチプレクサ18は、zero信号がハイレベルの場合には「0」を選択して出力し、zero信号がローレベルの場合には変換テーブル格納部17が出力する変換データを選択して出力する。
【0046】
線形補間部20は、変換テーブル格納部17が出力する第1及び第2の変換データに対して線形補間処理を行う。
レジスタ21は、マルチプレクサ18が出力する第1の変換データを所定の時間保持する。
減算器22は、マルチプレクサ18が出力する第2の変換データからレジスタ21が出力する第1の変換データを減じて出力する。
乗算器23は、減算器22の出力データにPデータを乗じて出力する。
【0047】
シフタ24は、乗算器23の出力データを「4’hd」(13ビット)だけ右シフトして出力する。
加算器25は、シフタ24の出力データをレジスタ21の出力データに加えて出力する。
【0048】
変換テーブル格納部13は、Kデータをテーブルアドレスとし、2−K/γを表わす12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
【0049】
図4は、入力データ、Lデータ、Kデータ(テーブルアドレス)、及び、変換データの対応を示す図である。図4において、yFは、入力データ「16’h0001」に対応するKデータ「4’hf」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yEは、入力データ「16’h0002」に対応するKデータ「4’he」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yDは、入力データ「16’h0004」に対応するKデータ「4’hd」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yCは、入力データ「16’h0008」に対応するKデータ「4’hc」を用いて2−K/γを計算することにより求めた12ビット幅のデータである。また、yBは、入力データ「16’h0010」に対応するKデータ「4’hb」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yAは、入力データ「16’h0020」に対応するKデータ「4’ha」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、y0は、入力データ「16’h8000」に対応するKデータ「4’h0」を用いて2−K/γを計算することにより求めた12ビット幅のデータである。
【0050】
図4に示すように、例えば、入力データが「16’h0002」の場合に、テーブルアドレスは、「4’he」となり、入力データが「16’h0003」の場合にも、テーブルアドレスは、「4’he」となる。この場合、変換テーブル格納部17は、入力データ「16’h0002」に対応するKデータ「4’he」を用いて2−K/γを計算することにより求めた変換データyEをテーブルアドレス「4’he」に対応させて格納し、入力データ「16’h0003」に対応するKデータ「4’he」を用いて求めた変換データyEは格納しない。このように、複数の入力データから同一のテーブルアドレスが生成される場合には、変換テーブル格納部13は、複数の入力データの内の最小の入力データに対応するKデータを用いて求めた変換データのみを格納する。
【0051】
図5は、入力データ、テーブルアドレス、及び、変換データの対応を示す図である。図4において対応する変換データが変換テーブル格納部13に格納されていない入力データの表示は、図5においては省かれている。図4に示すように、入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、変換データは、yF、yE、yD、yC、yB、yA、y9、y8、y7、y6、y5、y4、y3、y2、y1、y0の16データとなる。従って、変換テーブル格納部13は、16ワード(ここでは、1ワード=12ビット)の記憶容量を有すれば良いこととなる。
【0052】
即ち、図5に示すように、変換テーブル格納部13は、入力データ「16’h0001」、「16’h0002」、「16’h0004」、「16’h0008」、「16’h0010」、「16’h0020」、「16’h0040」、「16’h0080」、「16’h0100」、「16’h0200」、「16’h0400」、「16’h0800」、「16’h1000」、「16’h2000」、「16’h4000」、「16’h8000」にそれぞれ対応する変換データyF、yE、yD、yC、yB、yA、y9、y8、y7、y6、y5、y4、y3、y2、y1、及び、y0を格納する。
【0053】
再び図1を参照すると、乗算器19は、変換テーブル格納部13の出力データに線形補間部20の出力データを乗じ、出力データ(ガンマ変換データ)として出力する。
【0054】
次に、ガンマ変換回路10が行う処理の原理について、式(2)及び式(3)を参照しながら説明する。
【数2】
式(2)において、nは入力データxのビット数を示し、本実施形態においてはn=16である。
【数3】
式(3)は、上位kビットが0の場合を示している。式(3)に示すように、入力データxに対応する変換データyはz1/γの項と2−k/γの項とに分けることができるので、zと2−kの変換データを用いて変換データyを算出する。zは、入力データxを左にkビットシフトして上位にある0を除いたもので、最上位は「1」である。ここで、すべてのzの値に対応する変換データをテーブルに用意しても良いし、本実施形態において説明するように、代表的なzの値に対応する変換データのみを用意しておき、残りを補間により求めても良い。
【0055】
次に、線形補間部20が行うz1/γの項の線形補間処理について図6を参照しながら説明する。図6は、線形補間部20が行う線形補間処理の原理を示す図である。図6に示すように、線形補間部20は、入力データxLに対応する変換データyLを、次式によって算出することができる。
【数4】
【0056】
次に、ガンマ変換回路10におけるガンマ変換処理について、図1、図7、及び、図8を参照しながら説明する。図7は、ガンマ変換回路のガンマ変換処理を示すフローチャートであり、図8は、ガンマ変換回路の線形補間部の線形補間処理を示すフローチャートである。
【0057】
図7及び図8の処理を開始すると、プライオリティエンコーダ11は、入力データを入力し、Lデータを出力する(ステップS101)。
次に、減算器12は、Lデータを入力し、Kデータを出力する(ステップS102)。
次に、シフタ14は、入力データ及びKデータを入力し、Mデータを出力する(ステップS103)。
次に、ビット抽出部15は、Mデータを入力し、Nデータ及びPデータを出力する(ステップS104)。
次に、テーブルアドレス作成部16は、Nデータを入力し、第1のテーブルアドレスを出力する(ステップS105)。
【0058】
次に、補間用変換テーブル格納部17は、第1のテーブルアドレスに応じて、第1の変換データを出力する(ステップS106)。
次に、マルチプレクサ18は、zero信号の値に応じて、0又は第1の変換データを選択して出力し、これがレジスタ21に読み込まれる(ステップS107)。
次に、テーブルアドレス作成部16は、第1のテーブルアドレスをインクリメントした第2のテーブルアドレスを出力する(ステップS108)。
【0059】
次に、補間用変換テーブル格納部17は、第2のテーブルアドレスに応じて、第2の変換データを出力する(ステップS109)。
次に、マルチプレクサ18は、zero信号の値に応じて、0又は第2の変換データを選択出力する(ステップS110)。
次に、線形補間部20は、第1の変換データ及び第2の変換データに基づいて、線形補間処理を行い、補間データを出力する(ステップS111)。
【0060】
図8に示すように、線形補間処理において、線形補間部20の減算器22は、マルチプレクサ18の出力データである第2の変換データからレジスタ21の出力データである第1の変換データを減ずる(ステップS201)。
次に、乗算器23は、減算器22の出力データにPデータを乗ずる(ステップS202)。
次に、シフタ24は、乗算器23の出力データを、「4’hd」(13ビット分)だけ右シフトする(ステップS203)。
次に、加算器25は、レジスタ21の出力データである第1の変換データにシフタ24の出力データを加え、補間データとして出力する(ステップS204)。
【0061】
再び図7を参照すると、次に、変換テーブル格納部13は、Kデータに応じて、第3の変換データを出力する(ステップS112)。
次に、乗算器19は、第3の変換データに補間データを乗じ、ガンマ変換データとして出力する(ステップS113)。
このようにして、ガンマ変換回路10は、入力データに応じた出力データ(ガンマ変換データ)を出力することができる。
【0062】
次に、入力データとして「16’h0009」が入力された場合のガンマ変換回路10の動作について、具体的に説明する。
まず、プライオリティエンコーダ11は、入力データ「16’h0009」を入力すると、Lデータ「4’h3」を減算器12に出力すると共に、ローレベルのzero信号をマルチプレクサ18に出力する。
【0063】
減算器12は、「4’hf」からLデータ「4’h3」を減じた「4’hc」をKデータとして変換テーブル格納部13、及び、シフタ14に出力する。
【0064】
シフタ14は、Kデータ「4’hc」を入力すると、入力データ「16’h0009」をKデータ「4’hc」が表わすビット数だけ左シフトさせた「16’h9000」をMデータとしてビット抽出部15に出力する。
【0065】
ビット抽出部15は、Mデータ「16’h9000」のビット番号14,13の2ビット「2’b00」をNデータとしてテーブルアドレス作成部16に出力する。さらに、ビット抽出部15は、Mデータ「16’h9000」のビット番号12〜0のビットを16ビットにゼロ拡張した「16’h1000」をPデータとして乗算器23に出力する。このPデータ「16’h1000」が、式(4)の「d」に相当する。
【0066】
テーブルアドレス作成部16は、Nデータ「2’b00」を入力すると、Nデータ「2’b00」を第1のテーブルアドレスとして補間用変換テーブル格納部17に出力する。さらに、テーブルアドレス作成部16は、所定時間経過後に、Nデータ「2’b00」をインクリメントしたNデータ「2’b01」を第2のテーブルアドレスとして補間用変換テーブル格納部17に出力する。
【0067】
補間用変換テーブル格納部17は、第1のテーブルアドレス「2’b00」を入力すると、第1のテーブルアドレス「2’b00」に対応する第1の変換データy00を出力する。さらに、補間用変換テーブル格納部17は、所定時間経過後に、第2のテーブルアドレス「2’b01」を入力すると、第2のテーブルアドレス「2’b01」に対応する第2の変換データy01を出力する。
【0068】
マルチプレクサ18は、zero信号がローレベルであるため、補間用変換テーブル格納部17が出力する第1の変換データy00を選択出力する。さらに、マルチプレクサ18は、所定時間経過後に、補間用変換テーブル格納部17が出力する第2の変換データy01を選択して出力する。
【0069】
レジスタ21は、マルチプレクサ18が選択出力する第1の変換データy00を所定時間保持する。この第1の変換データy00が、式(4)の「yM」に対応する。
【0070】
減算器22は、マルチプレクサ18が出力する第2の変換データy01からレジスタ21が保持する第1の変換データy00の値を減じて出力する。この減算器22の出力データが、式(4)の「Δy」に対応する。
乗算器23は、減算器22の出力データである(y01−y00)にPデータ「16’h1000」を乗じて出力する。この乗算器23の出力データ(ここでは、212×(y01−y00))が、式(4)の「d×Δy」に対応する。
【0071】
シフタ24は、乗算器23の出力データ(ここでは、212×(y01−y00))を、13ビット分だけ右シフトして出力する。このシフタ24の出力データ(ここでは、212×(y01−y00)/213)が、式(4)の「d×Δy/Δx」に対応する。
加算器25は、レジスタ21が保持する第1の変換データy00にシフタ24の出力データ(ここでは、212×(y01−y00)/213)を加えて出力する。この加算器25が出力するデータが、式(3)の「d×Δy/Δx+yM」に対応する。
【0072】
図9は、本例における線形補間を示す図である。このように、線形補間部20は、Mデータ「16’h9000」に応じた出力データ(ガンマ変換データ)を出力することができる。
【0073】
変換テーブル格納部13は、Kデータ「4’hc」を入力すると、Kデータ「4’hc」をテーブルアドレスとして、テーブルアドレス「4’hc」に対応する変換データを出力する。
【0074】
乗算器19は、線形補間部20の出力データ(ここでは、212×(y01−y00)/213+yM)に変換テーブル格納部13の出力データを乗じて出力する。この乗算器19が出力するデータが、式(3)に対応する。
【0075】
次に、ガンマ変換回路10の出力データと式(1)によって算出される値との間の誤差について、図10を参照しながら説明する。図10に示すように、ガンマ変換回路10の出力データと式(1)によって算出される値との間の誤差は、最大で約73であり、図28に示すガンマ変換回路110の誤差(約130)の約1.78分の1となっている。
【0076】
このように、本実施形態によれば、変換テーブル格納部13及び補間用変換テーブル格納部17の記憶容量を小さくすることができる。本実施形態においては、変換テーブル格納部13及び補間用変換テーブル格納部17の記憶容量は20ワードであり、従来のガンマ変換回路100(図26)の変換テーブル格納部101の記憶容量(65536ワード)の約3277分の1に低減することができる。従って、従来のガンマ変換回路110(図27)の変換テーブル格納部111の記憶容量(4096ワード)を、約205分の1に低減することができる。また、本実施形態によれば、出力データの誤差をガンマ変換回路110の誤差の約1.78分の1に低減することができる。
【0077】
なお、ガンマ変換回路10をCPUとプログラムによって構成することができる。その場合には、図3及び図5に示す変換テーブルのサイズが20ワードと小さいため、変換テーブルはキャッシュメモリに入り、ガンマ変換を高速に実現することが可能となる。
【0078】
本実施形態においては、ビット抽出部15が、Mデータのビット番号14,13の2ビットをNデータとして抽出することとしているが、Mデータのビット番号14〜12の3ビットをNデータとして抽出することとしても良いし、Mデータのビット番号14〜11の4ビットをNデータとして抽出することとしても良い。また、本実施形態においてはMデータを補間しているが、Nデータのビット幅を増やすことにより、補間しなくても良い。このように、Nデータのビット幅を増やすことにより、出力データの誤差をより小さくすることができる。
さらに、本実施形態においては、入力データを16ビット幅とし、出力データを12ビット幅としているが、これらのデータを他のビット幅としても良い。
【0079】
図11は、本発明の第1の実施形態の変形例に係るデータ変換回路の構成を示す図である。図11に示すように、この変形例において、線形補間部40は、レジスタ41、減算器42、乗算器43、シフタ44及び加算器45に加えて、マルチプレクサ46、マルチプレクサ47及びラッチ回路48をさらに含んでいる。
【0080】
マルチプレクサ46は、補間出力制御信号がハイレベルの場合には変換テーブル格納部13が出力する変換データを選択して出力し、補間出力制御信号がローレベルの場合にはビット抽出部15が出力するPデータを選択して出力する。
【0081】
マルチプレクサ47は、補間出力制御信号がハイレベルの場合には加算器45が出力する補間データを選択して出力し、補間出力制御信号がローレベルの場合には減算器42が出力するデータを選択して出力する。
【0082】
ラッチ回路48は補間出力制御信号がハイレベルの場合において乗算器43が出力するガンマ変換データをラッチして出力する。
【0083】
このように、線形補間部の乗算器を兼用することにより、ハードウエアの増大を抑えることができる。
【0084】
次に、本発明の第2の実施形態について説明する。図12は、本発明の第2の実施形態に係るデータ変換回路の構成を示す図である。本実施形態は、本発明をガンマ変換回路に適用したものである。本実施形態においては、入力データは16ビット幅であり、出力データは12ビット幅であるものとする。
図12において、ガンマ変換回路50は、プライオリティエンコーダ51と、減算器52と、変換テーブル格納部53と、シフタ54と、ビット抽出部55と、テーブル格納部56と、テーブルアドレス作成部57と、補間用変換テーブル格納部58と、乗算器59と、線形補間部60とを具備している。また、線形補間部60は、レジスタ61と、減算器62と、テーブル格納部63と、テーブル格納部64と、ビット抽出部65と、補正項算出部66と、加算器67とを含んでいる。
【0085】
プライオリティエンコーダ51は、16ビット幅の入力データを入力し、入力データ中の最上位に位置する「1」のビットを検出し、検出したビットのビット番号を4ビット幅のLデータとして出力する。
減算器52は、「4’hf」からLデータを減じて4ビット幅のKデータとして出力する。
変換テーブル格納部53は、Kデータをテーブルアドレスとし、2−Kをガンマ変換した12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
【0086】
シフタ54は、入力データを減算器の出力するKデータの値分だけ左シフトしてMデータを出力する。
ビット抽出部55は、Mデータを入力し、ビット番号14〜11の4ビットをNデータとして出力する。
【0087】
テーブル格納部56は、4ビットのNデータを2ビット幅のrepiデータに変換するテーブルを格納しており、Nデータが「4’h0」〜「4’h2」の場合には、「2’b00」をrepiデータとして出力し、Nデータが「4’h3」〜「4’h6」の場合には、「2’b01」をrepiデータとして出力し、Nデータが「4’h7」〜「4’ha」の場合には、「2’b10」をrepiデータとして出力し、Nデータが「4’hb」〜「4’hf」の場合には、「2’b11」をrepiデータとして出力する。
【0088】
テーブルアドレス作成部57は、入力した2ビット幅のrepiデータを第1のテーブルアドレスとして出力し、所定時間経過後に、repiデータをインクリメント(又はデクリメント)した第2のテーブルアドレスを出力する。
補間用変換テーブル格納部58は、16ビット幅のデータをガンマ変換した12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、第1及び第2のテーブルアドレスに応じて第1及び第2の変換データを出力する。
【0089】
線形補間部60は、補間用変換テーブル格納部58が出力する第1及び第2の変換データに対して線形補間処理を行う。
ビット抽出部65は、Mデータを入力し、Mデータ中のビット番号10〜0の11ビットを抽出し、抽出したデータをxRデータとして出力する。
【0090】
テーブル格納部63は、Nデータを所定のデータ(ddデータ)に変換するテーブルを格納しており、Nデータが「4’h0」の場合には、「0」をddデータとして出力し、データが「4’h1」の場合には、「1」をddデータとして出力し、Nデータが「4’h2」の場合には、「2」をddデータとして出力し、Nデータが「4’h3」の場合には、「0」をddデータとして出力する。また、テーブル格納部63は、Nデータが「4’h4」の場合には、「1」をddデータとして出力し、Nデータが「4’h5」の場合には、「2」をddデータとして出力し、Nデータが「4’h6」の場合には、「3」をddデータとして出力し、Nデータが「4’h7」の場合には、「0」をddデータとして出力する。
【0091】
また、テーブル格納部63は、Nデータが「4’h8」の場合には、「1」をddデータとして出力し、Nデータが「4’h9」の場合には、「2」をddデータとして出力し、Nデータが「4’ha」の場合には、「3」をddデータとして出力し、Nデータが「4’hb」の場合には、「0」をddデータとして出力する。また、テーブル格納部63は、Nデータが「4’hc」の場合には、「1」をddデータとして出力し、Nデータが「4’hd」の場合には、「2」をddデータとして出力し、Nデータが「4’he」の場合には、「3」をddデータとして出力し、Nデータが「4’hf」の場合には、「4」をddデータとして出力する。
【0092】
テーブル格納部64は、Nデータを所定のデータ(spanデータ)に変換するテーブルを格納しており、Nデータが「4’h0」〜「4’h2」の場合には、「3」をspanデータとして出力し、Nデータが「4’h3」〜「4’ha」の場合には、「4」をspanデータとして出力し、Nデータが「4’hb」〜「4’hf」の場合には、「5」をspanデータとして出力する。
【0093】
図13は、Mデータ、Mデータを所定の幅に分割したレンジ、ddデータ、spanデータ、repiデータ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。図13において、y00は、Mデータ「16’h8000」をガンマ変換した12ビット幅のデータであり、y01は、Mデータ「16’h9800」をガンマ変換した12ビット幅のデータであり、y10は、Mデータ「16’hb800」をガンマ変換した12ビット幅のデータであり、y11は、Mデータ「16’hd800」をガンマ変換した12ビット幅のデータである。
【0094】
図13に示すように、例えば、Mデータが「16’h8000」の場合に、テーブルアドレスは、「2’b00」となり、Mデータが「16’h8800」の場合にも、テーブルアドレスは、「2’b00」となる。この場合、補間用変換テーブル格納部58は、Mデータ「16’h8000」をガンマ変換した補間用変換データy00をテーブルアドレス「2’b00」に対応させて格納し、Mデータ「16’h8800」をガンマ変換した補間用変換データy00は格納しない。このように、複数のMデータから同一のテーブルアドレスが生成される場合には、補間用変換テーブル格納部58は、複数のMデータの内の最小のMデータをガンマ変換した補間用変換データのみを格納する。
【0095】
即ち、補間用変換テーブル格納部58は、Mデータの「16’h8000」〜「16’hffff」のレンジにおいて、Mデータ「16’h8000」に対応する補間用変換データy00、並びに、「16’h8000」〜「16’hffff」のレンジを3:4:4:5に分割するMデータ「16’h9800」、「16’hb800」、及び、「16’hd800」にそれぞれ対応する補間用変換データy01、y10、及び、y11を格納することとなる。
【0096】
ここで、Mデータの「16’h8000」〜「16’h9800」のレンジをrep0とし、Mデータの「16’h9800」〜「16’hb800」のレンジをrep1とし、Mデータの「16’hb800」〜「16’hd800」のレンジをrep2とし、Mデータの「16’hd800」〜「16’hffff」のレンジをrep3とすると、repiデータは、Mデータが属するレンジのrep番号を示す。
【0097】
また、spanデータは、Mデータが属するレンジの他の3つのレンジに対する比率となる。例えば、Mデータが「16’h8001」の場合には、spanデータは、Mデータが属するレンジであるrep0のrep1〜rep3に対する比率である「3」となる。
【0098】
再び図12を参照すると、レジスタ61は、補間用変換テーブル格納部58の出力データを所定の時間保持すると共に、保持しているデータをy_tblデータとして出力する。
減算器62は、補間用変換テーブル格納部58の出力データからレジスタ61の出力データを減じたデータをstep_yとして出力する。
補正項算出部66は、ddデータ、spanデータ、xRデータ、及び、step_yデータを入力し、dyデータを次式によって算出して出力する。ここで、211の指数部である「11」は、MデータのMSBのビット番号「15」から、Nデータのビット数である「4」を引いたものである。加算器67は、dyデータをy_tblデータに加えて出力する。
【数5】
【0099】
変換テーブル格納部53は、Kデータをテーブルアドレスとし、2−K/γを表す12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
【0100】
図14は、入力データ、テーブルアドレス、及び、変換データの対応を示す図である。入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、変換データは、yF、yE、yD、yC、yB、yA、y9、y8、y7、y6、y5、y4、y3、y2、y1、y0の16データとなる。従って、変換テーブル格納部53は、16ワード(ここでは、1ワード=12ビット)の記憶容量を有すれば良いこととなる。
【0101】
即ち、図14に示すように、変換テーブル格納部53は、入力データ「16’h0001」、「16’h0002」、「16’h0004」、「16’h0008」、「16’h0010」、「16’h0020」、「16’h0040」、「16’h0080」、「16’h0100」、「16’h0200」、「16’h0400」、「16’h0800」、「16’h1000」、「16’h2000」、「16’h4000」、「16’h8000」にそれぞれ対応する変換データyF、yE、yD、yC、yB、yA、y9、y8、y7、y6、y5、y4、y3、y2、y1、及び、y0を格納する。
【0102】
再び図12を参照すると、乗算器59は、変換テーブル格納部53の出力データに線形補間部60の出力データを乗じ、出力データ(ガンマ変換データ)として出力する。
【0103】
次に、線形補間部60が行う線形補間処理について、図15を参照しながら説明する。図15は、線形補間部60が行う線形補間処理の原理を示す図である。図15に示すように、線形補間部60は、Mデータxに対応する補間データyを次式によって算出することができる。
y=y_tbl+dy・・・(6)
【0104】
次に、ガンマ変換回路50におけるガンマ変換処理について、図12、図16、及び、図17を参照しながら説明する。図16は、ガンマ変換回路のガンマ変換処理を示すフローチャートであり、図17は、ガンマ変換回路の線形補間部の線形補間処理を示すフローチャートである。
【0105】
図16及び図17の処理を開始すると、プライオリティエンコーダ51は、入力データを入力し、Lデータを出力する(ステップS301)。
次に、減算器52は、Lデータを入力し、Kデータを出力する(ステップS302)。
次に、シフタ54は、入力データ及びKデータを入力し、Mデータを出力する(ステップS303)。
次に、ビット抽出部55は、Mデータを入力し、Nデータを出力する(ステップS304)。
次に、テーブル格納部56は、Nデータを入力し、repiデータを出力する(ステップS305)。
【0106】
次に、テーブルアドレス作成部57は、repiデータを入力し、第1のテーブルアドレスを出力する(ステップS306)。
次に、補間用変換テーブル格納部58は、第1のテーブルアドレスに応じて、第1の変換データを出力し、レジスタ61はこれを保持する(ステップS307)。
【0107】
次に、テーブルアドレス作成部57は、第1のテーブルアドレスをインクリメントした第2のテーブルアドレスを出力する(ステップS308)。
次に、補間用変換テーブル格納部58は、第2のテーブルアドレスに応じて、第2の変換データを出力する(ステップS309)。
次に、線形補間部60は、第1の変換データ及び第2の変換データに基づいて、線形補間処理を行い、補間データを出力する(ステップS310)。
【0108】
図17に示すように、線形補間処理において、線形補間部60のビット抽出部65は、Mデータを入力し、xRデータを出力する(ステップS401)。
次に、テーブル格納部63は、Nデータを入力し、ddデータを出力する(ステップS402)。
次に、テーブル格納部64は、Nデータを入力し、spanデータを出力する(ステップS403)。
【0109】
次に、減算器62は、補間用変換テーブル格納部58の出力データである第2の変換データからレジスタ61の出力データである第1の変換データを減じ、step_yデータを出力する(ステップS404)。
【0110】
次に、補正項算出部66は、xRデータ、ddデータ、spanデータ、及び、step_yデータを入力し、dyデータを出力する(ステップS405)。次に、加算器67は、y_tblデータにdyデータを加え、補間データとして出力する(ステップS406)。
【0111】
再び図16を参照すると、次に、変換テーブル格納部53は、Kデータに応じて、第3の変換データを出力する(ステップS311)。
次に、乗算器59は、第3の変換データに補間データを乗じ、ガンマ変換データとして出力する(ステップS312)。
このようにして、ガンマ変換回路50は、入力データに応じた出力データ(ガンマ変換データ)を出力することができる。
【0112】
次に、ガンマ変換回路50の出力データと式(1)によって算出される値との間の誤差について、図18を参照しながら説明する。図18に示すように、ガンマ変換回路50の出力データと式(1)によって算出される値との間の誤差は、最大で約58程度であり、図28に示すガンマ変換回路110の誤差(約130)の約2.24分の1となっており、図10に示すガンマ変換回路10の誤差(約73)の約1.25分の1となっている。
【0113】
このように、本実施形態によれば、変換テーブル格納部53及び補間用変換テーブル格納部58が格納する変換テーブルのサイズを、第1の実施形態におけるガンマ変換回路10の変換テーブル格納部13及び補間用変換テーブル格納部17が格納する変換テーブルのサイズと同一に保ったまま、ガンマ変換回路10より誤差を小さくすることができる。
【0114】
なお、ガンマ変換回路50をCPUとプログラムによって構成することができる。その場合には、変換テーブルのサイズが小さいため、変換テーブルはキャッシュメモリに入り、ガンマ変換を高速に実現することが可能となる。
【0115】
また、本実施形態においては、ビット抽出部55が、Mデータのビット番号14〜11の4ビットをNデータとして抽出することとしているが、Mデータのビット番号14〜12の3ビットをNデータとして抽出することとしても良いし、Mデータのビット番号14〜10の5ビットをNデータとして抽出することとしても良い。Nデータのビット幅を増やすこととすると、出力データの誤差をより小さくすることができる。
また、本実施形態においては、入力データを16ビット幅とし、出力データを12ビット幅としているが、これらのデータを他のビット幅としても良い。
【0116】
また、本実施形態においては、Nデータに基づいてrepiデータを出力するためにテーブル格納部56を用いているが、テーブル格納部56に代えてデコーダを用いることとしても良い。同様に、テーブル格納部63及びテーブル格納部64に代えてデコーダを用いることとしても良い。
【0117】
次に、本発明の第3の実施形態について説明する。図19は、本発明の第3の実施形態に係るデータ変換回路の構成を示す図である。本実施形態は、本発明をガンマ変換回路に適用したものである。本実施形態においては、入力データは16ビット幅であり、出力データは12ビット幅であるものとする。
図19において、ガンマ変換回路70は、プライオリティエンコーダ71及び76と、減算器72と、変換テーブル格納部73と、シフタ74と、ビット抽出部75及び79と、テーブルアドレス作成部77と、補間用変換テーブル格納部78と、マルチプレクサ18と、線形補間部80と、乗算器19とを具備している。また、線形補間部80は、レジスタ21と、減算器22と、乗算器23と、デコーダ81と、シフタ82と、加算器25とを含んでいる。
【0118】
プライオリティエンコーダ71は、16ビット幅の入力データを入力し、入力データ中の最上位に位置する「1」のビットを検出し、検出したビットのビット番号を4ビット幅のL1データとして出力する。また、プライオリティエンコーダ71は、入力データ中に「1」のビットがない場合、すなわち入力データが「16’h0000」である場合には、「4’h0」のL1データを出力すると共に、ハイレベルのzero信号を出力する。
【0119】
減算器72は、「4’hf」からL1データを減じて4ビット幅のKデータとして出力する。
変換テーブル格納部73は、Kデータをテーブルアドレスとし、2−Kをガンマ変換した12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
シフタ74は、入力データを減算器の出力するKデータの値分だけ左シフトしてMデータを出力する。
ビット抽出部75は、Mデータを入力し、ビット番号14〜12の3ビットを抽出し、抽出した3ビットをNデータとして出力する。
【0120】
プライオリティエンコーダ76は、ビット抽出部75から3ビット幅のNデータを入力し、入力したNデータ中の最上位に位置する「1」のビットを検出し、検出したビットのビット番号を2ビット幅のL2データとして出力する。なお、ビット番号は最下位ビットを1とし、上位ビットに向かってカウントし、入力したデータ中に「1」のビットがない場合には、L2データとして「2’b00」を出力する。
【0121】
テーブルアドレス作成部77は、入力した2ビット幅のL2データを第1のテーブルアドレスとして出力し、所定時間経過後に、L2データをインクリメント(又はデクリメント)した第2のテーブルアドレスを出力する。
補間用変換テーブル格納部78は、ビット番号4とビット番号L2を「1」とし、その他のビットを「0」とする16ビット幅のデータを、「4’hb」(11ビット分)だけ左シフトさせたデータをガンマ変換した12ビット幅の補間用変換データをテーブルアドレスに対応させた補間用変換テーブルを格納しており、第1及び第2のテーブルアドレスに応じて第1及び第2の補間用変換データを出力する。
【0122】
図20は、入力データ、L1データ、Mデータ、L2データ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。図20において、y00は、ビット番号4と入力データ「16’h0001」に対応するビット番号L2を「1」とし、その他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した12ビット幅のデータであり、y11は、ビット番号4と入力データ「16’h0003」に対応するビット番号L2を「1」とし、その他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した12ビット幅のデータであり、y10は、ビット番号4と入力データ「16’h0005」に対応するビット番号L2を「1」とし、その他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した12ビット幅のデータであり、y01は、ビット番号4と入力データ「16’h0009」に対応するビット番号L2を「1」とし、その他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した12ビット幅のデータである。
【0123】
図20に示すように、例えば、入力データが「16’h0001」の場合に、テーブルアドレスは、「2’b00」となり、入力データが「16’h0002」の場合にも、テーブルアドレスは、「2’b00」となる。この場合、補間用変換テーブル格納部78は、ビット番号4と入力データ「16’h0001」に対応するビット番号「2’b00」を「1」としてその他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データy00をテーブルアドレス「2’b00」に対応させて格納し、ビット番号4と入力データ「16’h0002」に対応するビット番号「2’b00」を「1」としてその他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データy00は格納しない。このように、複数の入力データから同一のテーブルアドレスが生成される場合には、補間用変換テーブル格納部78は、ビット番号4と複数の入力データの内の最小の入力データに対応するビット番号L2を「1」としてその他のビットを「0」とする16ビット幅のデータを11ビット分だけ左シフトさせたデータをガンマ変換した補間用変換データのみを格納する。
【0124】
図21は、入力データ、テーブルアドレス、及び、補間用変換データの対応を示す図である。図20において、対応する補間用変換データが補間用変換テーブル格納部78に格納されていない入力データの表示は、図21においては省かれている。図20に示すように、入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、補間用変換データは、y00、y01、y10、y11の4データとなる。従って、補間用変換テーブル格納部78は、4ワード(ここでは、1ワード=12ビット)の記憶容量を有すれば良いこととなる。
【0125】
即ち、図21に示すように、補間用変換テーブル格納部78は、入力データ「16’h0001」、「16’h0003」、「16’h0005」、「16’h0009」にそれぞれ対応する補間用変換データy00、y11、y10、及び、y01を格納する。
【0126】
再び図19を参照すると、線形補間部80は、補間用変換テーブル格納部78が出力する第1及び第2の変換データに対して線形補間を行う。
デコーダ81は、L2データが「2’b00」の場合には12を出力し、「2’b01」の場合には12を出力し、「2’b10」の場合には13を出力し、「2’b11」の場合には14を出力する。
【0127】
次に、ガンマ変換回路のガンマ変換処理について、図19、図22、及び、図23を参照しながら説明する。図22は、ガンマ変換回路のガンマ変換処理を示すフローチャートであり、図23は、ガンマ変換回路の線形補間部の線形補間処理を示すフローチャートである。
【0128】
図22及び図23の処理を開始すると、プライオリティエンコーダ71は、入力データを入力し、L1データを出力する(ステップS501)。
次に、減算器72は、L1データを入力し、Kデータを出力する(ステップS502)。
次に、シフタ74は、入力データ及びKデータを入力し、Mデータを出力する(ステップS503)。
次に、ビット抽出部75は、Mデータを入力し、ビット番号14〜12の3ビットのNデータを抽出する(ステップS504)。
次に、プライオリティエンコーダ76は、Nデータを入力し、L2データを出力する(ステップS505)。
次に、テーブルアドレス作成部77は、L2データを入力し、第1のテーブルアドレスを出力する(ステップS506)。
【0129】
次に、補間用変換テーブル格納部78は、第1のテーブルアドレスに応じて、第1の変換データを出力する(ステップS507)。
次に、マルチプレクサ18は、zero信号の値に応じて、0又は第1の変換データを選択出力する(ステップS508)。
次に、テーブルアドレス作成部77は、第1のテーブルアドレスをインクリメントした第2のテーブルアドレスを出力する(ステップS509)。
【0130】
次に、補間用変換テーブル格納部78は、第2のテーブルアドレスに応じて、第2の変換データを出力する(ステップS510)。
次に、マルチプレクサ18は、zero信号の値に応じて、0又は第2の変換データを選択して出力する(ステップS511)。
次に、線形補間部80は、第1の変換データ及び第2の変換データに基づいて、線形補間処理を行い、補間データを出力する(ステップS512)。
【0131】
図23に示すように、線形補間処理において、線形補間部80のデコーダ81は、L2データからシフタ82が行うシフト処理のシフト量を算出する(ステップS601)。
次に、レジスタ21は、第1の変換データを所定の時間保持する(ステップS602)。
次に、減算器22は、マルチプレクサ18の出力データである第2の変換データからレジスタ21の出力データである第1の変換データを減ずる(ステップS603)。
【0132】
次に、乗算器23は、減算器22の出力データにPデータを乗ずる(ステップS604)。
次に、シフタ82は、乗算器23の出力データを、デコーダ81の出力データに応じた量だけシフトする(ステップS605)。
次に、加算器25は、レジスタ21の出力データである第1の変換データにシフタ82の出力データを加え、補間データとして出力する(ステップS606)。
【0133】
次に、変換テーブル格納部73は、Kデータに応じて、第3の変換データを出力する(ステップS513)。
次に、乗算器19は、補間データに第3の変換データを乗じ、ガンマ変換データとして出力する(ステップS514)。
このようにして、ガンマ変換回路70は、入力データに応じた出力データ(ガンマ変換データ)を出力することができる。
【0134】
次に、ガンマ変換回路70の出力データと式(1)によって算出される値との間の誤差について、図24を参照しながら説明する。図24に示すように、ガンマ変換回路70の出力データと式(1)によって算出される値との間の誤差は、最大で約150程度である。
【0135】
このように、本実施形態によれば、変換データ格納部78の記憶容量を小さくすることができる
【0136】
なお、ガンマ変換回路70をCPUとプログラムによって構成することができる。その場合には、変換テーブルのサイズが小さいため、変換テーブルはキャッシュメモリに入り、ガンマ変換を高速に実現することが可能となる。
【0137】
また、本実施形態においては、入力データを16ビット幅とし、出力データを12ビット幅としているが、これらのデータを他のビット幅としても良い。
【0138】
【発明の効果】
以上述べた様に、本発明によれば、変換データを格納する回路の記憶容量を小さくすると共に、出力データの誤差を小さくすることができる。
【図面の簡単な説明】
【図1】本発明の第1の実施形態に係るガンマ変換回路の構成を示す図である。
【図2】本発明の第1の実施形態における入力データ、Lデータ、Mデータ、Nデータ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。
【図3】本発明の第1の実施形態における入力データ、テーブルアドレス、及び、補間用変換データの対応を示す図である。
【図4】本発明の第1の実施形態における入力データ、Lデータ、Kデータ(テーブルアドレス)、及び、変換データの対応を示す図である。
【図5】本発明の第1の実施形態における入力データ、テーブルアドレス、及び、変換データの対応を示す図である。
【図6】本発明の第1の実施形態における線形補間処理の原理を示す図である。
【図7】本発明の第1の実施形態に係るガンマ変換回路の動作を示すフローチャートである。
【図8】本発明の第1の実施形態に係るガンマ変換回路の線形補間処理を示すフローチャートである。
【図9】本発明の第1の実施形態における線形補間処理によるガンマ変換データの算出の原理を示す図である。
【図10】本発明の第1の実施形態に係るガンマ変換回路の出力データの誤差を示す図である。
【図11】本発明の第1の実施形態の変形例に係るガンマ変換回路の構成を示す図である。
【図12】本発明の第2の実施形態に係るガンマ変換回路の構成を示す図である。
【図13】本発明の第2の実施形態におけるMデータ、Mデータのレンジ、ddデータ、spanデータ、repiデータ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。
【図14】本発明の第2の実施形態における入力データ、テーブルアドレス、及び、変換データの対応を示す図である。
【図15】本発明の第2の実施形態における線形補間処理の原理を示す図である。
【図16】本発明の第2の実施形態に係るガンマ変換回路の動作を示すフローチャートである。
【図17】本発明の第2の実施形態に係るガンマ変換回路の線形補間処理を示すフローチャートである。
【図18】本発明の第2の実施形態に係るガンマ変換回路の出力データの誤差を示す図である。
【図19】本発明の第3の実施形態に係るガンマ変換回路の構成を示す図である。
【図20】本発明の第3の実施形態における入力データ、L1データ、Mデータ、L2データ(テーブルアドレス)、及び、補間用変換データの対応を示す図である。
【図21】本発明の第3の実施形態における入力データ、テーブルアドレス、及び、補間用変換データの対応を示す図である。
【図22】本発明の第3の実施形態に係るガンマ変換回路の動作を示すフローチャートである。
【図23】本発明の第3の実施形態に係るガンマ変換回路の線形補間処理を示すフローチャートである。
【図24】本発明の第3の実施形態に係るガンマ変換回路の出力データの誤差を示す図である。
【図25】ガンマ変換のグラフを示す図である。
【図26】従来のガンマ変換回路の構成を示す図である。
【図27】従来のガンマ変換回路の構成を示す図である。
【図28】図27のガンマ変換回路の出力データの誤差を示す図である。
【符号の説明】
10、30、50、70 ガンマ変換回路
11、51、71、76 プライオリティエンコーダ
12、22、42、52、62、72 減算器
13、53、73、101、111 変換テーブル格納部
14、24、44、54、74、82 シフタ
15、55、65、75、79 ビット抽出部
16、57、77 テーブルアドレス作成部
17、58、78 補間用変換テーブル格納部
18、46、47 マルチプレクサ
19、23、43、59 乗算器
20、40、60、80、112 線形補間部
25、45、67、 加算器
48 ラッチ回路
56、63、64 テーブル格納部
66 補正項算出部
81 デコーダ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a data conversion method, a data conversion circuit, and a data conversion program for converting input data to generate output data, and more particularly to a data conversion method for generating output data by gamma converting input data.
[0002]
[Prior art]
Generally, in a picture tube such as a CRT, a relationship represented by the following equation exists between the drive voltage E and the cathode current I.
I = KEγ
This relationship is called a gamma (γ) characteristic. Since the value of gamma is generally about 1.6 to 3, the cathode current I has non-linearity with respect to the drive voltage E. Since it is difficult to set γ = 1 in the picture tube, a gamma correction circuit is provided on the image transmission side to generally set γ = 1. In the present application, conversion performed on an image signal for such gamma correction is called gamma conversion.
[0003]
Gamma conversion of image data is performed in an image processing LSI or the like used for an image reading device, an image display device, or the like. The gamma conversion is represented by the following equation, where x is an input and y is an output.
(Equation 1)
[0004]
FIG. 25 shows a graph of equation (1) when γ = 1.8. Since gamma conversion is a power function in this way, its operation requires a lot of time. However, gamma conversion is required to be performed at high speed for high-speed operation of an image reading device or the like. Therefore, conventionally, a conversion table having conversion data corresponding to input data is stored in a high-speed storage element such as an SRAM, and conversion data corresponding to input data is read from the conversion table. FIG. 26 is a diagram showing such a conventional gamma conversion circuit. As shown in FIG. 26, a conventional
[0005]
In the
[0006]
In order to reduce the size of the conversion table, a conversion table having conversion data corresponding to input data at predetermined intervals (for example, 16) is stored in an SRAM or the like, and the corresponding conversion data is stored in the conversion table. When the input data is input, the conversion data is output. When the input data for which the corresponding conversion data is not stored in the conversion table is input, the input data before and after the input data and the corresponding conversion data are output. Data obtained by performing an interpolation process on converted data corresponding to input data whose data is stored in a conversion table is output. FIG. 27 is a diagram showing such a conventional gamma conversion circuit. As shown in FIG. 27, a conventional
[0007]
In the
[0008]
[Problems to be solved by the invention]
However, the output data of the
[0009]
In view of the above, the present invention provides a data conversion method, a data conversion circuit, and a data conversion program that can reduce the storage capacity of a circuit that stores converted data and reduce errors in output data. The purpose is to.
[0010]
[Means for Solving the Problems]
In order to solve the above problems, a data conversion method according to a first aspect of the present invention is a data conversion method for converting input data to generate output data. (A) for obtaining first data indicating the number K of bits of “0” located higher than the most significant bit among the bits of “1”; A first conversion data corresponding to the first data obtained in step (a) from a first table storing a plurality of conversion data obtained by performing conversion in correspondence with a plurality of addresses. (B), a step (c) of obtaining second data having a p-bit width following the bit located at the (K + 1) th position from the most significant in the input data, and a second Applying the conversion Reading the second converted data corresponding to the second data obtained in step (c) from the second table storing the plurality of obtained converted data corresponding to the plurality of addresses ( d) and a step (e) of generating output data based on the first converted data and the second converted data.
[0011]
Here, the step (e) may generate the output data by multiplying the first conversion data by the second conversion data, or the step (d) may generate the output data by incrementing or decrementing the second data. Is read from the second table, and the step (e) comprises multiplying the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated. Further, step (c) is a step of selecting a p-bit width (where 1 ≦ p ≦ n−K−1) of bit numbers (n−K−2) to (n−K−p−1) from the input data. The second data may be obtained by extracting the data of (2).
[0012]
Further, a data conversion method according to a second aspect of the present invention is a data conversion method for converting input data to generate output data. (A) for obtaining first data indicating the number K of bits of “0” positioned higher than the bit positioned at the highest order, and performing first conversion on a plurality of first data in advance. Reading out the first converted data corresponding to the first data obtained in step (a) from the first table storing the plurality of obtained converted data corresponding to the plurality of addresses (b) And (c) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data; and performing a predetermined operation on the second data to obtain third data. Seeking for Step (d) from a second table storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance in correspondence with a plurality of addresses. (E) reading out the second converted data corresponding to the third data obtained in step (e), and generating (f) output data based on the first converted data and the second converted data. Is provided.
[0013]
Here, the step (f) may generate output data by multiplying the first conversion data by the second conversion data, or the step (e) may generate data obtained by incrementing or decrementing the third data. Is read from the second table, and the step (f) comprises multiplying the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated. Further, step (d) sets the number of data belonging to the i-th group to V i And V 0 ≤V 1 ≦… ≦ V N The
[0014]
Further, a data conversion method according to a third aspect of the present invention is a data conversion method for converting input data to generate output data, wherein the data conversion method comprises the steps of: (A) for obtaining first data indicating the number K of bits of “0” positioned higher than the bit positioned at the highest order, and performing first conversion on a plurality of first data in advance. Reading out the first converted data corresponding to the first data obtained in step (a) from the first table storing the plurality of obtained converted data corresponding to the plurality of addresses (b) (C) obtaining second data having a p-bit width following the bit located at the (K + 1) th position from the most significant bit in the input data; and a bit being "1" in the second data having the p-bit width. Ranked highest among (D) obtaining third data indicating a bit number of a bit to be converted, and converting a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance in correspondence with a plurality of addresses. Reading (e) second conversion data corresponding to the third data obtained in step (d) from the stored second table; and (e) reading the first conversion data and the second conversion data. (F) generating output data based on
[0015]
Here, the step (f) may generate output data by multiplying the first conversion data by the second conversion data, or the step (e) may generate data obtained by incrementing or decrementing the third data. Is read from the second table, and the step (f) comprises multiplying the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated.
[0016]
In the above, the interpolation process may be a linear interpolation process, and the first conversion is -K May be gamma-converted, and the second conversion may be to perform gamma conversion on n-bit width data in which the most significant bit is set to “1” and the following p bits are used as second data.
[0017]
A data conversion circuit according to a first aspect of the present invention is a data conversion circuit that converts input data to generate output data, and is one of the most significant bits of “1” in n-bit input data. First means for obtaining first data indicating the number of bits K of "0" positioned higher than higher-order bits, and obtained by first performing a first conversion on a plurality of first data. A second means for reading out first converted data corresponding to the first data obtained by the first means from a first table storing a plurality of converted data corresponding to a plurality of addresses; Third means for obtaining second data having a p-bit width following the bit located at the (K + 1) -th position from the most significant bit in the data; and a second means for performing a second conversion on a plurality of second data in advance. Support multiple addresses for multiple conversion data Fourth means for reading out from the second table stored the second converted data corresponding to the second data obtained by the third means, the first converted data and the second converted data, Fifth means for generating output data based on the
[0018]
Here, the fifth means may generate the output data by multiplying the first converted data by the second converted data, or the fourth means may generate the output data by incrementing or decrementing the second data. Is read from the second table, and the fifth means multiplies the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data, thereby obtaining the output data. May be generated. In addition, the third means may select, from the input data, a p-bit width (where 1 ≦ p ≦ n−K−1) of bit numbers (n−K−2) to (n−K−p−1). The second data may be obtained by extracting the data of (2).
[0019]
Further, a data conversion circuit according to a second aspect of the present invention is a data conversion circuit that converts input data to generate output data, wherein the data conversion circuit includes one of bits “1” in n-bit input data. Means for obtaining first data indicating the number K of bits of "0" located higher than the most significant bit, and performing first conversion on a plurality of first data in advance. Second means for reading out first converted data corresponding to the first data obtained by the first means from a first table storing the obtained plurality of converted data corresponding to a plurality of addresses; Third means for obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data; and performing a predetermined operation on the second data to convert the third data. A fourth means for obtaining a plurality of second Data corresponding to the third data obtained by the fourth means from the second table storing a plurality of conversion data obtained by performing the second conversion on the data in correspondence with the plurality of addresses. Fifth means for reading out the second converted data and sixth means for generating output data based on the first converted data and the second converted data are provided.
[0020]
Here, the sixth means may generate the output data by multiplying the first converted data by the second converted data, or the fifth means may generate the output data by incrementing or decrementing the third data. Is read from the second table, and the sixth means multiplies the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data, thereby obtaining the output data. May be generated. Further, the fourth means sets the number of data belonging to the i-th group to V i And V 0 ≤V 1 ≦… ≦ V N The
[0021]
Furthermore, a data conversion circuit according to a third aspect of the present invention is a data conversion circuit that converts input data to generate output data, and includes: Means for obtaining first data indicating the number K of bits of "0" located higher than the most significant bit, and performing first conversion on a plurality of first data in advance. Second means for reading out first converted data corresponding to the first data obtained by the first means from a first table storing the obtained plurality of converted data corresponding to a plurality of addresses; A third means for obtaining second data having a p-bit width following the bit located at the (K + 1) th position from the most significant bit in the input data; and a third means for determining the bit "1" in the second data having the p-bit width. The bit number of the most significant bit in A fourth means for obtaining third data, and a second means for storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance corresponding to a plurality of addresses. Fifth means for reading out the second converted data corresponding to the third data obtained by the fourth means from the table, and generating output data based on the first converted data and the second converted data. And sixth means for performing the above.
[0022]
Here, the sixth means may generate the output data by multiplying the first converted data by the second converted data, or the fifth means may generate the output data by incrementing or decrementing the third data. Is read from the second table, and the sixth means multiplies the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data, thereby obtaining the output data. May be generated.
[0023]
In the above, the interpolation process may be a linear interpolation process, and the first conversion is -K May be gamma-converted, and the second conversion may perform gamma conversion on data having an n-bit width in which the most significant bit is “1” and the subsequent p bits are second data.
[0024]
A data conversion program according to a first aspect of the present invention is a data conversion program that converts input data to generate output data, and is a data conversion program that has a maximum of 1 bits in n-bit input data. A procedure (a) for obtaining first data indicating the number of bits K of “0” located higher than the higher-order bits, and a first conversion performed on a plurality of first data in advance. Reading (b) first conversion data corresponding to the first data obtained in step (a) from a first table storing a plurality of conversion data corresponding to a plurality of addresses; A procedure (c) for obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data, and a second conversion performed on a plurality of pieces of second data in advance. Multiple conversion data A step (d) of reading out the second conversion data corresponding to the second data obtained in the step (c) from the second table stored corresponding to the plurality of addresses; And (e) generating output data based on the second converted data.
[0025]
Here, the procedure (e) may generate the output data by multiplying the first conversion data by the second conversion data, or the procedure (d) may generate the output data by incrementing or decrementing the second data. Is read from the second table, and the procedure (e) multiplies the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated. Also, the procedure (c) is based on the p-bit width (where 1 ≦ p ≦ n−K−1) of the bit numbers (n−K−2) to (n−K−p−1) from the input data. The second data may be obtained by extracting the data of (2).
[0026]
A data conversion program according to a second aspect of the present invention is a data conversion program that converts input data to generate output data, and includes a program that converts one of bits “1” in input data having an n-bit width. (A) for obtaining the first data indicating the number K of bits of “0” positioned higher than the bit positioned at the uppermost position, and performing the first conversion on a plurality of first data in advance. Reading the first converted data corresponding to the first data obtained in step (a) from the first table storing the obtained plurality of converted data corresponding to the plurality of addresses (b) And (c) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data, and performing a predetermined operation on the second data to obtain third data. Steps to ask for d) and a second table storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance corresponding to a plurality of addresses, in step (d). A step (e) of reading out the second converted data corresponding to the obtained third data; and a step (f) of generating output data based on the first converted data and the second converted data. I do.
[0027]
Here, the procedure (f) may generate the output data by multiplying the first conversion data by the second conversion data, or the procedure (e) may generate the output data by incrementing or decrementing the third data. Is read from the second table, and the procedure (f) is to multiply the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated. Further, the procedure (d) determines that the number of data belonging to the i-th group is V i And V 0 ≤V 1 ≦… ≦ V N The
[0028]
Further, a data conversion program according to a third aspect of the present invention is a data conversion program that converts input data to generate output data, wherein the data conversion program includes one of bits “1” in n-bit input data. (A) for obtaining the first data indicating the number K of bits of “0” positioned higher than the bit positioned at the uppermost position, and performing the first conversion on a plurality of first data in advance. Reading the first converted data corresponding to the first data obtained in the step (a) from the first table storing the obtained plurality of converted data corresponding to the plurality of addresses (b) And (c) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data; and “1” bit in the p-bit-width second data. At the top of Step (d) of obtaining third data indicating a bit number of a bit, and storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance in correspondence with a plurality of addresses. A procedure (e) of reading out the second converted data corresponding to the third data obtained in the procedure (d) from the second table, and a first converted data and a second converted data. (F) generating output data based on the output data.
[0029]
Here, the procedure (f) may generate the output data by multiplying the first conversion data by the second conversion data, or the procedure (e) may generate the output data by incrementing or decrementing the third data. Is read from the second table, and the procedure (f) is to multiply the data obtained by performing the interpolation processing based on the second and third converted data by the first converted data to obtain the output data. May be generated.
[0030]
In the above, the interpolation process may be a linear interpolation process, and the first conversion is -K May be gamma-converted, and the second conversion may perform gamma conversion on data having an n-bit width in which the most significant bit is “1” and the subsequent p bits are second data.
[0031]
ADVANTAGE OF THE INVENTION According to this invention, while reducing the storage capacity of the circuit which stores conversion data, the error of output data can be reduced.
[0032]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings. Note that the same components are denoted by the same reference numerals, and description thereof will be omitted.
FIG. 1 is a diagram illustrating a configuration of a data conversion circuit according to the first embodiment of the present invention. In the present embodiment, the present invention is applied to a gamma conversion circuit. In the present embodiment, it is assumed that the input data has a 16-bit width and the output data has a 12-bit width.
In FIG. 1, the
[0033]
The
[0034]
The
[0035]
The conversion
[0036]
The
[0037]
The
[0038]
The
[0039]
The
[0040]
The interpolation conversion
[0041]
FIG. 2 is a diagram showing correspondence between input data, L data, M data, N data (table address), and conversion data for interpolation. In FIG. 2, y 00 Is 12-bit wide data obtained by gamma-converting data obtained by adding “1” to the upper part and “13′b0000000000000” to the lower part of the N data “2′b00” corresponding to the input data “16′h0001”, and 10 Is 12-bit width data obtained by gamma-converting data obtained by adding “1” to the upper part and “13′b0000000000000” to the lower part of the N data “2′b10” corresponding to the input data “16′h0003”. 01 Is 12-bit width data obtained by gamma-converting data obtained by adding “1” to the upper part and “13′b0000000000000” to the lower part of the N data “2′b01” corresponding to the input data “16′h0005”. 11 Is 12-bit width data obtained by gamma-converting data obtained by adding “1” to the upper part and “13′b0000000000000” to the lower part of the N data “2′b11” corresponding to the input data “16′h0007”.
[0042]
As shown in FIG. 2, for example, when the input data is “16′h0001”, the table address is “2′b00”, and when the input data is “16′h0002”, the table address is “16′h0002”. 2'b00 ". In this case, the interpolation conversion
[0043]
FIG. 3 is a diagram showing the correspondence between the input data, the table address, and the conversion data for interpolation. In FIG. 2, the display of the input data for which the corresponding interpolation conversion data is not stored in the interpolation conversion
[0044]
That is, as shown in FIG. 3, the interpolation conversion
[0045]
Referring to FIG. 1 again, the
[0046]
The
The
The
The
[0047]
The
The
[0048]
The conversion
[0049]
FIG. 4 is a diagram showing the correspondence between input data, L data, K data (table address), and conversion data. In FIG. 4, y F Is calculated using K data “4′hf” corresponding to the input data “16′h0001”. -K / 12-bit data obtained by calculating γ, and y E Is calculated using the K data “4′he” corresponding to the input data “16′h0002”. -K / 12-bit data obtained by calculating γ, and y D Is calculated using the K data “4′hd” corresponding to the input data “16′h0004”. -K / 12-bit data obtained by calculating γ, and y C Is calculated using the K data “4′hc” corresponding to the input data “16′h0008”. -K / This is 12-bit width data obtained by calculating γ. Also, y B Is calculated using K data “4′hb” corresponding to the input data “16′h0010”. -K / 12-bit data obtained by calculating γ, and y A Is calculated using K data “4′ha” corresponding to the input data “16′h0020”. -K / 12-bit data obtained by calculating γ, and y 0 Is calculated using K data “4′h0” corresponding to input data “16′h8000”. -K / This is 12-bit width data obtained by calculating γ.
[0050]
As shown in FIG. 4, for example, when the input data is “16′h0002”, the table address is “4′he”, and when the input data is “16′h0003”, the table address is “16′h0003”. 4'he ". In this case, the conversion
[0051]
FIG. 5 is a diagram showing the correspondence between input data, table addresses, and conversion data. The display of the input data for which the corresponding conversion data is not stored in the conversion
[0052]
That is, as shown in FIG. 5, the conversion
[0053]
Referring to FIG. 1 again, the
[0054]
Next, the principle of the processing performed by the
(Equation 2)
In the expression (2), n indicates the number of bits of the input data x, and in the present embodiment, n = 16.
[Equation 3]
Equation (3) shows a case where the upper k bits are 0. As shown in Expression (3), the conversion data y corresponding to the input data x is z 1 / term of γ and 2 -K / γ term, so that z and 2 -K Is used to calculate the conversion data y. z is obtained by shifting the input data x to the left by k bits and excluding higher-order 0s, and the highest order is “1”. Here, conversion data corresponding to all z values may be prepared in a table, or only conversion data corresponding to a representative z value may be prepared as described in the present embodiment. The rest may be obtained by interpolation.
[0055]
Next, z performed by the
(Equation 4)
[0056]
Next, gamma conversion processing in the
[0057]
When the processing of FIGS. 7 and 8 is started, the
Next, the
Next, the
Next, the
Next, the table
[0058]
Next, the interpolation conversion
Next, the
Next, the table
[0059]
Next, the conversion
Next, the
Next, the
[0060]
As shown in FIG. 8, in the linear interpolation processing, the
Next, the
Next, the
Next, the
[0061]
Referring again to FIG. 7, next, the conversion
Next, the
Thus, the
[0062]
Next, the operation of the
First, upon input of the input data “16′h0009”, the
[0063]
The
[0064]
When K data “4′hc” is input,
[0065]
The
[0066]
When the N data “2′b00” is input, the table
[0067]
When the first table address “2′b00” is input, the interpolation conversion
[0068]
The
[0069]
The
[0070]
The
The
[0071]
The
The
[0072]
FIG. 9 is a diagram illustrating linear interpolation in this example. As described above, the
[0073]
When the K data “4′hc” is input, the conversion
[0074]
The
[0075]
Next, an error between output data of the
[0076]
Thus, according to the present embodiment, the storage capacities of the conversion
[0077]
Note that the
[0078]
In the present embodiment, the
Furthermore, in the present embodiment, the input data has a 16-bit width and the output data has a 12-bit width, but these data may have other bit widths.
[0079]
FIG. 11 is a diagram illustrating a configuration of a data conversion circuit according to a modification of the first embodiment of the present invention. As shown in FIG. 11, in this modification, the
[0080]
The
[0081]
The
[0082]
The
[0083]
As described above, by also using the multiplier of the linear interpolation unit, an increase in hardware can be suppressed.
[0084]
Next, a second embodiment of the present invention will be described. FIG. 12 is a diagram illustrating a configuration of a data conversion circuit according to the second embodiment of the present invention. In the present embodiment, the present invention is applied to a gamma conversion circuit. In the present embodiment, it is assumed that the input data has a 16-bit width and the output data has a 12-bit width.
12, a
[0085]
The
The
The conversion
[0086]
The
The
[0087]
The
[0088]
The table
The interpolation conversion
[0089]
The
The
[0090]
The
[0091]
Further, the
[0092]
The
[0093]
FIG. 13 is a diagram showing correspondence between M data, a range obtained by dividing the M data into a predetermined width, dd data, span data, repi data (table address), and conversion data for interpolation. In FIG. 13, y 00 Is 12-bit width data obtained by gamma-converting the M data “16′h8000”, and y is 01 Is a 12-bit width data obtained by gamma-converting the M data “16′h9800”. 10 Is 12-bit width data obtained by gamma-converting the M data “16′hb800”, and y 11 Is 12-bit width data obtained by gamma-converting the M data “16′hd800”.
[0094]
As shown in FIG. 13, for example, when the M data is “16′h8000”, the table address is “2′b00”, and when the M data is “16′h8800”, the table address is “16′h8800”. 2′b00 ”. In this case, the interpolation conversion
[0095]
That is, the interpolation conversion
[0096]
Here, the range of M data "16'h8000" to "16'h9800" is rep0, the range of M data "16'h9800" to "16'hb800" is rep1, and the range of M data is "16'hb800". Assuming that the range from "" to "16'hd800" is rep2 and the range from "16'hd800" to "16'hffff" of the M data is rep3, the repi data indicates the rep number of the range to which the M data belongs.
[0097]
The span data is a ratio of the range to which the M data belongs to the other three ranges. For example, when the M data is “16′h8001”, the span data is “3” which is a ratio of rep0, which is the range to which the M data belongs, to rep1 to rep3.
[0098]
Referring again to FIG. 12, the
The subtracter 62 outputs, as step_y, data obtained by subtracting the output data of the
The correction
(Equation 5)
[0099]
The conversion
[0100]
FIG. 14 is a diagram showing correspondence between input data, table addresses, and conversion data. With respect to the input data (in this embodiment, 65536 types of “16′h0000” to “16′hffff”), the conversion data is y F , Y E , Y D , Y C , Y B , Y A , Y 9 , Y 8 , Y 7 , Y 6 , Y 5 , Y 4 , Y 3 , Y 2 , Y 1 , Y 0 Of 16 data. Therefore, the conversion
[0101]
That is, as shown in FIG. 14, the conversion
[0102]
Referring again to FIG. 12, the
[0103]
Next, the linear interpolation processing performed by the
y = y_tbl + dy (6)
[0104]
Next, gamma conversion processing in the
[0105]
When the processing in FIGS. 16 and 17 is started, the
Next, the
Next, the
Next, the
Next, the
[0106]
Next, the table
Next, the conversion
[0107]
Next, the table
Next, the conversion
Next, the
[0108]
As shown in FIG. 17, in the linear interpolation processing, the
Next, the
Next, the
[0109]
Next, the subtracter 62 subtracts the first conversion data, which is the output data of the
[0110]
Next, the correction
[0111]
Referring again to FIG. 16, next, the conversion
Next, the
Thus, the
[0112]
Next, an error between output data of the
[0113]
As described above, according to the present embodiment, the size of the conversion table stored in the conversion
[0114]
Note that the
[0115]
Further, in the present embodiment, the
In the present embodiment, the input data has a 16-bit width and the output data has a 12-bit width. However, these data may have other bit widths.
[0116]
Further, in the present embodiment, the
[0117]
Next, a third embodiment of the present invention will be described. FIG. 19 is a diagram illustrating a configuration of a data conversion circuit according to the third embodiment of the present invention. In the present embodiment, the present invention is applied to a gamma conversion circuit. In the present embodiment, it is assumed that the input data has a 16-bit width and the output data has a 12-bit width.
In FIG. 19, the
[0118]
The
[0119]
The
The
The
The
[0120]
The
[0121]
The table
The conversion
[0122]
FIG. 20 is a diagram showing the correspondence between input data, L1 data, M data, L2 data (table address), and conversion data for interpolation. In FIG. 20, y 00 Is a 16-bit width data in which bit
[0123]
As shown in FIG. 20, for example, when the input data is “16′h0001”, the table address is “2′b00”, and when the input data is “16′h0002”, the table address is “16′h0002”. 2′b00 ”. In this case, the interpolation conversion
[0124]
FIG. 21 is a diagram showing the correspondence between the input data, the table address, and the conversion data for interpolation. In FIG. 20, the display of input data for which the corresponding interpolation conversion data is not stored in the interpolation conversion
[0125]
That is, as shown in FIG. 21, the interpolation conversion
[0126]
Referring to FIG. 19 again, the
The
[0127]
Next, the gamma conversion processing of the gamma conversion circuit will be described with reference to FIGS. 19, 22, and 23. FIG. 22 is a flowchart illustrating the gamma conversion processing of the gamma conversion circuit, and FIG. 23 is a flowchart illustrating the linear interpolation processing of the linear interpolation unit of the gamma conversion circuit.
[0128]
When the processing in FIGS. 22 and 23 is started, the
Next, the
Next, the
Next, the
Next, the
Next, the table
[0129]
Next, the conversion
Next, the
Next, the table
[0130]
Next, the interpolation conversion
Next, the
Next, the
[0131]
As shown in FIG. 23, in the linear interpolation processing, the
Next, the
Next, the
[0132]
Next, the
Next, the
Next, the
[0133]
Next, the conversion
Next, the
Thus, the
[0134]
Next, an error between output data of the
[0135]
As described above, according to the present embodiment, the storage capacity of the conversion
[0136]
Note that the
[0137]
In the present embodiment, the input data has a 16-bit width and the output data has a 12-bit width. However, these data may have other bit widths.
[0138]
【The invention's effect】
As described above, according to the present invention, it is possible to reduce the storage capacity of the circuit that stores the conversion data and reduce the error in the output data.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating a configuration of a gamma conversion circuit according to a first embodiment of the present invention.
FIG. 2 is a diagram showing correspondence between input data, L data, M data, N data (table address), and conversion data for interpolation in the first embodiment of the present invention.
FIG. 3 is a diagram showing correspondence between input data, table addresses, and conversion data for interpolation in the first embodiment of the present invention.
FIG. 4 is a diagram showing a correspondence among input data, L data, K data (table address), and converted data in the first embodiment of the present invention.
FIG. 5 is a diagram showing correspondence between input data, table addresses, and conversion data according to the first embodiment of the present invention.
FIG. 6 is a diagram illustrating the principle of linear interpolation processing according to the first embodiment of the present invention.
FIG. 7 is a flowchart illustrating an operation of the gamma conversion circuit according to the first embodiment of the present invention.
FIG. 8 is a flowchart illustrating a linear interpolation process of the gamma conversion circuit according to the first embodiment of the present invention.
FIG. 9 is a diagram illustrating a principle of calculating gamma conversion data by linear interpolation processing according to the first embodiment of the present invention.
FIG. 10 is a diagram illustrating an error in output data of the gamma conversion circuit according to the first embodiment of the present invention.
FIG. 11 is a diagram illustrating a configuration of a gamma conversion circuit according to a modification of the first embodiment of the present invention.
FIG. 12 is a diagram illustrating a configuration of a gamma conversion circuit according to a second embodiment of the present invention.
FIG. 13 is a diagram showing correspondence between M data, a range of M data, dd data, span data, repi data (table address), and conversion data for interpolation in the second embodiment of the present invention.
FIG. 14 is a diagram showing correspondence between input data, table addresses, and conversion data according to the second embodiment of the present invention.
FIG. 15 is a diagram illustrating the principle of linear interpolation processing according to the second embodiment of the present invention.
FIG. 16 is a flowchart illustrating an operation of the gamma conversion circuit according to the second embodiment of the present invention.
FIG. 17 is a flowchart illustrating a linear interpolation process of the gamma conversion circuit according to the second embodiment of the present invention.
FIG. 18 is a diagram illustrating an error in output data of a gamma conversion circuit according to the second embodiment of the present invention.
FIG. 19 is a diagram illustrating a configuration of a gamma conversion circuit according to a third embodiment of the present invention.
FIG. 20 is a diagram showing correspondence between input data, L1 data, M data, L2 data (table address), and conversion data for interpolation in the third embodiment of the present invention.
FIG. 21 is a diagram illustrating correspondence between input data, table addresses, and conversion data for interpolation according to the third embodiment of the present invention.
FIG. 22 is a flowchart illustrating an operation of the gamma conversion circuit according to the third embodiment of the present invention.
FIG. 23 is a flowchart illustrating a linear interpolation process of the gamma conversion circuit according to the third embodiment of the present invention.
FIG. 24 is a diagram illustrating an error of output data of the gamma conversion circuit according to the third embodiment of the present invention.
FIG. 25 is a diagram showing a graph of gamma conversion.
FIG. 26 is a diagram showing a configuration of a conventional gamma conversion circuit.
FIG. 27 is a diagram showing a configuration of a conventional gamma conversion circuit.
FIG. 28 is a diagram illustrating an error of output data of the gamma conversion circuit of FIG. 27;
[Explanation of symbols]
10, 30, 50, 70 gamma conversion circuit
11, 51, 71, 76 priority encoder
12, 22, 42, 52, 62, 72 Subtractor
13, 53, 73, 101, 111 Conversion table storage
14, 24, 44, 54, 74, 82 Shifter
15, 55, 65, 75, 79 bit extraction unit
16, 57, 77 Table address creation unit
17, 58, 78 Conversion table storage for interpolation
18, 46, 47 multiplexer
19, 23, 43, 59 Multiplier
20, 40, 60, 80, 112 Linear interpolation unit
25, 45, 67, adder
48 Latch Circuit
56, 63, 64 Table storage unit
66 Correction term calculator
81 decoder
Claims (39)
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(c)において求められた第2のデータに対応する第2の変換データを読み出すステップ(d)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成するステップ(e)と、
を具備するデータ変換方法。A data conversion method for converting input data to generate output data,
(a) determining first data indicating the number K of bits of “0” located higher than the most significant bit among the bits of “1” in the n-bit width input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading out first converted data corresponding to the first data;
(C) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
The second table obtained in step (c) is obtained from a second table storing a plurality of converted data obtained by previously performing a second conversion on a plurality of second data corresponding to a plurality of addresses. (D) reading out the second converted data corresponding to the second data;
(E) generating output data based on the first converted data and the second converted data;
A data conversion method comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、
前記第2のデータに所定の操作を施すことにより第3のデータを求めるステップ(d)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(d)において求められた第3のデータに対応する第2の変換データを読み出すステップ(e)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成するステップ(f)と、
を具備するデータ変換方法。A data conversion method for converting input data to generate output data,
(a) determining first data indicating the number K of bits of “0” located higher than the most significant bit among the bits of “1” in the n-bit width input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading out first converted data corresponding to the first data;
(C) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
(D) obtaining third data by performing a predetermined operation on the second data;
The second table obtained in step (d) is obtained from a second table that stores a plurality of converted data obtained by previously performing a second conversion on a plurality of second data corresponding to a plurality of addresses. (E) reading the second converted data corresponding to the data of No. 3;
(F) generating output data based on the first converted data and the second converted data;
A data conversion method comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求めるステップ(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出すステップ(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求めるステップ(c)と、
pビット幅の前記第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求めるステップ(d)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、ステップ(d)において求められた第3のデータに対応する第2の変換データを読み出すステップ(e)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成するステップ(f)と、
を具備するデータ変換方法。A data conversion method for converting input data to generate output data,
(a) determining first data indicating the number K of bits of “0” located higher than the most significant bit among the bits of “1” in the n-bit width input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading out first converted data corresponding to the first data;
(C) obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
(d) obtaining third data indicating a bit number of a most significant bit among bits that are “1” in the second data having a p-bit width;
The second table obtained in step (d) is obtained from a second table that stores a plurality of converted data obtained by previously performing a second conversion on a plurality of second data corresponding to a plurality of addresses. (E) reading the second converted data corresponding to the data of No. 3;
(F) generating output data based on the first converted data and the second converted data;
A data conversion method comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、前記第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、前記第3の手段が求めた第2のデータに対応する第2の変換データを読み出す第4の手段と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する第5の手段と、
を具備するデータ変換回路。A data conversion circuit for converting input data to generate output data,
first means for obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
A first table obtained by the first means from a first table storing a plurality of converted data obtained by previously performing a first conversion on a plurality of first data corresponding to a plurality of addresses. Second means for reading out first converted data corresponding to one piece of data;
Third means for obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
A third table obtained by the third means from a second table storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance corresponding to a plurality of addresses. Fourth means for reading out the second converted data corresponding to the second data,
Fifth means for generating output data based on the first converted data and the second converted data;
A data conversion circuit comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、前記第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、
前記第2のデータに所定の操作を施すことにより第3のデータを求める第4の手段と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、前記第4の手段が求めた第3のデータに対応する第2の変換データを読み出す第5の手段と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する第6の手段と、
を具備するデータ変換回路。A data conversion circuit for converting input data to generate output data,
first means for obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
A first table obtained by the first means from a first table storing a plurality of converted data obtained by previously performing a first conversion on a plurality of first data corresponding to a plurality of addresses. Second means for reading out first converted data corresponding to one piece of data;
Third means for obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
Fourth means for obtaining third data by performing a predetermined operation on the second data;
A fourth table obtained by the fourth means from a second table storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance corresponding to a plurality of addresses. Fifth means for reading out the second converted data corresponding to the data of No. 3,
Sixth means for generating output data based on the first converted data and the second converted data;
A data conversion circuit comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める第1の手段と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、前記第1の手段が求めた第1のデータに対応する第1の変換データを読み出す第2の手段と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める第3の手段と、
pビット幅の前記第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求める第4の手段と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、前記第4の手段が求めた第3のデータに対応する第2の変換データを読み出す第5の手段と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する第6の手段と、
を具備するデータ変換回路。A data conversion circuit for converting input data to generate output data,
first means for obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
A first table obtained by the first means from a first table storing a plurality of converted data obtained by previously performing a first conversion on a plurality of first data corresponding to a plurality of addresses. Second means for reading out first converted data corresponding to one piece of data;
Third means for obtaining p-bit-width second data following the bit located at the (K + 1) th position from the most significant bit in the input data;
fourth means for obtaining third data indicating a bit number of a most significant bit among bits which are "1" in the second data having a p-bit width;
A fourth table obtained by the fourth means from a second table storing a plurality of converted data obtained by performing a second conversion on a plurality of second data in advance corresponding to a plurality of addresses. Fifth means for reading out the second converted data corresponding to the data of No. 3,
Sixth means for generating output data based on the first converted data and the second converted data;
A data conversion circuit comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、手順(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(c)において求められた第2のデータに対応する第2の変換データを読み出す手順(d)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する手順(e)と、
を具備するデータ変換プログラム。A data conversion program that converts input data to generate output data,
(a) obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading the first converted data corresponding to the first data;
A step (c) of obtaining p-bit-width second data following the K + 1-th bit from the most significant bit in the input data;
The second table obtained in step (c) from a second table storing a plurality of converted data obtained by previously performing a second conversion on a plurality of second data in correspondence with a plurality of addresses. (D) reading out the second converted data corresponding to the second data;
(E) generating output data based on the first converted data and the second converted data;
A data conversion program comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、ステップ(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、
前記第2のデータに所定の操作を施すことにより第3のデータを求める手順(d)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(d)において求められた第3のデータに対応する第2の変換データを読み出す手順(e)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する手順(f)と、
を具備するデータ変換プログラム。A data conversion program that converts input data to generate output data,
(a) obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading the first converted data corresponding to the first data;
A step (c) of obtaining p-bit-width second data following the K + 1-th bit from the most significant bit in the input data;
A procedure (d) for obtaining third data by performing a predetermined operation on the second data;
The second table obtained in step (d) is obtained from a second table that stores a plurality of converted data obtained by previously performing a second conversion on a plurality of second data in correspondence with a plurality of addresses. (E) reading the second converted data corresponding to the data No. 3;
(F) generating output data based on the first converted data and the second converted data;
A data conversion program comprising:
nビット幅の前記入力データ中の「1」であるビットの内で最上位に位置するビットより上位に位置する「0」のビット数Kを示す第1のデータを求める手順(a)と、
予め複数の第1のデータに第1の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第1のテーブルから、手順(a)において求められた第1のデータに対応する第1の変換データを読み出す手順(b)と、
前記入力データ中で、最上位からK+1番目に位置するビットに続くpビット幅の第2のデータを求める手順(c)と、
pビット幅の前記第2のデータ中の「1」であるビットの内で最上位に位置するビットのビット番号を示す第3のデータを求める手順(d)と、
予め複数の第2のデータに第2の変換を施すことにより得られた複数の変換データを複数のアドレスに対応して格納している第2のテーブルから、手順(d)において求められた第3のデータに対応する第2の変換データを読み出す手順(e)と、
前記第1の変換データと前記第2の変換データとに基づいて出力データを生成する手順(f)と、
を具備するデータ変換プログラム。A data conversion program that converts input data to generate output data,
(a) obtaining first data indicating the number K of bits of "0" located higher than the most significant bit among the bits of "1" in the n-bit input data;
From a first table that stores a plurality of converted data obtained by previously performing a first conversion on a plurality of first data in correspondence with a plurality of addresses, the first table obtained in step (a) (B) reading the first converted data corresponding to the first data;
A step (c) of obtaining p-bit-width second data following the K + 1-th bit from the most significant bit in the input data;
(d) obtaining third data indicating the bit number of the most significant bit among the bits that are “1” in the second data having a p-bit width;
The second table obtained in step (d) is obtained from a second table that stores a plurality of converted data obtained by previously performing a second conversion on a plurality of second data in correspondence with a plurality of addresses. (E) reading the second converted data corresponding to the data No. 3;
(F) generating output data based on the first converted data and the second converted data;
A data conversion program comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002242471A JP2004088157A (en) | 2002-08-22 | 2002-08-22 | Data conversion method, data converter circuit, and data conversion program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002242471A JP2004088157A (en) | 2002-08-22 | 2002-08-22 | Data conversion method, data converter circuit, and data conversion program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004088157A true JP2004088157A (en) | 2004-03-18 |
Family
ID=32051548
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002242471A Withdrawn JP2004088157A (en) | 2002-08-22 | 2002-08-22 | Data conversion method, data converter circuit, and data conversion program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004088157A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008547137A (en) * | 2005-06-28 | 2008-12-25 | クゥアルコム・インコーポレイテッド | System and method for counting leading zeros and leading ones in a digital signal processor |
-
2002
- 2002-08-22 JP JP2002242471A patent/JP2004088157A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008547137A (en) * | 2005-06-28 | 2008-12-25 | クゥアルコム・インコーポレイテッド | System and method for counting leading zeros and leading ones in a digital signal processor |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108228136B (en) | Logarithmic function calculation method and device based on optimization lookup table method | |
JP3551113B2 (en) | Divider | |
JP3757884B2 (en) | Data conversion method, data conversion circuit, and data conversion program | |
JP2001127645A (en) | Error correction method and error correction device | |
US8909689B2 (en) | Arithmetic device | |
JP2011028312A (en) | Processor, control method thereof, and arithmetic processing program | |
JP2004088157A (en) | Data conversion method, data converter circuit, and data conversion program | |
JP2008257407A (en) | Logarithmic computing unit and logarithmic computing method | |
JP2005056032A (en) | Residue system arithmetic system, scaling arithmetic unit, scaling arithmetic method, its program, and recording medium | |
JP2846816B2 (en) | Digital signal processor | |
KR20160057590A (en) | Elimination Method for Common Sub-Expression And Filter Using the Method | |
US6636882B1 (en) | Means and method for performing multiplication | |
JPH1032497A (en) | Error evaluation polynomial coefficient computing device | |
CN114840175B (en) | Device and method for realizing remainder operation and operation chip | |
JPH10320524A (en) | Look-up table device and image generator | |
JP2914813B2 (en) | Error correction decoding device | |
JP2795253B2 (en) | Divider | |
JP3390599B2 (en) | Divider | |
JP2000010763A (en) | Division circuit | |
JP4402523B2 (en) | DATA CONVERSION METHOD, DATA CONVERSION DEVICE, PROGRAM, AND STORAGE MEDIUM | |
JP2002063023A (en) | Arithmetic unit and arithmetic method | |
JP4505751B2 (en) | Waveform data converter | |
JP2002063022A (en) | Data converter, data storage device and method therefor | |
JPH08249161A (en) | Cubic root arithmetic unit | |
JPH06202752A (en) | Interpolating device for exponential function data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20051101 |