37 #include "NE10_imgproc.h"
39 #include "unit_test_common.h"
46 #define TEST_COUNT 5000
55 static ne10_uint8_t * in_c = NULL;
56 static ne10_uint8_t * in_neon = NULL;
58 static ne10_uint8_t * out_c = NULL;
59 static ne10_uint8_t * out_neon = NULL;
61 void test_resize_conformance_case()
70 ne10_int32_t channels = 4;
71 ne10_int32_t pic_size = MEM_SIZE * MEM_SIZE * channels *
sizeof (ne10_uint8_t);
74 in_c = NE10_MALLOC (pic_size);
75 in_neon = NE10_MALLOC (pic_size);
78 out_c = NE10_MALLOC (pic_size);
79 out_neon = NE10_MALLOC (pic_size);
81 for (i = 0; i < pic_size; i++)
83 in_c[i] = in_neon[i] = (rand() & 0xff);
85 #if defined(REGRESSION_TEST)
86 for (h = 1; h < MEM_SIZE; h++)
88 for (w = 1; w < MEM_SIZE; w++)
95 printf (
"srcw X srch = %d X %d \n", srcw, srch);
96 printf (
"dstw X dsth = %d X %d \n", dstw, dsth);
101 PSNR = CAL_PSNR_UINT8 (out_c, out_neon, dstw * dsth * channels);
102 assert_false ( (PSNR < PSNR_THRESHOLD));
105 #else // defined(SMOKE_TEST)
106 for (h = 96; h < MEM_SIZE; h++)
108 for (w = 96; w < MEM_SIZE; w++)
115 printf (
"srcw X srch = %d X %d \n", srcw, srch);
116 printf (
"dstw X dsth = %d X %d \n", dstw, dsth);
121 PSNR = CAL_PSNR_UINT8 (out_c, out_neon, dstw * dsth * channels);
122 assert_false ( (PSNR < PSNR_THRESHOLD));
130 NE10_FREE (out_neon);
133 void test_resize_performance_case()
141 ne10_int32_t channels = 4;
142 ne10_int32_t pic_size = MEM_SIZE * MEM_SIZE * channels *
sizeof (ne10_uint8_t);
143 ne10_int64_t time_c = 0;
144 ne10_int64_t time_neon = 0;
147 in_c = NE10_MALLOC (pic_size);
148 in_neon = NE10_MALLOC (pic_size);
151 out_c = NE10_MALLOC (pic_size);
152 out_neon = NE10_MALLOC (pic_size);
154 for (i = 0; i < pic_size; i++)
156 in_c[i] = in_neon[i] = (rand() & 0xff);
159 for (h = 16; h < MEM_SIZE; h += 4)
161 for (w = 16; w < MEM_SIZE; w += 4)
168 printf (
"srcw X srch = %d X %d \n", srcw, srch);
169 printf (
"dstw X dsth = %d X %d \n", dstw, dsth);
175 for (i = 0; i < TEST_COUNT; i++)
184 for (i = 0; i < TEST_COUNT; i++)
190 ne10_log (__FUNCTION__,
"IMAGERESIZE%20d%20lld%20lld%19.2f%%%18.2f:1\n", (h * MEM_SIZE + w), time_c, time_neon, 0, 0);
197 NE10_FREE (out_neon);
202 #if defined (SMOKE_TEST)||(REGRESSION_TEST)
203 test_resize_conformance_case();
206 #if defined PERFORMANCE_TEST
207 test_resize_performance_case();
211 static void my_test_setup (
void)
213 ne10_log_buffer_ptr = ne10_log_buffer;
216 void test_fixture_resize (
void)
218 test_fixture_start();
220 fixture_setup (my_test_setup);
222 run_test (test_resize);