@@ -14,13 +14,14 @@ namespace {
14
14
class fixedpoint64
15
15
{
16
16
private:
17
- static const int fixedShift = 32 ;
18
-
19
17
int64_t val;
20
18
fixedpoint64 (int64_t _val) : val(_val) {}
21
19
static CV_ALWAYS_INLINE uint64_t fixedround (const uint64_t & _val) { return (_val + ((1LL << fixedShift) >> 1 )); }
22
20
public:
21
+ static const int fixedShift = 32 ;
22
+
23
23
typedef fixedpoint64 WT;
24
+ typedef int64_t raw_t ;
24
25
CV_ALWAYS_INLINE fixedpoint64 () { val = 0 ; }
25
26
CV_ALWAYS_INLINE fixedpoint64 (const fixedpoint64& v) { val = v.val ; }
26
27
CV_ALWAYS_INLINE fixedpoint64 (const int8_t & _val) { val = ((int64_t )_val) << fixedShift; }
@@ -97,13 +98,14 @@ class fixedpoint64
97
98
class ufixedpoint64
98
99
{
99
100
private:
100
- static const int fixedShift = 32 ;
101
-
102
101
uint64_t val;
103
102
ufixedpoint64 (uint64_t _val) : val(_val) {}
104
103
static CV_ALWAYS_INLINE uint64_t fixedround (const uint64_t & _val) { return (_val + ((1LL << fixedShift) >> 1 )); }
105
104
public:
105
+ static const int fixedShift = 32 ;
106
+
106
107
typedef ufixedpoint64 WT;
108
+ typedef uint64_t raw_t ;
107
109
CV_ALWAYS_INLINE ufixedpoint64 () { val = 0 ; }
108
110
CV_ALWAYS_INLINE ufixedpoint64 (const ufixedpoint64& v) { val = v.val ; }
109
111
CV_ALWAYS_INLINE ufixedpoint64 (const uint8_t & _val) { val = ((uint64_t )_val) << fixedShift; }
@@ -157,20 +159,24 @@ class ufixedpoint64
157
159
CV_ALWAYS_INLINE bool isZero () { return val == 0 ; }
158
160
static CV_ALWAYS_INLINE ufixedpoint64 zero () { return ufixedpoint64 (); }
159
161
static CV_ALWAYS_INLINE ufixedpoint64 one () { return ufixedpoint64 ((uint64_t )(1ULL << fixedShift)); }
162
+
163
+ static CV_ALWAYS_INLINE ufixedpoint64 fromRaw (uint64_t v) { return ufixedpoint64 (v); }
164
+ CV_ALWAYS_INLINE uint64_t raw () { return val; }
160
165
CV_ALWAYS_INLINE uint32_t cvFloor () const { return cv::saturate_cast<uint32_t >(val >> fixedShift); }
161
166
friend class ufixedpoint32 ;
162
167
};
163
168
164
169
class fixedpoint32
165
170
{
166
171
private:
167
- static const int fixedShift = 16 ;
168
-
169
172
int32_t val;
170
173
fixedpoint32 (int32_t _val) : val(_val) {}
171
174
static CV_ALWAYS_INLINE uint32_t fixedround (const uint32_t & _val) { return (_val + ((1 << fixedShift) >> 1 )); }
172
175
public:
176
+ static const int fixedShift = 16 ;
177
+
173
178
typedef fixedpoint64 WT;
179
+ typedef int32_t raw_t ;
174
180
CV_ALWAYS_INLINE fixedpoint32 () { val = 0 ; }
175
181
CV_ALWAYS_INLINE fixedpoint32 (const fixedpoint32& v) { val = v.val ; }
176
182
CV_ALWAYS_INLINE fixedpoint32 (const int8_t & _val) { val = ((int32_t )_val) << fixedShift; }
@@ -218,13 +224,14 @@ class fixedpoint32
218
224
class ufixedpoint32
219
225
{
220
226
private:
221
- static const int fixedShift = 16 ;
222
-
223
227
uint32_t val;
224
228
ufixedpoint32 (uint32_t _val) : val(_val) {}
225
229
static CV_ALWAYS_INLINE uint32_t fixedround (const uint32_t & _val) { return (_val + ((1 << fixedShift) >> 1 )); }
226
230
public:
231
+ static const int fixedShift = 16 ;
232
+
227
233
typedef ufixedpoint64 WT;
234
+ typedef uint32_t raw_t ;
228
235
CV_ALWAYS_INLINE ufixedpoint32 () { val = 0 ; }
229
236
CV_ALWAYS_INLINE ufixedpoint32 (const ufixedpoint32& v) { val = v.val ; }
230
237
CV_ALWAYS_INLINE ufixedpoint32 (const uint8_t & _val) { val = ((uint32_t )_val) << fixedShift; }
@@ -262,19 +269,23 @@ class ufixedpoint32
262
269
CV_ALWAYS_INLINE bool isZero () { return val == 0 ; }
263
270
static CV_ALWAYS_INLINE ufixedpoint32 zero () { return ufixedpoint32 (); }
264
271
static CV_ALWAYS_INLINE ufixedpoint32 one () { return ufixedpoint32 ((1U << fixedShift)); }
272
+
273
+ static CV_ALWAYS_INLINE ufixedpoint32 fromRaw (uint32_t v) { return ufixedpoint32 (v); }
274
+ CV_ALWAYS_INLINE uint32_t raw () { return val; }
265
275
friend class ufixedpoint16 ;
266
276
};
267
277
268
278
class fixedpoint16
269
279
{
270
280
private:
271
- static const int fixedShift = 8 ;
272
-
273
281
int16_t val;
274
282
fixedpoint16 (int16_t _val) : val(_val) {}
275
283
static CV_ALWAYS_INLINE uint16_t fixedround (const uint16_t & _val) { return (_val + ((1 << fixedShift) >> 1 )); }
276
284
public:
285
+ static const int fixedShift = 8 ;
286
+
277
287
typedef fixedpoint32 WT;
288
+ typedef int16_t raw_t ;
278
289
CV_ALWAYS_INLINE fixedpoint16 () { val = 0 ; }
279
290
CV_ALWAYS_INLINE fixedpoint16 (const fixedpoint16& v) { val = v.val ; }
280
291
CV_ALWAYS_INLINE fixedpoint16 (const int8_t & _val) { val = ((int16_t )_val) << fixedShift; }
@@ -315,13 +326,14 @@ class fixedpoint16
315
326
class ufixedpoint16
316
327
{
317
328
private:
318
- static const int fixedShift = 8 ;
319
-
320
329
uint16_t val;
321
330
ufixedpoint16 (uint16_t _val) : val(_val) {}
322
331
static CV_ALWAYS_INLINE uint16_t fixedround (const uint16_t & _val) { return (_val + ((1 << fixedShift) >> 1 )); }
323
332
public:
333
+ static const int fixedShift = 8 ;
334
+
324
335
typedef ufixedpoint32 WT;
336
+ typedef uint16_t raw_t ;
325
337
CV_ALWAYS_INLINE ufixedpoint16 () { val = 0 ; }
326
338
CV_ALWAYS_INLINE ufixedpoint16 (const ufixedpoint16& v) { val = v.val ; }
327
339
CV_ALWAYS_INLINE ufixedpoint16 (const uint8_t & _val) { val = ((uint16_t )_val) << fixedShift; }
@@ -358,7 +370,7 @@ class ufixedpoint16
358
370
static CV_ALWAYS_INLINE ufixedpoint16 one () { return ufixedpoint16 ((uint16_t )(1 << fixedShift)); }
359
371
360
372
static CV_ALWAYS_INLINE ufixedpoint16 fromRaw (uint16_t v) { return ufixedpoint16 (v); }
361
- CV_ALWAYS_INLINE ufixedpoint16 raw () { return val; }
373
+ CV_ALWAYS_INLINE uint16_t raw () { return val; }
362
374
};
363
375
364
376
}
0 commit comments