##// END OF EJS Templates
3.2.0.11...
paul -
r361:3e73a8516099 R3++ draft
parent child
Show More
@@ -66,29 +66,33 typedef struct{
66 66 unsigned char dpu_spw_rx_too_big;
67 67 } hk_lfr_me_t;
68 68
69 #define B00 23
70 #define B01 23
69 #define B00 65
70 #define B01 65
71 71 #define B02 0
72 #define B10 1024
73 #define B11 -1771
74 #define B12 1024
75 #define B20 1024
76 #define B21 -1937
77 #define B22 1024
72 #define B10 2048
73 #define B11 -3817
74 #define B12 2048
75 #define B20 2048
76 #define B21 -3987
77 #define B22 2048
78 78
79 79 #define A00 1
80 #define A01 -28324
80 #define A01 -1850
81 81 #define A02 0
82 82 #define A10 1
83 #define A11 -1828
84 #define A12 822
83 #define A11 -3787
84 #define A12 1758
85 85 #define A20 1
86 #define A21 -1956
87 #define A22 950
86 #define A21 -3974
87 #define A22 1943
88 88
89 #define G0 15
90 #define G1 10
91 #define G2 10
89 #define GAIN_B0 17
90 #define GAIN_B1 11
91 #define GAIN_B2 11
92
93 #define GAIN_A0 11
94 #define GAIN_A1 11
95 #define GAIN_A2 11
92 96
93 97 #define NB_COEFFS 3
94 98 #define COEFF0 0
@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF)
64 64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "10" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "11" CACHE STRING "Choose N4 FSW Version." FORCE)
68 68
69 69 if(FSW_verbose)
70 70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
@@ -351,9 +351,10 int filter( int x, filter_ctx* ctx )
351 351 {
352 352 static const int b[NB_COEFFS][NB_COEFFS]={ {B00, B01, B02}, {B10, B11, B12}, {B20, B21, B22} };
353 353 static const int a[NB_COEFFS][NB_COEFFS]={ {A00, A01, A02}, {A10, A11, A12}, {A20, A21, A22} };
354 static const int g_pow2[NB_COEFFS]={G0, G1, G2};
354 static const int b_gain[NB_COEFFS]={GAIN_B0, GAIN_B1, GAIN_B2};
355 static const int a_gain[NB_COEFFS]={GAIN_A0, GAIN_A1, GAIN_A2};
355 356
356 int W;
357 int_fast32_t W;
357 358 int i;
358 359
359 360 W = INIT_INT;
@@ -362,15 +363,15 int filter( int x, filter_ctx* ctx )
362 363 //Direct-Form-II
363 364 for ( i = 0; i < NB_COEFFS; i++ )
364 365 {
365 x = x << g_pow2[ i ];
366 x = x << a_gain[i];
366 367 W = ( x - ( a[i][COEFF1] * ctx->W[i][COEFF0] )
367 - ( a[i][COEFF2] * ctx->W[i][COEFF1] ) ) >> g_pow2[ i ];
368 - ( a[i][COEFF2] * ctx->W[i][COEFF1] ) ) >> a_gain[i];
368 369 x = ( b[i][COEFF0] * W )
369 370 + ( b[i][COEFF1] * ctx->W[i][COEFF0] )
370 371 + ( b[i][COEFF2] * ctx->W[i][COEFF1] );
371 x =- ( x >> g_pow2[i] );
372 ctx->W[i][COEFF1] = ctx->W[i][COEFF0];
373 ctx->W[i][COEFF0] = W;
372 x = x >> b_gain[i];
373 ctx->W[i][1] = ctx->W[i][0];
374 ctx->W[i][0] = W;
374 375 }
375 376 return x;
376 377 }
General Comments 0
You need to be logged in to leave comments. Login now