GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / host / isp_op1w.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #ifndef __ISP_OP1W_H_INCLUDED__
16 #define __ISP_OP1W_H_INCLUDED__
17
18 /*
19  * This file is part of the Multi-precision vector operations exstension package.
20  */
21
22 /*
23  * Single-precision vector operations
24  */
25
26 /*
27  * Prerequisites:
28  *
29  */
30 #include "storage_class.h"
31
32 #ifdef INLINE_ISP_OP1W
33 #define STORAGE_CLASS_ISP_OP1W_FUNC_H STORAGE_CLASS_INLINE
34 #define STORAGE_CLASS_ISP_OP1W_DATA_H STORAGE_CLASS_INLINE_DATA
35 #else /* INLINE_ISP_OP1W */
36 #define STORAGE_CLASS_ISP_OP1W_FUNC_H STORAGE_CLASS_EXTERN
37 #define STORAGE_CLASS_ISP_OP1W_DATA_H STORAGE_CLASS_EXTERN_DATA
38 #endif  /* INLINE_ISP_OP1W */
39
40 /*
41  * Single-precision data type specification
42  */
43
44 #include "isp_op1w_types.h"
45 #include "isp_op2w_types.h" // for doubling operations.
46
47 /*
48  * Single-precision prototype specification
49  */
50
51 /* Arithmetic */
52
53 /** @brief bitwise AND
54  *
55  * @param[in] _a        first argument
56  * @param[in] _b        second argument
57  *
58  * @return              bitwise and of both input arguments
59  *
60  * This function will calculate the bitwise and.
61  * result = _a & _b
62  */
63 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_and(
64     const tvector1w     _a,
65     const tvector1w     _b);
66
67 /** @brief bitwise OR
68  *
69  * @param[in] _a        first argument
70  * @param[in] _b        second argument
71  *
72  * @return              bitwise or of both input arguments
73  *
74  * This function will calculate the bitwise or.
75  * result = _a | _b
76  */
77 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_or(
78     const tvector1w     _a,
79     const tvector1w     _b);
80
81 /** @brief bitwise XOR
82  *
83  * @param[in] _a        first argument
84  * @param[in] _b        second argument
85  *
86  * @return              bitwise xor of both input arguments
87  *
88  * This function will calculate the bitwise xor.
89  * result = _a ^ _b
90  */
91 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_xor(
92     const tvector1w     _a,
93     const tvector1w     _b);
94
95 /** @brief bitwise inverse
96  *
97  * @param[in] _a        first argument
98  *
99  * @return              bitwise inverse of both input arguments
100  *
101  * This function will calculate the bitwise inverse.
102  * result = ~_a
103  */
104 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_inv(
105     const tvector1w     _a);
106
107 /* Additive */
108
109 /** @brief addition
110  *
111  * @param[in] _a        first argument
112  * @param[in] _b        second argument
113  *
114  * @return              sum of both input arguments
115  *
116  * This function will calculate the sum of the input arguments.
117  * in case of overflow it will wrap around.
118  * result = _a + _b
119  */
120 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_add(
121     const tvector1w     _a,
122     const tvector1w     _b);
123
124 /** @brief subtraction
125  *
126  * @param[in] _a        first argument
127  * @param[in] _b        second argument
128  *
129  * @return              _b subtracted from _a.
130  *
131  * This function will subtract _b from _a.
132  * in case of overflow it will wrap around.
133  * result = _a - _b
134  */
135 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_sub(
136     const tvector1w     _a,
137     const tvector1w     _b);
138
139 /** @brief saturated addition
140  *
141  * @param[in] _a        first argument
142  * @param[in] _b        second argument
143  *
144  * @return              saturated sum of both input arguments
145  *
146  * This function will calculate the sum of the input arguments.
147  * in case of overflow it will saturate.
148  * result = CLIP(_a + _b, MIN_RANGE, MAX_RANGE);
149  */
150 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_addsat(
151     const tvector1w     _a,
152     const tvector1w     _b);
153
154 /** @brief saturated subtraction
155  *
156  * @param[in] _a        first argument
157  * @param[in] _b        second argument
158  *
159  * @return              saturated subtraction of both input arguments
160  *
161  * This function will subtract _b from _a.
162  * in case of overflow it will saturate.
163  * result = CLIP(_a - _b, MIN_RANGE, MAX_RANGE);
164  */
165 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subsat(
166     const tvector1w     _a,
167     const tvector1w     _b);
168
169 #ifdef ISP2401
170 /** @brief Unsigned saturated subtraction
171  *
172  * @param[in] _a        first argument
173  * @param[in] _b        second argument
174  *
175  * @return              saturated subtraction of both input arguments
176  *
177  * This function will subtract _b from _a.
178  * in case of overflow it will saturate.
179  * result = CLIP(_a - _b, 0, MAX_RANGE);
180  */
181 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w_unsigned OP_1w_subsat_u(
182     const tvector1w_unsigned _a,
183     const tvector1w_unsigned _b);
184
185 #endif
186 /** @brief subtraction with shift right and rounding
187  *
188  * @param[in] _a        first argument
189  * @param[in] _b        second argument
190  *
191  * @return              (a - b) >> 1
192  *
193  * This function subtracts _b from _a and right shifts
194  * the result by 1 bit with rounding.
195  * No overflow can occur.
196  * result = (_a - _b) >> 1
197  *
198  * Note: This function will be deprecated due to
199  * the naming confusion and it will be replaced
200  * by "OP_1w_subhalfrnd".
201  */
202 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subasr1(
203     const tvector1w     _a,
204     const tvector1w     _b);
205
206 /** @brief Subtraction with shift right and rounding
207  *
208  * @param[in] _a        first operand
209  * @param[in] _b        second operand
210  *
211  * @return              (_a - _b) >> 1
212  *
213  * This function subtracts _b from _a and right shifts
214  * the result by 1 bit with rounding.
215  * No overflow can occur.
216  */
217 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subhalfrnd(
218     const tvector1w     _a,
219     const tvector1w     _b);
220
221 /** @brief Subtraction with shift right and no rounding
222  *
223  * @param[in] _a        first operand
224  * @param[in] _b        second operand
225  *
226  * @return              (_a - _b) >> 1
227  *
228  * This function subtracts _b from _a and right shifts
229  * the result by 1 bit without rounding (i.e. truncation).
230  * No overflow can occur.
231  */
232 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subhalf(
233     const tvector1w     _a,
234     const tvector1w     _b);
235
236
237 /** @brief saturated absolute value
238  *
239  * @param[in] _a        input
240  *
241  * @return              saturated absolute value of the input
242  *
243  * This function will calculate the saturated absolute value of the input.
244  * in case of overflow it will saturate.
245  * if (_a > 0) return _a;<br>
246  * else return CLIP(-_a, MIN_RANGE, MAX_RANGE);<br>
247  */
248 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_abs(
249     const tvector1w     _a);
250
251 /** @brief saturated absolute difference
252  *
253  * @param[in] _a        first argument
254  * @param[in] _b        second argument
255  *
256  * @return              sat(abs(a-b));
257  *
258  * This function will calculate the saturated absolute value
259  * of the saturated difference of both inputs.
260  * result = sat(abs(sat(_a - _b)));
261  */
262 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_subabssat(
263     const tvector1w     _a,
264     const tvector1w     _b);
265
266 /* Multiplicative */
267
268 /** @brief doubling multiply
269  *
270  * @param[in] _a        first argument
271  * @param[in] _b        second argument
272  *
273  * @return              product of _a and _b
274  *
275  * This function will calculate the product
276  * of the input arguments and returns a double
277  * precision result.
278  * No overflow can occur.
279  * result = _a * _b;
280  */
281 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector2w OP_1w_muld(
282     const tvector1w     _a,
283     const tvector1w     _b);
284
285 /** @brief integer multiply
286  *
287  * @param[in] _a        first argument
288  * @param[in] _b        second argument
289  *
290  * @return              product of _a and _b
291  *
292  * This function will calculate the product
293  * of the input arguments and returns the LSB
294  * aligned single precision result.
295  * In case of overflow it will wrap around.
296  * result = _a * _b;
297  */
298 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mul(
299     const tvector1w     _a,
300     const tvector1w     _b);
301
302 /** @brief fractional saturating multiply
303  *
304  * @param[in] _a        first argument
305  * @param[in] _b        second argument
306  *
307  * @return              saturated product of _a and _b
308  *
309  * This function will calculate the fixed point
310  * product of the input arguments
311  * and returns a single precision result.
312  * In case of overflow it will saturate.
313  * FP_UNITY * FP_UNITY => FP_UNITY.
314  * result = CLIP(_a * _b >> (NUM_BITS-1), MIN_RANGE, MAX_RANGE);
315  */
316 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qmul(
317     const tvector1w     _a,
318     const tvector1w     _b);
319
320 /** @brief fractional saturating multiply with rounding
321  *
322  * @param[in] _a        first argument
323  * @param[in] _b        second argument
324  *
325  * @return              product of _a and _b
326  *
327  * This function will calculate the fixed point
328  * product of the input arguments
329  * and returns a single precision result.
330  * FP_UNITY * FP_UNITY => FP_UNITY.
331  * Depending on the rounding mode of the core
332  * it will round to nearest or to nearest even.
333  * result = CLIP(_a * _b >> (NUM_BITS-1), MIN_RANGE, MAX_RANGE);
334  */
335 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qrmul(
336     const tvector1w     _a,
337     const tvector1w     _b);
338
339 /* Comparative */
340
341 /** @brief equal
342  *
343  * @param[in] _a        first argument
344  * @param[in] _b        second argument
345  *
346  * @return              _a == _b
347  *
348  * This function will return true if both inputs
349  * are equal, and false if not equal.
350  */
351 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_eq(
352     const tvector1w     _a,
353     const tvector1w     _b);
354
355 /** @brief not equal
356  *
357  * @param[in] _a        first argument
358  * @param[in] _b        second argument
359  *
360  * @return              _a != _b
361  *
362  * This function will return false if both inputs
363  * are equal, and true if not equal.
364  */
365 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_ne(
366     const tvector1w     _a,
367     const tvector1w     _b);
368
369 /** @brief less or equal
370  *
371  * @param[in] _a        first argument
372  * @param[in] _b        second argument
373  *
374  * @return              _a <= _b
375  *
376  * This function will return true if _a is smaller
377  * or equal than _b.
378  */
379 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_le(
380     const tvector1w     _a,
381     const tvector1w     _b);
382
383 /** @brief less then
384  *
385  * @param[in] _a        first argument
386  * @param[in] _b        second argument
387  *
388  * @return              _a < _b
389  *
390  * This function will return true if _a is smaller
391  * than _b.
392  */
393 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_lt(
394     const tvector1w     _a,
395     const tvector1w     _b);
396
397 /** @brief greater or equal
398  *
399  * @param[in] _a        first argument
400  * @param[in] _b        second argument
401  *
402  * @return              _a >= _b
403  *
404  * This function will return true if _a is greater
405  * or equal than _b.
406  */
407 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_ge(
408     const tvector1w     _a,
409     const tvector1w     _b);
410
411 /** @brief greater than
412  *
413  * @param[in] _a        first argument
414  * @param[in] _b        second argument
415  *
416  * @return              _a > _b
417  *
418  * This function will return true if _a is greater
419  * than _b.
420  */
421 STORAGE_CLASS_ISP_OP1W_FUNC_H tflags OP_1w_gt(
422     const tvector1w     _a,
423     const tvector1w     _b);
424
425 /* Shift */
426
427 /** @brief aritmetic shift right
428  *
429  * @param[in] _a        input
430  * @param[in] _b        shift amount
431  *
432  * @return              _a >> _b
433  *
434  * This function will shift _a with _b bits to the right,
435  * preserving the sign bit.
436  * It asserts 0 <= _b <= MAX_SHIFT_1W.
437  *
438  * The operation count for this function assumes that
439  * the shift amount is a cloned scalar input.
440  */
441 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asr(
442     const tvector1w     _a,
443     const tvector1w     _b);
444
445 /** @brief aritmetic shift right with rounding
446  *
447  * @param[in] _a        input
448  * @param[in] _b        shift amount
449  *
450  * @return              _a >> _b
451  *
452  * If _b < NUM_BITS, this function will shift _a with _b bits to the right,
453  * preserving the sign bit, and depending on the rounding mode of the core
454  * it will round to nearest or to nearest even.
455  * If _b >= NUM_BITS, this function will return 0.
456  * It asserts 0 <= _b <= MAX_SHIFT_1W.
457  * The operation count for this function assumes that
458  * the shift amount is a cloned scalar input.
459  */
460 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asrrnd(
461     const tvector1w     _a,
462     const tvector1w     _b);
463
464 /** @brief saturating arithmetic shift left
465  *
466  * @param[in] _a        input
467  * @param[in] _b        shift amount
468  *
469  * @return              _a << _b
470  *
471  * If _b < MAX_BITDEPTH, this function will shift _a with _b bits to the left,
472  * saturating at MIN_RANGE/MAX_RANGE in case of overflow.
473  * If _b >= MAX_BITDEPTH, this function will return MIN_RANGE if _a < 0,
474  * MAX_RANGE if _a > 0, 0 if _a == 0.
475  * (with MAX_BITDEPTH=64)
476  * It asserts 0 <= _b <= MAX_SHIFT_1W.
477  * The operation count for this function assumes that
478  * the shift amount is a cloned scalar input.
479  */
480 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_asl(
481     const tvector1w     _a,
482     const tvector1w     _b);
483
484 /** @brief saturating aritmetic shift left
485  *
486  * @param[in] _a        input
487  * @param[in] _b        shift amount
488  *
489  * @return              _a << _b
490  *
491  * This function is identical to OP_1w_asl( )
492  */
493 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_aslsat(
494     const tvector1w     _a,
495     const tvector1w     _b);
496
497 /** @brief logical shift left
498  *
499  * @param[in] _a        input
500  * @param[in] _b        shift amount
501  *
502  * @return              _a << _b
503  *
504  * This function will shift _a with _b bits to the left.
505  * It will insert zeroes on the right.
506  * It asserts 0 <= _b <= MAX_SHIFT_1W.
507  * The operation count for this function assumes that
508  * the shift amount is a cloned scalar input.
509  */
510 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lsl(
511     const tvector1w     _a,
512     const tvector1w     _b);
513
514 /** @brief logical shift right
515  *
516  * @param[in] _a        input
517  * @param[in] _b        shift amount
518  *
519  * @return              _a >> _b
520  *
521  * This function will shift _a with _b bits to the right.
522  * It will insert zeroes on the left.
523  * It asserts 0 <= _b <= MAX_SHIFT_1W.
524  * The operation count for this function assumes that
525  * the shift amount is a cloned scalar input.
526  */
527 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lsr(
528     const tvector1w     _a,
529     const tvector1w     _b);
530
531 #ifdef ISP2401
532 /** @brief bidirectional saturating arithmetic shift
533  *
534  * @param[in] _a        input
535  * @param[in] _b        shift amount
536  *
537  * @return              _a << |_b| if _b is positive
538  *                      _a >> |_b| if _b is negative
539  *
540  * If _b > 0, this function will shift _a with _b bits to the left,
541  * saturating at MIN_RANGE/MAX_RANGE in case of overflow.
542  * if _b < 0, this function will shift _a with _b bits to the right.
543  * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W.
544  * If _b = 0, it returns _a.
545  */
546 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_ashift_sat(
547     const tvector1w     _a,
548     const tvector1w     _b);
549
550 /** @brief bidirectional non-saturating arithmetic shift
551  *
552  * @param[in] _a        input
553  * @param[in] _b        shift amount
554  *
555  * @return              _a << |_b| if _b is positive
556  *                      _a >> |_b| if _b is negative
557  *
558  * If _b > 0, this function will shift _a with _b bits to the left,
559  * no saturation is performed in case of overflow.
560  * if _b < 0, this function will shift _a with _b bits to the right.
561  * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W.
562  * If _b = 0, it returns _a.
563  */
564 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_ashift(
565     const tvector1w     _a,
566     const tvector1w     _b);
567
568
569 /** @brief bidirectional logical shift
570  *
571  * @param[in] _a        input
572  * @param[in] _b        shift amount
573  *
574  * @return              _a << |_b| if _b is positive
575  *                      _a >> |_b| if _b is negative
576  *
577  * This function will shift _a with _b bits to the left if _b is positive.
578  * This function will shift _a with _b bits to the right if _b is negative.
579  * It asserts -MAX_SHIFT_1W <= _b <= MAX_SHIFT_1W.
580  * It inserts zeros on the left or right depending on the shift direction: 
581  * right or left.
582  * The operation count for this function assumes that
583  * the shift amount is a cloned scalar input.
584  */
585 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_lshift(
586     const tvector1w     _a,
587     const tvector1w     _b);
588
589 #endif
590 /* Cast */
591
592 /** @brief Cast from int to 1w
593  *
594  * @param[in] _a        input
595  *
596  * @return              _a
597  *
598  * This function casts the input from integer type to
599  * single precision. It asserts there is no overflow.
600  *
601  */
602 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_int_cast_to_1w(
603     const int           _a);
604
605 /** @brief Cast from 1w to int
606  *
607  * @param[in] _a        input
608  *
609  * @return              _a
610  *
611  * This function casts the input from single precision type to
612  * integer, preserving value and sign.
613  *
614  */
615 STORAGE_CLASS_ISP_OP1W_FUNC_H int OP_1w_cast_to_int(
616     const tvector1w      _a);
617
618 /** @brief Cast from 1w to 2w
619  *
620  * @param[in] _a        input
621  *
622  * @return              _a
623  *
624  * This function casts the input from single precision type to
625  * double precision, preserving value and sign.
626  *
627  */
628 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector2w OP_1w_cast_to_2w(
629     const tvector1w     _a);
630
631 /** @brief Cast from 2w to 1w
632  *
633  * @param[in] _a        input
634  *
635  * @return              _a
636  *
637  * This function casts the input from double precision type to
638  * single precision. In case of overflow it will wrap around.
639  *
640  */
641 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_2w_cast_to_1w(
642     const tvector2w    _a);
643
644
645 /** @brief Cast from 2w to 1w with saturation
646  *
647  * @param[in] _a        input
648  *
649  * @return              _a
650  *
651  * This function casts the input from double precision type to
652  * single precision after saturating it to the range of single
653  * precision.
654  *
655  */
656 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_2w_sat_cast_to_1w(
657     const tvector2w    _a);
658
659 /* clipping */
660
661 /** @brief Clip asymmetrical
662  *
663  * @param[in] _a        first argument
664  * @param[in] _b        second argument
665  *
666  * @return              _a clipped between ~_b and b
667  *
668  * This function will clip the first argument between
669  * (-_b - 1) and _b.
670  * It asserts _b >= 0.
671  *
672  */
673 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_clip_asym(
674     const tvector1w     _a,
675     const tvector1w     _b);
676
677 /** @brief Clip zero
678  *
679  * @param[in] _a        first argument
680  * @param[in] _b        second argument
681  *
682  * @return              _a clipped beteween 0 and _b
683  *
684  * This function will clip the first argument between
685  * zero and _b.
686  * It asserts _b >= 0.
687  *
688  */
689 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_clipz(
690     const tvector1w     _a,
691     const tvector1w     _b);
692
693 /* division */
694
695 /** @brief Truncated division
696  *
697  * @param[in] _a        first argument
698  * @param[in] _b        second argument
699  *
700  * @return              trunc( _a / _b )
701  *
702  * This function will divide the first argument by
703  * the second argument, with rounding toward 0.
704  * If _b == 0 and _a <  0, the function will return MIN_RANGE.
705  * If _b == 0 and _a == 0, the function will return 0.
706  * If _b == 0 and _a >  0, the function will return MAX_RANGE.
707  */
708 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_div(
709     const tvector1w     _a,
710     const tvector1w     _b);
711
712 /** @brief Fractional saturating divide
713  *
714  * @param[in] _a        first argument
715  * @param[in] _b        second argument
716  *
717  * @return              _a / _b
718  *
719  * This function will perform fixed point division of
720  * the first argument by the second argument, with rounding toward 0.
721  * In case of overflow it will saturate.
722  * If _b == 0 and _a <  0, the function will return MIN_RANGE.
723  * If _b == 0 and _a == 0, the function will return 0.
724  * If _b == 0 and _a >  0, the function will return MAX_RANGE.
725  */
726 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_qdiv(
727     const tvector1w     _a,
728     const tvector1w     _b);
729
730 /** @brief Modulo
731  *
732  * @param[in] _a        first argument
733  * @param[in] _b        second argument
734  *
735  * @return              _a % _b
736  *
737  * This function will return the remainder r = _a - _b * trunc( _a / _b ),
738  * Note that the sign of the remainder is always equal to the sign of _a.
739  * If _b == 0 the function will return _a.
740  */
741 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mod(
742     const tvector1w     _a,
743     const tvector1w     _b);
744
745 /** @brief Unsigned integer Square root
746  *
747  * @param[in] _a        input
748  *
749  * @return              Integer square root of _a
750  *
751  * This function will calculate the Integer square root of _a
752  */
753 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w_unsigned OP_1w_sqrt_u(
754         const tvector1w_unsigned     _a);
755
756 /* Miscellaneous */
757
758 /** @brief Multiplexer
759  *
760  * @param[in] _a        first argument
761  * @param[in] _b        second argument
762  * @param[in] _c        condition
763  *
764  * @return              _c ? _a : _b
765  *
766  * This function will return _a if the condition _c
767  * is true and _b otherwise.
768  */
769 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_mux(
770     const tvector1w     _a,
771     const tvector1w     _b,
772     const tflags           _c);
773
774 /** @brief Average without rounding
775  *
776  * @param[in] _a        first operand
777  * @param[in] _b        second operand
778  *
779  * @return              (_a + _b) >> 1
780  *
781  * This function will add _a and _b, and right shift
782  * the result by one without rounding. No overflow
783  * will occur because addition is performed in the
784  * proper precision.
785  */
786 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w  OP_1w_avg(
787     const tvector1w     _a,
788     const tvector1w     _b);
789
790 /** @brief Average with rounding
791  *
792  * @param[in] _a        first argument
793  * @param[in] _b        second argument
794  *
795  * @return              (_a + _b) >> 1
796  *
797  * This function will add _a and _b at full precision,
798  * and right shift with rounding the result with 1 bit.
799  * Depending on the rounding mode of the core
800  * it will round to nearest or to nearest even.
801  */
802 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_avgrnd(
803     const tvector1w     _a,
804     const tvector1w     _b);
805
806 /** @brief Minimum
807  *
808  * @param[in] _a        first argument
809  * @param[in] _b        second argument
810  *
811  * @return              (_a < _b) ? _a : _b;
812  *
813  * This function will return the smallest of both
814  * input arguments.
815  */
816 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_min(
817     const tvector1w     _a,
818     const tvector1w     _b);
819
820 /** @brief Maximum
821  *
822  * @param[in] _a        first argument
823  * @param[in] _b        second argument
824  *
825  * @return              (_a > _b) ? _a : _b;
826  *
827  * This function will return the largest of both
828  * input arguments.
829  */
830 STORAGE_CLASS_ISP_OP1W_FUNC_H tvector1w OP_1w_max(
831     const tvector1w     _a,
832     const tvector1w     _b);
833
834 #ifndef INLINE_ISP_OP1W
835 #define STORAGE_CLASS_ISP_OP1W_FUNC_C
836 #define STORAGE_CLASS_ISP_OP1W_DATA_C const
837 #else /* INLINE_ISP_OP1W */
838 #define STORAGE_CLASS_ISP_OP1W_FUNC_C STORAGE_CLASS_ISP_OP1W_FUNC_H
839 #define STORAGE_CLASS_ISP_OP1W_DATA_C STORAGE_CLASS_ISP_OP1W_DATA_H
840 #include "isp_op1w.c"
841 #define ISP_OP1W_INLINED
842 #endif  /* INLINE_ISP_OP1W */
843
844 #endif /* __ISP_OP1W_H_INCLUDED__ */
845