vavgub
Vector Average Unsigned Byte
Computes (a+b+1)/2 for bytes.
Details
The vavgub instruction performs an average operation on corresponding bytes of two source vectors, VRA and VRB, treating the values as unsigned integers. It adds each pair of corresponding bytes from VRA and VRB, increments the sum by 1, shifts it right by 1 bit to perform rounding, and stores the result in the destination vector VRT.
Pseudocode Operation
Programming Note
The vavgub instruction is commonly used for averaging pixel values in image processing tasks. Ensure that the source vectors are properly aligned to avoid performance penalties. This instruction operates at user privilege level and will raise an exception if the vector facility is not enabled (MSR.VEC=0).
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Src B