Scales a given vector by 1/255. * * @note This does not work for all cases. e.g. for float of 0.49999999999999994 and large floats. * * @param in Input vector to scale. * @return Scaled dst rounded to nearest (round half up). */
| 157 | * @return Scaled dst rounded to nearest (round half up). |
| 158 | */ |
| 159 | inline int32x4_t scale255_S32_S32(int32x4_t in) |
| 160 | { |
| 161 | // Scale |
| 162 | const float32x4_t tmp = vmulq_f32(vcvtq_f32_s32(in), scale255_constant_f32q); |
| 163 | // Round to nearest (round half up) |
| 164 | // Add +0.5 for all values |
| 165 | // Afterwards vcvt rounds toward zero |
| 166 | return vcvtq_s32_f32(vaddq_f32(tmp, positive_round_f32q)); |
| 167 | } |
| 168 | |
| 169 | inline uint16x8_t scale255_U16_U16(uint16x8_t in) |
| 170 | { |
no outgoing calls
no test coverage detected