-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
41 lines (30 loc) · 1.23 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef _UTILS_H_
#define _UTILS_H_
#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
// FILE* log_fd;
// int log_count = 0;
#define cerr(x) cerr << x << endl;
#define cerrv(x) cerr << #x << " : " << x << endl;
// #define logg(x) fprintf(d, "%i >>>",log_count);fprintf(log_fd, x);fprintf(log_fd, "\n");
// #define loggv(x) fprintf(log_fd, "%i >>>",log_count);fprintf(log_fd, #x);fprintf(log_fd, " : %2.2f\n", (float) x);
// refresh max and min value throwing samples at it
#define CHANGE_MIN_MAX( sample, min, max) \
{ \
float abs_sample = fabs(sample); \
if(abs_sample > (max)) \
{ \
(max) = abs_sample; \
} \
else if(abs_sample < (min)) \
{ \
(min) = abs_sample; \
} \
}
void KILL_DENORMAL_BY_QUANTIZATION (float &val);
void rotateVector(float& x, float& y, float rad);
void normalizeVector(float& x, float& y);
void HSLtoRGB(float h, float s, float l, unsigned char &r, unsigned char &g, unsigned char &b);
#endif