8xscaling2

description
Author: Remco van der Most
License: BSD
Github: sss/math/8xscaling2.axo

Inlets

frac32.bipolar in1

frac32.bipolar in2

frac32.bipolar in3

frac32.bipolar in4

frac32.bipolar in5

frac32.bipolar in6

frac32.bipolar in7

frac32.bipolar in8

Outlets

frac32 out1

frac32 out2

frac32 out3

frac32 out4

frac32 out5

frac32 out6

frac32 out7

frac32 out8

Attributes

spinner Max1

spinner Min1

spinner Max2

spinner Min2

spinner Max3

spinner Min3

spinner Max4

spinner Min4

spinner Max5

spinner Min5

spinner Max6

spinner Min6

spinner Max7

spinner Min7

spinner Max8

spinner Min8

Declaration
int32_t min[8];
int32_t max[8];
float32_t width2[8];
float32_t ratio[8];
int32_t in[8];
int32_t In[8];
int i;
Init
max[0] = attr_Max1;
max[1] = attr_Max2;
max[2] = attr_Max3;
max[3] = attr_Max4;
max[4] = attr_Max5;
max[5] = attr_Max6;
max[6] = attr_Max7;
max[7] = attr_Max8;
min[0] = attr_Min1;
min[1] = attr_Min2;
min[2] = attr_Min3;
min[3] = attr_Min4;
min[4] = attr_Min5;
min[5] = attr_Min6;
min[6] = attr_Min7;
min[7] = attr_Min8;
Control Rate
In[0] = inlet_in1;
In[1] = inlet_in2;
In[2] = inlet_in3;
In[3] = inlet_in4;
In[4] = inlet_in5;
In[5] = inlet_in6;
In[6] = inlet_in7;
In[7] = inlet_in8;

for (i = 0; i < 8; i++) {
  width2[i] = (max[i] - min[i]) << 21;
  ratio[i] = (float32_t)width2[i] / (1 << 28);
  in[i] = __SSAT(In[i], 28);
}
outlet_out1 = (in[0] + (1 << 27)) * ratio[0] + (min[0] << 21);
outlet_out2 = (in[1] + (1 << 27)) * ratio[1] + (min[1] << 21);
outlet_out3 = (in[2] + (1 << 27)) * ratio[2] + (min[2] << 21);
outlet_out4 = (in[3] + (1 << 27)) * ratio[3] + (min[3] << 21);
outlet_out5 = (in[4] + (1 << 27)) * ratio[4] + (min[4] << 21);
outlet_out6 = (in[5] + (1 << 27)) * ratio[5] + (min[5] << 21);
outlet_out7 = (in[6] + (1 << 27)) * ratio[6] + (min[6] << 21);
outlet_out8 = (in[7] + (1 << 27)) * ratio[7] + (min[7] << 21);

Privacy

© 2024 Zrna Research