summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>2000-01-01 00:02:25 +0900
committerroot <root@avtech.domain.avtechpulse.com>2000-01-01 00:02:25 +0900
commitb6c31b220001f7ba515ca81f44bef3802cd46a03 (patch)
tree92c755ba7f5961a21b876bc0fbafde3f514823ff
parent0243a5fd3a1ac3a3812b56c29a9a8bf86db2d46b (diff)
remove failed 3 point interpolation scheme
-rw-r--r--device-functions.c49
1 files changed, 1 insertions, 48 deletions
diff --git a/device-functions.c b/device-functions.c
index 609208e..176ba02 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -2493,35 +2493,6 @@ static int linear_interpolation (int x1, int x2, float y1, float y2, float y_nee
}
-static int inverse_3pt_interpolation (int X1, int X2, int X3, float y1, float y2, float y3, float y_need)
-{
- // assuming y = C + B / (x - A)
- // A, B, C = constants
- // x = word
- // y = output
-
- // doesn't seem to work well - abandoned
-
- if ((y1 == y2) || (y2 == y3) || (y1 == y3) || (y_need == 0.0)) {
- return -1;
- }
-
- float x1 = (float) X1;
- float x2 = (float) X2;
- float x3 = (float) X3;
-
- float A = (x1*x2*y1 - x1*x2*y2 - x1*x3*y1 + x1*x3*y3 + x2*x3*y2 - x2*x3*y3) /
- (-x1*y2 + x1*y3 + x2*y1 - x2*y3 - x3*y1 + x3*y2);
-
- float B = (y1 - y2) / ((1 / (x1 - A)) - (1 / (x2 - A)));
-
- float C = y1 - B / (x1 - A);
-
- float solved = A + B / (y_need - C);
- return (int) solved;
-}
-
-
static int inverse_interpolation (int x1, int x2, float y1, float y2, float y_need)
{
// assuming y = B / (x - A)
@@ -2538,8 +2509,6 @@ static int inverse_interpolation (int x1, int x2, float y1, float y2, float y_ne
int solved = (int) (A + (B / y_need));
-// printf ("x1 %d, x2 %d, y1 %e, y2 %e, solved %d for %e\n",x1,x2,y1,y2,solved,y_need);
-
return (int) solved;
}
@@ -2856,11 +2825,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
// we copy these floats out into variables because anything that touches
// floats seems to generate instructions that can't work on unaligned
// data and these are unaligned.
- float pwlamp0, pwlamp1, pwlamp2;
-
-// if (index>0) {
-// memcpy(&pwlamp0, &pwl_amp[index-1], sizeof(pwlamp0));
-// }
+ float pwlamp1, pwlamp2;
memcpy(&pwlamp1, &pwl_amp[index], sizeof(pwlamp1));
memcpy(&pwlamp2, &pwl_amp[index+1], sizeof(pwlamp2));
@@ -2923,13 +2888,6 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
if (reciprocal_relationship) {
*word_out = inverse_interpolation (pwl_vc[index], pwl_vc[index+1], pwlamp1, pwlamp2, tweaked_use_ampl);
-
-// if (index>0) {
-// int test_word_out = inverse_3pt_interpolation (pwl_vc[index-1], pwl_vc[index], pwl_vc[index+1], pwlamp0, pwlamp1, pwlamp2, tweaked_use_ampl);
-// printf ("%d %d\n",*word_out,test_word_out);
-// *word_out = test_word_out;
-// }
-
} else {
*word_out = linear_interpolation (pwl_vc[index], pwl_vc[index+1], pwlamp1, pwlamp2, tweaked_use_ampl);
}
@@ -2982,11 +2940,6 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
*entry=entry_i;
*word_out = inverse_interpolation (pwl_vc[index], pwl_vc[index+1], pwl_amp[index], pwl_amp[index+1], tweaked_use_ampl);
-// if (index>0) {
-// int test_word_out = inverse_3pt_interpolation (pwl_vc[index-1], pwl_vc[index], pwl_vc[index+1], pwl_amp[index-1], pwl_amp[index], pwl_amp[index+1], tweaked_use_ampl);
-// printf ("ext %d %d\n",*word_out,test_word_out);
-// *word_out = test_word_out;
-// }
}
}
}