diff --git a/tests/checkasm/sw_yuv2rgb.c b/tests/checkasm/sw_yuv2rgb.c index c6c1ad934b..ba579d0545 100644 --- a/tests/checkasm/sw_yuv2rgb.c +++ b/tests/checkasm/sw_yuv2rgb.c @@ -104,6 +104,8 @@ static void check_yuv2rgb(int src_pix_fmt) { const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); #define MAX_LINE_SIZE 1920 +#define SRC_STRIDE_PAD 32 +#define NUM_LINES 4 static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE}; declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, @@ -111,36 +113,26 @@ static void check_yuv2rgb(int src_pix_fmt) const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); - LOCAL_ALIGNED_8(uint8_t, src_y, [MAX_LINE_SIZE * 2]); - LOCAL_ALIGNED_8(uint8_t, src_u, [MAX_LINE_SIZE]); - LOCAL_ALIGNED_8(uint8_t, src_v, [MAX_LINE_SIZE]); - LOCAL_ALIGNED_8(uint8_t, src_a, [MAX_LINE_SIZE * 2]); + LOCAL_ALIGNED_8(uint8_t, src_y, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, src_u, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, src_v, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]); + LOCAL_ALIGNED_8(uint8_t, src_a, [(MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES]); const uint8_t *src[4] = { src_y, src_u, src_v, src_a }; - LOCAL_ALIGNED_8(uint8_t, dst0_0, [2 * MAX_LINE_SIZE * 6]); - LOCAL_ALIGNED_8(uint8_t, dst0_1, [2 * MAX_LINE_SIZE]); - LOCAL_ALIGNED_8(uint8_t, dst0_2, [2 * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst0_0, [NUM_LINES * MAX_LINE_SIZE * 6]); + LOCAL_ALIGNED_8(uint8_t, dst0_1, [NUM_LINES * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst0_2, [NUM_LINES * MAX_LINE_SIZE]); uint8_t *dst0[4] = { dst0_0, dst0_1, dst0_2 }; - uint8_t *lines0[4][2] = { - { dst0_0, dst0_0 + MAX_LINE_SIZE * 6 }, - { dst0_1, dst0_1 + MAX_LINE_SIZE }, - { dst0_2, dst0_2 + MAX_LINE_SIZE } - }; - LOCAL_ALIGNED_8(uint8_t, dst1_0, [2 * MAX_LINE_SIZE * 6]); - LOCAL_ALIGNED_8(uint8_t, dst1_1, [2 * MAX_LINE_SIZE]); - LOCAL_ALIGNED_8(uint8_t, dst1_2, [2 * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst1_0, [NUM_LINES * MAX_LINE_SIZE * 6]); + LOCAL_ALIGNED_8(uint8_t, dst1_1, [NUM_LINES * MAX_LINE_SIZE]); + LOCAL_ALIGNED_8(uint8_t, dst1_2, [NUM_LINES * MAX_LINE_SIZE]); uint8_t *dst1[4] = { dst1_0, dst1_1, dst1_2 }; - uint8_t *lines1[4][2] = { - { dst1_0, dst1_0 + MAX_LINE_SIZE * 6 }, - { dst1_1, dst1_1 + MAX_LINE_SIZE }, - { dst1_2, dst1_2 + MAX_LINE_SIZE } - }; - randomize_buffers(src_y, MAX_LINE_SIZE * 2); - randomize_buffers(src_u, MAX_LINE_SIZE); - randomize_buffers(src_v, MAX_LINE_SIZE); - randomize_buffers(src_a, MAX_LINE_SIZE * 2); + randomize_buffers(src_y, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES); + randomize_buffers(src_u, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES); + randomize_buffers(src_v, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES); + randomize_buffers(src_a, (MAX_LINE_SIZE + SRC_STRIDE_PAD) * NUM_LINES); for (int dfi = 0; dfi < FF_ARRAY_ELEMS(dst_fmts); dfi++) { int dst_pix_fmt = dst_fmts[dfi]; @@ -152,12 +144,12 @@ static void check_yuv2rgb(int src_pix_fmt) int log_level; int width = input_sizes[isi]; int srcSliceY = 0; - int srcSliceH = 2; + int srcSliceH = NUM_LINES; int srcStride[4] = { - width, - width >> src_desc->log2_chroma_w, - width >> src_desc->log2_chroma_w, - width, + width + SRC_STRIDE_PAD, + (width >> src_desc->log2_chroma_w) + SRC_STRIDE_PAD, + (width >> src_desc->log2_chroma_w) + SRC_STRIDE_PAD, + width + SRC_STRIDE_PAD, }; int dstStride[4] = { MAX_LINE_SIZE * 6, @@ -178,13 +170,13 @@ static void check_yuv2rgb(int src_pix_fmt) c = sws_internal(sws); if (check_func(c->convert_unscaled, "%s_%s_%d", src_desc->name, dst_desc->name, width)) { - memset(dst0_0, 0xFF, 2 * MAX_LINE_SIZE * 6); - memset(dst1_0, 0xFF, 2 * MAX_LINE_SIZE * 6); + memset(dst0_0, 0xFF, NUM_LINES * MAX_LINE_SIZE * 6); + memset(dst1_0, 0xFF, NUM_LINES * MAX_LINE_SIZE * 6); if (dst_pix_fmt == AV_PIX_FMT_GBRP) { - memset(dst0_1, 0xFF, MAX_LINE_SIZE); - memset(dst0_2, 0xFF, MAX_LINE_SIZE); - memset(dst1_1, 0xFF, MAX_LINE_SIZE); - memset(dst1_2, 0xFF, MAX_LINE_SIZE); + memset(dst0_1, 0xFF, NUM_LINES * MAX_LINE_SIZE); + memset(dst0_2, 0xFF, NUM_LINES * MAX_LINE_SIZE); + memset(dst1_1, 0xFF, NUM_LINES * MAX_LINE_SIZE); + memset(dst1_2, 0xFF, NUM_LINES * MAX_LINE_SIZE); } call_ref(c, src, srcStride, srcSliceY, @@ -198,23 +190,31 @@ static void check_yuv2rgb(int src_pix_fmt) dst_pix_fmt == AV_PIX_FMT_BGRA || dst_pix_fmt == AV_PIX_FMT_RGB24 || dst_pix_fmt == AV_PIX_FMT_BGR24) { - if (cmp_off_by_n(lines0[0][0], lines1[0][0], width * sample_size, 3) || - cmp_off_by_n(lines0[0][1], lines1[0][1], width * sample_size, 3)) - fail(); + for (int row = 0; row < srcSliceH; row++) + if (cmp_off_by_n(dst0_0 + row * dstStride[0], + dst1_0 + row * dstStride[0], + width * sample_size, 3)) + fail(); } else if (dst_pix_fmt == AV_PIX_FMT_RGB565 || dst_pix_fmt == AV_PIX_FMT_BGR565) { - if (cmp_565_by_n(lines0[0][0], lines1[0][0], width, 2) || - cmp_565_by_n(lines0[0][1], lines1[0][1], width, 2)) - fail(); + for (int row = 0; row < srcSliceH; row++) + if (cmp_565_by_n(dst0_0 + row * dstStride[0], + dst1_0 + row * dstStride[0], + width, 2)) + fail(); } else if (dst_pix_fmt == AV_PIX_FMT_RGB555 || dst_pix_fmt == AV_PIX_FMT_BGR555) { - if (cmp_555_by_n(lines0[0][0], lines1[0][0], width, 2) || - cmp_555_by_n(lines0[0][1], lines1[0][1], width, 2)) - fail(); + for (int row = 0; row < srcSliceH; row++) + if (cmp_555_by_n(dst0_0 + row * dstStride[0], + dst1_0 + row * dstStride[0], + width, 2)) + fail(); } else if (dst_pix_fmt == AV_PIX_FMT_GBRP) { for (int p = 0; p < 3; p++) - for (int l = 0; l < 2; l++) - if (cmp_off_by_n(lines0[p][l], lines1[p][l], width, 3)) + for (int row = 0; row < srcSliceH; row++) + if (cmp_off_by_n(dst0[p] + row * dstStride[p], + dst1[p] + row * dstStride[p], + width, 3)) fail(); } else { fail(); @@ -228,6 +228,8 @@ static void check_yuv2rgb(int src_pix_fmt) } } +#undef NUM_LINES +#undef SRC_STRIDE_PAD #undef MAX_LINE_SIZE void checkasm_check_sw_yuv2rgb(void)