JP2004088157A - Data conversion method, data converter circuit, and data conversion program - Google Patents

Data conversion method, data converter circuit, and data conversion program Download PDF

Info

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
Application number
JP2002242471A
Other languages
Japanese (ja)
Inventor
Hisao Sato
佐藤 比佐夫
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2002242471A priority Critical patent/JP2004088157A/en
Publication of JP2004088157A publication Critical patent/JP2004088157A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Picture Signal Circuits (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a data converter circuit, etc. which reduces the memory capacity of a circuit for storing conversion data and the error of output data. <P>SOLUTION: The conversion circuit comprises a priority encoder 11 for outputting the bit number of "1" located at the highest position in an input data as an L-data, a subtractor 12 for outputting the number of bits higher than this position as a K-data, a memory 13 for storing a conversion table, a shifter 14 for shifting the input data to output an M-data, a bit extractor 15 for extracting an N-data and a P-data from the M-data, a table address creation part 16 for forming a table address based on the N-data, a memory 17 for storing an interpolating conversion table, and means 19, 20 for generating output data based on the output of the conversion table memory 13 and the output of the interpolating conversion table memory 17. <P>COPYRIGHT: (C)2004,JPO

Description

【0001】
【発明の属する技術分野】
本発明は、入力データを変換して出力データを生成するデータ変換方法、データ変換回路及びデータ変換プログラムに関し、特に、入力データをガンマ変換して出力データを生成するデータ変換方法等に関する。
【0002】
【従来の技術】
一般に、CRT等の受像管において、駆動電圧Eとカソード電流Iとの間には、次式で表すような関係が存在する。
I=KEγ
この関係はガンマ(γ)特性と呼ばれる。ガンマの値は一般に1.6〜3程度であるので、カソード電流Iは駆動電圧Eに対して非直線性を有する。受像管においてγ=1とすることは困難なので、送像側にガンマ補正回路を設けて総合的にγ=1とすることが行われている。本願においては、このようなガンマ補正のために画像信号に対して行う変換のことをガンマ変換という。
【0003】
画像読み取り装置や画像表示装置等に用いられる画像処理LSI等において、画像データのガンマ変換が行われる。ガンマ変換は、入力をx、出力をyとすると、次式によって表される。
【数1】

Figure 2004088157
【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群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、第2のデータ0〜(2−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群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、第2のデータ0〜(2−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群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、第2のデータ0〜(2−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において、yは、入力データ「16’h0001」に対応するKデータ「4’hf」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yは、入力データ「16’h0002」に対応するKデータ「4’he」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yは、入力データ「16’h0004」に対応するKデータ「4’hd」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yは、入力データ「16’h0008」に対応するKデータ「4’hc」を用いて2−K/γを計算することにより求めた12ビット幅のデータである。また、yは、入力データ「16’h0010」に対応するKデータ「4’hb」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yは、入力データ「16’h0020」に対応するKデータ「4’ha」を用いて2−K/γを計算することにより求めた12ビット幅のデータであり、yは、入力データ「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/γを計算することにより求めた変換データyをテーブルアドレス「4’he」に対応させて格納し、入力データ「16’h0003」に対応するKデータ「4’he」を用いて求めた変換データyは格納しない。このように、複数の入力データから同一のテーブルアドレスが生成される場合には、変換テーブル格納部13は、複数の入力データの内の最小の入力データに対応するKデータを用いて求めた変換データのみを格納する。
【0051】
図5は、入力データ、テーブルアドレス、及び、変換データの対応を示す図である。図4において対応する変換データが変換テーブル格納部13に格納されていない入力データの表示は、図5においては省かれている。図4に示すように、入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、変換データは、y、y、y、y、y、y、y、y、y、y、y、y、y、y、y、yの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」にそれぞれ対応する変換データy、y、y、y、y、y、y、y、y、y、y、y、y、y、y、及び、yを格納する。
【0053】
再び図1を参照すると、乗算器19は、変換テーブル格納部13の出力データに線形補間部20の出力データを乗じ、出力データ(ガンマ変換データ)として出力する。
【0054】
次に、ガンマ変換回路10が行う処理の原理について、式(2)及び式(3)を参照しながら説明する。
【数2】
Figure 2004088157
式(2)において、nは入力データxのビット数を示し、本実施形態においてはn=16である。
【数3】
Figure 2004088157
式(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は、入力データxに対応する変換データyを、次式によって算出することができる。
【数4】
Figure 2004088157
【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)の「y」に対応する。
【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+y」に対応する。
【0072】
図9は、本例における線形補間を示す図である。このように、線形補間部20は、Mデータ「16’h9000」に応じた出力データ(ガンマ変換データ)を出力することができる。
【0073】
変換テーブル格納部13は、Kデータ「4’hc」を入力すると、Kデータ「4’hc」をテーブルアドレスとして、テーブルアドレス「4’hc」に対応する変換データを出力する。
【0074】
乗算器19は、線形補間部20の出力データ(ここでは、212×(y01−y00)/213+y)に変換テーブル格納部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ビットを抽出し、抽出したデータをxデータとして出力する。
【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データ、xデータ、及び、step_yデータを入力し、dyデータを次式によって算出して出力する。ここで、211の指数部である「11」は、MデータのMSBのビット番号「15」から、Nデータのビット数である「4」を引いたものである。加算器67は、dyデータをy_tblデータに加えて出力する。
【数5】
Figure 2004088157
【0099】
変換テーブル格納部53は、Kデータをテーブルアドレスとし、2−K/γを表す12ビット幅の変換データをテーブルアドレスに対応させた変換テーブルを格納しており、テーブルアドレスに応じて変換データを出力する。
【0100】
図14は、入力データ、テーブルアドレス、及び、変換データの対応を示す図である。入力データ(本実施形態においては、「16’h0000」〜「16’hffff」の65536通りに変化する)に対して、変換データは、y、y、y、y、y、y、y、y、y、y、y、y、y、y、y、yの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」にそれぞれ対応する変換データy、y、y、y、y、y、y、y、y、y、y、y、y、y、y、及び、yを格納する。
【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データを入力し、xデータを出力する(ステップS401)。
次に、テーブル格納部63は、Nデータを入力し、ddデータを出力する(ステップS402)。
次に、テーブル格納部64は、Nデータを入力し、spanデータを出力する(ステップS403)。
【0109】
次に、減算器62は、補間用変換テーブル格納部58の出力データである第2の変換データからレジスタ61の出力データである第1の変換データを減じ、step_yデータを出力する(ステップS404)。
【0110】
次に、補正項算出部66は、xデータ、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)
Figure 2004088157
[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 gamma conversion circuit 100 includes a conversion table storage unit 101 that stores a conversion table having conversion data corresponding to input data, and outputs conversion data corresponding to the input data. . Here, the conversion table storage unit 101 is configured by a high-speed storage element such as an SRAM.
[0005]
In the gamma conversion circuit 100, for example, when the input data is 12-bit data and the output data is 8-bit data, the size of the conversion table is 4096 words (here, 1 word = 8 bits). And the storage capacity of the conversion table storage unit 101 is also required to be 4096 words. When the input data is 16-bit data and the output data is 12-bit data, the size of the conversion table is 65536 words (here, 1 word = 12 bits). Requires 65,536 words. It is extremely difficult to integrate a large-capacity SRAM for storing such a large-sized conversion table in an image processing LSI. Further, even if such a large-capacity SRAM can be integrated in an image processing LSI, the cost of the image processing LSI will be significantly increased.
[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 gamma conversion circuit 110 includes a conversion table storage unit 111 for storing a conversion table having conversion data corresponding to input data at predetermined intervals, and an interpolation process for output data of the conversion table storage unit 111. Is provided. Here, the conversion table storage unit 111 is configured by a high-speed storage element such as an SRAM.
[0007]
In the gamma conversion circuit 110, for example, when the input data is 12-bit data, the output data is 8-bit data, and the interval between the input data in which the corresponding conversion data is stored is 16, The size of the table is 256 words (1 word = 8 bits in this case), and the storage capacity required for the conversion table storage unit 111 is also reduced to 256 words. If the input data is 16-bit data, the output data is 12-bit data, and the interval between the input data is 16, the size of the conversion table is 4096 words (here, 1 word = 12 bits). ), And the storage capacity required for the conversion table storage unit 111 is also reduced to 4096 words.
[0008]
[Problems to be solved by the invention]
However, the output data of the gamma conversion circuit 110 has an error because it is calculated by the interpolation processing. FIG. 28 shows the output of the gamma conversion circuit 110 when the input data is 16-bit data, the output data is 16-bit data, and the interval between the input data in which the corresponding conversion data is stored is 16. FIG. 6 is a diagram illustrating an error between data and a value calculated by Expression (1). As shown in FIG. 28, the output data of the gamma conversion circuit 110 has an error of about 130 at the maximum.
[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 second data 0 to (2 p Third data may be obtained by dividing -1) into N groups.
[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 second data 0 to (2 p Third data may be obtained by dividing -1) into N groups.
[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 second data 0 to (2 p Third data may be obtained by dividing -1) into N groups.
[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 gamma conversion circuit 10 includes a priority encoder 11, a subtractor 12, a conversion table storage unit 13, a shifter 14, a bit extraction unit 15, a table address creation unit 16, an interpolation conversion table storage unit. 17, a multiplexer 18, a multiplier 19, and a linear interpolation unit 20. The linear interpolation unit 20 includes a register 21, a subtracter 22, a multiplier 23, a shifter 24, and an adder 25.
[0033]
The priority encoder 11 inputs 16-bit width input data, detects the most significant bit “1” in the input data, and outputs the detected bit number as 4-bit width L data. In general, the bit number is counted from the least significant bit to 0, with the least significant bit set to 0. In the present embodiment, generally, the bit number of the least significant bit is set to 0, and the bit number of the most significant bit is set to 15. For example, the priority encoder 11 determines that the input data is “16′h0001” (here, “16 ′” indicates that the data has a 16-bit width, “h” indicates that the data is in hexadecimal notation, and “0001” indicates that the input data is “0001”. "Indicates the value of the input data),"4'h0"(where" 4 '"indicates that the data has a 4-bit width, and" h "indicates that the data is in hexadecimal. And “0” indicates the value of the L data), and when the input data is “16′h0002”, the L data of “4′h1” is output, and the input data is “16′h0002”. In the case of 'h0003', L data of '4'h1' is output. When there is no “1” bit in the input data, that is, when the input data is “16′h0000”, the priority encoder 11 outputs the L data of “4′h0” and outputs a high-level signal. Is output.
[0034]
The subtractor 12 subtracts L data from “4′hf” and outputs the result as K data having a 4-bit width. For example, when the L data is “4′h3”, the subtractor 12 outputs the K data of “4′hc”. Alternatively, 4-bit width K data may be directly created by decoding 16-bit width input data.
[0035]
The conversion table storage unit 13 uses the K data as a table address, -K It stores a conversion table in which conversion data having a 12-bit width obtained by gamma-converting is converted into a table address, and the conversion data is output according to the table address.
[0036]
The shifter 14 shifts the input data to the left by the value of the K data output from the subtractor and outputs M data. For example, if the input data is "16'h0008", the input data "16'h0008" is shifted to the left by K data "4'hc", and the M data of "16'h8000" is output. If it is "16'h000a", the M data of "16'ha000" obtained by shifting the input data "16'h000a" to the left by K data "4'hc" is output.
[0037]
The bit extraction unit 15 receives the M data and outputs 2 bits of the bit numbers 14 and 13 as N data. For example, when the M data is “16′h8000”, the bit extraction unit 15 determines that “2′b00” (here, “2 ′” indicates that the data has a 2-bit width, and “b” Indicates binary display, "00" indicates a data value), and outputs N data of "2'b01" when M data is "16'ha000". Output. Alternatively, N data having a 2-bit width may be directly created by decoding input data having a 16-bit width.
[0038]
The bit extracting unit 15 outputs to the multiplier 23 P data obtained by zero-extending the 13 bits of the bit numbers 12 to 0 in the M data to a 16-bit width. For example, when the M data is “16′h8001”, the bit extracting unit 15 outputs “16′h0001” obtained by adding 3 bits of 0 to the upper 13 bits of the lower 13 bits of the M data to the multiplier 23 as P data. Output. Further, for example, when the M data is “16′h8003”, the bit extraction unit 15 adds “3′0” to the upper 13 bits of “13′b0000000000011”, which is the lower 13 bits of the M data, to “16′h0003”. Is output to the multiplier 23 as P data.
[0039]
The table address generator 16 outputs the input 2-bit width N data as a first table address, and after a predetermined time has elapsed, outputs a second table address obtained by incrementing (or decrementing) the N data. For example, when the N data is “2′b00”, the table address creating unit 16 outputs “2′b00” as the first table address, and after a predetermined time elapses, outputs “2′b01” as the first table address. 2 as the table address.
[0040]
The interpolation conversion table storage unit 17 corresponds to a table address with 12-bit interpolation conversion data obtained by gamma-converting 16-bit data obtained by adding “1” to the upper part of N data and “13'b0000000000000” to the lower part. The first and second interpolation conversion tables are stored, and the first and second interpolation conversion data are output according to the first and second table addresses.
[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 table storage unit 17 zero-extends the N data “2′b00” corresponding to the input data “16′h0001” to a 16-bit width, sets the bit of bit number 2 to “1”, and Interpolation conversion data y obtained by gamma-converting the data left-shifted by the number of bits 00 Is stored in association with the table address “2′b00”, the N data “2′b00” corresponding to the input data “16′h0002” is zero-extended to a 16-bit width, and the bit of bit number 2 is set to “1”. And interpolation conversion data y obtained by gamma-converting data shifted left by 13 bits. 00 Is not stored. As described above, when the same table address is generated from a plurality of input data, the interpolation conversion table storage unit 17 stores the N data corresponding to the minimum input data among the plurality of input data in a 16-bit width. , The bit of bit number 2 is set to “1”, and only interpolation conversion data obtained by gamma conversion of data shifted left by 13 bits is stored.
[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 table storage unit 17 is omitted in FIG. As shown in FIG. 2, for the input data (in the present embodiment, 65536 types of “16′h0000” to “16′hffff”), the conversion data for interpolation is y. 00 , Y 10 , Y 01 , Y 11 4 data. Therefore, the interpolation conversion table storage unit 17 only needs to have a storage capacity of 4 words (here, 1 word = 12 bits).
[0044]
That is, as shown in FIG. 3, the interpolation conversion table storage unit 17 stores the interpolation conversion tables respectively corresponding to the input data "16'h0001", "16'h0003", "16'h0005", and "16'h0007". Data y 00 , Y 10 , Y 01 , And y 11 Is stored.
[0045]
Referring to FIG. 1 again, the multiplexer 18 selects and outputs “0” when the zero signal is at a high level, and converts the conversion data output from the conversion table storage unit 17 when the zero signal is at a low level. Select and output.
[0046]
The linear interpolation unit 20 performs a linear interpolation process on the first and second conversion data output from the conversion table storage unit 17.
The register 21 holds the first converted data output from the multiplexer 18 for a predetermined time.
The subtracter 22 subtracts the first conversion data output from the register 21 from the second conversion data output from the multiplexer 18 and outputs the result.
The multiplier 23 multiplies the output data of the subtractor 22 by P data and outputs the result.
[0047]
The shifter 24 right-shifts the output data of the multiplier 23 by “4′hd” (13 bits) and outputs the data.
The adder 25 adds the output data of the shifter 24 to the output data of the register 21 and outputs the result.
[0048]
The conversion table storage unit 13 uses the K data as a table address, -K / A conversion table is stored in which conversion data of 12-bit width representing γ is associated with a table address, and the conversion data is output according to the table address.
[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 table storage unit 17 uses the K data “4′he” corresponding to the input data “16′h0002” to store -K / Conversion data y obtained by calculating γ E Is stored in association with the table address “4′he”, and the conversion data y obtained using the K data “4′he” corresponding to the input data “16′h0003” E Is not stored. As described above, when the same table address is generated from a plurality of input data, the conversion table storage unit 13 converts the conversion data obtained by using the K data corresponding to the minimum input data among the plurality of input data. Store only data.
[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 table storage unit 13 in FIG. 4 is omitted in FIG. As shown in FIG. 4, for input data (in the present 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 table storage unit 13 only needs to have a storage capacity of 16 words (here, 1 word = 12 bits).
[0052]
That is, as shown in FIG. 5, the conversion table storage unit 13 stores the input data "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", and conversion data y corresponding to "16'h8000", respectively. 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 , And y 0 Is stored.
[0053]
Referring to FIG. 1 again, the multiplier 19 multiplies the output data of the conversion table storage unit 13 by the output data of the linear interpolation unit 20, and outputs the result as output data (gamma conversion data).
[0054]
Next, the principle of the processing performed by the gamma conversion circuit 10 will be described with reference to equations (2) and (3).
(Equation 2)
Figure 2004088157
In the expression (2), n indicates the number of bits of the input data x, and in the present embodiment, n = 16.
[Equation 3]
Figure 2004088157
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 linear interpolation unit 20 1 / The linear interpolation of the term γ will be described with reference to FIG. FIG. 6 is a diagram illustrating the principle of the linear interpolation processing performed by the linear interpolation unit 20. As shown in FIG. 6, the linear interpolation unit 20 outputs the input data x L Conversion data y corresponding to L Can be calculated by the following equation.
(Equation 4)
Figure 2004088157
[0056]
Next, gamma conversion processing in the gamma conversion circuit 10 will be described with reference to FIGS. 1, 7, and 8. FIG. FIG. 7 is a flowchart illustrating the gamma conversion processing of the gamma conversion circuit, and FIG. 8 is a flowchart illustrating the linear interpolation processing of the linear interpolation unit of the gamma conversion circuit.
[0057]
When the processing of FIGS. 7 and 8 is started, the priority encoder 11 inputs input data and outputs L data (step S101).
Next, the subtractor 12 receives the L data and outputs the K data (step S102).
Next, the shifter 14 receives the input data and the K data, and outputs the M data (step S103).
Next, the bit extracting unit 15 receives the M data and outputs the N data and the P data (step S104).
Next, the table address creation unit 16 receives the N data and outputs a first table address (step S105).
[0058]
Next, the interpolation conversion table storage unit 17 outputs the first conversion data according to the first table address (Step S106).
Next, the multiplexer 18 selects and outputs 0 or the first conversion data according to the value of the zero signal, and this is read into the register 21 (step S107).
Next, the table address creation unit 16 outputs a second table address obtained by incrementing the first table address (Step S108).
[0059]
Next, the conversion table storage unit 17 for interpolation outputs the second conversion data according to the second table address (step S109).
Next, the multiplexer 18 selectively outputs 0 or the second converted data according to the value of the zero signal (step S110).
Next, the linear interpolation unit 20 performs a linear interpolation process based on the first conversion data and the second conversion data, and outputs interpolation data (Step S111).
[0060]
As shown in FIG. 8, in the linear interpolation processing, the subtracter 22 of the linear interpolation unit 20 subtracts the first converted data output from the register 21 from the second converted data output from the multiplexer 18 ( Step S201).
Next, the multiplier 23 multiplies the output data of the subtractor 22 by P data (Step S202).
Next, the shifter 24 shifts the output data of the multiplier 23 rightward by “4 ′ hd” (13 bits) (step S203).
Next, the adder 25 adds the output data of the shifter 24 to the first converted data, which is the output data of the register 21, and outputs the result as interpolation data (step S204).
[0061]
Referring again to FIG. 7, next, the conversion table storage unit 13 outputs the third conversion data according to the K data (step S112).
Next, the multiplier 19 multiplies the third conversion data by the interpolation data and outputs the result as gamma conversion data (step S113).
Thus, the gamma conversion circuit 10 can output output data (gamma conversion data) corresponding to the input data.
[0062]
Next, the operation of the gamma conversion circuit 10 when "16'h0009" is input as input data will be specifically described.
First, upon input of the input data “16′h0009”, the priority encoder 11 outputs L data “4′h3” to the subtractor 12 and outputs a low-level zero signal to the multiplexer 18.
[0063]
The subtracter 12 outputs “4′hc” obtained by subtracting the L data “4′h3” from “4′hf” to the conversion table storage unit 13 and the shifter 14 as K data.
[0064]
When K data “4′hc” is input, shifter 14 extracts “16′h9000” obtained by shifting input data “16′h0009” to the left by the number of bits represented by K data “4′hc” as M data. Output to the unit 15.
[0065]
The bit extraction unit 15 outputs the two bits “2′b00” of the bit numbers 14 and 13 of the M data “16′h9000” to the table address creation unit 16 as N data. Further, the bit extracting unit 15 outputs to the multiplier 23, “16′h1000” obtained by zero-extending the bits of the bit numbers 12 to 0 of the M data “16′h9000” to 16 bits as P data. This P data “16′h1000” corresponds to “d” in equation (4).
[0066]
When the N data “2′b00” is input, the table address creation unit 16 outputs the N data “2′b00” to the interpolation conversion table storage unit 17 as a first table address. Further, the table address creation unit 16 outputs the N data “2′b01” obtained by incrementing the N data “2′b00” to the interpolation conversion table storage unit 17 as a second table address after a predetermined time has elapsed.
[0067]
When the first table address “2′b00” is input, the interpolation conversion table storage unit 17 stores the first conversion data y corresponding to the first table address “2′b00”. 00 Is output. Further, when the second table address “2′b01” is input after a predetermined time has elapsed, the interpolation conversion table storage unit 17 stores the second conversion data y corresponding to the second table address “2′b01”. 01 Is output.
[0068]
The multiplexer 18 outputs the first conversion data y output from the interpolation conversion table storage 17 because the zero signal is at a low level. 00 Is selected and output. Further, the multiplexer 18 outputs the second conversion data y output from the interpolation conversion table storage 17 after a predetermined time has elapsed. 01 Select and output.
[0069]
The register 21 stores the first conversion data y selected and output by the multiplexer 18. 00 For a predetermined time. This first conversion data y 00 Is "y" in equation (4). M ".
[0070]
The subtractor 22 outputs the second conversion data y output from the multiplexer 18. 01 From the first conversion data y held by the register 21 00 The value of is subtracted and output. The output data of the subtracter 22 corresponds to “Δy” in Expression (4).
The multiplier 23 is output data of the subtractor 22 (y 01 -Y 00 ) Is multiplied by P data “16′h1000” and output. The output data of the multiplier 23 (here, 2 12 × (y 01 -Y 00 )) Corresponds to “d × Δy” in equation (4).
[0071]
The shifter 24 outputs the output data of the multiplier 23 (here, 2 12 × (y 01 -Y 00 )) Is shifted right by 13 bits and output. The output data of the shifter 24 (here, 2 12 × (y 01 -Y 00 ) / 2 Thirteen ) Corresponds to “d × Δy / Δx” in equation (4).
The adder 25 outputs the first conversion data y held by the register 21. 00 The output data of the shifter 24 (here, 2 12 × (y 01 -Y 00 ) / 2 Thirteen ) And output. The data output from the adder 25 is represented by “d × Δy / Δx + y” in Expression (3). M ".
[0072]
FIG. 9 is a diagram illustrating linear interpolation in this example. As described above, the linear interpolation unit 20 can output output data (gamma conversion data) corresponding to the M data “16′h9000”.
[0073]
When the K data “4′hc” is input, the conversion table storage unit 13 outputs the conversion data corresponding to the table address “4′hc” using the K data “4′hc” as a table address.
[0074]
The multiplier 19 outputs the output data of the linear interpolation unit 20 (here, 2 12 × (y 01 -Y 00 ) / 2 Thirteen + Y M ) Is multiplied by the output data of the conversion table storage unit 13 and output. The data output from the multiplier 19 corresponds to equation (3).
[0075]
Next, an error between output data of the gamma conversion circuit 10 and a value calculated by the equation (1) will be described with reference to FIG. As shown in FIG. 10, the error between the output data of the gamma conversion circuit 10 and the value calculated by the equation (1) is up to about 73, and the error of the gamma conversion circuit 110 shown in FIG. 130) is about 1.78 times smaller.
[0076]
Thus, according to the present embodiment, the storage capacities of the conversion table storage unit 13 and the interpolation conversion table storage unit 17 can be reduced. In the present embodiment, the storage capacity of the conversion table storage unit 13 and the conversion table storage unit 17 for interpolation is 20 words, and the storage capacity of the conversion table storage unit 101 (65536 words) of the conventional gamma conversion circuit 100 (FIG. 26). ) Can be reduced by a factor of about 3277. Therefore, the storage capacity (4096 words) of the conversion table storage unit 111 of the conventional gamma conversion circuit 110 (FIG. 27) can be reduced to about 1/205. Further, according to the present embodiment, the error of the output data can be reduced to about 1/78 of the error of the gamma conversion circuit 110.
[0077]
Note that the gamma conversion circuit 10 can be configured by a CPU and a program. In this case, since the size of the conversion table shown in FIGS. 3 and 5 is as small as 20 words, the conversion table is stored in the cache memory, and gamma conversion can be realized at high speed.
[0078]
In the present embodiment, the bit extraction unit 15 extracts two bits of the bit numbers 14 and 13 of the M data as N data, but extracts three bits of the bit numbers 14 to 12 of the M data as N data. Alternatively, four bits of bit numbers 14 to 11 of M data may be extracted as N data. Further, in the present embodiment, the M data is interpolated, but the interpolation need not be performed by increasing the bit width of the N data. As described above, by increasing the bit width of the N data, the error of the output data can be further reduced.
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 linear interpolation unit 40 further includes a multiplexer 46, a multiplexer 47, and a latch circuit 48 in addition to the register 41, the subtractor 42, the multiplier 43, the shifter 44, and the adder 45. Contains.
[0080]
The multiplexer 46 selects and outputs the conversion data output from the conversion table storage unit 13 when the interpolation output control signal is at a high level, and outputs the bit data when the interpolation output control signal is at a low level. Select and output P data.
[0081]
The multiplexer 47 selects and outputs the interpolation data output by the adder 45 when the interpolation output control signal is at a high level, and selects the data output by the subtractor 42 when the interpolation output control signal is at a low level. And output.
[0082]
The latch circuit 48 latches and outputs the gamma conversion data output from the multiplier 43 when the interpolation output control signal is at a high level.
[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 gamma conversion circuit 50 includes a priority encoder 51, a subtractor 52, a conversion table storage unit 53, a shifter 54, a bit extraction unit 55, a table storage unit 56, a table address creation unit 57, An interpolation conversion table storage unit 58, a multiplier 59, and a linear interpolation unit 60 are provided. Further, the linear interpolation unit 60 includes a register 61, a subtractor 62, a table storage unit 63, a table storage unit 64, a bit extraction unit 65, a correction term calculation unit 66, and an adder 67. .
[0085]
The priority encoder 51 inputs 16-bit width input data, detects the most significant bit “1” in the input data, and outputs the detected bit number as 4-bit width L data.
The subtracter 52 subtracts L data from “4′hf” and outputs the result as K data having a 4-bit width.
The conversion table storage unit 53 stores the K data as a table address, -K It stores a conversion table in which conversion data having a 12-bit width obtained by gamma-converting is converted into a table address, and the conversion data is output according to the table address.
[0086]
The shifter 54 shifts the input data to the left by the value of the K data output from the subtractor and outputs M data.
The bit extraction unit 55 receives the M data and outputs 4 bits of bit numbers 14 to 11 as N data.
[0087]
The table storage unit 56 stores a table for converting 4-bit N data to 2-bit width repi data. When the N data is “4′h0” to “4′h2”, “2 ′” is used. b00 "is output as repi data, and when N data is"4'h3"to"4'h6","2'b01"is output as repi data, and N data is"4'h7"to"4'h7"to"4'h7". In the case of "4'ha", "2'b10" is output as repi data, and when the N data is "4'hb" to "4'hf", "2'b11" is output as repi data. I do.
[0088]
The table address creation unit 57 outputs the input 2-bit width repi data as a first table address, and after a predetermined time has elapsed, outputs a second table address obtained by incrementing (or decrementing) the repi data.
The interpolation conversion table storage unit 58 stores a conversion table in which conversion data of 12-bit width obtained by gamma-converting data of 16-bit width is associated with a table address, and is stored in accordance with the first and second table addresses. The first and second converted data are output.
[0089]
The linear interpolation unit 60 performs a linear interpolation process on the first and second conversion data output from the conversion table for interpolation 58.
The bit extraction unit 65 receives the M data, extracts 11 bits of bit numbers 10 to 0 in the M data, and extracts the extracted data as x R Output as data.
[0090]
The table storage unit 63 stores a table for converting N data into predetermined data (dd data). When the N data is “4′h0”, “0” is output as dd data, and the data is output. Is "4'h1", "1" is output as dd data, and if N data is "4'h2", "2" is output as dd data and N data is "4'h". In the case of "h3", "0" is output as dd data. The table storage unit 63 outputs “1” as dd data when the N data is “4′h4”, and outputs “2” when the N data is “4′h5”. When N data is “4′h6”, “3” is output as dd data, and when N data is “4′h7”, “0” is output as dd data.
[0091]
Further, the table storage unit 63 outputs “1” as dd data when the N data is “4′h8”, and outputs “2” when the N data is “4′h9”. When the N data is “4′ha”, “3” is output as dd data, and when the N data is “4′hb”, “0” is output as dd data. The table storage unit 63 outputs “1” as dd data when the N data is “4′hc”, and outputs “2” when the N data is “4′hd”. When the N data is “4′he”, “3” is output as dd data, and when the N data is “4′hf”, “4” is output as dd data.
[0092]
The table storage unit 64 stores a table for converting N data into predetermined data (span data). When the N data is “4′h0” to “4′h2”, “3” is converted to “span”. When the N data is "4'h3" to "4'ha", "4" is output as span data, and when the N data is "4'hb" to "4'hf" Output “5” as span data.
[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 table storage unit 58 stores the interpolation conversion data y obtained by gamma-converting the M data “16′h8000”. 00 Is stored in association with the table address “2′b00”, and the conversion data y for gamma conversion of the M data “16′h8800” 00 Is not stored. As described above, when the same table address is generated from a plurality of M data, the interpolation conversion table storage unit 58 stores only the interpolation conversion data obtained by gamma converting the minimum M data among the plurality of M data. Is stored.
[0095]
That is, the interpolation conversion table storage unit 58 stores the interpolation conversion data y corresponding to the M data "16'h8000" in the range of "16'h8000" to "16'hffff" of the M data. 00 , And M data “16′h9800”, “16′hb800”, and “16′hd800” that divide the range of “16′h8000” to “16′hffff” into 3: 4: 4: 5, respectively. Corresponding conversion data y for interpolation 01 , Y 10 , And y 11 Will be stored.
[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 register 61 holds the output data of the interpolation conversion table storage unit 58 for a predetermined time, and outputs the held data as y_tbl data.
The subtracter 62 outputs, as step_y, data obtained by subtracting the output data of the register 61 from the output data of the conversion table storage unit 58 for interpolation.
The correction term calculation unit 66 calculates the dd data, the span data, x R Data and step_y data are input, and dy data is calculated and output by the following equation. Where 2 11 "11", which is the exponent part of, is obtained by subtracting "4" which is the number of bits of N data from the bit number "15" of the MSB of M data. The adder 67 outputs the dy data in addition to the y_tbl data.
(Equation 5)
Figure 2004088157
[0099]
The conversion table storage unit 53 stores the K data as a table address, -K / It stores a conversion table in which conversion data of 12-bit width representing γ is associated with a table address, and outputs the conversion data according to the table address.
[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 table storage unit 53 only needs to have a storage capacity of 16 words (here, 1 word = 12 bits).
[0101]
That is, as shown in FIG. 14, the conversion table storage unit 53 stores the input data "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" and "16'h8000" respectively. 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 , And y 0 Is stored.
[0102]
Referring again to FIG. 12, the multiplier 59 multiplies the output data of the conversion table storage unit 53 by the output data of the linear interpolation unit 60, and outputs the result as output data (gamma conversion data).
[0103]
Next, the linear interpolation processing performed by the linear interpolation unit 60 will be described with reference to FIG. FIG. 15 is a diagram illustrating the principle of the linear interpolation processing performed by the linear interpolation unit 60. As shown in FIG. 15, the linear interpolation unit 60 can calculate interpolation data y corresponding to the M data x by the following equation.
y = y_tbl + dy (6)
[0104]
Next, gamma conversion processing in the gamma conversion circuit 50 will be described with reference to FIGS. 12, 16, and 17. FIG. FIG. 16 is a flowchart illustrating the gamma conversion processing of the gamma conversion circuit, and FIG. 17 is a flowchart illustrating the linear interpolation processing of the linear interpolation unit of the gamma conversion circuit.
[0105]
When the processing in FIGS. 16 and 17 is started, the priority encoder 51 inputs input data and outputs L data (step S301).
Next, the subtractor 52 receives the L data and outputs the K data (step S302).
Next, the shifter 54 receives the input data and the K data, and outputs the M data (step S303).
Next, the bit extracting unit 55 receives the M data and outputs the N data (Step S304).
Next, the table storage unit 56 receives the N data and outputs the repi data (step S305).
[0106]
Next, the table address creation unit 57 inputs the repi data and outputs the first table address (Step S306).
Next, the conversion table storage unit 58 for interpolation outputs the first conversion data according to the first table address, and the register 61 holds this (step S307).
[0107]
Next, the table address creation unit 57 outputs a second table address obtained by incrementing the first table address (Step S308).
Next, the conversion table storage unit 58 for interpolation outputs the second conversion data according to the second table address (step S309).
Next, the linear interpolation unit 60 performs a linear interpolation process based on the first conversion data and the second conversion data, and outputs interpolation data (Step S310).
[0108]
As shown in FIG. 17, in the linear interpolation processing, the bit extraction unit 65 of the linear interpolation unit 60 receives the M data, R The data is output (step S401).
Next, the table storage unit 63 receives the N data and outputs the dd data (step S402).
Next, the table storage unit 64 receives the N data and outputs span data (step S403).
[0109]
Next, the subtracter 62 subtracts the first conversion data, which is the output data of the register 61, from the second conversion data, which is the output data of the conversion table for interpolation 58, and outputs step_y data (step S404). .
[0110]
Next, the correction term calculation unit 66 calculates x R The data, dd data, span data, and step_y data are input, and dy data is output (step S405). Next, the adder 67 adds the dy data to the y_tbl data and outputs it as interpolation data (step S406).
[0111]
Referring again to FIG. 16, next, the conversion table storage unit 53 outputs the third conversion data according to the K data (step S311).
Next, the multiplier 59 multiplies the third conversion data by the interpolation data and outputs the result as gamma conversion data (step S312).
Thus, the gamma conversion circuit 50 can output output data (gamma conversion data) corresponding to the input data.
[0112]
Next, an error between output data of the gamma conversion circuit 50 and a value calculated by the equation (1) will be described with reference to FIG. As shown in FIG. 18, the error between the output data of the gamma conversion circuit 50 and the value calculated by the equation (1) is about 58 at the maximum, and the error of the gamma conversion circuit 110 shown in FIG. This is about 1/24 of about 130) and about 1.25 of the error (about 73) of the gamma conversion circuit 10 shown in FIG.
[0113]
As described above, according to the present embodiment, the size of the conversion table stored in the conversion table storage unit 53 and the conversion table storage unit 58 for interpolation is changed by the conversion table storage unit 13 of the gamma conversion circuit 10 in the first embodiment. The error can be made smaller than that of the gamma conversion circuit 10 while maintaining the same size as the conversion table stored in the interpolation conversion table storage unit 17.
[0114]
Note that the gamma conversion circuit 50 can be constituted by a CPU and a program. In this case, since the size of the conversion table is small, the conversion table enters the cache memory, and gamma conversion can be realized at high speed.
[0115]
Further, in the present embodiment, the bit extraction unit 55 extracts the four bits of the bit numbers 14 to 11 of the M data as N data. Or 5 bits of bit numbers 14 to 10 of M data may be extracted as N data. If the bit width of the N data is increased, the error of the output data can be further reduced.
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 table storage unit 56 is used to output the repi data based on the N data, but a decoder may be used instead of the table storage unit 56. Similarly, a decoder may be used instead of the table storage unit 63 and the table storage unit 64.
[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 gamma conversion circuit 70 includes priority encoders 71 and 76, a subtractor 72, a conversion table storage unit 73, a shifter 74, bit extraction units 75 and 79, a table address creation unit 77, It includes a conversion table storage unit 78, a multiplexer 18, a linear interpolation unit 80, and a multiplier 19. The linear interpolation unit 80 includes a register 21, a subtractor 22, a multiplier 23, a decoder 81, a shifter 82, and an adder 25.
[0118]
The priority encoder 71 receives input data having a 16-bit width, detects the most significant bit “1” in the input data, and outputs the bit number of the detected bit as L1 data having a 4-bit width. When there is no “1” bit in the input data, that is, when the input data is “16′h0000”, the priority encoder 71 outputs the L1 data of “4′h0” and outputs Is output.
[0119]
The subtracter 72 subtracts L1 data from “4′hf” and outputs the result as K data having a 4-bit width.
The conversion table storage 73 uses the K data as a table address, -K It stores a conversion table in which conversion data having a 12-bit width obtained by gamma-converting is converted into a table address, and the conversion data is output according to the table address.
The shifter 74 shifts the input data to the left by the value of the K data output from the subtractor and outputs M data.
The bit extraction unit 75 receives the M data, extracts three bits of bit numbers 14 to 12, and outputs the extracted three bits as N data.
[0120]
The priority encoder 76 inputs N data having a width of 3 bits from the bit extracting unit 75, detects the most significant bit “1” in the input N data, and converts the bit number of the detected bit into a bit width of 2 bits. Is output as L2 data. Note that the bit number is counted from the least significant bit to the most significant bit, and if there is no "1" bit in the input data, "2'b00" is output as L2 data.
[0121]
The table address creation unit 77 outputs the input 2-bit width L2 data as a first table address, and after a lapse of a predetermined time, outputs a second table address obtained by incrementing (or decrementing) the L2 data.
The conversion table storage unit 78 for interpolation stores the 16-bit width data in which the bit number 4 and the bit number L2 are “1” and the other bits are “0” by “4′hb” (11 bits). An interpolation conversion table is stored in which 12-bit interpolation conversion data obtained by gamma-converting the shifted data is made to correspond to a table address, and first and second conversion tables are stored in accordance with the first and second table addresses. Outputs the conversion data for interpolation.
[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 number 4 and bit number L2 corresponding to input data "16'h0001" are set to "1", and other bits are set to "0". This is gamma-converted 12-bit data, y 11 Is a data obtained by shifting the bit number L2 corresponding to the bit number 4 and the input data "16'h0003" to "1" and the other bits to "0" by shifting the 16-bit width data to the left by 11 bits. This is gamma-converted 12-bit data, y 10 Is a 16-bit data having bit number 4 and bit number L2 corresponding to input data "16'h0005" set to "1" and other bits set to "0", which is left-shifted by 11 bits. This is gamma-converted 12-bit data, y 01 Is a 16-bit data having bit number 4 and bit number L2 corresponding to input data "16'h0009" set to "1" and other bits set to "0", left-shifted by 11 bits to the left. This is gamma-converted 12-bit data.
[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 table storage unit 78 sets the bit number 4 and the bit number “2′b00” corresponding to the input data “16′h0001” to “1”, and sets the other bits to “0”. Conversion data y obtained by gamma-converting data obtained by shifting the data to the left by 11 bits 00 Is stored in association with the table address “2′b00”, the bit number “2′b00” corresponding to the bit number 4 and the input data “16′h0002” is set to “1”, and the other bits are set to “0”. Interpolation conversion data y obtained by gamma-converting data obtained by shifting 16-bit data to the left by 11 bits 00 Is not stored. As described above, when the same table address is generated from a plurality of input data, the interpolation conversion table storage unit 78 stores the bit number 4 and the bit number corresponding to the smallest input data among the plurality of input data. Only the interpolation conversion data obtained by gamma-converting data obtained by shifting L2 to “1” and other bits to “0” and shifting the 16-bit data to the left by 11 bits is stored.
[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 table storage unit 78 is omitted in FIG. As shown in FIG. 20, the input conversion data (in the present embodiment, 65536 types of “16′h0000” to “16′hffff”) change the interpolation conversion data to y. 00 , Y 01 , Y 10 , Y 11 4 data. Therefore, the conversion table storage unit 78 for interpolation only needs to have a storage capacity of 4 words (here, 1 word = 12 bits).
[0125]
That is, as shown in FIG. 21, the interpolation conversion table storage unit 78 stores the interpolation conversion tables respectively corresponding to the input data “16′h0001”, “16′h0003”, “16′h0005”, and “16′h0009”. Data y 00 , Y 11 , Y 10 , And y 01 Is stored.
[0126]
Referring to FIG. 19 again, the linear interpolation unit 80 performs linear interpolation on the first and second conversion data output from the conversion table storage unit 78 for interpolation.
The decoder 81 outputs 12 when the L2 data is “2′b00”, outputs 12 when it is “2′b01”, outputs 13 when it is “2′b10”, In the case of “2′b11”, 14 is output.
[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 priority encoder 71 inputs input data and outputs L1 data (step S501).
Next, the subtractor 72 receives the L1 data and outputs the K data (step S502).
Next, the shifter 74 receives the input data and the K data, and outputs the M data (step S503).
Next, the bit extracting unit 75 receives the M data, and extracts 3-bit N data of bit numbers 14 to 12 (step S504).
Next, the priority encoder 76 receives the N data and outputs the L2 data (step S505).
Next, the table address creation unit 77 inputs the L2 data and outputs a first table address (Step S506).
[0129]
Next, the conversion table storage unit 78 for interpolation outputs the first conversion data according to the first table address (step S507).
Next, the multiplexer 18 selectively outputs 0 or the first conversion data according to the value of the zero signal (step S508).
Next, the table address creation unit 77 outputs a second table address obtained by incrementing the first table address (Step S509).
[0130]
Next, the interpolation conversion table storage unit 78 outputs the second conversion data according to the second table address (step S510).
Next, the multiplexer 18 selects and outputs 0 or the second conversion data according to the value of the zero signal (step S511).
Next, the linear interpolation unit 80 performs a linear interpolation process based on the first conversion data and the second conversion data, and outputs interpolation data (Step S512).
[0131]
As shown in FIG. 23, in the linear interpolation processing, the decoder 81 of the linear interpolation unit 80 calculates the shift amount of the shift processing performed by the shifter 82 from the L2 data (step S601).
Next, the register 21 holds the first converted data for a predetermined time (Step S602).
Next, the subtracter 22 subtracts the first converted data, which is the output data of the register 21, from the second converted data, which is the output data of the multiplexer 18 (Step S603).
[0132]
Next, the multiplier 23 multiplies the output data of the subtractor 22 by P data (step S604).
Next, the shifter 82 shifts the output data of the multiplier 23 by an amount corresponding to the output data of the decoder 81 (Step S605).
Next, the adder 25 adds the output data of the shifter 82 to the first converted data, which is the output data of the register 21, and outputs the result as interpolation data (step S606).
[0133]
Next, the conversion table storage unit 73 outputs the third conversion data according to the K data (Step S513).
Next, the multiplier 19 multiplies the interpolation data by the third conversion data and outputs the result as gamma conversion data (step S514).
Thus, the gamma conversion circuit 70 can output output data (gamma conversion data) corresponding to the input data.
[0134]
Next, an error between output data of the gamma conversion circuit 70 and a value calculated by the equation (1) will be described with reference to FIG. As shown in FIG. 24, the error between the output data of the gamma conversion circuit 70 and the value calculated by the equation (1) is about 150 at the maximum.
[0135]
As described above, according to the present embodiment, the storage capacity of the conversion data storage unit 78 can be reduced.
[0136]
Note that the gamma conversion circuit 70 can be configured by a CPU and a program. In this case, since the size of the conversion table is small, the conversion table enters the cache memory, and gamma conversion can be realized at high speed.
[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:
ステップ(e)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項1記載のデータ変換方法。2. The data conversion method according to claim 1, wherein step (e) generates output data by multiplying the first conversion data by the second conversion data. ステップ(d)が、前記第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(e)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項1記載のデータ変換方法。Step (d) reads out third conversion data corresponding to the data obtained by incrementing or decrementing the second data from the second table, and step (e) reads out the third conversion data based on the second and third conversion data. 2. The data conversion method according to claim 1, wherein output data is generated by multiplying the data subjected to the interpolation processing by the first conversion data. ステップ(c)が、前記入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより前記第2のデータを求めることを特徴とする請求項1〜3のいずれか1項記載のデータ変換方法。Step (c) comprises, among the input data, a p-bit width of bit numbers (n−K−2) to (n−K−p−1) (where 1 ≦ p ≦ n−K−1) The data conversion method according to claim 1, wherein the second data is obtained by extracting the second data. 入力データを変換して出力データを生成するデータ変換方法であって、
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:
ステップ(f)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項5記載のデータ変換方法。The data conversion method according to claim 5, wherein step (f) generates output data by multiplying the first conversion data by the second conversion data. ステップ(e)が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(f)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項5記載のデータ変換方法。Step (e) reads third conversion data corresponding to the data obtained by incrementing or decrementing the third data from the second table, and step (f) performs reading based on the second and third conversion data. 6. The data conversion method according to claim 5, wherein output data is generated by multiplying the first conversion data by the data subjected to the interpolation processing. ステップ(d)が、第i群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、前記第2のデータ0〜(2−1)をN群に分割することにより前記第3のデータを求めることを特徴とする請求項5〜7のいずれか1項記載のデータ変換方法。Step (d), such that V 0 ≦ V 1 ≦ ... ≦ V N the number of data belonging to the i-th group when the V i, the second data 0 to (2 p -1) 8. The data conversion method according to claim 5, wherein the third data is obtained by dividing the data into N groups. 入力データを変換して出力データを生成するデータ変換方法であって、
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:
ステップ(f)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項9記載のデータ変換方法。10. The data conversion method according to claim 9, wherein step (f) generates output data by multiplying the first conversion data by the second conversion data. ステップ(e)が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、ステップ(f)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項9記載のデータ変換方法。Step (e) reads third conversion data corresponding to the data obtained by incrementing or decrementing the third data from the second table, and step (f) performs reading based on the second and third conversion data. 10. The data conversion method according to claim 9, wherein output data is generated by multiplying the data subjected to the interpolation processing by the first conversion data. 前記補間処理が線形補間処理であることを特徴とする請求項3又は7又は11項記載のデータ変換方法。12. The data conversion method according to claim 3, wherein the interpolation process is a linear interpolation process. 前記第1の変換が、2−Kをガンマ変換し、前記第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換することを特徴とする請求項1〜12のいずれか1項記載のデータ変換方法。The first conversion performs gamma conversion on 2- K , and the second conversion performs 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. 13. The data conversion method according to claim 1, wherein the data conversion is performed. 入力データを変換して出力データを生成するデータ変換回路であって、
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:
前記第5の手段が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項14記載のデータ変換回路。15. The data conversion circuit according to claim 14, wherein said fifth means generates output data by multiplying said first conversion data by said second conversion data. 前記第4の手段が、前記第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、前記第5の手段が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項14記載のデータ変換回路。The fourth means reads, from a second table, third conversion data corresponding to the data obtained by incrementing or decrementing the second data, and the fifth means reads the second and third conversion data. The data conversion circuit according to claim 14, wherein output data is generated by multiplying the data obtained by performing the interpolation processing based on the first conversion data by the first conversion data. 前記第3の手段が、前記入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより前記第2のデータを求めることを特徴とする請求項14〜16のいずれか1項記載のデータ変換回路。The third means selects 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. 17. The data conversion circuit according to claim 14, wherein the second data is obtained by extracting the data of (1). 入力データを変換して出力データを生成するデータ変換回路であって、
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:
前記第6の手段が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項18記載のデータ変換回路。19. The data conversion circuit according to claim 18, wherein said sixth means generates output data by multiplying said first conversion data by said second conversion data. 前記第5の手段が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、前記第6の手段が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項18記載のデータ変換回路。The fifth means reads, from a second table, third conversion data corresponding to data obtained by incrementing or decrementing the third data, and the sixth means reads the second and third conversion data. 19. The data conversion circuit according to claim 18, wherein output data is generated by multiplying the data obtained by performing the interpolation processing based on the first conversion data by the first conversion data. 前記第4の手段が、第i群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、前記第2のデータ0〜(2−1)をN群に分割することにより前記第3のデータを求めることを特徴とする請求項18〜20のいずれか1項記載のデータ変換回路。Said fourth means, such that V 0 ≦ V 1 ≦ ... ≦ V N the number of data belonging to the i-th group when the V i, the second data 0 to (2 p -1) 21. The data conversion circuit according to claim 18, wherein the third data is obtained by dividing the third data into N groups. 入力データを変換して出力データを生成するデータ変換回路であって、
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:
前記第6の手段が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項22記載のデータ変換回路。23. The data conversion circuit according to claim 22, wherein said sixth means generates output data by multiplying said first conversion data by said second conversion data. 前記第5の手段が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、前記第6の手段が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項22記載のデータ変換回路。The fifth means reads, from a second table, third conversion data corresponding to data obtained by incrementing or decrementing the third data, and the sixth means reads the second and third conversion data. 23. The data conversion circuit according to claim 22, wherein output data is generated by multiplying the data obtained by performing the interpolation processing based on the first conversion data by the first conversion data. 前記補間処理が線形補間処理であることを特徴とする請求項16又は20又は24項記載のデータ変換回路。25. The data conversion circuit according to claim 16, wherein the interpolation process is a linear interpolation process. 前記第1の変換が、2−Kをガンマ変換し、前記第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換することを特徴とする請求項14〜25のいずれか1項記載のデータ変換回路。The first conversion performs gamma conversion on 2- K , and the second conversion performs 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. The data conversion circuit according to any one of claims 14 to 25, wherein: 入力データを変換して出力データを生成するデータ変換プログラムであって、
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:
手順(e)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項27記載のデータ変換プログラム。28. The data conversion program according to claim 27, wherein the step (e) generates output data by multiplying the first conversion data by the second conversion data. 手順(d)が、前記第2のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(e)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項27記載のデータ変換プログラム。Step (d) reads out third conversion data corresponding to the data obtained by incrementing or decrementing the second data from the second table, and step (e) performs processing based on the second and third conversion data. 28. The data conversion program according to claim 27, wherein output data is generated by multiplying the data obtained by the interpolation processing by the first conversion data. 手順(c)が、前記入力データの中から、ビット番号(n−K−2)〜(n−K−p−1)のpビット幅(ここで、1≦p≦n−K−1)のデータを抽出することにより前記第2のデータを求めることを特徴とする請求項27〜29のいずれか1項記載のデータ変換プログラム。Step (c) is to select 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. 30. The data conversion program according to claim 27, wherein the second data is obtained by extracting the second data. 入力データを変換して出力データを生成するデータ変換プログラムであって、
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:
手順(f)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項31記載のデータ変換プログラム。32. The data conversion program according to claim 31, wherein the step (f) generates output data by multiplying the first conversion data by the second conversion data. 手順(e)が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(f)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項31記載のデータ変換プログラム。Step (e) reads third conversion data corresponding to the data obtained by incrementing or decrementing the third data from the second table, and step (f) performs reading based on the second and third conversion data. 32. The data conversion program according to claim 31, wherein output data is generated by multiplying the data subjected to the interpolation processing by the first conversion data. 手順(d)が、第i群に属するデータの数をVとしたときにV≦V≦…≦Vとなるように、前記第2のデータ0〜(2−1)をN群に分割することにより前記第3のデータを求めることを特徴とする請求項31〜33のいずれか1項記載のデータ変換プログラム。Procedure (d) is such that V 0 ≦ V 1 ≦ ... ≦ V N the number of data belonging to the i-th group when the V i, the second data 0 to (2 p -1) The data conversion program according to any one of claims 31 to 33, wherein the third data is obtained by dividing the data into N groups. 入力データを変換して出力データを生成するデータ変換プログラムであって、
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:
手順(f)が、前記第1の変換データに前記第2の変換データを乗ずることにより出力データを生成することを特徴とする請求項35記載のデータ変換プログラム。The data conversion program according to claim 35, wherein the step (f) generates output data by multiplying the first conversion data by the second conversion data. 手順(e)が、前記第3のデータをインクリメント又はデクリメントしたデータに対応する第3の変換データを第2のテーブルから読み出し、手順(f)が、前記第2及び第3の変換データに基づいて補間処理をしたデータに前記第1の変換データを乗ずることにより出力データを生成することを特徴とする請求項35記載のデータ変換プログラム。Step (e) reads third conversion data corresponding to the data obtained by incrementing or decrementing the third data from the second table, and step (f) performs reading based on the second and third conversion data. 36. The data conversion program according to claim 35, wherein output data is generated by multiplying the data obtained by the interpolation processing by the first conversion data. 前記補間処理が線形補間処理であることを特徴とする請求項29又は33又は37項記載のデータ変換プログラム。38. The data conversion program according to claim 29, wherein the interpolation process is a linear interpolation process. 前記第1の変換が、2−Kをガンマ変換し、前記第2の変換が、最上位ビットを「1」とし、続くpビット分を第2のデータとしたnビット幅のデータをガンマ変換することを特徴とする請求項27〜38のいずれか1項記載のデータ変換プログラム。The first conversion performs gamma conversion on 2- K , and the second conversion performs 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. The data conversion program according to any one of claims 27 to 38, wherein:
JP2002242471A 2002-08-22 2002-08-22 Data conversion method, data converter circuit, and data conversion program Withdrawn JP2004088157A (en)

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)

* Cited by examiner, † Cited by third party
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

Cited By (1)

* Cited by examiner, † Cited by third party
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
JP5175983B2 (en) Arithmetic unit
JP2011028312A (en) Processor, control method thereof, and arithmetic processing program
KR20090032989A (en) Signal processing apparatus and signal processing method performing gamma correction
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
JPH11317676A (en) Reciprocal incarnation circuit for optional element of finite field
KR20160057590A (en) Elimination Method for Common Sub-Expression And Filter Using the Method
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

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