bug fix for resampling
This commit is contained in:
parent
62cab9ec66
commit
93200960c3
3 changed files with 130 additions and 239 deletions
|
@ -87,8 +87,8 @@ int CResample::Resample ( CVector<double>& vecdInput,
|
||||||
double dy2 = 0.0;
|
double dy2 = 0.0;
|
||||||
for (int i = 0; i < NUM_TAPS_PER_PHASE1; i++)
|
for (int i = 0; i < NUM_TAPS_PER_PHASE1; i++)
|
||||||
{
|
{
|
||||||
dy1 += fResTaps1[ip1][i] * vecdIntBuff[in1 - i];
|
dy1 += fResTaps1[ip1 * INTERP_DECIM_I_D1 + i] * vecdIntBuff[in1 - i];
|
||||||
dy2 += fResTaps1[ip2][i] * vecdIntBuff[in2 - i];
|
dy2 += fResTaps1[ip2 * INTERP_DECIM_I_D1 + i] * vecdIntBuff[in2 - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ void CAudioResample::Resample ( CVector<double>& vecdInput,
|
||||||
double dy = 0.0;
|
double dy = 0.0;
|
||||||
for ( int i = 0; i < iNumTaps; i++ )
|
for ( int i = 0; i < iNumTaps; i++ )
|
||||||
{
|
{
|
||||||
dy += pFiltTaps[ip * iNumTaps + i] * vecdIntBuff[in - i];
|
dy += pFiltTaps[ip + i * iI] * vecdIntBuff[in - i];
|
||||||
}
|
}
|
||||||
|
|
||||||
vecdOutput[j] = dy;
|
vecdOutput[j] = dy;
|
||||||
|
@ -195,14 +195,14 @@ void CAudioResample::Init ( const int iNewInputBlockSize,
|
||||||
switch ( iFrom / iTo )
|
switch ( iFrom / iTo )
|
||||||
{
|
{
|
||||||
case 2: // 48 kHz to 24 kHz
|
case 2: // 48 kHz to 24 kHz
|
||||||
pFiltTaps = &fResTaps2dn[0][0];
|
pFiltTaps = fResTaps2;
|
||||||
iNumTaps = INTERP_I_2 * NUM_TAPS_PER_PHASE2;
|
iNumTaps = INTERP_I_2 * NUM_TAPS_PER_PHASE2;
|
||||||
iI = DECIM_D_2;
|
iI = DECIM_D_2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* not yet supported
|
/* not yet supported
|
||||||
case ( 2 / 3 ): // 48 kHz to 32 kHz
|
case ( 2 / 3 ): // 48 kHz to 32 kHz
|
||||||
pFiltTaps = &fResTaps3_2dn[0][0];
|
pFiltTaps = fResTaps3_2;
|
||||||
iNumTaps = INTERP_I_3_2 * NUM_TAPS_PER_PHASE3_2;
|
iNumTaps = INTERP_I_3_2 * NUM_TAPS_PER_PHASE3_2;
|
||||||
iI = DECIM_D_3_2;
|
iI = DECIM_D_3_2;
|
||||||
break;
|
break;
|
||||||
|
@ -223,14 +223,14 @@ case ( 2 / 3 ): // 48 kHz to 32 kHz
|
||||||
switch ( iTo / iFrom )
|
switch ( iTo / iFrom )
|
||||||
{
|
{
|
||||||
case 2: // 24 kHz to 48 kHz
|
case 2: // 24 kHz to 48 kHz
|
||||||
pFiltTaps = &fResTaps2up[0][0];
|
pFiltTaps = fResTaps2;
|
||||||
iNumTaps = DECIM_D_2 * NUM_TAPS_PER_PHASE2;
|
iNumTaps = DECIM_D_2 * NUM_TAPS_PER_PHASE2;
|
||||||
iI = INTERP_I_2;
|
iI = INTERP_I_2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* not yet supported
|
/* not yet supported
|
||||||
case 1.5: // 32 kHz to 48 kHz
|
case 1.5: // 32 kHz to 48 kHz
|
||||||
pFiltTaps = &fResTaps3_2up[0][0];
|
pFiltTaps = fResTaps3_2;
|
||||||
iNumTaps = DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2;
|
iNumTaps = DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2;
|
||||||
iI = INTERP_I_3_2;
|
iI = INTERP_I_3_2;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -17,39 +17,7 @@
|
||||||
|
|
||||||
|
|
||||||
// Filter for ratio 2
|
// Filter for ratio 2
|
||||||
static float fResTaps2up[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.00978643021021321540f,
|
|
||||||
-0.02671025414462463400f,
|
|
||||||
0.05837045639157300400f,
|
|
||||||
-0.11980958828278984000f,
|
|
||||||
0.30855591451377506000f,
|
|
||||||
0.87515091657445054000f,
|
|
||||||
-0.14170168497101379000f,
|
|
||||||
0.05384957575491138700f,
|
|
||||||
-0.02086828471078093500f,
|
|
||||||
0.00681767720964485820f,
|
|
||||||
-0.00149441363437698710f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00149441363437698710f,
|
|
||||||
0.00681767720964485820f,
|
|
||||||
-0.02086828471078093500f,
|
|
||||||
0.05384957575491138700f,
|
|
||||||
-0.14170168497101379000f,
|
|
||||||
0.87515091657445054000f,
|
|
||||||
0.30855591451377506000f,
|
|
||||||
-0.11980958828278984000f,
|
|
||||||
0.05837045639157300400f,
|
|
||||||
-0.02671025414462463400f,
|
|
||||||
0.00978643021021321540f,
|
|
||||||
-0.00197231219263642580f
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static float fResTaps2dn[DECIM_D_2][INTERP_I_2 * NUM_TAPS_PER_PHASE2] = {
|
|
||||||
{
|
|
||||||
-0.00197231219263642580f,
|
-0.00197231219263642580f,
|
||||||
-0.00149441363437698710f,
|
-0.00149441363437698710f,
|
||||||
0.00978643021021321540f,
|
0.00978643021021321540f,
|
||||||
|
@ -74,241 +42,171 @@ static float fResTaps2dn[DECIM_D_2][INTERP_I_2 * NUM_TAPS_PER_PHASE2] = {
|
||||||
0.00978643021021321540f,
|
0.00978643021021321540f,
|
||||||
-0.00149441363437698710f,
|
-0.00149441363437698710f,
|
||||||
-0.00197231219263642580f
|
-0.00197231219263642580f
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Filter for ratio 3 / 2
|
// Filter for ratio 3 / 2
|
||||||
static float fResTaps3_2up[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.00176046250093099540f,
|
||||||
0.00833859487742245890f,
|
|
||||||
-0.02185973842102897900f,
|
|
||||||
0.04574010538564617100f,
|
|
||||||
-0.08888051700234801700f,
|
|
||||||
0.20666894693494509000f,
|
|
||||||
0.92713992460312022000f,
|
|
||||||
-0.10021438259584969000f,
|
|
||||||
0.03356421112732931000f,
|
|
||||||
-0.01106578529670297800f,
|
|
||||||
0.00269922033961634070f,
|
|
||||||
-0.00023822280323501131f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00336610762581997370f,
|
-0.00336610762581997370f,
|
||||||
0.01339722511380138700f,
|
|
||||||
-0.03569929574814127000f,
|
|
||||||
0.08068909318354972000f,
|
|
||||||
-0.18084907976234993000f,
|
|
||||||
0.62554698344706861000f,
|
|
||||||
0.62554698344706861000f,
|
|
||||||
-0.18084907976234993000f,
|
|
||||||
0.08068909318354972000f,
|
|
||||||
-0.03569929574814127000f,
|
|
||||||
0.01339722511380138700f,
|
|
||||||
-0.00336610762581997370f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00023822280323501131f,
|
-0.00023822280323501131f,
|
||||||
0.00269922033961634070f,
|
|
||||||
-0.01106578529670297800f,
|
|
||||||
0.03356421112732931000f,
|
|
||||||
-0.10021438259584969000f,
|
|
||||||
0.92713992460312022000f,
|
|
||||||
0.20666894693494509000f,
|
|
||||||
-0.08888051700234801700f,
|
|
||||||
0.04574010538564617100f,
|
|
||||||
-0.02185973842102897900f,
|
|
||||||
0.00833859487742245890f,
|
0.00833859487742245890f,
|
||||||
-0.00176046250093099540f
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static float fResTaps3_2dn[DECIM_D_3_2][INTERP_I_3_2 * NUM_TAPS_PER_PHASE3_2] = {
|
|
||||||
{
|
|
||||||
-0.00176046250093099540f,
|
|
||||||
-0.00023822280323501131f,
|
|
||||||
0.01339722511380138700f,
|
0.01339722511380138700f,
|
||||||
|
0.00269922033961634070f,
|
||||||
-0.02185973842102897900f,
|
-0.02185973842102897900f,
|
||||||
|
-0.03569929574814127000f,
|
||||||
-0.01106578529670297800f,
|
-0.01106578529670297800f,
|
||||||
|
0.04574010538564617100f,
|
||||||
0.08068909318354972000f,
|
0.08068909318354972000f,
|
||||||
|
0.03356421112732931000f,
|
||||||
-0.08888051700234801700f,
|
-0.08888051700234801700f,
|
||||||
|
-0.18084907976234993000f,
|
||||||
-0.10021438259584969000f,
|
-0.10021438259584969000f,
|
||||||
|
0.20666894693494509000f,
|
||||||
0.62554698344706861000f,
|
0.62554698344706861000f,
|
||||||
0.92713992460312022000f,
|
0.92713992460312022000f,
|
||||||
|
0.92713992460312022000f,
|
||||||
|
0.62554698344706861000f,
|
||||||
0.20666894693494509000f,
|
0.20666894693494509000f,
|
||||||
|
-0.10021438259584969000f,
|
||||||
-0.18084907976234993000f,
|
-0.18084907976234993000f,
|
||||||
|
-0.08888051700234801700f,
|
||||||
0.03356421112732931000f,
|
0.03356421112732931000f,
|
||||||
|
0.08068909318354972000f,
|
||||||
0.04574010538564617100f,
|
0.04574010538564617100f,
|
||||||
|
-0.01106578529670297800f,
|
||||||
-0.03569929574814127000f,
|
-0.03569929574814127000f,
|
||||||
|
-0.02185973842102897900f,
|
||||||
0.00269922033961634070f,
|
0.00269922033961634070f,
|
||||||
|
0.01339722511380138700f,
|
||||||
0.00833859487742245890f,
|
0.00833859487742245890f,
|
||||||
-0.00336610762581997370f
|
-0.00023822280323501131f,
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00336610762581997370f,
|
-0.00336610762581997370f,
|
||||||
0.00833859487742245890f,
|
|
||||||
0.00269922033961634070f,
|
|
||||||
-0.03569929574814127000f,
|
|
||||||
0.04574010538564617100f,
|
|
||||||
0.03356421112732931000f,
|
|
||||||
-0.18084907976234993000f,
|
|
||||||
0.20666894693494509000f,
|
|
||||||
0.92713992460312022000f,
|
|
||||||
0.62554698344706861000f,
|
|
||||||
-0.10021438259584969000f,
|
|
||||||
-0.08888051700234801700f,
|
|
||||||
0.08068909318354972000f,
|
|
||||||
-0.01106578529670297800f,
|
|
||||||
-0.02185973842102897900f,
|
|
||||||
0.01339722511380138700f,
|
|
||||||
-0.00023822280323501131f,
|
|
||||||
-0.00176046250093099540f
|
-0.00176046250093099540f
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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.00129181992672801360f,
|
||||||
0.00561586829442904840f,
|
|
||||||
-0.01349857823816511800f,
|
|
||||||
0.02541150940858524100f,
|
|
||||||
-0.04267869501534898200f,
|
|
||||||
0.07724474282951483700f,
|
|
||||||
0.96609875058711103000f,
|
|
||||||
-0.01641812005088002400f,
|
|
||||||
-0.00427135103965109450f,
|
|
||||||
0.00726225824406205160f,
|
|
||||||
-0.00544188094946287510f,
|
|
||||||
0.00266742068076876060f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00207886551285772290f,
|
-0.00207886551285772290f,
|
||||||
0.00866090598717600930f,
|
|
||||||
-0.02161960909069559500f,
|
|
||||||
0.04383507935997314800f,
|
|
||||||
-0.08302470868585065700f,
|
|
||||||
0.18738870090358245000f,
|
|
||||||
0.93524350914423104000f,
|
|
||||||
-0.09031872116141286000f,
|
|
||||||
0.02909509423931267600f,
|
|
||||||
-0.00897188476756275060f,
|
|
||||||
0.00178311012364952820f,
|
|
||||||
0.00010586149691723067f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00287519800425638110f,
|
-0.00287519800425638110f,
|
||||||
0.01143197533872717000f,
|
|
||||||
-0.02889142869399521600f,
|
|
||||||
0.06060641890050100900f,
|
|
||||||
-0.12152802242786863000f,
|
|
||||||
0.30933747340895279000f,
|
|
||||||
0.87539536840978205000f,
|
|
||||||
-0.14271415809850990000f,
|
|
||||||
0.05516985095031713000f,
|
|
||||||
-0.02205265100214613000f,
|
|
||||||
0.00761119378345958850f,
|
|
||||||
-0.00187713739944610450f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00354120720771153910f,
|
-0.00354120720771153910f,
|
||||||
0.01351098086300389300f,
|
|
||||||
-0.03433664370844288100f,
|
|
||||||
0.07367662235517660800f,
|
|
||||||
-0.15398027155782226000f,
|
|
||||||
0.43728178746780866000f,
|
|
||||||
0.79013921003423337000f,
|
|
||||||
-0.17341770937821352000f,
|
|
||||||
0.07263788052016696700f,
|
|
||||||
-0.03120859084480779800f,
|
|
||||||
0.01170664402374247200f,
|
|
||||||
-0.00319259334815649940f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00391755659664638590f,
|
-0.00391755659664638590f,
|
||||||
0.01447751287549226700f,
|
|
||||||
-0.03701682481313090000f,
|
|
||||||
0.08107302414568577600f,
|
|
||||||
-0.17606165300033697000f,
|
|
||||||
0.56464344237183917000f,
|
|
||||||
0.68451472884717957000f,
|
|
||||||
-0.18369620562420094000f,
|
|
||||||
0.08111657494320076400f,
|
|
||||||
-0.03614676421513295800f,
|
|
||||||
0.01396276906259418800f,
|
|
||||||
-0.00384568128202934270f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00384568128202934270f,
|
-0.00384568128202934270f,
|
||||||
|
-0.00319259334815649940f,
|
||||||
|
-0.00187713739944610450f,
|
||||||
|
0.00010586149691723067f,
|
||||||
|
0.00266742068076876060f,
|
||||||
|
0.00561586829442904840f,
|
||||||
|
0.00866090598717600930f,
|
||||||
|
0.01143197533872717000f,
|
||||||
|
0.01351098086300389300f,
|
||||||
|
0.01447751287549226700f,
|
||||||
0.01396276906259418800f,
|
0.01396276906259418800f,
|
||||||
|
0.01170664402374247200f,
|
||||||
|
0.00761119378345958850f,
|
||||||
|
0.00178311012364952820f,
|
||||||
|
-0.00544188094946287510f,
|
||||||
|
-0.01349857823816511800f,
|
||||||
|
-0.02161960909069559500f,
|
||||||
|
-0.02889142869399521600f,
|
||||||
|
-0.03433664370844288100f,
|
||||||
|
-0.03701682481313090000f,
|
||||||
-0.03614676421513295800f,
|
-0.03614676421513295800f,
|
||||||
|
-0.03120859084480779800f,
|
||||||
|
-0.02205265100214613000f,
|
||||||
|
-0.00897188476756275060f,
|
||||||
|
0.00726225824406205160f,
|
||||||
|
0.02541150940858524100f,
|
||||||
|
0.04383507935997314800f,
|
||||||
|
0.06060641890050100900f,
|
||||||
|
0.07367662235517660800f,
|
||||||
|
0.08107302414568577600f,
|
||||||
0.08111657494320076400f,
|
0.08111657494320076400f,
|
||||||
|
0.07263788052016696700f,
|
||||||
|
0.05516985095031713000f,
|
||||||
|
0.02909509423931267600f,
|
||||||
|
-0.00427135103965109450f,
|
||||||
|
-0.04267869501534898200f,
|
||||||
|
-0.08302470868585065700f,
|
||||||
|
-0.12152802242786863000f,
|
||||||
|
-0.15398027155782226000f,
|
||||||
|
-0.17606165300033697000f,
|
||||||
-0.18369620562420094000f,
|
-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.68451472884717957000f,
|
||||||
0.56464344237183917000f,
|
0.56464344237183917000f,
|
||||||
-0.17606165300033697000f,
|
|
||||||
0.08107302414568577600f,
|
|
||||||
-0.03701682481313090000f,
|
|
||||||
0.01447751287549226700f,
|
|
||||||
-0.00391755659664638590f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00319259334815649940f,
|
|
||||||
0.01170664402374247200f,
|
|
||||||
-0.03120859084480779800f,
|
|
||||||
0.07263788052016696700f,
|
|
||||||
-0.17341770937821352000f,
|
|
||||||
0.79013921003423337000f,
|
|
||||||
0.43728178746780866000f,
|
0.43728178746780866000f,
|
||||||
-0.15398027155782226000f,
|
|
||||||
0.07367662235517660800f,
|
|
||||||
-0.03433664370844288100f,
|
|
||||||
0.01351098086300389300f,
|
|
||||||
-0.00354120720771153910f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-0.00187713739944610450f,
|
|
||||||
0.00761119378345958850f,
|
|
||||||
-0.02205265100214613000f,
|
|
||||||
0.05516985095031713000f,
|
|
||||||
-0.14271415809850990000f,
|
|
||||||
0.87539536840978205000f,
|
|
||||||
0.30933747340895279000f,
|
0.30933747340895279000f,
|
||||||
-0.12152802242786863000f,
|
|
||||||
0.06060641890050100900f,
|
|
||||||
-0.02889142869399521600f,
|
|
||||||
0.01143197533872717000f,
|
|
||||||
-0.00287519800425638110f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0.00010586149691723067f,
|
|
||||||
0.00178311012364952820f,
|
|
||||||
-0.00897188476756275060f,
|
|
||||||
0.02909509423931267600f,
|
|
||||||
-0.09031872116141286000f,
|
|
||||||
0.93524350914423104000f,
|
|
||||||
0.18738870090358245000f,
|
0.18738870090358245000f,
|
||||||
-0.08302470868585065700f,
|
|
||||||
0.04383507935997314800f,
|
|
||||||
-0.02161960909069559500f,
|
|
||||||
0.00866090598717600930f,
|
|
||||||
-0.00207886551285772290f
|
|
||||||
},
|
|
||||||
{
|
|
||||||
0.00266742068076876060f,
|
|
||||||
-0.00544188094946287510f,
|
|
||||||
0.00726225824406205160f,
|
|
||||||
-0.00427135103965109450f,
|
|
||||||
-0.01641812005088002400f,
|
|
||||||
0.96609875058711103000f,
|
|
||||||
0.07724474282951483700f,
|
0.07724474282951483700f,
|
||||||
|
-0.01641812005088002400f,
|
||||||
|
-0.09031872116141286000f,
|
||||||
|
-0.14271415809850990000f,
|
||||||
|
-0.17341770937821352000f,
|
||||||
|
-0.18369620562420094000f,
|
||||||
|
-0.17606165300033697000f,
|
||||||
|
-0.15398027155782226000f,
|
||||||
|
-0.12152802242786863000f,
|
||||||
|
-0.08302470868585065700f,
|
||||||
-0.04267869501534898200f,
|
-0.04267869501534898200f,
|
||||||
|
-0.00427135103965109450f,
|
||||||
|
0.02909509423931267600f,
|
||||||
|
0.05516985095031713000f,
|
||||||
|
0.07263788052016696700f,
|
||||||
|
0.08111657494320076400f,
|
||||||
|
0.08107302414568577600f,
|
||||||
|
0.07367662235517660800f,
|
||||||
|
0.06060641890050100900f,
|
||||||
|
0.04383507935997314800f,
|
||||||
0.02541150940858524100f,
|
0.02541150940858524100f,
|
||||||
|
0.00726225824406205160f,
|
||||||
|
-0.00897188476756275060f,
|
||||||
|
-0.02205265100214613000f,
|
||||||
|
-0.03120859084480779800f,
|
||||||
|
-0.03614676421513295800f,
|
||||||
|
-0.03701682481313090000f,
|
||||||
|
-0.03433664370844288100f,
|
||||||
|
-0.02889142869399521600f,
|
||||||
|
-0.02161960909069559500f,
|
||||||
-0.01349857823816511800f,
|
-0.01349857823816511800f,
|
||||||
|
-0.00544188094946287510f,
|
||||||
|
0.00178311012364952820f,
|
||||||
|
0.00761119378345958850f,
|
||||||
|
0.01170664402374247200f,
|
||||||
|
0.01396276906259418800f,
|
||||||
|
0.01447751287549226700f,
|
||||||
|
0.01351098086300389300f,
|
||||||
|
0.01143197533872717000f,
|
||||||
|
0.00866090598717600930f,
|
||||||
0.00561586829442904840f,
|
0.00561586829442904840f,
|
||||||
|
0.00266742068076876060f,
|
||||||
|
0.00010586149691723067f,
|
||||||
|
-0.00187713739944610450f,
|
||||||
|
-0.00319259334815649940f,
|
||||||
|
-0.00384568128202934270f,
|
||||||
|
-0.00391755659664638590f,
|
||||||
|
-0.00354120720771153910f,
|
||||||
|
-0.00287519800425638110f,
|
||||||
|
-0.00207886551285772290f,
|
||||||
-0.00129181992672801360f
|
-0.00129181992672801360f
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,15 +78,13 @@ fprintf(fid, '\n\n');
|
||||||
|
|
||||||
% Write filter taps
|
% Write filter taps
|
||||||
fprintf(fid, '\n// Filter for ratio 2\n');
|
fprintf(fid, '\n// Filter for ratio 2\n');
|
||||||
ExportFilterTaps(fid, 'fResTaps2up[INTERP_I_2][DECIM_D_2 * NUM_TAPS_PER_PHASE2]', h2, I2);
|
ExportFilterTaps(fid, 'fResTaps2[INTERP_I_2 * DECIM_D_2 * NUM_TAPS_PER_PHASE2]', h2);
|
||||||
ExportFilterTaps(fid, 'fResTaps2dn[DECIM_D_2][INTERP_I_2 * NUM_TAPS_PER_PHASE2]', h2, D2);
|
|
||||||
|
|
||||||
fprintf(fid, '\n// Filter for ratio 3 / 2\n');
|
fprintf(fid, '\n// Filter for ratio 3 / 2\n');
|
||||||
ExportFilterTaps(fid, 'fResTaps3_2up[INTERP_I_3_2][DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2]', h3_2, I3_2);
|
ExportFilterTaps(fid, 'fResTaps3_2[INTERP_I_3_2 * DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2]', h3_2);
|
||||||
ExportFilterTaps(fid, 'fResTaps3_2dn[DECIM_D_3_2][INTERP_I_3_2 * NUM_TAPS_PER_PHASE3_2]', h3_2, D3_2);
|
|
||||||
|
|
||||||
fprintf(fid, '// Filter for ratios close to 1\n');
|
fprintf(fid, '// Filter for ratios close to 1\n');
|
||||||
ExportFilterTaps(fid, 'fResTaps1[INTERP_DECIM_I_D1][NUM_TAPS_PER_PHASE1]', h1, I1);
|
ExportFilterTaps(fid, 'fResTaps1[INTERP_DECIM_I_D1 * NUM_TAPS_PER_PHASE1]', h1);
|
||||||
|
|
||||||
fprintf(fid, '\n#endif /* _RESAMPLEFILTER_H_ */\n');
|
fprintf(fid, '\n#endif /* _RESAMPLEFILTER_H_ */\n');
|
||||||
fclose(fid);
|
fclose(fid);
|
||||||
|
@ -108,17 +106,12 @@ h = I * firls(NoTapsP - 1, [0 fc fc 1], [1 1 0 0]) .* kaiser(NoTapsP, 5)';
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
function ExportFilterTaps(f, name, h, I)
|
function ExportFilterTaps(f, name, h)
|
||||||
|
|
||||||
% Write filter taps
|
% Write filter taps
|
||||||
fprintf(f, ['static float ' name ' = {\n']);
|
fprintf(f, ['static float ' name ' = {\n']);
|
||||||
for i = 1:I
|
fprintf(f, ' %.20ff,\n', h(1:end - 1));
|
||||||
hTemp = h(i:I:end) ;
|
fprintf(f, ' %.20ff\n', h(end));
|
||||||
fprintf(f, '{\n');
|
|
||||||
fprintf(f, ' %.20ff,\n', hTemp(1:end - 1));
|
|
||||||
fprintf(f, ' %.20ff\n', hTemp(end));
|
|
||||||
fprintf(f, '},\n');
|
|
||||||
end
|
|
||||||
fprintf(f, '};\n\n');
|
fprintf(f, '};\n\n');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue