Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / aom / test / comp_avg_pred_test.h
blob9661dd9f547ffcffd7563091cb0804eb2bc3eb4d
1 /*
2 * Copyright (c) 2018, Alliance for Open Media. All rights reserved
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
12 #ifndef AOM_TEST_COMP_AVG_PRED_TEST_H_
13 #define AOM_TEST_COMP_AVG_PRED_TEST_H_
15 #include "config/aom_dsp_rtcd.h"
17 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
18 #include "test/acm_random.h"
19 #include "test/util.h"
20 #include "test/clear_system_state.h"
21 #include "test/register_state_check.h"
22 #include "av1/common/common_data.h"
23 #include "aom_ports/aom_timer.h"
25 namespace libaom_test {
26 const int kMaxSize = 128 + 32; // padding
28 namespace AV1JNTCOMPAVG {
30 typedef void (*jntcompavg_func)(uint8_t *comp_pred, const uint8_t *pred,
31 int width, int height, const uint8_t *ref,
32 int ref_stride,
33 const JNT_COMP_PARAMS *jcp_param);
35 typedef void (*jntcompavgupsampled_func)(
36 MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col,
37 const MV *const mv, uint8_t *comp_pred, const uint8_t *pred, int width,
38 int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref,
39 int ref_stride, const JNT_COMP_PARAMS *jcp_param, int subpel_search);
41 typedef void (*highbdjntcompavgupsampled_func)(
42 MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col,
43 const MV *const mv, uint8_t *comp_pred8, const uint8_t *pred8, int width,
44 int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref8,
45 int ref_stride, int bd, const JNT_COMP_PARAMS *jcp_param,
46 int subpel_search);
48 typedef ::testing::tuple<jntcompavg_func, BLOCK_SIZE> JNTCOMPAVGParam;
50 typedef ::testing::tuple<jntcompavgupsampled_func, BLOCK_SIZE>
51 JNTCOMPAVGUPSAMPLEDParam;
53 typedef ::testing::tuple<int, jntcompavg_func, BLOCK_SIZE>
54 HighbdJNTCOMPAVGParam;
56 typedef ::testing::tuple<int, highbdjntcompavgupsampled_func, BLOCK_SIZE>
57 HighbdJNTCOMPAVGUPSAMPLEDParam;
59 ::testing::internal::ParamGenerator<JNTCOMPAVGParam> BuildParams(
60 jntcompavg_func filter) {
61 return ::testing::Combine(::testing::Values(filter),
62 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
65 ::testing::internal::ParamGenerator<JNTCOMPAVGUPSAMPLEDParam> BuildParams(
66 jntcompavgupsampled_func filter) {
67 return ::testing::Combine(::testing::Values(filter),
68 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
71 ::testing::internal::ParamGenerator<HighbdJNTCOMPAVGParam> BuildParams(
72 jntcompavg_func filter, int is_hbd) {
73 (void)is_hbd;
74 return ::testing::Combine(::testing::Range(8, 13, 2),
75 ::testing::Values(filter),
76 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
79 ::testing::internal::ParamGenerator<HighbdJNTCOMPAVGUPSAMPLEDParam> BuildParams(
80 highbdjntcompavgupsampled_func filter) {
81 return ::testing::Combine(::testing::Range(8, 13, 2),
82 ::testing::Values(filter),
83 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
86 class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
87 public:
88 ~AV1JNTCOMPAVGTest() {}
89 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
90 void TearDown() { libaom_test::ClearSystemState(); }
92 protected:
93 void RunCheckOutput(jntcompavg_func test_impl) {
94 const int w = kMaxSize, h = kMaxSize;
95 const int block_idx = GET_PARAM(1);
97 uint8_t pred8[kMaxSize * kMaxSize];
98 uint8_t ref8[kMaxSize * kMaxSize];
99 uint8_t output[kMaxSize * kMaxSize];
100 uint8_t output2[kMaxSize * kMaxSize];
102 for (int i = 0; i < h; ++i)
103 for (int j = 0; j < w; ++j) {
104 pred8[i * w + j] = rnd_.Rand8();
105 ref8[i * w + j] = rnd_.Rand8();
107 const int in_w = block_size_wide[block_idx];
108 const int in_h = block_size_high[block_idx];
110 JNT_COMP_PARAMS jnt_comp_params;
111 jnt_comp_params.use_jnt_comp_avg = 1;
113 for (int ii = 0; ii < 2; ii++) {
114 for (int jj = 0; jj < 4; jj++) {
115 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
116 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
118 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
119 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
120 aom_jnt_comp_avg_pred_c(output, pred8 + offset_r * w + offset_c, in_w,
121 in_h, ref8 + offset_r * w + offset_c, in_w,
122 &jnt_comp_params);
123 test_impl(output2, pred8 + offset_r * w + offset_c, in_w, in_h,
124 ref8 + offset_r * w + offset_c, in_w, &jnt_comp_params);
126 for (int i = 0; i < in_h; ++i) {
127 for (int j = 0; j < in_w; ++j) {
128 int idx = i * in_w + j;
129 ASSERT_EQ(output[idx], output2[idx])
130 << "Mismatch at unit tests for AV1JNTCOMPAVGTest\n"
131 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
132 << " = (" << i << ", " << j << ")";
138 void RunSpeedTest(jntcompavg_func test_impl) {
139 const int w = kMaxSize, h = kMaxSize;
140 const int block_idx = GET_PARAM(1);
142 uint8_t pred8[kMaxSize * kMaxSize];
143 uint8_t ref8[kMaxSize * kMaxSize];
144 uint8_t output[kMaxSize * kMaxSize];
145 uint8_t output2[kMaxSize * kMaxSize];
147 for (int i = 0; i < h; ++i)
148 for (int j = 0; j < w; ++j) {
149 pred8[i * w + j] = rnd_.Rand8();
150 ref8[i * w + j] = rnd_.Rand8();
152 const int in_w = block_size_wide[block_idx];
153 const int in_h = block_size_high[block_idx];
155 JNT_COMP_PARAMS jnt_comp_params;
156 jnt_comp_params.use_jnt_comp_avg = 1;
158 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
159 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
161 const int num_loops = 1000000000 / (in_w + in_h);
162 aom_usec_timer timer;
163 aom_usec_timer_start(&timer);
165 for (int i = 0; i < num_loops; ++i)
166 aom_jnt_comp_avg_pred_c(output, pred8, in_w, in_h, ref8, in_w,
167 &jnt_comp_params);
169 aom_usec_timer_mark(&timer);
170 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
171 printf("jntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
172 1000.0 * elapsed_time / num_loops);
174 aom_usec_timer timer1;
175 aom_usec_timer_start(&timer1);
177 for (int i = 0; i < num_loops; ++i)
178 test_impl(output2, pred8, in_w, in_h, ref8, in_w, &jnt_comp_params);
180 aom_usec_timer_mark(&timer1);
181 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
182 printf("jntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
183 1000.0 * elapsed_time1 / num_loops);
186 libaom_test::ACMRandom rnd_;
187 }; // class AV1JNTCOMPAVGTest
189 class AV1JNTCOMPAVGUPSAMPLEDTest
190 : public ::testing::TestWithParam<JNTCOMPAVGUPSAMPLEDParam> {
191 public:
192 ~AV1JNTCOMPAVGUPSAMPLEDTest() {}
193 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
194 void TearDown() { libaom_test::ClearSystemState(); }
196 protected:
197 void RunCheckOutput(jntcompavgupsampled_func test_impl) {
198 const int w = kMaxSize, h = kMaxSize;
199 const int block_idx = GET_PARAM(1);
201 uint8_t pred8[kMaxSize * kMaxSize];
202 uint8_t ref8[kMaxSize * kMaxSize];
203 DECLARE_ALIGNED(16, uint8_t, output[MAX_SB_SQUARE]);
204 DECLARE_ALIGNED(16, uint8_t, output2[MAX_SB_SQUARE]);
206 for (int i = 0; i < h; ++i)
207 for (int j = 0; j < w; ++j) {
208 pred8[i * w + j] = rnd_.Rand8();
209 ref8[i * w + j] = rnd_.Rand8();
211 const int in_w = block_size_wide[block_idx];
212 const int in_h = block_size_high[block_idx];
214 JNT_COMP_PARAMS jnt_comp_params;
215 jnt_comp_params.use_jnt_comp_avg = 1;
216 int sub_x_q3, sub_y_q3;
217 int subpel_search;
218 for (subpel_search = 1; subpel_search <= 2; ++subpel_search) {
219 for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
220 for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
221 for (int ii = 0; ii < 2; ii++) {
222 for (int jj = 0; jj < 4; jj++) {
223 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
224 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
226 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
227 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
229 aom_jnt_comp_avg_upsampled_pred_c(
230 NULL, NULL, 0, 0, NULL, output,
231 pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3,
232 sub_y_q3, ref8 + offset_r * w + offset_c, in_w,
233 &jnt_comp_params, subpel_search);
234 test_impl(NULL, NULL, 0, 0, NULL, output2,
235 pred8 + offset_r * w + offset_c, in_w, in_h, sub_x_q3,
236 sub_y_q3, ref8 + offset_r * w + offset_c, in_w,
237 &jnt_comp_params, subpel_search);
239 for (int i = 0; i < in_h; ++i) {
240 for (int j = 0; j < in_w; ++j) {
241 int idx = i * in_w + j;
242 ASSERT_EQ(output[idx], output2[idx])
243 << "Mismatch at unit tests for "
244 "AV1JNTCOMPAVGUPSAMPLEDTest\n"
245 << in_w << "x" << in_h << " Pixel mismatch at index "
246 << idx << " = (" << i << ", " << j
247 << "), sub pixel offset = (" << sub_y_q3 << ", "
248 << sub_x_q3 << ")";
257 void RunSpeedTest(jntcompavgupsampled_func test_impl) {
258 const int w = kMaxSize, h = kMaxSize;
259 const int block_idx = GET_PARAM(1);
261 uint8_t pred8[kMaxSize * kMaxSize];
262 uint8_t ref8[kMaxSize * kMaxSize];
263 DECLARE_ALIGNED(16, uint8_t, output[MAX_SB_SQUARE]);
264 DECLARE_ALIGNED(16, uint8_t, output2[MAX_SB_SQUARE]);
266 for (int i = 0; i < h; ++i)
267 for (int j = 0; j < w; ++j) {
268 pred8[i * w + j] = rnd_.Rand8();
269 ref8[i * w + j] = rnd_.Rand8();
271 const int in_w = block_size_wide[block_idx];
272 const int in_h = block_size_high[block_idx];
274 JNT_COMP_PARAMS jnt_comp_params;
275 jnt_comp_params.use_jnt_comp_avg = 1;
277 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
278 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
280 int sub_x_q3 = 0;
281 int sub_y_q3 = 0;
283 const int num_loops = 1000000000 / (in_w + in_h);
284 aom_usec_timer timer;
285 aom_usec_timer_start(&timer);
286 int subpel_search = 2; // set to 1 to test 4-tap filter.
288 for (int i = 0; i < num_loops; ++i)
289 aom_jnt_comp_avg_upsampled_pred_c(NULL, NULL, 0, 0, NULL, output, pred8,
290 in_w, in_h, sub_x_q3, sub_y_q3, ref8,
291 in_w, &jnt_comp_params, subpel_search);
293 aom_usec_timer_mark(&timer);
294 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
295 printf("jntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
296 1000.0 * elapsed_time / num_loops);
298 aom_usec_timer timer1;
299 aom_usec_timer_start(&timer1);
301 for (int i = 0; i < num_loops; ++i)
302 test_impl(NULL, NULL, 0, 0, NULL, output2, pred8, in_w, in_h, sub_x_q3,
303 sub_y_q3, ref8, in_w, &jnt_comp_params, subpel_search);
305 aom_usec_timer_mark(&timer1);
306 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
307 printf("jntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
308 1000.0 * elapsed_time1 / num_loops);
311 libaom_test::ACMRandom rnd_;
312 }; // class AV1JNTCOMPAVGUPSAMPLEDTest
314 class AV1HighBDJNTCOMPAVGTest
315 : public ::testing::TestWithParam<HighbdJNTCOMPAVGParam> {
316 public:
317 ~AV1HighBDJNTCOMPAVGTest() {}
318 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
320 void TearDown() { libaom_test::ClearSystemState(); }
322 protected:
323 void RunCheckOutput(jntcompavg_func test_impl) {
324 const int w = kMaxSize, h = kMaxSize;
325 const int block_idx = GET_PARAM(2);
326 const int bd = GET_PARAM(0);
327 uint16_t pred8[kMaxSize * kMaxSize];
328 uint16_t ref8[kMaxSize * kMaxSize];
329 uint16_t output[kMaxSize * kMaxSize];
330 uint16_t output2[kMaxSize * kMaxSize];
332 for (int i = 0; i < h; ++i)
333 for (int j = 0; j < w; ++j) {
334 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
335 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
337 const int in_w = block_size_wide[block_idx];
338 const int in_h = block_size_high[block_idx];
340 JNT_COMP_PARAMS jnt_comp_params;
341 jnt_comp_params.use_jnt_comp_avg = 1;
343 for (int ii = 0; ii < 2; ii++) {
344 for (int jj = 0; jj < 4; jj++) {
345 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
346 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
348 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
349 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
350 aom_highbd_jnt_comp_avg_pred_c(
351 CONVERT_TO_BYTEPTR(output),
352 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w, in_h,
353 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w,
354 &jnt_comp_params);
355 test_impl(CONVERT_TO_BYTEPTR(output2),
356 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
357 in_h, CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c,
358 in_w, &jnt_comp_params);
360 for (int i = 0; i < in_h; ++i) {
361 for (int j = 0; j < in_w; ++j) {
362 int idx = i * in_w + j;
363 ASSERT_EQ(output[idx], output2[idx])
364 << "Mismatch at unit tests for AV1HighBDJNTCOMPAVGTest\n"
365 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
366 << " = (" << i << ", " << j << ")";
372 void RunSpeedTest(jntcompavg_func test_impl) {
373 const int w = kMaxSize, h = kMaxSize;
374 const int block_idx = GET_PARAM(2);
375 const int bd = GET_PARAM(0);
376 uint16_t pred8[kMaxSize * kMaxSize];
377 uint16_t ref8[kMaxSize * kMaxSize];
378 uint16_t output[kMaxSize * kMaxSize];
379 uint16_t output2[kMaxSize * kMaxSize];
381 for (int i = 0; i < h; ++i)
382 for (int j = 0; j < w; ++j) {
383 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
384 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
386 const int in_w = block_size_wide[block_idx];
387 const int in_h = block_size_high[block_idx];
389 JNT_COMP_PARAMS jnt_comp_params;
390 jnt_comp_params.use_jnt_comp_avg = 1;
392 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
393 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
395 const int num_loops = 1000000000 / (in_w + in_h);
396 aom_usec_timer timer;
397 aom_usec_timer_start(&timer);
399 for (int i = 0; i < num_loops; ++i)
400 aom_highbd_jnt_comp_avg_pred_c(
401 CONVERT_TO_BYTEPTR(output), CONVERT_TO_BYTEPTR(pred8), in_w, in_h,
402 CONVERT_TO_BYTEPTR(ref8), in_w, &jnt_comp_params);
404 aom_usec_timer_mark(&timer);
405 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
406 printf("highbdjntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
407 1000.0 * elapsed_time / num_loops);
409 aom_usec_timer timer1;
410 aom_usec_timer_start(&timer1);
412 for (int i = 0; i < num_loops; ++i)
413 test_impl(CONVERT_TO_BYTEPTR(output2), CONVERT_TO_BYTEPTR(pred8), in_w,
414 in_h, CONVERT_TO_BYTEPTR(ref8), in_w, &jnt_comp_params);
416 aom_usec_timer_mark(&timer1);
417 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
418 printf("highbdjntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
419 1000.0 * elapsed_time1 / num_loops);
422 libaom_test::ACMRandom rnd_;
423 }; // class AV1HighBDJNTCOMPAVGTest
425 class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
426 : public ::testing::TestWithParam<HighbdJNTCOMPAVGUPSAMPLEDParam> {
427 public:
428 ~AV1HighBDJNTCOMPAVGUPSAMPLEDTest() {}
429 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
430 void TearDown() { libaom_test::ClearSystemState(); }
432 protected:
433 void RunCheckOutput(highbdjntcompavgupsampled_func test_impl) {
434 const int w = kMaxSize, h = kMaxSize;
435 const int block_idx = GET_PARAM(2);
436 const int bd = GET_PARAM(0);
437 uint16_t pred8[kMaxSize * kMaxSize];
438 uint16_t ref8[kMaxSize * kMaxSize];
439 uint16_t output[kMaxSize * kMaxSize];
440 uint16_t output2[kMaxSize * kMaxSize];
442 for (int i = 0; i < h; ++i)
443 for (int j = 0; j < w; ++j) {
444 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
445 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
447 const int in_w = block_size_wide[block_idx];
448 const int in_h = block_size_high[block_idx];
450 JNT_COMP_PARAMS jnt_comp_params;
451 jnt_comp_params.use_jnt_comp_avg = 1;
452 int sub_x_q3, sub_y_q3;
453 int subpel_search;
454 for (subpel_search = 1; subpel_search <= 2; ++subpel_search) {
455 for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
456 for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
457 for (int ii = 0; ii < 2; ii++) {
458 for (int jj = 0; jj < 4; jj++) {
459 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
460 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
462 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
463 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
465 aom_highbd_jnt_comp_avg_upsampled_pred_c(
466 NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output),
467 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
468 in_h, sub_x_q3, sub_y_q3,
469 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w, bd,
470 &jnt_comp_params, subpel_search);
471 test_impl(NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output2),
472 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c,
473 in_w, in_h, sub_x_q3, sub_y_q3,
474 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c,
475 in_w, bd, &jnt_comp_params, subpel_search);
477 for (int i = 0; i < in_h; ++i) {
478 for (int j = 0; j < in_w; ++j) {
479 int idx = i * in_w + j;
480 ASSERT_EQ(output[idx], output2[idx])
481 << "Mismatch at unit tests for "
482 "AV1HighBDJNTCOMPAVGUPSAMPLEDTest\n"
483 << in_w << "x" << in_h << " Pixel mismatch at index "
484 << idx << " = (" << i << ", " << j
485 << "), sub pixel offset = (" << sub_y_q3 << ", "
486 << sub_x_q3 << ")";
495 void RunSpeedTest(highbdjntcompavgupsampled_func test_impl) {
496 const int w = kMaxSize, h = kMaxSize;
497 const int block_idx = GET_PARAM(2);
498 const int bd = GET_PARAM(0);
499 uint16_t pred8[kMaxSize * kMaxSize];
500 uint16_t ref8[kMaxSize * kMaxSize];
501 uint16_t output[kMaxSize * kMaxSize];
502 uint16_t output2[kMaxSize * kMaxSize];
504 for (int i = 0; i < h; ++i)
505 for (int j = 0; j < w; ++j) {
506 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
507 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
509 const int in_w = block_size_wide[block_idx];
510 const int in_h = block_size_high[block_idx];
512 JNT_COMP_PARAMS jnt_comp_params;
513 jnt_comp_params.use_jnt_comp_avg = 1;
515 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
516 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
517 int sub_x_q3 = 0;
518 int sub_y_q3 = 0;
519 const int num_loops = 1000000000 / (in_w + in_h);
520 aom_usec_timer timer;
521 aom_usec_timer_start(&timer);
522 int subpel_search = 2; // set to 1 to test 4-tap filter.
523 for (int i = 0; i < num_loops; ++i)
524 aom_highbd_jnt_comp_avg_upsampled_pred_c(
525 NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output),
526 CONVERT_TO_BYTEPTR(pred8), in_w, in_h, sub_x_q3, sub_y_q3,
527 CONVERT_TO_BYTEPTR(ref8), in_w, bd, &jnt_comp_params, subpel_search);
529 aom_usec_timer_mark(&timer);
530 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
531 printf("highbdjntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
532 1000.0 * elapsed_time / num_loops);
534 aom_usec_timer timer1;
535 aom_usec_timer_start(&timer1);
537 for (int i = 0; i < num_loops; ++i)
538 test_impl(NULL, NULL, 0, 0, NULL, CONVERT_TO_BYTEPTR(output2),
539 CONVERT_TO_BYTEPTR(pred8), in_w, in_h, sub_x_q3, sub_y_q3,
540 CONVERT_TO_BYTEPTR(ref8), in_w, bd, &jnt_comp_params,
541 subpel_search);
543 aom_usec_timer_mark(&timer1);
544 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
545 printf("highbdjntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w,
546 in_h, 1000.0 * elapsed_time1 / num_loops);
549 libaom_test::ACMRandom rnd_;
550 }; // class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
552 } // namespace AV1JNTCOMPAVG
553 } // namespace libaom_test
555 #endif // AOM_TEST_COMP_AVG_PRED_TEST_H_