Operator SIN

Operator Library: Arithmetics

该算子用于计算输入的正弦值。

由于正弦函数的周期性,该 VisualApplets 算子的输入范围受限于 [-\u03c0, \u03c0],即输入的最小值为 -\u03c0,输入的最高值加 1 为 \u03c0。因此,输入不可能出现 +\u03c0 的值。

因此,正弦函数的参数 x 由以下公式确定

其中

是输入 link 上的 Bit Width。

正弦函数的结果范围为 [-1, 1]。该算子在 VisualApplets 中的输出值范围被映射至

其中

是输出 link 上的 Bit Width。因此输出值为

下图显示了正弦函数的曲线图。

下一图表展示了 VisualApplets operator 的实现。请注意输入和输出的 Bit Width。

我们来看一个输入像素值,例如 -50。在给定的 8 Bit Width 输入下,该像素值的实际值表示形式为 -50 * pi / 128。其正弦计算结果将为 -0.94。在像素值表示形式中,该结果变为 -121,这与曲线图中显示的一致。

I/O Property

Property 值
Operator Type O
Input Link I, data input
Output Link O,数据输出

支持的 Link Format

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

参数

无

使用示例

以下示例展示了 SIN 算子的使用方法: