ABS 運算子

Operator Library: Arithmetics

此運算子會計算輸入的絕對值,亦即

請注意,可能出現之最小負值的絕對值需要與其正值等同的位元數。 因此,輸出 Bit Width 等於輸入 Bit Width。 例如,在 8 bit 表示法中,最小值為 -128,而最大值為 127。 經過絕對值運算後,-128 變成 +128,這仍然需要 8 bit。

I/O Properties

Property Value
Operator Type O
Input Link I, data input
Output Link O, data output

支援的 Link 格式

Link Parameter Input Link I Output Link O
Bit Width [2, 64] as I
Arithmetic signed as I
Parallelism any as I
Kernel Columns any as I
Kernel Rows any as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format VAF_GRAY, VAF_COLOR as I
Color Flavor FL_NONE as I
Max. Img Width any as I
Max. Img Height any as I

參數

無

使用範例

以下範例展示了 ABS 運算子的使用方式: