speed optimization: use shorter resampling filter

This commit is contained in:
Volker Fischer 2009-02-14 11:15:53 +00:00
parent 55c680e6fd
commit 0087d50761
3 changed files with 119 additions and 333 deletions

View file

@ -211,7 +211,7 @@ void CClient::run()
// Set thread priority (The working thread should have a higher // Set thread priority (The working thread should have a higher
// priority than the GUI) // priority than the GUI)
#ifdef _WIN32 #ifdef _WIN32
SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_HIGHEST ); SetThreadPriority ( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
#else #else
/* /*
// set the process to realtime privs, taken from // set the process to realtime privs, taken from

View file

@ -5,10 +5,10 @@
#ifndef _RESAMPLEFILTER_H_ #ifndef _RESAMPLEFILTER_H_
#define _RESAMPLEFILTER_H_ #define _RESAMPLEFILTER_H_
#define NUM_TAPS_PER_PHASE2 12 #define NUM_TAPS_PER_PHASE2 4
#define NUM_TAPS_PER_PHASE3_2 12 #define NUM_TAPS_PER_PHASE3_2 4
#define NUM_TAPS_PER_PHASE12_7 12 #define NUM_TAPS_PER_PHASE12_7 4
#define NUM_TAPS_PER_PHASE1 12 #define NUM_TAPS_PER_PHASE1 4
#define INTERP_I_2 2 #define INTERP_I_2 2
#define DECIM_D_2 1 #define DECIM_D_2 1
#define INTERP_I_3_2 3 #define INTERP_I_3_2 3
@ -21,344 +21,128 @@
// Filter for ratio 2 // Filter for ratio 2
static float fResTaps2[INTERP_I_2 * DECIM_D_2 * NUM_TAPS_PER_PHASE2] = { static float fResTaps2[INTERP_I_2 * DECIM_D_2 * NUM_TAPS_PER_PHASE2] = {
-0.00197231219263642580f, -0.00543278438387929850f,
-0.00149441363437698710f, -0.04267524016158903000f,
0.00978643021021321540f, 0.20891570602538878000f,
0.00681767720964485820f, 0.83952404734744124000f,
-0.02671025414462463400f, 0.83952404734744124000f,
-0.02086828471078093500f, 0.20891570602538878000f,
0.05837045639157300400f, -0.04267524016158903000f,
0.05384957575491138700f, -0.00543278438387929850f
-0.11980958828278984000f,
-0.14170168497101379000f,
0.30855591451377506000f,
0.87515091657445054000f,
0.87515091657445054000f,
0.30855591451377506000f,
-0.14170168497101379000f,
-0.11980958828278984000f,
0.05384957575491138700f,
0.05837045639157300400f,
-0.02086828471078093500f,
-0.02671025414462463400f,
0.00681767720964485820f,
0.00978643021021321540f,
-0.00149441363437698710f,
-0.00197231219263642580f
}; };
// Filter for ratio 3 / 2 // Filter for ratio 3 / 2
static float fResTaps3_2[INTERP_I_3_2 * DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2] = { static float fResTaps3_2[INTERP_I_3_2 * DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2] = {
-0.00176046250093099540f, -0.00408852062433148060f,
-0.00336610762581997370f, -0.03403350863992425000f,
-0.00023822280323501131f, -0.04022975217253792900f,
0.00833859487742245890f, 0.13329249686943762000f,
0.01339722511380138700f, 0.53708476977179720000f,
0.00269922033961634070f, 0.91181435690712065000f,
-0.02185973842102897900f, 0.91181435690712065000f,
-0.03569929574814127000f, 0.53708476977179720000f,
-0.01106578529670297800f, 0.13329249686943762000f,
0.04574010538564617100f, -0.04022975217253792900f,
0.08068909318354972000f, -0.03403350863992425000f,
0.03356421112732931000f, -0.00408852062433148060f
-0.08888051700234801700f,
-0.18084907976234993000f,
-0.10021438259584969000f,
0.20666894693494509000f,
0.62554698344706861000f,
0.92713992460312022000f,
0.92713992460312022000f,
0.62554698344706861000f,
0.20666894693494509000f,
-0.10021438259584969000f,
-0.18084907976234993000f,
-0.08888051700234801700f,
0.03356421112732931000f,
0.08068909318354972000f,
0.04574010538564617100f,
-0.01106578529670297800f,
-0.03569929574814127000f,
-0.02185973842102897900f,
0.00269922033961634070f,
0.01339722511380138700f,
0.00833859487742245890f,
-0.00023822280323501131f,
-0.00336610762581997370f,
-0.00176046250093099540f
}; };
// Filter for ratio 12 / 7 // Filter for ratio 12 / 7
static float fResTaps12_7[INTERP_I_12_7 * DECIM_D_12_7 * NUM_TAPS_PER_PHASE12_7] = { static float fResTaps12_7[INTERP_I_12_7 * DECIM_D_12_7 * NUM_TAPS_PER_PHASE12_7] = {
-0.00125208827289417920f, -0.00185134160992586720f,
-0.00190626448556412160f, -0.00535053051492332800f,
-0.00258725330105407910f, -0.01104625703005996000f,
-0.00321911699468315850f, -0.01899767406878452600f,
-0.00371304124871946240f, -0.02882121807019974400f,
-0.00397449433584967650f, -0.03958235672293213700f,
-0.00391226244728601170f, -0.04974153780519474000f,
-0.00344872729447937270f, -0.05717451684296728800f,
-0.00253053775303447700f, -0.05927956058301216100f,
-0.00113866891904707700f, -0.05317329279983799100f,
0.00070321859502462086f, -0.03596445360838258800f,
0.00292319218332290870f, -0.00508228090027591780f,
0.00539918825312160800f, 0.04137452990390712300f,
0.00796161187294208010f, 0.10430949713686680000f,
0.01040080648737300700f, 0.18336405182544557000f,
0.01247940789020031800f, 0.27675710732757719000f,
0.01394914970162503700f, 0.38125907488903715000f,
0.01457122611642731000f, 0.49231678134249329000f,
0.01413888175955135800f, 0.60432839502202396000f,
0.01250052994177179200f, 0.71104906219027497000f,
0.00958143947199255330f, 0.80609094024529682000f,
0.00540191094345563410f, 0.88346804514451582000f,
0.00008991148771200068f, 0.93812874014341641000f,
-0.00611363430350713410f, 0.96641799077360369000f,
-0.01285829127084545300f, 0.96641799077360369000f,
-0.01969712096259990500f, 0.93812874014341641000f,
-0.02610936928229550000f, 0.88346804514451582000f,
-0.03153216669657662300f, 0.80609094024529682000f,
-0.03539975740910365800f, 0.71104906219027497000f,
-0.03718799481084937600f, 0.60432839502202396000f,
-0.03646116541074920900f, 0.49231678134249329000f,
-0.03291769690105803700f, 0.38125907488903715000f,
-0.02643102432092192500f, 0.27675710732757719000f,
-0.01708187424006729600f, 0.18336405182544557000f,
-0.00517850526744063640f, 0.10430949713686680000f,
0.00873798258468762820f, 0.04137452990390712300f,
0.02390530685294215600f, -0.00508228090027591780f,
0.03936958373129542700f, -0.03596445360838258800f,
0.05403253332659402300f, -0.05317329279983799100f,
0.06671467306160311400f, -0.05927956058301216100f,
0.07623153406248735200f, -0.05717451684296728800f,
0.08147871600785833200f, -0.04974153780519474000f,
0.08152058589868019200f, -0.03958235672293213700f,
0.07567671586657001600f, -0.02882121807019974400f,
0.06359981811742342100f, -0.01899767406878452600f,
0.04533902176348663500f, -0.01104625703005996000f,
0.02138286854317816500f, -0.00535053051492332800f,
-0.00732262749824698880f, -0.00185134160992586720f
-0.03938414980169741000f,
-0.07300109067071840200f,
-0.10603511604421303000f,
-0.13610699820077277000f,
-0.16071647179549162000f,
-0.17737908657056814000f,
-0.18377255785167662000f,
-0.17788407020636693000f,
-0.15814946187689599000f,
-0.12357526654261679000f,
-0.07383523520087217900f,
-0.00933418413014485730f,
0.06876624614792664600f,
0.15856318013703752000f,
0.25747026200729783000f,
0.36231581851199790000f,
0.46947713391879947000f,
0.57504420553142555000f,
0.67500437604388086000f,
0.76543776689193965000f,
0.84271257101448604000f,
0.90366907084389148000f,
0.94578175032061074000f,
0.96729004417063957000f,
0.96729004417063957000f,
0.94578175032061074000f,
0.90366907084389148000f,
0.84271257101448604000f,
0.76543776689193965000f,
0.67500437604388086000f,
0.57504420553142555000f,
0.46947713391879947000f,
0.36231581851199790000f,
0.25747026200729783000f,
0.15856318013703752000f,
0.06876624614792664600f,
-0.00933418413014485730f,
-0.07383523520087217900f,
-0.12357526654261679000f,
-0.15814946187689599000f,
-0.17788407020636693000f,
-0.18377255785167662000f,
-0.17737908657056814000f,
-0.16071647179549162000f,
-0.13610699820077277000f,
-0.10603511604421303000f,
-0.07300109067071840200f,
-0.03938414980169741000f,
-0.00732262749824698880f,
0.02138286854317816500f,
0.04533902176348663500f,
0.06359981811742342100f,
0.07567671586657001600f,
0.08152058589868019200f,
0.08147871600785833200f,
0.07623153406248735200f,
0.06671467306160311400f,
0.05403253332659402300f,
0.03936958373129542700f,
0.02390530685294215600f,
0.00873798258468762820f,
-0.00517850526744063640f,
-0.01708187424006729600f,
-0.02643102432092192500f,
-0.03291769690105803700f,
-0.03646116541074920900f,
-0.03718799481084937600f,
-0.03539975740910365800f,
-0.03153216669657662300f,
-0.02610936928229550000f,
-0.01969712096259990500f,
-0.01285829127084545300f,
-0.00611363430350713410f,
0.00008991148771200068f,
0.00540191094345563410f,
0.00958143947199255330f,
0.01250052994177179200f,
0.01413888175955135800f,
0.01457122611642731000f,
0.01394914970162503700f,
0.01247940789020031800f,
0.01040080648737300700f,
0.00796161187294208010f,
0.00539918825312160800f,
0.00292319218332290870f,
0.00070321859502462086f,
-0.00113866891904707700f,
-0.00253053775303447700f,
-0.00344872729447937270f,
-0.00391226244728601170f,
-0.00397449433584967650f,
-0.00371304124871946240f,
-0.00321911699468315850f,
-0.00258725330105407910f,
-0.00190626448556412160f,
-0.00125208827289417920f
}; };
// Filter for ratios close to 1 // Filter for ratios close to 1
static float fResTaps1[INTERP_DECIM_I_D1 * NUM_TAPS_PER_PHASE1] = { static float fResTaps1[INTERP_DECIM_I_D1 * NUM_TAPS_PER_PHASE1] = {
-0.00129181992672801360f, -0.00200330615661920140f,
-0.00207886551285772290f, -0.00657158284969252320f,
-0.00287519800425638110f, -0.01434325067267541500f,
-0.00354120720771153910f, -0.02515649349164660000f,
-0.00391755659664638590f, -0.03781954301370460400f,
-0.00384568128202934270f, -0.04991380271447259900f,
-0.00319259334815649940f, -0.05780029046175797600f,
-0.00187713739944610450f, -0.05688089663877354800f,
0.00010586149691723067f, -0.04212153837626786400f,
0.00266742068076876060f, -0.00879070792017156400f,
0.00561586829442904840f, 0.04668529656863164300f,
0.00866090598717600930f, 0.12588850452342773000f,
0.01143197533872717000f, 0.22775132810044491000f,
0.01351098086300389300f, 0.34821676223650200000f,
0.01447751287549226700f, 0.48031735951868820000f,
0.01396276906259418800f, 0.61470848494637820000f,
0.01170664402374247200f, 0.74061377477860824000f,
0.00761119378345958850f, 0.84706508415438742000f,
0.00178311012364952820f, 0.92426036786924715000f,
-0.00544188094946287510f, 0.96483311873999922000f,
-0.01349857823816511800f, 0.96483311873999922000f,
-0.02161960909069559500f, 0.92426036786924715000f,
-0.02889142869399521600f, 0.84706508415438742000f,
-0.03433664370844288100f, 0.74061377477860824000f,
-0.03701682481313090000f, 0.61470848494637820000f,
-0.03614676421513295800f, 0.48031735951868820000f,
-0.03120859084480779800f, 0.34821676223650200000f,
-0.02205265100214613000f, 0.22775132810044491000f,
-0.00897188476756275060f, 0.12588850452342773000f,
0.00726225824406205160f, 0.04668529656863164300f,
0.02541150940858524100f, -0.00879070792017156400f,
0.04383507935997314800f, -0.04212153837626786400f,
0.06060641890050100900f, -0.05688089663877354800f,
0.07367662235517660800f, -0.05780029046175797600f,
0.08107302414568577600f, -0.04991380271447259900f,
0.08111657494320076400f, -0.03781954301370460400f,
0.07263788052016696700f, -0.02515649349164660000f,
0.05516985095031713000f, -0.01434325067267541500f,
0.02909509423931267600f, -0.00657158284969252320f,
-0.00427135103965109450f, -0.00200330615661920140f
-0.04267869501534898200f,
-0.08302470868585065700f,
-0.12152802242786863000f,
-0.15398027155782226000f,
-0.17606165300033697000f,
-0.18369620562420094000f,
-0.17341770937821352000f,
-0.14271415809850990000f,
-0.09031872116141286000f,
-0.01641812005088002400f,
0.07724474282951483700f,
0.18738870090358245000f,
0.30933747340895279000f,
0.43728178746780866000f,
0.56464344237183917000f,
0.68451472884717957000f,
0.79013921003423337000f,
0.87539536840978205000f,
0.93524350914423104000f,
0.96609875058711103000f,
0.96609875058711103000f,
0.93524350914423104000f,
0.87539536840978205000f,
0.79013921003423337000f,
0.68451472884717957000f,
0.56464344237183917000f,
0.43728178746780866000f,
0.30933747340895279000f,
0.18738870090358245000f,
0.07724474282951483700f,
-0.01641812005088002400f,
-0.09031872116141286000f,
-0.14271415809850990000f,
-0.17341770937821352000f,
-0.18369620562420094000f,
-0.17606165300033697000f,
-0.15398027155782226000f,
-0.12152802242786863000f,
-0.08302470868585065700f,
-0.04267869501534898200f,
-0.00427135103965109450f,
0.02909509423931267600f,
0.05516985095031713000f,
0.07263788052016696700f,
0.08111657494320076400f,
0.08107302414568577600f,
0.07367662235517660800f,
0.06060641890050100900f,
0.04383507935997314800f,
0.02541150940858524100f,
0.00726225824406205160f,
-0.00897188476756275060f,
-0.02205265100214613000f,
-0.03120859084480779800f,
-0.03614676421513295800f,
-0.03701682481313090000f,
-0.03433664370844288100f,
-0.02889142869399521600f,
-0.02161960909069559500f,
-0.01349857823816511800f,
-0.00544188094946287510f,
0.00178311012364952820f,
0.00761119378345958850f,
0.01170664402374247200f,
0.01396276906259418800f,
0.01447751287549226700f,
0.01351098086300389300f,
0.01143197533872717000f,
0.00866090598717600930f,
0.00561586829442904840f,
0.00266742068076876060f,
0.00010586149691723067f,
-0.00187713739944610450f,
-0.00319259334815649940f,
-0.00384568128202934270f,
-0.00391755659664638590f,
-0.00354120720771153910f,
-0.00287519800425638110f,
-0.00207886551285772290f,
-0.00129181992672801360f
}; };

View file

@ -9,10 +9,12 @@
function resamplefilter() function resamplefilter()
% Number of taps per poly phase for different resampling types % Number of taps per poly phase for different resampling types
NoTapsP2 = 12; % 24 kHz GlobalNoTaps = 4;%12; % use global value for all types
NoTapsP3_2 = 12; % 32 kHz
NoTapsP12_7 = 12; % 28 kHz NoTapsP2 = GlobalNoTaps; % 24 kHz
NoTapsP1 = 12; % 48 kHz NoTapsP3_2 = GlobalNoTaps; % 32 kHz
NoTapsP12_7 = GlobalNoTaps; % 28 kHz
NoTapsP1 = GlobalNoTaps; % 48 kHz
% Filter for ratio 2 ----------------------------------------------------------- % Filter for ratio 2 -----------------------------------------------------------