Quantize a neon vector holding 8 floating point values. * * @param[in] qv Input values to be quantized. * @param[in] qi Quantization information to be used in the computation. * * @return A neon vector holding the quantized values */
| 618 | * @return A neon vector holding the quantized values |
| 619 | */ |
| 620 | inline uint8x8_t vquantize(const float32x4x2_t &qv, const UniformQuantizationInfo &qi) |
| 621 | { |
| 622 | const float scale = qi.scale; |
| 623 | const int offset = qi.offset; |
| 624 | const float32x4_t voffset = vdupq_n_f32(offset); |
| 625 | const float32x4_t vinvscale = vdupq_n_f32(1.f / scale); |
| 626 | const int32x4x4_t rf = {{ |
| 627 | #ifdef __aarch64__ |
| 628 | vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)), |
| 629 | vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)), |
| 630 | #else //__aarch64__ |
| 631 | vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)), |
| 632 | vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)), |
| 633 | #endif //__aarch64__ |
| 634 | }}; |
| 635 | return vqmovun_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1]))); |
| 636 | } |
| 637 | |
| 638 | /** Quantize a neon vector holding 8 floating point values. |
| 639 | * |
no test coverage detected