@@ -76,6 +76,8 @@ class fixedpoint64
76
76
// int64_t nval = (int64_t)val + val2.val + nfrac >> 32;
77
77
// return nval > MAXINT32 ? beConv(MAXINT32, MAXINT32) : beConv((int32_t)(nval), 0);
78
78
// }
79
+ CV_ALWAYS_INLINE fixedpoint64 operator >> (int n) const { return fixedpoint64 (val >> n); }
80
+ CV_ALWAYS_INLINE fixedpoint64 operator << (int n) const { return fixedpoint64 (val << n); }
79
81
template <typename ET>
80
82
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>((int64_t )fixedround ((uint64_t )val) >> fixedShift); }
81
83
CV_ALWAYS_INLINE operator double () const { return (double )val / (1LL << fixedShift); }
@@ -129,6 +131,8 @@ class ufixedpoint64
129
131
// int64_t nval = (int64_t)val + val2.val + nfrac >> 32;
130
132
// return nval > MAXINT32 ? beConv(MAXINT32, MAXINT32) : beConv((int32_t)(nval), 0);
131
133
// }
134
+ CV_ALWAYS_INLINE ufixedpoint64 operator >> (int n) const { return ufixedpoint64 (val >> n); }
135
+ CV_ALWAYS_INLINE ufixedpoint64 operator << (int n) const { return ufixedpoint64 (val << n); }
132
136
template <typename ET>
133
137
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>(fixedround (val) >> fixedShift); }
134
138
CV_ALWAYS_INLINE operator double () const { return (double )val / (1LL << fixedShift); }
@@ -170,6 +174,8 @@ class fixedpoint32
170
174
// int32_t nval = (int32_t)val + val2.val + nfrac >> 32;
171
175
// return nval > MAXINT32 ? beConv(MAXINT32, MAXINT32) : beConv((int32_t)(nval), 0);
172
176
// }
177
+ CV_ALWAYS_INLINE fixedpoint32 operator >> (int n) const { return fixedpoint32 (val >> n); }
178
+ CV_ALWAYS_INLINE fixedpoint32 operator << (int n) const { return fixedpoint32 (val << n); }
173
179
template <typename ET>
174
180
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>((int32_t )fixedround ((uint32_t )val) >> fixedShift); }
175
181
CV_ALWAYS_INLINE operator double () const { return (double )val / (1 << fixedShift); }
@@ -209,6 +215,8 @@ class ufixedpoint32
209
215
// int32_t nval = (int32_t)val + val2.val + nfrac >> 32;
210
216
// return nval > MAXINT32 ? beConv(MAXINT32, MAXINT32) : beConv((int32_t)(nval), 0);
211
217
// }
218
+ CV_ALWAYS_INLINE ufixedpoint32 operator >> (int n) const { return ufixedpoint32 (val >> n); }
219
+ CV_ALWAYS_INLINE ufixedpoint32 operator << (int n) const { return ufixedpoint32 (val << n); }
212
220
template <typename ET>
213
221
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>(fixedround (val) >> fixedShift); }
214
222
CV_ALWAYS_INLINE operator double () const { return (double )val / (1 << fixedShift); }
@@ -241,6 +249,8 @@ class fixedpoint16
241
249
CV_ALWAYS_INLINE fixedpoint32 operator * (const fixedpoint16& val2) const { return (int32_t )val * (int32_t )(val2.val ); }
242
250
CV_ALWAYS_INLINE fixedpoint16 operator + (const fixedpoint16& val2) const { return fixedpoint16 ((int16_t )(val + val2.val )); }
243
251
CV_ALWAYS_INLINE fixedpoint16 operator - (const fixedpoint16& val2) const { return fixedpoint16 ((int16_t )(val - val2.val )); }
252
+ CV_ALWAYS_INLINE fixedpoint16 operator >> (int n) const { return fixedpoint16 ((int16_t )(val >> n)); }
253
+ CV_ALWAYS_INLINE fixedpoint16 operator << (int n) const { return fixedpoint16 ((int16_t )(val << n)); }
244
254
template <typename ET>
245
255
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>((int16_t )fixedround ((uint16_t )val) >> fixedShift); }
246
256
CV_ALWAYS_INLINE operator double () const { return (double )val / (1 << fixedShift); }
@@ -271,12 +281,8 @@ class ufixedpoint16
271
281
CV_ALWAYS_INLINE ufixedpoint32 operator * (const ufixedpoint16& val2) const { return ((uint32_t )val * (uint32_t )(val2.val )); }
272
282
CV_ALWAYS_INLINE ufixedpoint16 operator + (const ufixedpoint16& val2) const { return ufixedpoint16 ((uint16_t )(val + val2.val )); }
273
283
CV_ALWAYS_INLINE ufixedpoint16 operator - (const ufixedpoint16& val2) const { return ufixedpoint16 ((uint16_t )(val - val2.val )); }
274
- // CV_ALWAYS_INLINE fixedpoint16 operator + (const fixedpoint16& val2) const
275
- // {
276
- // int16_t nfrac = (int32_t)frac + val2.frac;
277
- // int16_t nval = (int32_t)val + val2.val + nfrac >> 16;
278
- // return nval > MAXINT32 ? beConv(MAXINT16, MAXINT16) : beConv((int16_t)(nval), 0);
279
- // }
284
+ CV_ALWAYS_INLINE ufixedpoint16 operator >> (int n) const { return ufixedpoint16 ((uint16_t )(val >> n)); }
285
+ CV_ALWAYS_INLINE ufixedpoint16 operator << (int n) const { return ufixedpoint16 ((uint16_t )(val << n)); }
280
286
template <typename ET>
281
287
CV_ALWAYS_INLINE operator ET () const { return cv::saturate_cast<ET>(fixedround (val) >> fixedShift); }
282
288
CV_ALWAYS_INLINE operator double () const { return (double )val / (1 << fixedShift); }
0 commit comments