BDIF $X,$Y,$Z | BDIF $X,$Y,Z |
WDIF $X,$Y,$Z | WDIF $X,$Y,Z |
TDIF $X,$Y,$Z | TDIF $X,$Y,Z |
ODIF $X,$Y,$Z | ODIF $X,$Y,Z |
Specification:
x ← y-˙z = max (0,y - z)
Here x,y,z are corresponding elements of the vectors $X, $Y, and $Z.
Timing:
1υ
Description:
Saturated Difference. An Octa byte is regarded as a vector of eight byte, four Wyde, or two Tetra respectively.
BDIF | WDIF | TDIF | ODIF | For each (byte | wyde | tetra | octa) position j, the jth (byte | wyde | tetra | octa) register $X is set to (byte | wyde | tetra | octa) j of register $Y minus (byte | wyde | tetra | octa) j of the other
operand $Z or Z, unless that difference is negative; in the latter case, (byte | wyde | tetra | octa) j of $X is set to zero.
The BDIF and WDIF commands are useful in applications to graphics or video; TDIF and ODIF are also
present for reasons of consistency. For example, if a and b are registers containing 8-byte quantities, their
bytewise maxima c and bytewise minima d are computed by
similarly, the individual "pixel differences" e, namely the absolute values of the differences of corresponding
bytes, are computed by
BDIF x,a,b; BDIF y,b,a; OR e,x,y;
To add individual bytes of a and b while clipping all sums to 255 if they don't fit in a single byte, one can
say
in other words, complement a, apply BDIF, and complement the result. The operations can also be used to
construct efficient operations on strings of bytes or wydes. |