added resample filter taps for ratio 3/4
This commit is contained in:
parent
181a8142a8
commit
1459271f3d
3 changed files with 54 additions and 8 deletions
|
@ -154,7 +154,7 @@ void CStereoAudioResample::Init ( const int iNewMonoInputBlockSize,
|
|||
iMonoOutputBlockSize = (int) ( iNewMonoInputBlockSize * dRation );
|
||||
|
||||
// set correct parameters
|
||||
if ( iFrom == SND_CRD_SAMPLE_RATE ) // downsampling case
|
||||
if ( iFrom >= iTo ) // downsampling case
|
||||
{
|
||||
switch ( iTo )
|
||||
{
|
||||
|
|
|
@ -6,11 +6,14 @@
|
|||
#define _RESAMPLEFILTER_H_
|
||||
|
||||
#define NUM_TAPS_PER_PHASE2 4
|
||||
#define NUM_TAPS_PER_PHASE4_3 4
|
||||
#define NUM_TAPS_PER_PHASE3_2 4
|
||||
#define NUM_TAPS_PER_PHASE12_7 4
|
||||
#define NUM_TAPS_PER_PHASE1 4
|
||||
#define INTERP_I_2 2
|
||||
#define DECIM_D_2 1
|
||||
#define INTERP_I_4_3 4
|
||||
#define DECIM_D_4_3 3
|
||||
#define INTERP_I_3_2 3
|
||||
#define DECIM_D_3_2 2
|
||||
#define INTERP_I_12_7 12
|
||||
|
@ -32,6 +35,27 @@ static float fResTaps2[INTERP_I_2 * DECIM_D_2 * NUM_TAPS_PER_PHASE2] = {
|
|||
};
|
||||
|
||||
|
||||
// Filter for ratio 4 / 3
|
||||
static float fResTaps4_3[INTERP_I_4_3 * DECIM_D_4_3 * NUM_TAPS_PER_PHASE4_3] = {
|
||||
-0.00168001826454421440f,
|
||||
-0.01144215502840437900f,
|
||||
-0.02497303843128512500f,
|
||||
-0.01659712409419326200f,
|
||||
0.04986971950193624900f,
|
||||
0.18653698120980966000f,
|
||||
0.35284376758014113000f,
|
||||
0.46867597265041389000f,
|
||||
0.46867597265041389000f,
|
||||
0.35284376758014113000f,
|
||||
0.18653698120980966000f,
|
||||
0.04986971950193624900f,
|
||||
-0.01659712409419326200f,
|
||||
-0.02497303843128512500f,
|
||||
-0.01144215502840437900f,
|
||||
-0.00168001826454421440f
|
||||
};
|
||||
|
||||
|
||||
// Filter for ratio 3 / 2
|
||||
static float fResTaps3_2[INTERP_I_3_2 * DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2] = {
|
||||
-0.00236050848304511720f,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
%/******************************************************************************\
|
||||
% * Copyright (c) 2004-2009
|
||||
% *
|
||||
% * Author(s):
|
||||
% * Volker Fischer
|
||||
% *
|
||||
%\******************************************************************************/
|
||||
% /****************************************************************************\
|
||||
% * Copyright (c) 2004-2009
|
||||
% *
|
||||
% * Author(s):
|
||||
% * Volker Fischer
|
||||
% *
|
||||
% \****************************************************************************/
|
||||
|
||||
function resamplefilter()
|
||||
|
||||
|
@ -12,6 +12,7 @@ function resamplefilter()
|
|||
GlobalNoTaps = 4; % use global value for all types
|
||||
|
||||
NoTapsP2 = GlobalNoTaps; % 24 kHz
|
||||
NoTapsP4_3 = GlobalNoTaps; % 32 kHz <-> 24 kHz
|
||||
NoTapsP3_2 = GlobalNoTaps; % 32 kHz
|
||||
NoTapsP12_7 = GlobalNoTaps; % 28 kHz
|
||||
NoTapsP1 = GlobalNoTaps; % 48 kHz
|
||||
|
@ -26,6 +27,15 @@ D2 = 1;
|
|||
h2 = DesignFilter(NoTapsP2, I2);
|
||||
|
||||
|
||||
% Filter for ratio 4 / 3 -------------------------------------------------------
|
||||
% I and D
|
||||
I4_3 = 4;
|
||||
D4_3 = 3;
|
||||
|
||||
% filter design
|
||||
h4_3 = DesignFilter(NoTapsP4_3, I4_3);
|
||||
|
||||
|
||||
% Filter for ratio 3 / 2 -------------------------------------------------------
|
||||
% I and D
|
||||
I3_2 = 3;
|
||||
|
@ -65,6 +75,9 @@ fprintf(fid, '#define _RESAMPLEFILTER_H_\n\n');
|
|||
fprintf(fid, '#define NUM_TAPS_PER_PHASE2 ');
|
||||
fprintf(fid, int2str(NoTapsP2));
|
||||
fprintf(fid, '\n');
|
||||
fprintf(fid, '#define NUM_TAPS_PER_PHASE4_3 ');
|
||||
fprintf(fid, int2str(NoTapsP4_3));
|
||||
fprintf(fid, '\n');
|
||||
fprintf(fid, '#define NUM_TAPS_PER_PHASE3_2 ');
|
||||
fprintf(fid, int2str(NoTapsP3_2));
|
||||
fprintf(fid, '\n');
|
||||
|
@ -80,6 +93,12 @@ fprintf(fid, '\n');
|
|||
fprintf(fid, '#define DECIM_D_2 ');
|
||||
fprintf(fid, int2str(D2));
|
||||
fprintf(fid, '\n');
|
||||
fprintf(fid, '#define INTERP_I_4_3 ');
|
||||
fprintf(fid, int2str(I4_3));
|
||||
fprintf(fid, '\n');
|
||||
fprintf(fid, '#define DECIM_D_4_3 ');
|
||||
fprintf(fid, int2str(D4_3));
|
||||
fprintf(fid, '\n');
|
||||
fprintf(fid, '#define INTERP_I_3_2 ');
|
||||
fprintf(fid, int2str(I3_2));
|
||||
fprintf(fid, '\n');
|
||||
|
@ -101,6 +120,9 @@ fprintf(fid, '\n\n');
|
|||
fprintf(fid, '\n// Filter for ratio 2\n');
|
||||
ExportFilterTaps(fid, 'fResTaps2[INTERP_I_2 * DECIM_D_2 * NUM_TAPS_PER_PHASE2]', h2);
|
||||
|
||||
fprintf(fid, '\n// Filter for ratio 4 / 3\n');
|
||||
ExportFilterTaps(fid, 'fResTaps4_3[INTERP_I_4_3 * DECIM_D_4_3 * NUM_TAPS_PER_PHASE4_3]', h4_3);
|
||||
|
||||
fprintf(fid, '\n// Filter for ratio 3 / 2\n');
|
||||
ExportFilterTaps(fid, 'fResTaps3_2[INTERP_I_3_2 * DECIM_D_3_2 * NUM_TAPS_PER_PHASE3_2]', h3_2);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue