From 81be8c86aeb2170e92b7d2ccba9e00d4c13b8f01 Mon Sep 17 00:00:00 2001 From: nihuini Date: Tue, 11 Jun 2019 16:21:26 +0800 Subject: [PATCH] fix bus error in resize_bilinear_c2 on armv7 --- src/mat_pixel_resize.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mat_pixel_resize.cpp b/src/mat_pixel_resize.cpp index b289b0e712d..cd561b017ff 100644 --- a/src/mat_pixel_resize.cpp +++ b/src/mat_pixel_resize.cpp @@ -392,7 +392,12 @@ void resize_bilinear_c2(const unsigned char* src, int srcw, int srch, unsigned c int16x4_t _a0a1XX = vld1_s16(ialphap); int16x4_t _a0a0a1a1 = vzip_s16(_a0a1XX, _a0a1XX).val[0]; uint8x8_t _S1 = uint8x8_t(); - _S1 = vreinterpret_u8_u32(vld1_lane_u32((const unsigned int*)S1p, vreinterpret_u32_u8(_S1), 0)); + + _S1 = vld1_lane_u8(S1p, _S1, 0); + _S1 = vld1_lane_u8(S1p+1, _S1, 1); + _S1 = vld1_lane_u8(S1p+2, _S1, 2); + _S1 = vld1_lane_u8(S1p+3, _S1, 3); + int16x8_t _S116 = vreinterpretq_s16_u16(vmovl_u8(_S1)); int16x4_t _S1lowhigh = vget_low_s16(_S116); int32x4_t _S1ma0a1 = vmull_s16(_S1lowhigh, _a0a0a1a1); @@ -434,8 +439,17 @@ void resize_bilinear_c2(const unsigned char* src, int srcw, int srch, unsigned c int16x4_t _a1 = vdup_n_s16(a1); uint8x8_t _S0 = uint8x8_t(); uint8x8_t _S1 = uint8x8_t(); - _S0 = vreinterpret_u8_u32(vld1_lane_u32((const unsigned int*)S0p, vreinterpret_u32_u8(_S0), 0)); - _S1 = vreinterpret_u8_u32(vld1_lane_u32((const unsigned int*)S1p, vreinterpret_u32_u8(_S1), 0)); + + _S0 = vld1_lane_u8(S0p, _S0, 0); + _S0 = vld1_lane_u8(S0p+1, _S0, 1); + _S0 = vld1_lane_u8(S0p+2, _S0, 2); + _S0 = vld1_lane_u8(S0p+3, _S0, 3); + + _S1 = vld1_lane_u8(S1p, _S1, 0); + _S1 = vld1_lane_u8(S1p+1, _S1, 1); + _S1 = vld1_lane_u8(S1p+2, _S1, 2); + _S1 = vld1_lane_u8(S1p+3, _S1, 3); + int16x8_t _S016 = vreinterpretq_s16_u16(vmovl_u8(_S0)); int16x8_t _S116 = vreinterpretq_s16_u16(vmovl_u8(_S1)); int16x4_t _S0lowhigh = vget_low_s16(_S016);