Add dr prediction test
[aom.git] / test / comp_avg_pred_test.h
blobab2004c05bc4b458f4f1bacf315611cd04a3475c
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 TEST_COMP_AVG_PRED_TEST_H_
13 #define 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);
41 typedef void (*highbdjntcompavg_func)(uint16_t *comp_pred, const uint8_t *pred8,
42 int width, int height,
43 const uint8_t *ref8, int ref_stride,
44 const JNT_COMP_PARAMS *jcp_param);
46 typedef void (*highbdjntcompavgupsampled_func)(
47 MACROBLOCKD *xd, const struct AV1Common *const cm, int mi_row, int mi_col,
48 const MV *const mv, uint16_t *comp_pred, const uint8_t *pred8, int width,
49 int height, int subpel_x_q3, int subpel_y_q3, const uint8_t *ref8,
50 int ref_stride, int bd, const JNT_COMP_PARAMS *jcp_param);
52 typedef ::testing::tuple<jntcompavg_func, BLOCK_SIZE> JNTCOMPAVGParam;
54 typedef ::testing::tuple<jntcompavgupsampled_func, BLOCK_SIZE>
55 JNTCOMPAVGUPSAMPLEDParam;
57 typedef ::testing::tuple<int, highbdjntcompavg_func, BLOCK_SIZE>
58 HighbdJNTCOMPAVGParam;
60 typedef ::testing::tuple<int, highbdjntcompavgupsampled_func, BLOCK_SIZE>
61 HighbdJNTCOMPAVGUPSAMPLEDParam;
63 ::testing::internal::ParamGenerator<JNTCOMPAVGParam> BuildParams(
64 jntcompavg_func filter) {
65 return ::testing::Combine(::testing::Values(filter),
66 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
69 ::testing::internal::ParamGenerator<JNTCOMPAVGUPSAMPLEDParam> BuildParams(
70 jntcompavgupsampled_func filter) {
71 return ::testing::Combine(::testing::Values(filter),
72 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
75 ::testing::internal::ParamGenerator<HighbdJNTCOMPAVGParam> BuildParams(
76 highbdjntcompavg_func filter) {
77 return ::testing::Combine(::testing::Range(8, 13, 2),
78 ::testing::Values(filter),
79 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
82 ::testing::internal::ParamGenerator<HighbdJNTCOMPAVGUPSAMPLEDParam> BuildParams(
83 highbdjntcompavgupsampled_func filter) {
84 return ::testing::Combine(::testing::Range(8, 13, 2),
85 ::testing::Values(filter),
86 ::testing::Range(BLOCK_4X4, BLOCK_SIZES_ALL));
89 class AV1JNTCOMPAVGTest : public ::testing::TestWithParam<JNTCOMPAVGParam> {
90 public:
91 ~AV1JNTCOMPAVGTest() {}
92 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
93 void TearDown() { libaom_test::ClearSystemState(); }
95 protected:
96 void RunCheckOutput(jntcompavg_func test_impl) {
97 const int w = kMaxSize, h = kMaxSize;
98 const int block_idx = GET_PARAM(1);
100 uint8_t pred8[kMaxSize * kMaxSize];
101 uint8_t ref8[kMaxSize * kMaxSize];
102 uint8_t output[kMaxSize * kMaxSize];
103 uint8_t output2[kMaxSize * kMaxSize];
105 for (int i = 0; i < h; ++i)
106 for (int j = 0; j < w; ++j) {
107 pred8[i * w + j] = rnd_.Rand8();
108 ref8[i * w + j] = rnd_.Rand8();
110 const int in_w = block_size_wide[block_idx];
111 const int in_h = block_size_high[block_idx];
113 JNT_COMP_PARAMS jnt_comp_params;
114 jnt_comp_params.use_jnt_comp_avg = 1;
116 for (int ii = 0; ii < 2; ii++) {
117 for (int jj = 0; jj < 4; jj++) {
118 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
119 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
121 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
122 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
123 aom_jnt_comp_avg_pred_c(output, pred8 + offset_r * w + offset_c, in_w,
124 in_h, ref8 + offset_r * w + offset_c, in_w,
125 &jnt_comp_params);
126 test_impl(output2, pred8 + offset_r * w + offset_c, in_w, in_h,
127 ref8 + offset_r * w + offset_c, in_w, &jnt_comp_params);
129 for (int i = 0; i < in_h; ++i) {
130 for (int j = 0; j < in_w; ++j) {
131 int idx = i * in_w + j;
132 ASSERT_EQ(output[idx], output2[idx])
133 << "Mismatch at unit tests for AV1JNTCOMPAVGTest\n"
134 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
135 << " = (" << i << ", " << j << ")";
141 void RunSpeedTest(jntcompavg_func test_impl) {
142 const int w = kMaxSize, h = kMaxSize;
143 const int block_idx = GET_PARAM(1);
145 uint8_t pred8[kMaxSize * kMaxSize];
146 uint8_t ref8[kMaxSize * kMaxSize];
147 uint8_t output[kMaxSize * kMaxSize];
148 uint8_t output2[kMaxSize * kMaxSize];
150 for (int i = 0; i < h; ++i)
151 for (int j = 0; j < w; ++j) {
152 pred8[i * w + j] = rnd_.Rand8();
153 ref8[i * w + j] = rnd_.Rand8();
155 const int in_w = block_size_wide[block_idx];
156 const int in_h = block_size_high[block_idx];
158 JNT_COMP_PARAMS jnt_comp_params;
159 jnt_comp_params.use_jnt_comp_avg = 1;
161 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
162 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
164 const int num_loops = 1000000000 / (in_w + in_h);
165 aom_usec_timer timer;
166 aom_usec_timer_start(&timer);
168 for (int i = 0; i < num_loops; ++i)
169 aom_jnt_comp_avg_pred_c(output, pred8, in_w, in_h, ref8, in_w,
170 &jnt_comp_params);
172 aom_usec_timer_mark(&timer);
173 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
174 printf("jntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
175 1000.0 * elapsed_time / num_loops);
177 aom_usec_timer timer1;
178 aom_usec_timer_start(&timer1);
180 for (int i = 0; i < num_loops; ++i)
181 test_impl(output2, pred8, in_w, in_h, ref8, in_w, &jnt_comp_params);
183 aom_usec_timer_mark(&timer1);
184 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
185 printf("jntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
186 1000.0 * elapsed_time1 / num_loops);
189 libaom_test::ACMRandom rnd_;
190 }; // class AV1JNTCOMPAVGTest
192 class AV1JNTCOMPAVGUPSAMPLEDTest
193 : public ::testing::TestWithParam<JNTCOMPAVGUPSAMPLEDParam> {
194 public:
195 ~AV1JNTCOMPAVGUPSAMPLEDTest() {}
196 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
197 void TearDown() { libaom_test::ClearSystemState(); }
199 protected:
200 void RunCheckOutput(jntcompavgupsampled_func test_impl) {
201 const int w = kMaxSize, h = kMaxSize;
202 const int block_idx = GET_PARAM(1);
204 uint8_t pred8[kMaxSize * kMaxSize];
205 uint8_t ref8[kMaxSize * kMaxSize];
206 DECLARE_ALIGNED(16, uint8_t, output[MAX_SB_SQUARE]);
207 DECLARE_ALIGNED(16, uint8_t, output2[MAX_SB_SQUARE]);
209 for (int i = 0; i < h; ++i)
210 for (int j = 0; j < w; ++j) {
211 pred8[i * w + j] = rnd_.Rand8();
212 ref8[i * w + j] = rnd_.Rand8();
214 const int in_w = block_size_wide[block_idx];
215 const int in_h = block_size_high[block_idx];
217 JNT_COMP_PARAMS jnt_comp_params;
218 jnt_comp_params.use_jnt_comp_avg = 1;
219 int sub_x_q3, sub_y_q3;
220 for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
221 for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
222 for (int ii = 0; ii < 2; ii++) {
223 for (int jj = 0; jj < 4; jj++) {
224 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
225 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
227 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
228 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
230 aom_jnt_comp_avg_upsampled_pred_c(
231 NULL, NULL, 0, 0, NULL, output, pred8 + offset_r * w + offset_c,
232 in_w, in_h, sub_x_q3, sub_y_q3, ref8 + offset_r * w + offset_c,
233 in_w, &jnt_comp_params);
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);
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 AV1JNTCOMPAVGUPSAMPLEDTest\n"
244 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
245 << " = (" << i << ", " << j << "), sub pixel offset = ("
246 << sub_y_q3 << ", " << sub_x_q3 << ")";
254 void RunSpeedTest(jntcompavgupsampled_func test_impl) {
255 const int w = kMaxSize, h = kMaxSize;
256 const int block_idx = GET_PARAM(1);
258 uint8_t pred8[kMaxSize * kMaxSize];
259 uint8_t ref8[kMaxSize * kMaxSize];
260 DECLARE_ALIGNED(16, uint8_t, output[MAX_SB_SQUARE]);
261 DECLARE_ALIGNED(16, uint8_t, output2[MAX_SB_SQUARE]);
263 for (int i = 0; i < h; ++i)
264 for (int j = 0; j < w; ++j) {
265 pred8[i * w + j] = rnd_.Rand8();
266 ref8[i * w + j] = rnd_.Rand8();
268 const int in_w = block_size_wide[block_idx];
269 const int in_h = block_size_high[block_idx];
271 JNT_COMP_PARAMS jnt_comp_params;
272 jnt_comp_params.use_jnt_comp_avg = 1;
274 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
275 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
277 int sub_x_q3 = 0;
278 int sub_y_q3 = 0;
280 const int num_loops = 1000000000 / (in_w + in_h);
281 aom_usec_timer timer;
282 aom_usec_timer_start(&timer);
284 for (int i = 0; i < num_loops; ++i)
285 aom_jnt_comp_avg_upsampled_pred_c(NULL, NULL, 0, 0, NULL, output, pred8,
286 in_w, in_h, sub_x_q3, sub_y_q3, ref8,
287 in_w, &jnt_comp_params);
289 aom_usec_timer_mark(&timer);
290 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
291 printf("jntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
292 1000.0 * elapsed_time / num_loops);
294 aom_usec_timer timer1;
295 aom_usec_timer_start(&timer1);
297 for (int i = 0; i < num_loops; ++i)
298 test_impl(NULL, NULL, 0, 0, NULL, output2, pred8, in_w, in_h, sub_x_q3,
299 sub_y_q3, ref8, in_w, &jnt_comp_params);
301 aom_usec_timer_mark(&timer1);
302 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
303 printf("jntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
304 1000.0 * elapsed_time1 / num_loops);
307 libaom_test::ACMRandom rnd_;
308 }; // class AV1JNTCOMPAVGUPSAMPLEDTest
310 class AV1HighBDJNTCOMPAVGTest
311 : public ::testing::TestWithParam<HighbdJNTCOMPAVGParam> {
312 public:
313 ~AV1HighBDJNTCOMPAVGTest() {}
314 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
316 void TearDown() { libaom_test::ClearSystemState(); }
318 protected:
319 void RunCheckOutput(highbdjntcompavg_func test_impl) {
320 const int w = kMaxSize, h = kMaxSize;
321 const int block_idx = GET_PARAM(2);
322 const int bd = GET_PARAM(0);
323 uint16_t pred8[kMaxSize * kMaxSize];
324 uint16_t ref8[kMaxSize * kMaxSize];
325 uint16_t output[kMaxSize * kMaxSize];
326 uint16_t output2[kMaxSize * kMaxSize];
328 for (int i = 0; i < h; ++i)
329 for (int j = 0; j < w; ++j) {
330 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
331 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
333 const int in_w = block_size_wide[block_idx];
334 const int in_h = block_size_high[block_idx];
336 JNT_COMP_PARAMS jnt_comp_params;
337 jnt_comp_params.use_jnt_comp_avg = 1;
339 for (int ii = 0; ii < 2; ii++) {
340 for (int jj = 0; jj < 4; jj++) {
341 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
342 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
344 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
345 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
346 aom_highbd_jnt_comp_avg_pred_c(
347 output, CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
348 in_h, CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w,
349 &jnt_comp_params);
350 test_impl(output2, CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c,
351 in_w, in_h,
352 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w,
353 &jnt_comp_params);
355 for (int i = 0; i < in_h; ++i) {
356 for (int j = 0; j < in_w; ++j) {
357 int idx = i * in_w + j;
358 ASSERT_EQ(output[idx], output2[idx])
359 << "Mismatch at unit tests for AV1HighBDJNTCOMPAVGTest\n"
360 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
361 << " = (" << i << ", " << j << ")";
367 void RunSpeedTest(highbdjntcompavg_func test_impl) {
368 const int w = kMaxSize, h = kMaxSize;
369 const int block_idx = GET_PARAM(2);
370 const int bd = GET_PARAM(0);
371 uint16_t pred8[kMaxSize * kMaxSize];
372 uint16_t ref8[kMaxSize * kMaxSize];
373 uint16_t output[kMaxSize * kMaxSize];
374 uint16_t output2[kMaxSize * kMaxSize];
376 for (int i = 0; i < h; ++i)
377 for (int j = 0; j < w; ++j) {
378 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
379 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
381 const int in_w = block_size_wide[block_idx];
382 const int in_h = block_size_high[block_idx];
384 JNT_COMP_PARAMS jnt_comp_params;
385 jnt_comp_params.use_jnt_comp_avg = 1;
387 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
388 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
390 const int num_loops = 1000000000 / (in_w + in_h);
391 aom_usec_timer timer;
392 aom_usec_timer_start(&timer);
394 for (int i = 0; i < num_loops; ++i)
395 aom_highbd_jnt_comp_avg_pred_c(output, CONVERT_TO_BYTEPTR(pred8), in_w,
396 in_h, CONVERT_TO_BYTEPTR(ref8), in_w,
397 &jnt_comp_params);
399 aom_usec_timer_mark(&timer);
400 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
401 printf("highbdjntcompavg c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
402 1000.0 * elapsed_time / num_loops);
404 aom_usec_timer timer1;
405 aom_usec_timer_start(&timer1);
407 for (int i = 0; i < num_loops; ++i)
408 test_impl(output2, CONVERT_TO_BYTEPTR(pred8), in_w, in_h,
409 CONVERT_TO_BYTEPTR(ref8), in_w, &jnt_comp_params);
411 aom_usec_timer_mark(&timer1);
412 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
413 printf("highbdjntcompavg test_code %3dx%-3d: %7.2f us\n", in_w, in_h,
414 1000.0 * elapsed_time1 / num_loops);
417 libaom_test::ACMRandom rnd_;
418 }; // class AV1HighBDJNTCOMPAVGTest
420 class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
421 : public ::testing::TestWithParam<HighbdJNTCOMPAVGUPSAMPLEDParam> {
422 public:
423 ~AV1HighBDJNTCOMPAVGUPSAMPLEDTest() {}
424 void SetUp() { rnd_.Reset(ACMRandom::DeterministicSeed()); }
425 void TearDown() { libaom_test::ClearSystemState(); }
427 protected:
428 void RunCheckOutput(highbdjntcompavgupsampled_func test_impl) {
429 const int w = kMaxSize, h = kMaxSize;
430 const int block_idx = GET_PARAM(2);
431 const int bd = GET_PARAM(0);
432 uint16_t pred8[kMaxSize * kMaxSize];
433 uint16_t ref8[kMaxSize * kMaxSize];
434 uint16_t output[kMaxSize * kMaxSize];
435 uint16_t output2[kMaxSize * kMaxSize];
437 for (int i = 0; i < h; ++i)
438 for (int j = 0; j < w; ++j) {
439 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
440 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
442 const int in_w = block_size_wide[block_idx];
443 const int in_h = block_size_high[block_idx];
445 JNT_COMP_PARAMS jnt_comp_params;
446 jnt_comp_params.use_jnt_comp_avg = 1;
447 int sub_x_q3, sub_y_q3;
449 for (sub_x_q3 = 0; sub_x_q3 < 8; ++sub_x_q3) {
450 for (sub_y_q3 = 0; sub_y_q3 < 8; ++sub_y_q3) {
451 for (int ii = 0; ii < 2; ii++) {
452 for (int jj = 0; jj < 4; jj++) {
453 jnt_comp_params.fwd_offset = quant_dist_lookup_table[ii][jj][0];
454 jnt_comp_params.bck_offset = quant_dist_lookup_table[ii][jj][1];
456 const int offset_r = 3 + rnd_.PseudoUniform(h - in_h - 7);
457 const int offset_c = 3 + rnd_.PseudoUniform(w - in_w - 7);
459 aom_highbd_jnt_comp_avg_upsampled_pred_c(
460 NULL, NULL, 0, 0, NULL, output,
461 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w, in_h,
462 sub_x_q3, sub_y_q3,
463 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w, bd,
464 &jnt_comp_params);
465 test_impl(NULL, NULL, 0, 0, NULL, output2,
466 CONVERT_TO_BYTEPTR(pred8) + offset_r * w + offset_c, in_w,
467 in_h, sub_x_q3, sub_y_q3,
468 CONVERT_TO_BYTEPTR(ref8) + offset_r * w + offset_c, in_w,
469 bd, &jnt_comp_params);
471 for (int i = 0; i < in_h; ++i) {
472 for (int j = 0; j < in_w; ++j) {
473 int idx = i * in_w + j;
474 ASSERT_EQ(output[idx], output2[idx])
475 << "Mismatch at unit tests for "
476 "AV1HighBDJNTCOMPAVGUPSAMPLEDTest\n"
477 << in_w << "x" << in_h << " Pixel mismatch at index " << idx
478 << " = (" << i << ", " << j << "), sub pixel offset = ("
479 << sub_y_q3 << ", " << sub_x_q3 << ")";
487 void RunSpeedTest(highbdjntcompavgupsampled_func test_impl) {
488 const int w = kMaxSize, h = kMaxSize;
489 const int block_idx = GET_PARAM(2);
490 const int bd = GET_PARAM(0);
491 uint16_t pred8[kMaxSize * kMaxSize];
492 uint16_t ref8[kMaxSize * kMaxSize];
493 uint16_t output[kMaxSize * kMaxSize];
494 uint16_t output2[kMaxSize * kMaxSize];
496 for (int i = 0; i < h; ++i)
497 for (int j = 0; j < w; ++j) {
498 pred8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
499 ref8[i * w + j] = rnd_.Rand16() & ((1 << bd) - 1);
501 const int in_w = block_size_wide[block_idx];
502 const int in_h = block_size_high[block_idx];
504 JNT_COMP_PARAMS jnt_comp_params;
505 jnt_comp_params.use_jnt_comp_avg = 1;
507 jnt_comp_params.fwd_offset = quant_dist_lookup_table[0][0][0];
508 jnt_comp_params.bck_offset = quant_dist_lookup_table[0][0][1];
509 int sub_x_q3 = 0;
510 int sub_y_q3 = 0;
511 const int num_loops = 1000000000 / (in_w + in_h);
512 aom_usec_timer timer;
513 aom_usec_timer_start(&timer);
515 for (int i = 0; i < num_loops; ++i)
516 aom_highbd_jnt_comp_avg_upsampled_pred_c(
517 NULL, NULL, 0, 0, NULL, output, CONVERT_TO_BYTEPTR(pred8), in_w, in_h,
518 sub_x_q3, sub_y_q3, CONVERT_TO_BYTEPTR(ref8), in_w, bd,
519 &jnt_comp_params);
521 aom_usec_timer_mark(&timer);
522 const int elapsed_time = static_cast<int>(aom_usec_timer_elapsed(&timer));
523 printf("highbdjntcompavgupsampled c_code %3dx%-3d: %7.2f us\n", in_w, in_h,
524 1000.0 * elapsed_time / num_loops);
526 aom_usec_timer timer1;
527 aom_usec_timer_start(&timer1);
529 for (int i = 0; i < num_loops; ++i)
530 test_impl(NULL, NULL, 0, 0, NULL, output2, CONVERT_TO_BYTEPTR(pred8),
531 in_w, in_h, sub_x_q3, sub_y_q3, CONVERT_TO_BYTEPTR(ref8), in_w,
532 bd, &jnt_comp_params);
534 aom_usec_timer_mark(&timer1);
535 const int elapsed_time1 = static_cast<int>(aom_usec_timer_elapsed(&timer1));
536 printf("highbdjntcompavgupsampled test_code %3dx%-3d: %7.2f us\n", in_w,
537 in_h, 1000.0 * elapsed_time1 / num_loops);
540 libaom_test::ACMRandom rnd_;
541 }; // class AV1HighBDJNTCOMPAVGUPSAMPLEDTest
543 } // namespace AV1JNTCOMPAVG
544 } // namespace libaom_test
546 #endif // TEST_COMP_AVG_PRED_TEST_H_