JP2004129072A - Sampling frequency conversion device and sampling frequency conversion method - Google Patents
Sampling frequency conversion device and sampling frequency conversion method Download PDFInfo
- Publication number
- JP2004129072A JP2004129072A JP2002292860A JP2002292860A JP2004129072A JP 2004129072 A JP2004129072 A JP 2004129072A JP 2002292860 A JP2002292860 A JP 2002292860A JP 2002292860 A JP2002292860 A JP 2002292860A JP 2004129072 A JP2004129072 A JP 2004129072A
- Authority
- JP
- Japan
- Prior art keywords
- sampling frequency
- signal
- output
- calculating
- time position
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、サンプリングされた時系列信号のサンプリング周波数を再サンプリングするサンプリング周波数変換装置およびサンプリング周波数変換方法に関する。
【0002】
【従来の技術】
近年、デジタル音声信号のサンプリング(標本化)周波数は、例えば、デジタルビデオの32kHz、コンパクトディスクの44.1kHz、DVD−Audioの96kHz等数多くのサンプリング周波数が混在している。
【0003】
従って、符号化装置へ与えるデジタル音声信号、復号化装置から得られるデジタル音声信号、復号化装置から得られるデジタル音声信号のサンプリング周波数は装置間で必ずしも一致しない。そのため、電子機器を相互接続する際には、サンプリング周波数を再変換する必要がある。
【0004】
一般に、サンプリング周波数の変換は、補間と再サンプリングに分類される。補間は離散信号データから新しく連続関数を作成する処理であり、再サンプリングは連続関数から新しい離散信号データを作成する処理である。離散信号データから連続関数を作成するには、離散信号データと補間カーネルの一次結合、すなわち畳込みを行う。
【0005】
【発明が解決しようとする課題】
従来、サンプリング周波数を変換する方法として、フィルタバンクを用いた方法がある。この方法では、出力信号のサンプリング周波数と入力信号のサンプリング周波数との最小公倍数を求め、入力信号を最小公倍数でアップサンプリングし、それを低域通過フィルタで補間し、出力信号のサンプリング周波数にダウンサンプリングする。
【0006】
出力信号のサンプリング周波数が入力信号のサンプリング周波数より低い場合、ダウンサンプリングの前にフィルタリングを行う必要があり、サンプリング周波数変換装置の処理負担が大きくなる。
【0007】
一方、出力信号のサンプリング周波数が入力信号のサンプリング周波数より高い場合、アップサンプリングの前にフィルタリングを行う必要があり、サンプリング周波数変換装置の処理負担が大きくなる。
【0008】
以上のように、フィルタバンクを用いてサンプリング周波数の変換を行うと、サンプリング周波数変換装置の処理負担が大きくなる。そのため、回路規模を大きく、動作速度を速くする必要がある。
【0009】
また、フィルタバンクを使用した方法では、入力信号のサンプリング周波数や出力信号のサンプリング周波数が変更されるごとにフィルタの再設計が必要となる。フィルタの係数の算出においては、チェス盤歪み等に注意して設計しなければならず、複雑にして多くの処理が必要である。複雑なフィルタは、入出力の遅延時間が大きく、装置全体の応答特性を悪化させることになる。
【0010】
本発明は、上記の課題に鑑みてなされたものであって、簡単な回路構成であり、かつ、入力信号のサンプリング周波数および出力信号のサンプリング周波数の変更が容易なサンプリング周波数変換装置およびサンプリング周波数変換方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
上記の課題を解決するため、本発明におけるサンプリング周波数変換装置は、第1のサンプリング周波数でサンプリングされた信号を入力し第2のサンプリング周波数でサンプリングされた信号に変換して出力するサンプリング周波数変換装置であって、第1のサンプリング周波数の第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出手段と、Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出手段と、R1に対するRの比(R2とする。)を算出する巾数比算出手段と、R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換手段と、第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1個の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出手段と、第2の巾乗を上記平均信号のサンプリング周期とし、入力信号のサンプリング点に対する出力信号のサンプリング点の相対的な時間位置を算出する時間位置算出手段と、平均信号を算出された時間位置で直線補間し、補間して得た値を出力信号とする。
【0012】
また、本発明におけるサンプリング周波数変更方法は、第1のサンプリング周波数でサンプリングされた信号を入力し第2のサンプリング周波数でサンプリングされた信号に変換して出力するサンプリング周波数変換方法であって、第1のサンプリング周波数の第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出工程と、Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出工程と、R1に対するRの比(R2とする。)を算出する巾数比算出工程と、R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換工程と、第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出工程と、第2の巾乗を平均信号のサンプリング周期とし、入力信号のサンプリング点に対する出力信号のサンプリング点の相対的な時間位置を算出する時間位置算出工程と、平均信号を算出された時間位置で直線補間し、補間して得た値を上記出力信号とする。
【0013】
【発明の実施の形態】
以下、本発明を適用したサンプリング周波数変換装置について説明する。サンプリング周波数変換装置は、主に、4つの処理を行うことによって、サンプリング周波数を変換する。第1の処理は、入力信号のサンプリング周波数Fs1と出力信号のサンプリング周波数Fs2の値に基づいて、定数R、R1、R2、R3、N、Tを算出する処理である。この処理は、フローチャートのステップS1およびステップS2に対応する。ここで、定数Rとは入力信号のサンプリング周波数Fs1の出力信号のサンプリング周波数Fs2に対する比であり、R1はRを2の巾数で近似した値であり、R2はRとR1の誤差を示す値であり、R3およびNはR2を整数および2の巾数で近似する際に使用する値であり、Tは直線補間におけるサンプル間の周期を示す値である。
【0014】
以下、サンプリング周波数変換装置1が実行する4つの処理について図1のフローチャートに従って説明する。サンプリング周波数変換装置1は、入力信号のサンプリング信号Fs1と出力信号のサンプリング周波数Fs2の変化を常に監視し、Fs1および/またはFs2が変化すると(ステップS1;YES)、ステップS2に処理を移行し、定数R、R1、R2、R3、N、Tを更新する(ステップS2)。
【0015】
ステップS2において、サンプリング周波数変換装置1が定数R、R1、R2、R3、Tを算出する手順は、以下のようになる。サンプリング周波数変換装置1は、まず、定数Rを算出する。定数Rは、入力信号のサンプリング周波数Fs1と出力信号のサンプリング周波数Fs2との比であるから、以下の式(1)で求められる。
R=Fs1/Fs2・・・(1)
【0016】
次に、サンプリング周波数変換装置1は、定数R1を算出する。定数R1は、以下の式(2)で求められる値である。
R1=pow(2,floor(log2(max(1,R)))・・・(2)
ただし、pow(x,y)は、xのy乗を返す関数
floor(x)は、xを超えない最大の整数値を返す関数
log2(x)は、xの2を底としたときの対数
max(x,y)は、xとyのうちの大きい方の値を返す関数
である。
【0017】
式(2)によって算出されたR1は、入力信号をダウンサンプリングする場合とアップサンプリングする場合とで異なる値をとる。ダウンサンプリングする場合のR1とアップサンプリングする場合のR1との演算結果の違いを説明する。
【0018】
ダウンサンプリングする場合、Fs1>Fs2であるから、R>1となる。このとき、max(1,R)の戻り値はRとなり、R1の値はRを超えない最大の2の巾数となる。ダウンサンプリングする場合、定数R1は、入力信号の平均値をとるためのサンプル数として使用される。R1個のサンプルから1つの平均値を求めると、入力信号のサンプリング周波数Fs1は、Fs1×(1/R1)に変換される。以下、R1個のサンプルごとに平均化された信号を平均信号と記す。
【0019】
一方、アップサンプリングする場合、Fs1<Fs2であり、R<1となる。max(1,R)の戻り値は1となり、R1の値は1となる。
【0020】
信号をアップサンプリングする場合、R1の値は1である。1つのサンプルの平均値を求めても、サンプルの値およびサンプルの個数は変化しない。そのため、入力信号はそのまま出力され、入力信号のサンプリング周波数Fs1も変化しない。
【0021】
ステップS2では、さらに、サンプリング周波数変換装置1は、R2を算出する。R2は、以下の式(3)で求められる値である。
R2=R/R1・・・(3)
【0022】
R2は、平均信号のサンプリング周波数Fs1×(1/R1)をFs2に変換するための定数として使用される。R2の意味を数式を使って説明する。なお、以下の式において、平均信号のサンプリング周波数をFsMeanで表現する。
【0023】
このように、平均信号のサンプリング周波数を1/R2倍すると、出力信号のサンプリング周波数Fs2を求めることができる。しかしながら、R2は、整数と整数との除数であるため、値が小数になり、ハードウェアで演算を実行する際、回路規模が大きくなるという問題がある。そこで、R2を整数R3と2の巾数との組み合わせで表現する。
【0024】
R2=R3/pow(2,N)+Re・・・(4)
式(4)において、R3、Nは、Re≒0となるような整数である。式(4)において、Re=0と仮定すると、R2=R3/pow(2,N)となる。サンプリング周波数変換装置1では、平均信号のサンプルの個数をpow(2,N)/R3倍することにより、平均信号のサンプリング周波数をFs2に変換できる。
【0025】
サンプリング周波数変換装置1は、平均信号のサンプリング周波数をpow(2,N)/R3倍するために、直線補間を用いる。サンプリング周波数変換装置1は、直線補間に使用される定数として、周期を算出する。周期Tは以下の式(5)に基づいて算出される。なお、直線補間の手順については、後述する。
T=pow(2,N)・・・(5)
【0026】
以上のように、定数R、R1、R2、R3、N、Tが算出される。なお、ステップS1において、Fs1およびFs2の値が変化しない場合には(ステップS1;NO)、サンプリング周波数変換装置1は、定数R、R1、R2、R3、N、Tの値を更新することなく、ステップS3に処理を移行する。
【0027】
次いで、サンプリング周波数変換装置1は、第2の処理および第3の処理を開始する。第2の処理は、信号の直線補間を行う処理である。第2の処理は、主に、図1のフローチャートのステップS4、ステップS5、ステップS10、ステップS11に対応する。サンプリング周波数変換装置1はステップS4、ステップS5において、1回目の直線補間を行い、ステップS10、ステップS11において、2回目の直線補間を行う。サンプリング周波数変換装置1が2回の直線補間を行うのは、直線補間の結果を平均するためであり、これにより、信号のイメージノイズが取り除かれる。
【0028】
また、第3の処理は、入力信号をR1個のサンプルごとに平均をとり、平均信号を生成する処理である。第3の処理は、フローチャートのステップS8、ステップS14に対応する。
【0029】
サンプリング周波数変換装置1が第2の処理として行う直線補間の手順を図2を参照して説明する。図2は、周期Mと、平均信号と、出力信号との関係を示す図である。平均信号は、入力信号をR1個のサンプルごとに平均化した信号である。図2は、縦軸を振幅、横軸を時間とするグラフである。図2における、黒丸は平均信号の値を示し、黒四角は出力信号を示している。この図において、I1〜I4の平均信号が時系列に入力されている。平均信号のサンプリング周期はTに設定されている。ここで、平均信号の周期を信号の入力された順にT1、T2、T3と表す。
【0030】
まず、時間位置Pが周期T2に存在するとき、サンプリング周波数変換装置1は、I2の値を記憶領域B2に記憶し、I1の値を記憶領域B1に記憶する。そして、B1、B2、T、Pの値を式(6)に代入し、時間位置Pにおける直線補間S1を算出する。
【0031】
B3=B1×(T−P)+B2×P・・・(6)
【0032】
ステップS4において、直線補間を完了すると、サンプリング周波数変換装置1は、現在のPの値を式(7)に代入し、Pの値を更新する。
P=P+R3/2・・・(7)
そして、Pの値がTより大きくなると(ステップS6;YES)、ステップS7に処理を移行する。また、Pの値がTを超えない場合には(ステップS6;NO)、サンプリング周波数変換装置1は、処理をステップS10に移行する。
【0033】
ステップS6において、Pの値がTより大きくなった場合、Pの時間位置は周期T3に移動する。サンプリング周波数変換装置1は、周期T3での直線補間を実行するために、B1、B2に記憶された値を変更する。T2の左端の値は、T3の右端の値である。そこで、サンプリング周波数変換装置1は、式(8)を用いて、周期T2におけるB1の値を記憶領域B2に代入し、記憶の時間的移動を行う。(ステップS7)。
B2=B1・・・(8)
【0034】
周期T3におけるB2の値が設定されると、サンプリング周波数変換装置1は、周期T3におけるB1の値を算出する(ステップS8)。周期T3におけるB1は、R1個の入力信号の平均値であり、式(9)をもとに算出することができる。
B1=(I[t+0]+I[t+1]+・・・+I[t+R1])/R1・・・(9)
ここで、I[t]は、入力時刻tにおける入力信号と表すため、I[t]に次いで入力される入力信号は、時系列を持って、I[t+0],I[t+1],・・・,I[t+n]となる。
【0035】
ステップS8が終了すると、サンプリング周波数変換装置1は、Pの値からMの値を引き、Pの値が0以上M未満の整数となるように調整する(ステップS9)。式(10)は、Pの値を調整するための式である。図2に示すように、式(10)よって算出されたPの値は、周期T3の時間位置を示している。
P=P−M・・・(10)
【0036】
次いで、サンプリング周波数変換装置1は、2回目の直線補間を行う(ステップS11)。2回目の直線補間は、1回目の直線補間と同様に実行される。ステップS11では、1回目の直線補間の結果と2回目の直線補間の結果との和をB3として出力するため、演算式は式(11)のように表現される。
B3=B3+B1×(M−P)+B2×P・・・(11)
【0037】
2回目の直線補間が終了すると、サンプリング周波数変換装置1は、式(6)に従って、Pの値を算出し(ステップS11)、Pの値がTより大きい場合には(ステップS12;YES)、記憶領域B1に記憶された値を記憶領域B2に記憶させるとともに(ステップS13)、新しいB1の算出を行う(ステップS14)。新しいB1を算出すると、サンプリング周波数変換装置1は、Pの値からMの値を引いてPの値を調整する(ステップS15)。これらの処理によって、B1、B2、Pの値が算出され、次の直線補間が実行できるようになる。なお、ステップS11〜ステップS15までの処理は、それぞれステップS5〜ステップS9までの処理と同様であるため、詳しい説明を省略する。
【0038】
次いで、サンプリング周波数変換装置1は、ステップS16に処理を移行し、第4の処理を実行する。第4の処理は、1回目の直線補間と2回目の直線補間の平均をとり、出力信号Oを算出する処理である。1回目の直線補間と2回目の直線補間の平均をとる演算は、以下の式(12)のように表される。
O=B3/(M×2)・・・(12)
B3は、1回目の直線補間と2回目の直線補間との和であるため、B3を2で割るだけで直線補間の平均は算出される。式(12)おいて、B3をM×2で割っているのは、式(7)の直線補間を算出する演算において、式全体をMで割る演算を省略しているためである。M×2は2のべき乗であるため、式(12)の演算は、簡単なビット演算で実行することができる。ステップS16の処理が完了すると、サンプリング周波数変換装置1は、ステップS16で算出した値を出力信号として出力する(ステップS17)。
【0039】
以下、上述の処理を実行するサンプリング周波数変換装置1の一例について説明する。図3はサンプリング周波数変換装置1の回路構成を示す図である。サンプリング周波数変換装置1の回路は、その処理ごとに4つのブロックに分類される。
【0040】
図3において、加算器19と、DQフリップフロップ20と、除算器21と、セレクタ23とは、入力信号の平均値を算出するブロックである。また、乗算器24と、乗算器25と、減算器26と、加算器27とは、直線補間を行うためのブロックである。また、加算器32と、DQフリップフロップ31と、セレクタ34と、除算器30とは、直線補間の平均をとるブロックである。DQフリップフロップ28と、加算器33とは、時間位置Pの算出を行うブロックである。また、マイクロプロセッサ35は、R、R1、R2、R3、T、Nの算出を行い、シーケンサ36は、セレクタの入力信号の制御を行う。
【0041】
まず、入力信号の平均値を算出する回路について説明する。入力端子18から信号が入力されると、入力された信号は加算器19に入力される。加算器19には、入力信号のほかにセレクタ23からの信号が入力される。シーケンサ36は、加算器19の加算回数がR1に達するまでセレクタ23のスイッチをAに設定する。スイッチがAに設定されている間、加算器19には、DQフリップフロップ20に蓄積された信号が出力される。加算器19は、入力信号とDQフリップフロップ20に蓄積された信号とを加算し、この値をDQフリップフロップ20に蓄積する。シーケンサ36は、加算器19の加算数がR1に達すると、セレクタ23のスイッチをBに設定し、DQフリップフロップ20の値をリセットする。そして、DQフリップフロップ20に累積加算された値は、除算器21に出力される。除算器21は、入力された信号をR1で除算する。除算器21からの出力は、R1個のサンプルの平均値になる。
【0042】
次に、除算器21から出力された値は、DQフリップフロップ22および乗算器24に出力される。DQフリップフロップ22に出力された値は、1サンプル遅延するため、上述の処理フローにおいてのB1に相当し、乗算器21に出力された値は遅延がないため、上述の処理フローにおけるB2に相当する。乗算器24には、DQフリップフロップ28に格納されたPの値が出力され、乗算器24では、入力信号の平均値とPとの積「B2×P」が算出される。
【0043】
また、減算器26において、DQフリップフロップ28から出力されたPの値とMとの差分「T−P」が算出され、この値は、乗算器25に出力される。乗算器25では、減算器26からの出力「T−P」と入力信号の平均値との積「B2×(T−P)」が求められる。加算器27では、乗算器24からの出力「B1×P」と乗算器25からの出力「B1×(T−P)」との和「B1×(T−P)+B2×P」を算出する。これにより、直線補間される。
【0044】
加算器27によって算出された直線補間の結果は、加算器32に出力される。加算器32には、セレクタ34からの出力が入力される。シーケンサ36は、加算器32の加算回数が2回になるまで、セレクタのスイッチをAにする。スイッチがAに設定されている間、加算器32にはDQフリップフロップ31に蓄積された値が出力される。そのため、加算器32は、加算器27からの出力とDQフリップフロップ31に蓄積された値とを加算し、この結果をDQフリップフロップ31に蓄積していく。そして、加算器32の加算回数が2回になると、シーケンサ36は、セレクタ34のスイッチをBに切り換え、DQフリップフロップ31の値をリセットするとともに、DQフリップフロップ31に蓄積されていた値を除算器30に出力する。
【0045】
除算器30は、DQフリップフロップ31から出力された値をT×2で除算し、直線補間の結果の平均値を算出する。除算器30によって算出された値は、出力信号として、出力端子29を介して外部に出力される。
【0046】
以上のように、サンプリング周波数変換装置1は、入力信号のサンプリング周波数をR1分の1に変換した後、直線補間を用いて目的のサンプリング周波数に変換する。また、アップサンプリングする場合、サンプリング周波数変換装置1は、直線補間のみを用いて目的のサンプリング周波数に変換する。
【0047】
サンプリング周波数変換装置1は、R1個のサンプルの相加平均を出力信号とすることにより、入力信号のサンプリング周波数をR1分の1に変換する。R1サンプルの和を求める演算と、サンプルの和をR1で割る演算とは、単純な回路で実現できる。
【0048】
また、サンプリング周波数変換装置1は、サンプルの出現する周期をTに設定し、この周期Tに対する時間位置Pをもとに直線補間を行う。時間位置Pの変位量R3/2であり、直線補間はR3/2Tの割合で実行される。R3、Pは整数であり、Tは2の巾数であるため、直線補間は2の巾数と整数との四則演算により算出される。このため、直線補間は、単純な回路で実現できる。
【0049】
また、サンプリング周波数変換装置1は、信号のサンプリング周波数を2×Fs2に変換し、変換した信号の2サンプルずつの平均を出力信号として出力する。この処理は、信号に含まれるイメージノイズを除去するために実行される。イメージノイズを回路で除去しようとすると、大きな回路が必要になる。本発明を適用したサンプリング周波数変換装置1は、加算器と記憶素子と乗算器のみでイメージノイズが除去できるため、ハードウェア構成が単純になる。
【0050】
また、サンプリング周波数変換装置1は、定数R1、R2、R3、T、Nの値をセレクタに入力して、サンプリング周波数の変換レートを制御している。そのため、入力信号のサンプリング周波数Fs1と出力信号のサンプリング周波数Fs2の変化に応じて定数R1、R2、R3、T、Nを再計算するだけで、サンプリング周波数の変化に対応することができる。
【0051】
【発明の効果】
上記の課題を解決するため、本発明におけるサンプリング周波数変換装置は、第1のサンプリング周波数でサンプリングされた信号を入力し第2のサンプリング周波数でサンプリングされた信号に変換して出力するサンプリング周波数変換装置であって、第1のサンプリング周波数の第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出手段と、Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出手段と、R1に対するRの比(R2とする。)を算出する巾数比算出手段と、R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換手段と、第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1個の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出手段と、第2の巾乗を上記平均信号のサンプリング周期とし、入力信号のサンプリング点に対する出力信号のサンプリング点の相対的な時間位置を算出する時間位置算出手段と、平均信号を算出された時間位置で直線補間し、補間して得た値を出力信号とする。そのため、回路構成が簡単であるだけではなく、入力信号のサンプリング周波数および出力信号のサンプリング周波数の変更が容易なサンプリング周波数変換装置を提供することができる。
【0052】
また、本発明におけるサンプリング周波数変更方法は、第1のサンプリング周波数でサンプリングされた信号を入力し第2のサンプリング周波数でサンプリングされた信号に変換して出力するサンプリング周波数変換方法であって、第1のサンプリング周波数の第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出工程と、Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出工程と、R1に対するRの比(R2とする。)を算出する巾数比算出工程と、R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換工程と、第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出工程と、第2の巾乗を平均信号のサンプリング周期とし、入力信号のサンプリング点に対する出力信号のサンプリング点の相対的な時間位置を算出する時間位置算出工程と、平均信号を算出された時間位置で直線補間し、補間して得た値を上記出力信号とする。そのため、この方法をサンプリング周波数変換装置に適用すると、サンプリング周波数変換装置の回路構成を簡単にするとともに、入力信号のサンプリング周波数および出力信号のサンプリング周波数を容易に変化させることができる。
【図面の簡単な説明】
【図1】サンプリング周波数を変換する手順を示すフローチャートである。
【図2】直線補間の手順を示す図である。
【図3】サンプリング周波数変換装置の回路構成を示す図である。
【符号の説明】
1 サンプリング周波数変換装置、18 入力端子、19 加算器、20 DQフリップフロップ、21 除算器、22 DQフリップフロップ、23 セレクタ、24 乗算器、25 乗算器、26 減算器、27 加算器、28 DQフリップフロップ、29 出力端子、30 除算器、31 DQフリップフロップ、32 加算器、33 加算器、34 セレクタ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a sampling frequency conversion device and a sampling frequency conversion method for resampling a sampling frequency of a sampled time-series signal.
[0002]
[Prior art]
In recent years, the sampling frequency of digital audio signals has been mixed with a large number of sampling frequencies such as 32 kHz for digital video, 44.1 kHz for compact discs, and 96 kHz for DVD-Audio.
[0003]
Therefore, the sampling frequencies of the digital audio signal supplied to the encoding device, the digital audio signal obtained from the decoding device, and the digital audio signal obtained from the decoding device do not always match between the devices. Therefore, when interconnecting electronic devices, it is necessary to reconvert the sampling frequency.
[0004]
Generally, the conversion of the sampling frequency is classified into interpolation and resampling. Interpolation is a process of creating a new continuous function from discrete signal data, and resampling is a process of creating new discrete signal data from a continuous function. In order to create a continuous function from the discrete signal data, a linear combination of the discrete signal data and the interpolation kernel, that is, convolution is performed.
[0005]
[Problems to be solved by the invention]
Conventionally, as a method of converting a sampling frequency, there is a method using a filter bank. In this method, the least common multiple of the sampling frequency of the output signal and the sampling frequency of the input signal is obtained, the input signal is upsampled by the least common multiple, interpolated by a low-pass filter, and downsampled to the sampling frequency of the output signal. I do.
[0006]
If the sampling frequency of the output signal is lower than the sampling frequency of the input signal, it is necessary to perform filtering before downsampling, and the processing load on the sampling frequency conversion device increases.
[0007]
On the other hand, if the sampling frequency of the output signal is higher than the sampling frequency of the input signal, it is necessary to perform filtering before upsampling, and the processing load on the sampling frequency converter increases.
[0008]
As described above, when the sampling frequency is converted using the filter bank, the processing load of the sampling frequency conversion device increases. Therefore, it is necessary to increase the circuit scale and the operating speed.
[0009]
Further, in the method using the filter bank, it is necessary to redesign the filter every time the sampling frequency of the input signal or the sampling frequency of the output signal is changed. In calculating the coefficients of the filter, the design must be made with careful attention to chessboard distortion and the like, which is complicated and requires many processes. A complicated filter has a large input / output delay time, which deteriorates the response characteristics of the entire device.
[0010]
The present invention has been made in view of the above problems, and has a simple circuit configuration, and a sampling frequency conversion device and a sampling frequency conversion that can easily change the sampling frequency of an input signal and the sampling frequency of an output signal. The aim is to provide a method.
[0011]
[Means for Solving the Problems]
In order to solve the above problem, a sampling frequency conversion device according to the present invention is provided with a sampling frequency conversion device that inputs a signal sampled at a first sampling frequency, converts the signal into a signal sampled at a second sampling frequency, and outputs the converted signal. Input / output frequency ratio calculating means for calculating a ratio (R) of the first sampling frequency to the second sampling frequency, and a maximum width of 2 (R 1 And ) Is calculated, and R 1 To the ratio of R to (R 2 And ) For calculating the width ratio ratio; 2 Is any integer R 3 And a replacement means for performing replacement by a function represented by a function represented by a reciprocal of the width N of 2 and a signal R sampled at the first sampling frequency. 1 Signal values are extracted, and this R 1 Average signal calculation means for calculating an average value for each of the signal values, and outputting the average value as an average signal; an output signal for a sampling point of the input signal, wherein the second power is used as a sampling period of the average signal. And a time position calculating means for calculating a relative time position of the sampling point, and linearly interpolating the average signal at the calculated time position, and use the value obtained by the interpolation as an output signal.
[0012]
Further, the sampling frequency changing method according to the present invention is a sampling frequency conversion method for inputting a signal sampled at a first sampling frequency, converting the signal into a signal sampled at a second sampling frequency, and outputting the converted signal. An input / output frequency ratio calculating step of calculating a ratio (R) of the sampling frequency of the second sampling frequency to the second sampling frequency; 1 And ) Is calculated, and R is calculated. 1 To the ratio of R to (R 2 And ) Is calculated, and R is calculated. 2 Is any integer R 3 And a replacement step of performing a replacement with a function represented by a reciprocal of a width N of 2 and an R that continues in time series from a signal sampled at the first sampling frequency. 1 Signal values are extracted, and this R 1 Calculating an average value for each signal value, and outputting the average value as an average signal; and sampling the output signal with respect to the sampling point of the input signal using the second power as the sampling period of the average signal. A time position calculating step of calculating a relative time position of a point, linear interpolation is performed on the average signal at the calculated time position, and a value obtained by the interpolation is used as the output signal.
[0013]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, a sampling frequency conversion device to which the present invention is applied will be described. The sampling frequency conversion device mainly converts the sampling frequency by performing four processes. The first processing is a sampling frequency Fs of the input signal. 1 And the sampling frequency Fs of the output signal 2 Constants R, R 1 , R 2 , R 3 , N, and T. This processing corresponds to steps S1 and S2 in the flowchart. Here, the constant R is the sampling frequency Fs of the input signal. 1 Output signal sampling frequency Fs 2 And R 1 Is a value obtained by approximating R by a power of 2. 2 Is R and R 1 Is a value indicating the error of 3 And N is R 2 Is a value used when approximating by an integer and a power of 2, and T is a value indicating a period between samples in linear interpolation.
[0014]
Hereinafter, the four processes executed by the sampling
[0015]
In step S2, the
R = Fs 1 / Fs 2 ... (1)
[0016]
Next, the
R 1 = Pow (2, floor (log2 (max (1, R))) (2)
Where pow (x, y) is a function that returns x to the power of y
floor (x) is a function that returns the largest integer value not exceeding x
log2 (x) is the logarithm when x is
max (x, y) is a function that returns the larger of x and y
It is.
[0017]
R calculated by equation (2) 1 Takes different values depending on whether the input signal is down-sampled or up-sampled. R for downsampling 1 And R for upsampling 1 The difference between the calculation results and will be described.
[0018]
When downsampling, Fs 1 > Fs 2 Therefore, R> 1. At this time, the return value of max (1, R) is R, and R 1 Is the maximum power of 2 that does not exceed R. When downsampling, the constant R 1 Is used as the number of samples for averaging the input signal. R 1 When one average value is obtained from the number of samples, the sampling frequency Fs of the input signal is obtained. 1 Is Fs 1 × (1 / R 1 ). Hereinafter, R 1 The signal averaged for each sample is referred to as an average signal.
[0019]
On the other hand, when upsampling, Fs 1 <Fs 2 And R <1. The return value of max (1, R) is 1, and R 1 Is 1.
[0020]
When upsampling a signal, R 1 Is 1. Obtaining the average value of one sample does not change the value of the sample and the number of samples. Therefore, the input signal is output as it is, and the sampling frequency Fs of the input signal is output. 1 Also does not change.
[0021]
In step S2, the sampling
R 2 = R / R 1 ... (3)
[0022]
R 2 Is the sampling frequency Fs of the average signal 1 × (1 / R 1 ) To Fs 2 Used as a constant to convert to R 2 The meaning of is explained using a mathematical expression. In the following equation, the sampling frequency of the average signal is Fs Mean Expressed by
[0023]
Thus, the sampling frequency of the average signal is 1 / R 2 When multiplied, the sampling frequency Fs of the output signal 2 Can be requested. However, R 2 Is a divisor of an integer and an integer, so that the value becomes a decimal number, and there is a problem that a circuit scale becomes large when performing an operation by hardware. Then, R 2 Is an integer R 3 It is expressed by a combination of and a width of 2.
[0024]
R 2 = R 3 /Pow(2,N)+Re...(4)
In the formula (4), R 3 , N are integers such that Re ≒ 0. In equation (4), assuming that Re = 0, R 2 = R 3 / Pow (2, N). The sampling
[0025]
The
T = pow (2, N) (5)
[0026]
As described above, the constants R, R 1 , R 2 , R 3 , N, T are calculated. In step S1, Fs 1 And Fs 2 Does not change (step S1; NO), the
[0027]
Next, the sampling
[0028]
The third process is a process of averaging the input signal for every R1 samples to generate an average signal. The third process corresponds to steps S8 and S14 in the flowchart.
[0029]
The procedure of the linear interpolation performed by the sampling
[0030]
First, the time position P is the period T 2 , The sampling
[0031]
B 3 = B 1 × (TP) + B 2 × P ・ ・ ・ (6)
[0032]
In step S4, when the linear interpolation is completed, the sampling
P = P + R 3 /2...(7)
Then, when the value of P becomes larger than T (step S6; YES), the process proceeds to step S7. If the value of P does not exceed T (step S6; NO), the sampling
[0033]
If the value of P becomes larger than T in step S6, the time position of P is the period T 3 Move to The
B 2 = B 1 ... (8)
[0034]
Period T 3 B in 2 Is set, the
B 1 = (I [t + 0] + I [t + 1] +... + I [t + R 1 ] / R 1 ... (9)
Here, since I [t] is represented as an input signal at the input time t, the input signal input next to I [t] has a time series of I [t + 0], I [t + 1],. , I [t + n].
[0035]
When step S8 ends, the sampling
P = PM (10)
[0036]
Next, the sampling
B 3 = B 3 + B 1 × (MP) + B 2 × P ... (11)
[0037]
When the second linear interpolation is completed, the sampling
[0038]
Next, the sampling
O = B 3 / (M × 2) (12)
B 3 Is the sum of the first linear interpolation and the second linear interpolation. 3 Is simply divided by 2 to calculate the average of the linear interpolation. In equation (12), B 3 Is divided by M × 2 because the calculation of dividing the entire expression by M is omitted in the calculation of calculating the linear interpolation in Expression (7). Since M × 2 is a power of 2, the operation of Expression (12) can be executed by a simple bit operation. When the processing in step S16 is completed, the sampling
[0039]
Hereinafter, an example of the sampling
[0040]
3, an
[0041]
First, a circuit for calculating the average value of the input signal will be described. When a signal is input from the
[0042]
Next, the value output from the
[0043]
Further, the
[0044]
The result of the linear interpolation calculated by the
[0045]
The
[0046]
As described above, the sampling
[0047]
Sampling
[0048]
Further, the sampling
[0049]
The sampling
[0050]
In addition, the
[0051]
【The invention's effect】
In order to solve the above problem, a sampling frequency conversion device according to the present invention is provided with a sampling frequency conversion device that inputs a signal sampled at a first sampling frequency, converts the signal into a signal sampled at a second sampling frequency, and outputs the converted signal. Input / output frequency ratio calculating means for calculating a ratio (R) of the first sampling frequency to the second sampling frequency, and a maximum width of 2 (R 1 And ) Is calculated, and R 1 To the ratio of R to (R 2 And ) For calculating the width ratio ratio; 2 Is any integer R 3 And a replacement means for performing replacement by a function represented by a function represented by a reciprocal of the width N of 2 and a signal R sampled at the first sampling frequency. 1 Signal values are extracted, and this R 1 Average signal calculation means for calculating an average value for each of the signal values, and outputting the average value as an average signal; an output signal for a sampling point of the input signal, wherein the second power is used as a sampling period of the average signal. And a time position calculating means for calculating a relative time position of the sampling point, and linearly interpolating the average signal at the calculated time position, and use the value obtained by the interpolation as an output signal. Therefore, it is possible to provide a sampling frequency conversion device which not only has a simple circuit configuration but also easily changes the sampling frequency of an input signal and the sampling frequency of an output signal.
[0052]
Further, the sampling frequency changing method according to the present invention is a sampling frequency conversion method for inputting a signal sampled at a first sampling frequency, converting the signal into a signal sampled at a second sampling frequency, and outputting the converted signal. An input / output frequency ratio calculating step of calculating a ratio (R) of the sampling frequency of the second sampling frequency to the second sampling frequency; 1 And ) Is calculated, and R is calculated. 1 To the ratio of R to (R 2 And ) Is calculated, and R is calculated. 2 Is any integer R 3 And a replacement step of performing a replacement with a function represented by a reciprocal of a width N of 2 and an R that continues in time series from a signal sampled at the first sampling frequency. 1 Signal values are extracted, and this R 1 Calculating an average value for each signal value, and outputting the average value as an average signal; and sampling the output signal with respect to the sampling point of the input signal using the second power as the sampling period of the average signal. A time position calculating step of calculating a relative time position of a point, linear interpolation is performed on the average signal at the calculated time position, and a value obtained by the interpolation is used as the output signal. Therefore, when this method is applied to the sampling frequency converter, the circuit configuration of the sampling frequency converter can be simplified, and the sampling frequency of the input signal and the sampling frequency of the output signal can be easily changed.
[Brief description of the drawings]
FIG. 1 is a flowchart showing a procedure for converting a sampling frequency.
FIG. 2 is a diagram showing a procedure of linear interpolation.
FIG. 3 is a diagram showing a circuit configuration of a sampling frequency conversion device.
[Explanation of symbols]
1 sampling frequency converter, 18 input terminals, 19 adder, 20 DQ flip-flop, 21 divider, 22 DQ flip-flop, 23 selector, 24 multiplier, 25 multiplier, 26 subtractor, 27 adder, 28 DQ flip-flop , 29 output terminals, 30 divider, 31 DQ flip-flop, 32 adder, 33 adder, 34 selector
Claims (12)
上記第1のサンプリング周波数の上記第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出手段と、
上記Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出手段と、
上記R1に対するRの比(R2とする。)を算出する巾数比算出手段と、
上記R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換手段と、
上記第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1個の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出手段と、
上記平均信号に対する上記出力信号の相対的な時間位置を算出する時間位置算出手段と、
上記平均信号を上記時間位置で直線補間する直線補間手段とを有すること
を特徴とするサンプリング周波数変換装置。A sampling frequency conversion device that inputs a signal sampled at a first sampling frequency, converts the signal into an output signal sampled at a second sampling frequency, and outputs the output signal.
Input / output frequency ratio calculation means for calculating a ratio (R) of the first sampling frequency to the second sampling frequency;
And exponent calculation means for calculating the maximum second width number (and R 1.) Does not exceed the above R,
A width ratio calculating means for calculating a ratio of R (R 2 to.) With respect to the R 1,
Replacement means for replacing the above R 2 with a function represented by an arbitrary integer R 3 and a reciprocal of a width N of 2;
R 1 signal values connected in a time series are extracted from the signal sampled at the first sampling frequency, an average value is calculated for each of the R 1 signal values, and the average value is output as an average signal. Average signal calculating means for
Time position calculating means for calculating a relative time position of the output signal with respect to the average signal;
And a linear interpolation means for linearly interpolating the average signal at the time position.
上記時間位置算出手段は、上記R3を任意の整数Uで割った値Vを算出し、任意の初期値に対し上記Vを順次加算し、加算結果がN以上になったときに、加算結果からNを減算し、常に0以上N未満の値を保つ時間位置Pを算出することを特徴とする請求項1記載のサンプリング周波数変換装置。The relative time position of the output signal with respect to the average signal is the value of the time position (P) for the width N of 2;
It said time position calculating means, the R 3 calculates a value V divided by any integer U, sequentially adds the V for any initial value, when the addition result is equal to or greater than N, addition results 2. The sampling frequency conversion apparatus according to claim 1, wherein N is subtracted from, and a time position P which always keeps a value of 0 or more and less than N is calculated.
上記記憶手段に記憶された2つの平均信号のうち先に出力された信号をB1とし、後に出力された信号をB2とし、上記B1とB2とを上記B1とB2との間に位置する時間位置Pで直線補間することを特徴とする請求項2記載のサンプリング周波数変換装置。Storage means for storing the average signal;
The signals output to out destination of the stored two average signal to said memory means and B 1, a signal output after the B 2, and the B 1 and B 2 between the B 1 and B 2 3. The sampling frequency conversion device according to claim 2, wherein linear interpolation is performed at a time position P located between the two.
B3={B1×(N−P)+B2×P}/N・・・・(1)4. The sampling frequency conversion device according to claim 3 , wherein the result of the linear interpolation (B3) is calculated by the following equation (1).
B 3 = {B 1 × (NP) + B 2 × P} / N (1)
上記入出力周波数比算出手段、上記巾数算出手段、上記巾数比算出手段、上記置換手段は、上記Fs1および/またはFs2が変化するごとに、R、R1、R2、R3、Nの値を更新することを特徴とする請求項1記載のサンプリング周波数変換装置。A sampling frequency Fs 1 of the input signal, a monitoring means for monitoring changes in the sampling frequency Fs 2 of the output signal comprises,
The input / output frequency ratio calculating means, the width number calculating means, the width ratio calculating means, and the replacing means change R, R 1 , R 2 , R 3 each time the Fs 1 and / or Fs 2 change. , N is updated. The sampling frequency conversion apparatus according to claim 1, wherein
上記第1のサンプリング周波数の上記第2のサンプリング周波数に対する比(Rとする。)を算出する入出力周波数比算出工程と、
上記Rを超えない最大の2の巾数(R1とする。)を算出する巾数算出手段と、
上記R1に対するRの比(R2とする。)を算出する巾数比算出工程と、
上記R2を任意の整数R3と2の巾数Nの逆数とで表される関数で置換する置換工程と、
上記第1のサンプリング周波数でサンプリングされた信号から時系列に連なるR1個の信号値を抽出し、このR1個の信号値ごとに一平均値を算出し、この平均値を平均信号として出力する平均信号算出工程と、
上記平均信号に対する上記出力信号の相対的な時間位置を算出する時間位置算出工程と、
上記平均信号を上記時間位置で直線補間する直線補間工程とを有すること
を特徴とするサンプリング周波数変換方法。A sampling frequency conversion method for inputting a signal sampled at a first sampling frequency, converting the signal into an output signal sampled at a second sampling frequency, and outputting the output signal,
An input / output frequency ratio calculating step of calculating a ratio (R) of the first sampling frequency to the second sampling frequency;
And exponent calculation means for calculating the maximum second width number (and R 1.) Does not exceed the above R,
(And R 2.) The ratio of R to said R 1 and width ratio calculating step of calculating a
A replacement step of replacing the above R 2 by a function represented by an arbitrary integer R 3 and a reciprocal of a width N of 2;
R 1 signal values connected in a time series are extracted from the signal sampled at the first sampling frequency, an average value is calculated for each of the R 1 signal values, and the average value is output as an average signal. Average signal calculating step of
A time position calculating step of calculating a relative time position of the output signal with respect to the average signal;
A linear interpolation step of linearly interpolating the average signal at the time position.
上記時間位置算出工程は、上記R3を任意の整数Uで割った値Vを算出し、任意の初期値に対し上記Vを順次加算し、加算結果がN以上になったときに、加算結果からNを減算し、常に0以上N未満の値を保つ時間位置Pを算出することを特徴とする請求項7記載のサンプリング周波数変換方法。The relative time position of the output signal with respect to the average signal is the value of the time position (P) for the width N of 2;
Said time position calculating step, the R 3 calculates a value V divided by any integer U, sequentially adds the V for any initial value, when the addition result is equal to or greater than N, addition results 8. A sampling frequency conversion method according to claim 7, wherein a time position P is calculated by subtracting N from, and always keeping a value of 0 or more and less than N.
上記記憶手段に記憶された2つの平均信号のうち先に出力された信号をB1とし、後に出力された信号をB2とし、上記B1とB2とを上記B1とB2との間に位置する時間位置Pで直線補間することを特徴とする請求項8記載のサンプリング周波数変換方法。Storage means for storing the average signal;
The signals output to out destination of the stored two average signal to said memory means and B 1, a signal output after the B 2, and the B 1 and B 2 between the B 1 and B 2 9. The sampling frequency conversion method according to claim 8, wherein linear interpolation is performed at a time position P located therebetween.
B3={B1×(N−P)+B2×P}/N・・・・(1)(And B 3.) The results of the linear interpolation, sampling frequency conversion method according to claim 9, wherein to be calculated by the following equation (1).
B 3 = {B 1 × (NP) + B 2 × P} / N (1)
上記入出力比算出工程、上記巾数算出工程、上記巾数比算出工程、上記置換工程は、上記Fs1および/またはFs2が変化するごとに、R、R1、R2、R3、Nの値を更新することを特徴とする請求項7記載のサンプリング周波数変換方法。It includes the sampling frequency Fs 1 of the input signal, a monitoring step of monitoring changes in the sampling frequency Fs 2 of the output signal,
The output ratio calculating step, the exponent calculation step, the width ratio calculating step, the displacement step, each time the Fs 1 and / or Fs 2 changes, R, R 1, R 2 , R 3, The sampling frequency conversion method according to claim 7, wherein the value of N is updated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002292860A JP2004129072A (en) | 2002-10-04 | 2002-10-04 | Sampling frequency conversion device and sampling frequency conversion method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002292860A JP2004129072A (en) | 2002-10-04 | 2002-10-04 | Sampling frequency conversion device and sampling frequency conversion method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004129072A true JP2004129072A (en) | 2004-04-22 |
Family
ID=32283988
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002292860A Withdrawn JP2004129072A (en) | 2002-10-04 | 2002-10-04 | Sampling frequency conversion device and sampling frequency conversion method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004129072A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007049509A (en) * | 2005-08-11 | 2007-02-22 | Fuji Electric Retail Systems Co Ltd | Equal length compression method of time series data |
-
2002
- 2002-10-04 JP JP2002292860A patent/JP2004129072A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007049509A (en) * | 2005-08-11 | 2007-02-22 | Fuji Electric Retail Systems Co Ltd | Equal length compression method of time series data |
JP4544090B2 (en) * | 2005-08-11 | 2010-09-15 | 富士電機リテイルシステムズ株式会社 | Isometric compression method for time series data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR20060082803A (en) | Sample rate converter | |
JP2002374150A (en) | Digital filter and digital-signal filtering method | |
JPH0629786A (en) | Low-accuracy fir filter for digital interpolation | |
JP4376973B2 (en) | Sample rate converter | |
Pei et al. | Fractional bilinear transform for analog-to-digital conversion | |
JP2009004848A (en) | Mixing device | |
JP2002506603A (en) | Sample rate converter using polynomial interpolation | |
JP2000216664A (en) | Filter and method for acquiring its filter coefficient | |
US8949303B2 (en) | Filter | |
JPH1075159A (en) | Digital filter system | |
US5821884A (en) | Sampling rate conversion method and apparatus utilizing an area effect correlation method | |
JP2004129072A (en) | Sampling frequency conversion device and sampling frequency conversion method | |
JP2010041311A (en) | Filter, and configuration system and configuration method of filter | |
JP4020867B2 (en) | Asynchronous sampling rate conversion | |
US7609181B2 (en) | Sampling frequency conversion apparatus | |
JP5573901B2 (en) | Sampling rate converter | |
JP4648243B2 (en) | AC signal measuring instrument and offset adjustment method thereof | |
JPH06104751A (en) | Deltasigma modulation type a/d converter | |
WO2020132239A1 (en) | System and method for signal resampling | |
JP4857699B2 (en) | Filter device | |
JP3857011B2 (en) | Digital high-pass filter and jitter measuring instrument using digital high-pass filter | |
JP3172046B2 (en) | Sampling rate converter | |
JP2719722B2 (en) | Weight signal filtering method and apparatus | |
JP3154857B2 (en) | Interpolated noise shaping quantizer and oversampling DA converter | |
JPH09312549A (en) | Rate conversion circuit |
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: 20060110 |