This source file includes following definitions.
- dml_min
- dml_min3
- dml_min4
- dml_max
- dml_max3
- dml_max4
- dml_max5
- dml_ceil
- dml_floor
- dml_log2
- dml_pow
- dml_fmod
- dml_ceil_2
- dml_ceil_ex
- dml_floor_ex
- dml_log
- dml_round_to_multiple
- dml_abs
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 #ifndef __DML_INLINE_DEFS_H__
27 #define __DML_INLINE_DEFS_H__
28
29 #include "dml_common_defs.h"
30 #include "dcn_calc_math.h"
31 #include "dml_logger.h"
32
33 static inline double dml_min(double a, double b)
34 {
35 return (double) dcn_bw_min2(a, b);
36 }
37
38 static inline double dml_min3(double a, double b, double c)
39 {
40 return dml_min(dml_min(a, b), c);
41 }
42
43 static inline double dml_min4(double a, double b, double c, double d)
44 {
45 return dml_min(dml_min(a, b), dml_min(c, d));
46 }
47
48 static inline double dml_max(double a, double b)
49 {
50 return (double) dcn_bw_max2(a, b);
51 }
52
53 static inline double dml_max3(double a, double b, double c)
54 {
55 return dml_max(dml_max(a, b), c);
56 }
57
58 static inline double dml_max4(double a, double b, double c, double d)
59 {
60 return dml_max(dml_max(a, b), dml_max(c, d));
61 }
62
63 static inline double dml_max5(double a, double b, double c, double d, double e)
64 {
65 return dml_max(dml_max4(a, b, c, d), e);
66 }
67
68 static inline double dml_ceil(double a, double granularity)
69 {
70 return (double) dcn_bw_ceil2(a, granularity);
71 }
72
73 static inline double dml_floor(double a, double granularity)
74 {
75 return (double) dcn_bw_floor2(a, granularity);
76 }
77
78 static inline int dml_log2(double x)
79 {
80 return dml_round((double)dcn_bw_log(x, 2));
81 }
82
83 static inline double dml_pow(double a, int exp)
84 {
85 return (double) dcn_bw_pow(a, exp);
86 }
87
88 static inline double dml_fmod(double f, int val)
89 {
90 return (double) dcn_bw_mod(f, val);
91 }
92
93 static inline double dml_ceil_2(double f)
94 {
95 return (double) dcn_bw_ceil2(f, 2);
96 }
97
98 static inline double dml_ceil_ex(double x, double granularity)
99 {
100 return (double) dcn_bw_ceil2(x, granularity);
101 }
102
103 static inline double dml_floor_ex(double x, double granularity)
104 {
105 return (double) dcn_bw_floor2(x, granularity);
106 }
107
108 static inline double dml_log(double x, double base)
109 {
110 return (double) dcn_bw_log(x, base);
111 }
112
113 static inline unsigned int dml_round_to_multiple(unsigned int num,
114 unsigned int multiple,
115 bool up)
116 {
117 unsigned int remainder;
118
119 if (multiple == 0)
120 return num;
121
122 remainder = num % multiple;
123
124 if (remainder == 0)
125 return num;
126
127 if (up)
128 return (num + multiple - remainder);
129 else
130 return (num - remainder);
131 }
132 static inline double dml_abs(double a)
133 {
134 if (a > 0)
135 return a;
136 else
137 return (a*(-1));
138 }
139
140 #endif