Browse Source

fix warpaffine_bilinear_yuv420sp uv matrix (#3048)

tags/20210720
DaydreamCoding GitHub 5 years ago
parent
commit
f42d0e5dc9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions
  1. +10
    -1
      src/mat_pixel_affine.cpp
  2. +1
    -1
      tests/test_mat_pixel_affine.cpp

+ 10
- 1
src/mat_pixel_affine.cpp View File

@@ -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



+ 1
- 1
tests/test_mat_pixel_affine.cpp View File

@@ -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);
}


Loading…
Cancel
Save