| 53 | }; |
| 54 | |
| 55 | void Trim2FP_Offline(float *data, const int bw, float threshold) |
| 56 | { |
| 57 | //# Compute scale factor |
| 58 | float scaling_factor = threshold / (pow(2, bw-1) - 1); |
| 59 | |
| 60 | //# Clip the data b/w (-threshold, threshold) |
| 61 | data[0] = std::max(std::min(data[0], threshold), -threshold); |
| 62 | |
| 63 | if(threshold != 0) |
| 64 | { |
| 65 | data[0] /= scaling_factor; |
| 66 | data[0] = round(data[0]); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | void Trim2FixedPoint(float &data, const int bw, const int fl, int round_floor_flag) |
| 71 | { |
no test coverage detected