diff --git a/src/mat_pixel_affine.cpp b/src/mat_pixel_affine.cpp index 43afa8c66..750475910 100644 --- a/src/mat_pixel_affine.cpp +++ b/src/mat_pixel_affine.cpp @@ -1600,9 +1600,18 @@ void warpaffine_bilinear_yuv420sp(const unsigned char* src, int srcw, int srch, unsigned char* dstY = dst; warpaffine_bilinear_c1(srcY, srcw, srch, dstY, w, h, tm, type, v_y); + const float tm_uv[6] = { + tm[0], + tm[1], + tm[2] / 2.0f, + tm[3], + tm[4], + tm[5] / 2.0f, + }; + const unsigned char* srcUV = src + srcw * srch; unsigned char* dstUV = dst + w * h; - warpaffine_bilinear_c2(srcUV, srcw / 2, srch / 2, dstUV, w / 2, h / 2, tm, type, v_uv); + warpaffine_bilinear_c2(srcUV, srcw / 2, srch / 2, dstUV, w / 2, h / 2, tm_uv, type, v_uv); } #endif // NCNN_PIXEL_AFFINE diff --git a/tests/test_mat_pixel_affine.cpp b/tests/test_mat_pixel_affine.cpp index 2b01d742f..2158a9c28 100644 --- a/tests/test_mat_pixel_affine.cpp +++ b/tests/test_mat_pixel_affine.cpp @@ -494,7 +494,7 @@ static int test_mat_pixel_affine_yuv420sp(int w, int h) static int test_mat_pixel_affine_1() { return 0 - || test_mat_pixel_affine_yuv420sp(60, 40) + || test_mat_pixel_affine_yuv420sp(40, 40) || test_mat_pixel_affine_yuv420sp(120, 160) || test_mat_pixel_affine_yuv420sp(220, 340); }