Operator ShiftRight

Operator Library: Arithmetics

该算子对输入数据执行向右的算术移位操作。 要移位的位数通过参数 Shift 进行定义。 输入端的每个位都会按参数指定的位数向右移位。

位移通常用于按 2 的幂次缩放值。 例如,向右移一位会将输入值除以 2。 向右移两位会将输入值除以 4。

每个颜色分量均单独进行移位。

I/O Property

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

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width [1, 64] 无符号,[2, 64] 有符号 auto1
Arithmetic {unsigned, 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 any as I
Color Flavor any as I
Max. Img Width any as I
Max. Img Height any as I

1

输出端的 Bit Width 为输入 Bit Width 减去参数 Shift 的值。

参数

Shift
键入 static 参数
默认 0
范围

无符号数的范围为 [0, Input BitWidth - 1]

有符号数的范围为 [0, Input BitWidth - 2]

此参数定义了输入向右移位的位数。

使用示例

以下示例展示了 ShiftRight 算子的用法: