Operator CastBitWidth

Operator Library: Base

CastBitWidth オペレーターは、入力の下位ビットを選択することによって Bit Width を変更します。 出力の Bit Width が入力の Bit Width よりも大きい場合、値はそのまま保持され、つまり最上位ビットにビットが追加されます。 符号付きの値に対しては符号拡張が実行されます。 出力の Bit Width が入力の Bit Width よりも小さい場合、最上位ビットは破棄されます。値は次のように変更されます

つまり、残りのビットのみが使用されます。出力の Bit Width は次によって定義されます .

カラー値の場合、各コンポーネントは個別に処理されます。

[注] CastBitWidth オペレーターによって値が破損する可能性があります

必要がないことが確実な場合のみ、ビットを破棄してください。 CastBitWidth オペレーターによって値が破損する可能性があります。

Input Bit Width Input Value Arithmetic Output Bit Width 出力値 Comment
10進数 2進法 10進数 2進法
5 10 01010 unsigned 4 10 1010 値は保持されます
5 10 01010 unsigned 3 2 010 値が変更されます
5 10 01010 signed 6 10 001010 値は保持されます
5 -10 10110 signed 6 -10 110110 値は保持され、符号拡張が行われます
5 10 01010 signed 4 -6 1010 値が変更されます
5 -10 10110 signed 4 6 0110 値が変更されます

表 31. 例


I/O Property

Property 値
オペレータータイプ O
Input Link I, data input
Output Link O, data output

サポートされているリンクフォーマット

Link Parameter Input Link I Output Link O
Bit Width [1, 64]1 [1, 64]2
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, VALT_SIGNAL} 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 の範囲は次のとおりです:

  • 符号なし入力の場合: [1, 64]

  • 符号付き入力の場合: [2, 64]

  • 符号なしカラー入力の場合: [3, 63]

  • 符号付きカラー入力の場合: [6, 63]。

2

入力 Bit Width の範囲は次のとおりです:

  • 符号なし入力の場合: [1, 64]

  • 符号付き入力の場合: [2, 64]

  • 符号なしカラー入力の場合: [3, 63]

  • 符号付きカラー入力の場合: [6, 63]。

パラメーター

None

使用例

operator CastBitWidth の使用法を以下の例に示します: