blob: 327dab78e0b14d49289dcb7430c6e92ee29a8558 [file] [log] [blame]
John Koleszar5ca6a362013-01-25 09:47:09 -08001/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Tero Rintaluomae326cec2013-08-22 11:29:19 +030011#include <string.h>
James Zern8fb48af2013-05-02 13:08:19 -070012#include "test/acm_random.h"
Jim Bankoski18d32362014-12-12 06:18:56 -080013#include "test/clear_system_state.h"
James Zern8fb48af2013-05-02 13:08:19 -070014#include "test/register_state_check.h"
15#include "test/util.h"
16#include "third_party/googletest/src/include/gtest/gtest.h"
John Koleszar5ca6a362013-01-25 09:47:09 -080017
John Koleszar5ca6a362013-01-25 09:47:09 -080018#include "./vpx_config.h"
19#include "./vp9_rtcd.h"
Johann1c3594c2014-12-09 12:05:15 -080020#include "vp9/common/vp9_common.h"
John Koleszar557a1b22013-02-20 16:13:01 -080021#include "vp9/common/vp9_filter.h"
John Koleszar29d47ac2013-02-07 17:00:37 -080022#include "vpx_mem/vpx_mem.h"
John Koleszar6fd7dd12013-02-20 15:59:20 -080023#include "vpx_ports/mem.h"
John Koleszar5ca6a362013-01-25 09:47:09 -080024
25namespace {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070026
hkuangdb71c1b2014-09-19 22:47:28 -070027static const unsigned int kMaxDimension = 64;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070028
James Zerndfc4e8f2014-07-16 18:48:20 -070029typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
30 uint8_t *dst, ptrdiff_t dst_stride,
31 const int16_t *filter_x, int filter_x_stride,
32 const int16_t *filter_y, int filter_y_stride,
33 int w, int h);
John Koleszar5ca6a362013-01-25 09:47:09 -080034
35struct ConvolveFunctions {
Johann1c3594c2014-12-09 12:05:15 -080036 ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg,
37 ConvolveFunc h8, ConvolveFunc h8_avg,
James Zerndfc4e8f2014-07-16 18:48:20 -070038 ConvolveFunc v8, ConvolveFunc v8_avg,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070039 ConvolveFunc hv8, ConvolveFunc hv8_avg,
40 int bd)
Johann1c3594c2014-12-09 12:05:15 -080041 : copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),
42 v8_avg_(v8_avg), hv8_avg_(hv8_avg), use_highbd_(bd) {}
John Koleszar5ca6a362013-01-25 09:47:09 -080043
Johann1c3594c2014-12-09 12:05:15 -080044 ConvolveFunc copy_;
45 ConvolveFunc avg_;
James Zerndfc4e8f2014-07-16 18:48:20 -070046 ConvolveFunc h8_;
47 ConvolveFunc v8_;
48 ConvolveFunc hv8_;
49 ConvolveFunc h8_avg_;
50 ConvolveFunc v8_avg_;
51 ConvolveFunc hv8_avg_;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -070052 int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
John Koleszar5ca6a362013-01-25 09:47:09 -080053};
54
James Zerndfc4e8f2014-07-16 18:48:20 -070055typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
Joshua Litt51490e52013-11-18 17:07:55 -080056
John Koleszar5ca6a362013-01-25 09:47:09 -080057// Reference 8-tap subpixel filter, slightly modified to fit into this test.
58#define VP9_FILTER_WEIGHT 128
59#define VP9_FILTER_SHIFT 7
James Zern8fb48af2013-05-02 13:08:19 -070060uint8_t clip_pixel(int x) {
John Koleszar5ca6a362013-01-25 09:47:09 -080061 return x < 0 ? 0 :
62 x > 255 ? 255 :
63 x;
64}
65
James Zern8fb48af2013-05-02 13:08:19 -070066void filter_block2d_8_c(const uint8_t *src_ptr,
67 const unsigned int src_stride,
68 const int16_t *HFilter,
69 const int16_t *VFilter,
70 uint8_t *dst_ptr,
71 unsigned int dst_stride,
72 unsigned int output_width,
73 unsigned int output_height) {
John Koleszar5ca6a362013-01-25 09:47:09 -080074 // Between passes, we use an intermediate buffer whose height is extended to
75 // have enough horizontally filtered values as input for the vertical pass.
76 // This buffer is allocated to be big enough for the largest block type we
77 // support.
78 const int kInterp_Extend = 4;
79 const unsigned int intermediate_height =
James Zern8fb48af2013-05-02 13:08:19 -070080 (kInterp_Extend - 1) + output_height + kInterp_Extend;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070081 unsigned int i, j;
John Koleszar5ca6a362013-01-25 09:47:09 -080082
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070083 // Size of intermediate_buffer is max_intermediate_height * filter_max_width,
84 // where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
85 // + kInterp_Extend
86 // = 3 + 16 + 4
87 // = 23
88 // and filter_max_width = 16
89 //
90 uint8_t intermediate_buffer[71 * kMaxDimension];
John Koleszar5ca6a362013-01-25 09:47:09 -080091 const int intermediate_next_stride = 1 - intermediate_height * output_width;
92
93 // Horizontal pass (src -> transposed intermediate).
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070094 uint8_t *output_ptr = intermediate_buffer;
95 const int src_next_row_stride = src_stride - output_width;
96 src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
97 for (i = 0; i < intermediate_height; ++i) {
98 for (j = 0; j < output_width; ++j) {
99 // Apply filter...
100 const int temp = (src_ptr[0] * HFilter[0]) +
101 (src_ptr[1] * HFilter[1]) +
102 (src_ptr[2] * HFilter[2]) +
103 (src_ptr[3] * HFilter[3]) +
104 (src_ptr[4] * HFilter[4]) +
105 (src_ptr[5] * HFilter[5]) +
106 (src_ptr[6] * HFilter[6]) +
107 (src_ptr[7] * HFilter[7]) +
108 (VP9_FILTER_WEIGHT >> 1); // Rounding
John Koleszar5ca6a362013-01-25 09:47:09 -0800109
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700110 // Normalize back to 0-255...
111 *output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
112 ++src_ptr;
113 output_ptr += intermediate_height;
John Koleszar5ca6a362013-01-25 09:47:09 -0800114 }
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700115 src_ptr += src_next_row_stride;
116 output_ptr += intermediate_next_stride;
John Koleszar5ca6a362013-01-25 09:47:09 -0800117 }
118
119 // Vertical pass (transposed intermediate -> dst).
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700120 src_ptr = intermediate_buffer;
121 const int dst_next_row_stride = dst_stride - output_width;
122 for (i = 0; i < output_height; ++i) {
123 for (j = 0; j < output_width; ++j) {
124 // Apply filter...
125 const int temp = (src_ptr[0] * VFilter[0]) +
126 (src_ptr[1] * VFilter[1]) +
127 (src_ptr[2] * VFilter[2]) +
128 (src_ptr[3] * VFilter[3]) +
129 (src_ptr[4] * VFilter[4]) +
130 (src_ptr[5] * VFilter[5]) +
131 (src_ptr[6] * VFilter[6]) +
132 (src_ptr[7] * VFilter[7]) +
133 (VP9_FILTER_WEIGHT >> 1); // Rounding
John Koleszar5ca6a362013-01-25 09:47:09 -0800134
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700135 // Normalize back to 0-255...
136 *dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
137 src_ptr += intermediate_height;
John Koleszar5ca6a362013-01-25 09:47:09 -0800138 }
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700139 src_ptr += intermediate_next_stride;
140 dst_ptr += dst_next_row_stride;
John Koleszar5ca6a362013-01-25 09:47:09 -0800141 }
142}
143
James Zern8fb48af2013-05-02 13:08:19 -0700144void block2d_average_c(uint8_t *src,
145 unsigned int src_stride,
146 uint8_t *output_ptr,
147 unsigned int output_stride,
148 unsigned int output_width,
149 unsigned int output_height) {
John Koleszar5ca6a362013-01-25 09:47:09 -0800150 unsigned int i, j;
151 for (i = 0; i < output_height; ++i) {
152 for (j = 0; j < output_width; ++j) {
153 output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
154 }
155 output_ptr += output_stride;
156 }
157}
158
James Zern8fb48af2013-05-02 13:08:19 -0700159void filter_average_block2d_8_c(const uint8_t *src_ptr,
160 const unsigned int src_stride,
161 const int16_t *HFilter,
162 const int16_t *VFilter,
163 uint8_t *dst_ptr,
164 unsigned int dst_stride,
165 unsigned int output_width,
166 unsigned int output_height) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700167 uint8_t tmp[kMaxDimension * kMaxDimension];
John Koleszar5ca6a362013-01-25 09:47:09 -0800168
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700169 assert(output_width <= kMaxDimension);
170 assert(output_height <= kMaxDimension);
John Koleszara9ebbcc2013-04-18 13:05:38 -0700171 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
John Koleszar5ca6a362013-01-25 09:47:09 -0800172 output_width, output_height);
John Koleszara9ebbcc2013-04-18 13:05:38 -0700173 block2d_average_c(tmp, 64, dst_ptr, dst_stride,
John Koleszar5ca6a362013-01-25 09:47:09 -0800174 output_width, output_height);
175}
176
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700177#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700178void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
179 const unsigned int src_stride,
180 const int16_t *HFilter,
181 const int16_t *VFilter,
182 uint16_t *dst_ptr,
183 unsigned int dst_stride,
184 unsigned int output_width,
185 unsigned int output_height,
186 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700187 // Between passes, we use an intermediate buffer whose height is extended to
188 // have enough horizontally filtered values as input for the vertical pass.
189 // This buffer is allocated to be big enough for the largest block type we
190 // support.
191 const int kInterp_Extend = 4;
192 const unsigned int intermediate_height =
193 (kInterp_Extend - 1) + output_height + kInterp_Extend;
194
195 /* Size of intermediate_buffer is max_intermediate_height * filter_max_width,
196 * where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
197 * + kInterp_Extend
198 * = 3 + 16 + 4
199 * = 23
200 * and filter_max_width = 16
201 */
202 uint16_t intermediate_buffer[71 * kMaxDimension];
203 const int intermediate_next_stride = 1 - intermediate_height * output_width;
204
205 // Horizontal pass (src -> transposed intermediate).
206 {
207 uint16_t *output_ptr = intermediate_buffer;
208 const int src_next_row_stride = src_stride - output_width;
209 unsigned int i, j;
210 src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
211 for (i = 0; i < intermediate_height; ++i) {
212 for (j = 0; j < output_width; ++j) {
213 // Apply filter...
214 const int temp = (src_ptr[0] * HFilter[0]) +
215 (src_ptr[1] * HFilter[1]) +
216 (src_ptr[2] * HFilter[2]) +
217 (src_ptr[3] * HFilter[3]) +
218 (src_ptr[4] * HFilter[4]) +
219 (src_ptr[5] * HFilter[5]) +
220 (src_ptr[6] * HFilter[6]) +
221 (src_ptr[7] * HFilter[7]) +
222 (VP9_FILTER_WEIGHT >> 1); // Rounding
223
224 // Normalize back to 0-255...
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700225 *output_ptr = clip_pixel_highbd(temp >> VP9_FILTER_SHIFT, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700226 ++src_ptr;
227 output_ptr += intermediate_height;
228 }
229 src_ptr += src_next_row_stride;
230 output_ptr += intermediate_next_stride;
231 }
232 }
233
234 // Vertical pass (transposed intermediate -> dst).
235 {
236 uint16_t *src_ptr = intermediate_buffer;
237 const int dst_next_row_stride = dst_stride - output_width;
238 unsigned int i, j;
239 for (i = 0; i < output_height; ++i) {
240 for (j = 0; j < output_width; ++j) {
241 // Apply filter...
242 const int temp = (src_ptr[0] * VFilter[0]) +
243 (src_ptr[1] * VFilter[1]) +
244 (src_ptr[2] * VFilter[2]) +
245 (src_ptr[3] * VFilter[3]) +
246 (src_ptr[4] * VFilter[4]) +
247 (src_ptr[5] * VFilter[5]) +
248 (src_ptr[6] * VFilter[6]) +
249 (src_ptr[7] * VFilter[7]) +
250 (VP9_FILTER_WEIGHT >> 1); // Rounding
251
252 // Normalize back to 0-255...
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700253 *dst_ptr++ = clip_pixel_highbd(temp >> VP9_FILTER_SHIFT, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700254 src_ptr += intermediate_height;
255 }
256 src_ptr += intermediate_next_stride;
257 dst_ptr += dst_next_row_stride;
258 }
259 }
260}
261
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700262void highbd_block2d_average_c(uint16_t *src,
263 unsigned int src_stride,
264 uint16_t *output_ptr,
265 unsigned int output_stride,
266 unsigned int output_width,
267 unsigned int output_height,
268 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700269 unsigned int i, j;
270 for (i = 0; i < output_height; ++i) {
271 for (j = 0; j < output_width; ++j) {
272 output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
273 }
274 output_ptr += output_stride;
275 }
276}
277
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700278void highbd_filter_average_block2d_8_c(const uint16_t *src_ptr,
279 const unsigned int src_stride,
280 const int16_t *HFilter,
281 const int16_t *VFilter,
282 uint16_t *dst_ptr,
283 unsigned int dst_stride,
284 unsigned int output_width,
285 unsigned int output_height,
286 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700287 uint16_t tmp[kMaxDimension * kMaxDimension];
288
289 assert(output_width <= kMaxDimension);
290 assert(output_height <= kMaxDimension);
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700291 highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
292 output_width, output_height, bd);
293 highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride,
294 output_width, output_height, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700295}
296#endif // CONFIG_VP9_HIGHBITDEPTH
297
James Zerndfc4e8f2014-07-16 18:48:20 -0700298class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
John Koleszar29d47ac2013-02-07 17:00:37 -0800299 public:
300 static void SetUpTestCase() {
301 // Force input_ to be unaligned, output to be 16 byte aligned.
302 input_ = reinterpret_cast<uint8_t*>(
James Zernb0e57752013-05-02 12:29:34 -0700303 vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
John Koleszar29d47ac2013-02-07 17:00:37 -0800304 output_ = reinterpret_cast<uint8_t*>(
James Zernb0e57752013-05-02 12:29:34 -0700305 vpx_memalign(kDataAlignment, kOutputBufferSize));
Johann1c3594c2014-12-09 12:05:15 -0800306 output_ref_ = reinterpret_cast<uint8_t*>(
307 vpx_memalign(kDataAlignment, kOutputBufferSize));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700308#if CONFIG_VP9_HIGHBITDEPTH
309 input16_ = reinterpret_cast<uint16_t*>(
310 vpx_memalign(kDataAlignment,
311 (kInputBufferSize + 1) * sizeof(uint16_t))) + 1;
312 output16_ = reinterpret_cast<uint16_t*>(
313 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
Johann1c3594c2014-12-09 12:05:15 -0800314 output16_ref_ = reinterpret_cast<uint16_t*>(
315 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700316#endif
John Koleszar29d47ac2013-02-07 17:00:37 -0800317 }
318
Jim Bankoski18d32362014-12-12 06:18:56 -0800319 virtual void TearDown() { libvpx_test::ClearSystemState(); }
320
John Koleszar29d47ac2013-02-07 17:00:37 -0800321 static void TearDownTestCase() {
322 vpx_free(input_ - 1);
323 input_ = NULL;
324 vpx_free(output_);
325 output_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800326 vpx_free(output_ref_);
327 output_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700328#if CONFIG_VP9_HIGHBITDEPTH
329 vpx_free(input16_ - 1);
330 input16_ = NULL;
331 vpx_free(output16_);
332 output16_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800333 vpx_free(output16_ref_);
334 output16_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700335#endif
John Koleszar29d47ac2013-02-07 17:00:37 -0800336 }
337
James Zern8fb48af2013-05-02 13:08:19 -0700338 protected:
339 static const int kDataAlignment = 16;
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300340 static const int kOuterBlockSize = 256;
James Zern8fb48af2013-05-02 13:08:19 -0700341 static const int kInputStride = kOuterBlockSize;
342 static const int kOutputStride = kOuterBlockSize;
James Zern8fb48af2013-05-02 13:08:19 -0700343 static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
344 static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
John Koleszar5ca6a362013-01-25 09:47:09 -0800345
James Zern8fb48af2013-05-02 13:08:19 -0700346 int Width() const { return GET_PARAM(0); }
347 int Height() const { return GET_PARAM(1); }
348 int BorderLeft() const {
349 const int center = (kOuterBlockSize - Width()) / 2;
350 return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
351 }
352 int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
John Koleszar5ca6a362013-01-25 09:47:09 -0800353
James Zern8fb48af2013-05-02 13:08:19 -0700354 bool IsIndexInBorder(int i) {
355 return (i < BorderTop() * kOuterBlockSize ||
356 i >= (BorderTop() + Height()) * kOuterBlockSize ||
357 i % kOuterBlockSize < BorderLeft() ||
358 i % kOuterBlockSize >= (BorderLeft() + Width()));
359 }
360
361 virtual void SetUp() {
362 UUT_ = GET_PARAM(2);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700363#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700364 if (UUT_->use_highbd_ != 0)
365 mask_ = (1 << UUT_->use_highbd_) - 1;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700366 else
367 mask_ = 255;
368#endif
Johann158c80c2013-05-23 12:50:41 -0700369 /* Set up guard blocks for an inner block centered in the outer block */
James Zern8fb48af2013-05-02 13:08:19 -0700370 for (int i = 0; i < kOutputBufferSize; ++i) {
371 if (IsIndexInBorder(i))
372 output_[i] = 255;
373 else
374 output_[i] = 0;
John Koleszar5ca6a362013-01-25 09:47:09 -0800375 }
376
James Zern8fb48af2013-05-02 13:08:19 -0700377 ::libvpx_test::ACMRandom prng;
Yaowu Xu077144d2014-05-23 12:23:29 -0700378 for (int i = 0; i < kInputBufferSize; ++i) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700379 if (i & 1) {
Yaowu Xu077144d2014-05-23 12:23:29 -0700380 input_[i] = 255;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700381#if CONFIG_VP9_HIGHBITDEPTH
382 input16_[i] = mask_;
383#endif
384 } else {
Yaowu Xu077144d2014-05-23 12:23:29 -0700385 input_[i] = prng.Rand8Extremes();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700386#if CONFIG_VP9_HIGHBITDEPTH
387 input16_[i] = prng.Rand16() & mask_;
388#endif
389 }
Yaowu Xu077144d2014-05-23 12:23:29 -0700390 }
James Zern8fb48af2013-05-02 13:08:19 -0700391 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800392
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300393 void SetConstantInput(int value) {
394 memset(input_, value, kInputBufferSize);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700395#if CONFIG_VP9_HIGHBITDEPTH
396 vpx_memset16(input16_, value, kInputBufferSize);
397#endif
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300398 }
399
Johann1c3594c2014-12-09 12:05:15 -0800400 void CopyOutputToRef() {
James Zernf274c212015-04-23 20:42:19 -0700401 memcpy(output_ref_, output_, kOutputBufferSize);
Johann1c3594c2014-12-09 12:05:15 -0800402#if CONFIG_VP9_HIGHBITDEPTH
James Zernf274c212015-04-23 20:42:19 -0700403 memcpy(output16_ref_, output16_, kOutputBufferSize);
Johann1c3594c2014-12-09 12:05:15 -0800404#endif
405 }
406
James Zern8fb48af2013-05-02 13:08:19 -0700407 void CheckGuardBlocks() {
408 for (int i = 0; i < kOutputBufferSize; ++i) {
409 if (IsIndexInBorder(i))
410 EXPECT_EQ(255, output_[i]);
John Koleszar5ca6a362013-01-25 09:47:09 -0800411 }
James Zern8fb48af2013-05-02 13:08:19 -0700412 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800413
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700414 uint8_t *input() const {
415#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700416 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700417 return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
418 } else {
419 return CONVERT_TO_BYTEPTR(input16_ + BorderTop() * kOuterBlockSize +
420 BorderLeft());
421 }
422#else
James Zern8fb48af2013-05-02 13:08:19 -0700423 return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700424#endif
James Zern8fb48af2013-05-02 13:08:19 -0700425 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800426
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700427 uint8_t *output() const {
428#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700429 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700430 return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
431 } else {
432 return CONVERT_TO_BYTEPTR(output16_ + BorderTop() * kOuterBlockSize +
433 BorderLeft());
434 }
435#else
James Zern8fb48af2013-05-02 13:08:19 -0700436 return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700437#endif
438 }
439
Johann1c3594c2014-12-09 12:05:15 -0800440 uint8_t *output_ref() const {
441#if CONFIG_VP9_HIGHBITDEPTH
442 if (UUT_->use_highbd_ == 0) {
443 return output_ref_ + BorderTop() * kOuterBlockSize + BorderLeft();
444 } else {
445 return CONVERT_TO_BYTEPTR(output16_ref_ + BorderTop() * kOuterBlockSize +
446 BorderLeft());
447 }
448#else
449 return output_ref_ + BorderTop() * kOuterBlockSize + BorderLeft();
450#endif
451 }
452
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700453 uint16_t lookup(uint8_t *list, int index) const {
454#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700455 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700456 return list[index];
457 } else {
458 return CONVERT_TO_SHORTPTR(list)[index];
459 }
460#else
461 return list[index];
462#endif
463 }
464
465 void assign_val(uint8_t *list, int index, uint16_t val) const {
466#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700467 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700468 list[index] = (uint8_t) val;
469 } else {
470 CONVERT_TO_SHORTPTR(list)[index] = val;
471 }
472#else
473 list[index] = (uint8_t) val;
474#endif
475 }
476
477 void wrapper_filter_average_block2d_8_c(const uint8_t *src_ptr,
478 const unsigned int src_stride,
479 const int16_t *HFilter,
480 const int16_t *VFilter,
481 uint8_t *dst_ptr,
482 unsigned int dst_stride,
483 unsigned int output_width,
484 unsigned int output_height) {
485#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700486 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700487 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
488 dst_ptr, dst_stride, output_width,
489 output_height);
490 } else {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700491 highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr),
492 src_stride, HFilter, VFilter,
493 CONVERT_TO_SHORTPTR(dst_ptr),
494 dst_stride, output_width, output_height,
495 UUT_->use_highbd_);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700496 }
497#else
498 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
499 dst_ptr, dst_stride, output_width,
500 output_height);
501#endif
502 }
503
504 void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
505 const unsigned int src_stride,
506 const int16_t *HFilter,
507 const int16_t *VFilter,
508 uint8_t *dst_ptr,
509 unsigned int dst_stride,
510 unsigned int output_width,
511 unsigned int output_height) {
512#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700513 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700514 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
515 dst_ptr, dst_stride, output_width, output_height);
516 } else {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700517 highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
518 HFilter, VFilter,
519 CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,
520 output_width, output_height, UUT_->use_highbd_);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700521 }
522#else
523 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
524 dst_ptr, dst_stride, output_width, output_height);
525#endif
James Zern8fb48af2013-05-02 13:08:19 -0700526 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800527
James Zern8fb48af2013-05-02 13:08:19 -0700528 const ConvolveFunctions* UUT_;
529 static uint8_t* input_;
530 static uint8_t* output_;
Johann1c3594c2014-12-09 12:05:15 -0800531 static uint8_t* output_ref_;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700532#if CONFIG_VP9_HIGHBITDEPTH
533 static uint16_t* input16_;
534 static uint16_t* output16_;
Johann1c3594c2014-12-09 12:05:15 -0800535 static uint16_t* output16_ref_;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700536 int mask_;
537#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800538};
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700539
John Koleszar29d47ac2013-02-07 17:00:37 -0800540uint8_t* ConvolveTest::input_ = NULL;
541uint8_t* ConvolveTest::output_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800542uint8_t* ConvolveTest::output_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700543#if CONFIG_VP9_HIGHBITDEPTH
544uint16_t* ConvolveTest::input16_ = NULL;
545uint16_t* ConvolveTest::output16_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800546uint16_t* ConvolveTest::output16_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700547#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800548
549TEST_P(ConvolveTest, GuardBlocks) {
550 CheckGuardBlocks();
551}
552
Johann1c3594c2014-12-09 12:05:15 -0800553TEST_P(ConvolveTest, Copy) {
554 uint8_t* const in = input();
555 uint8_t* const out = output();
556
557 ASM_REGISTER_STATE_CHECK(
558 UUT_->copy_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
559 Width(), Height()));
560
561 CheckGuardBlocks();
562
563 for (int y = 0; y < Height(); ++y)
564 for (int x = 0; x < Width(); ++x)
565 ASSERT_EQ(lookup(out, y * kOutputStride + x),
566 lookup(in, y * kInputStride + x))
567 << "(" << x << "," << y << ")";
568}
569
570TEST_P(ConvolveTest, Avg) {
571 uint8_t* const in = input();
572 uint8_t* const out = output();
573 uint8_t* const out_ref = output_ref();
574 CopyOutputToRef();
575
576 ASM_REGISTER_STATE_CHECK(
577 UUT_->avg_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
578 Width(), Height()));
579
580 CheckGuardBlocks();
581
582 for (int y = 0; y < Height(); ++y)
583 for (int x = 0; x < Width(); ++x)
584 ASSERT_EQ(lookup(out, y * kOutputStride + x),
585 ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) +
586 lookup(out_ref, y * kOutputStride + x), 1))
587 << "(" << x << "," << y << ")";
588}
589
John Koleszar5ca6a362013-01-25 09:47:09 -0800590TEST_P(ConvolveTest, CopyHoriz) {
591 uint8_t* const in = input();
592 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700593 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800594
James Zern29e1b1a2014-07-09 21:02:02 -0700595 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800596 UUT_->h8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
597 Width(), Height()));
598
599 CheckGuardBlocks();
600
601 for (int y = 0; y < Height(); ++y)
602 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700603 ASSERT_EQ(lookup(out, y * kOutputStride + x),
604 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800605 << "(" << x << "," << y << ")";
606}
607
608TEST_P(ConvolveTest, CopyVert) {
609 uint8_t* const in = input();
610 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700611 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800612
James Zern29e1b1a2014-07-09 21:02:02 -0700613 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800614 UUT_->v8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
615 Width(), Height()));
616
617 CheckGuardBlocks();
618
619 for (int y = 0; y < Height(); ++y)
620 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700621 ASSERT_EQ(lookup(out, y * kOutputStride + x),
622 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800623 << "(" << x << "," << y << ")";
624}
625
626TEST_P(ConvolveTest, Copy2D) {
627 uint8_t* const in = input();
628 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700629 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800630
James Zern29e1b1a2014-07-09 21:02:02 -0700631 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800632 UUT_->hv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
633 Width(), Height()));
634
635 CheckGuardBlocks();
636
637 for (int y = 0; y < Height(); ++y)
638 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700639 ASSERT_EQ(lookup(out, y * kOutputStride + x),
640 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800641 << "(" << x << "," << y << ")";
642}
643
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700644const int kNumFilterBanks = 4;
John Koleszara9ebbcc2013-04-18 13:05:38 -0700645const int kNumFilters = 16;
646
647TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
648 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700649 const InterpKernel *filters =
650 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
John Koleszara9ebbcc2013-04-18 13:05:38 -0700651 for (int i = 0; i < kNumFilters; i++) {
652 const int p0 = filters[i][0] + filters[i][1];
653 const int p1 = filters[i][2] + filters[i][3];
654 const int p2 = filters[i][4] + filters[i][5];
655 const int p3 = filters[i][6] + filters[i][7];
656 EXPECT_LE(p0, 128);
657 EXPECT_LE(p1, 128);
658 EXPECT_LE(p2, 128);
659 EXPECT_LE(p3, 128);
660 EXPECT_LE(p0 + p3, 128);
661 EXPECT_LE(p0 + p3 + p1, 128);
662 EXPECT_LE(p0 + p3 + p1 + p2, 128);
663 EXPECT_EQ(p0 + p1 + p2 + p3, 128);
664 }
665 }
666}
John Koleszar557a1b22013-02-20 16:13:01 -0800667
John Koleszar04c24072013-02-20 16:32:02 -0800668const int16_t kInvalidFilter[8] = { 0 };
669
John Koleszar5ca6a362013-01-25 09:47:09 -0800670TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
671 uint8_t* const in = input();
672 uint8_t* const out = output();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700673#if CONFIG_VP9_HIGHBITDEPTH
674 uint8_t ref8[kOutputStride * kMaxDimension];
675 uint16_t ref16[kOutputStride * kMaxDimension];
676 uint8_t* ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700677 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700678 ref = ref8;
679 } else {
680 ref = CONVERT_TO_BYTEPTR(ref16);
681 }
682#else
John Koleszar5ca6a362013-01-25 09:47:09 -0800683 uint8_t ref[kOutputStride * kMaxDimension];
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700684#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800685
John Koleszar557a1b22013-02-20 16:13:01 -0800686 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700687 const InterpKernel *filters =
688 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700689 const InterpKernel *const eighttap_smooth =
690 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
691
John Koleszar557a1b22013-02-20 16:13:01 -0800692 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
693 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700694 wrapper_filter_block2d_8_c(in, kInputStride,
695 filters[filter_x], filters[filter_y],
696 ref, kOutputStride,
697 Width(), Height());
John Koleszar5ca6a362013-01-25 09:47:09 -0800698
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700699 if (filters == eighttap_smooth || (filter_x && filter_y))
James Zern29e1b1a2014-07-09 21:02:02 -0700700 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800701 UUT_->hv8_(in, kInputStride, out, kOutputStride,
702 filters[filter_x], 16, filters[filter_y], 16,
703 Width(), Height()));
704 else if (filter_y)
James Zern29e1b1a2014-07-09 21:02:02 -0700705 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800706 UUT_->v8_(in, kInputStride, out, kOutputStride,
John Koleszar04c24072013-02-20 16:32:02 -0800707 kInvalidFilter, 16, filters[filter_y], 16,
John Koleszar557a1b22013-02-20 16:13:01 -0800708 Width(), Height()));
709 else
James Zern29e1b1a2014-07-09 21:02:02 -0700710 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800711 UUT_->h8_(in, kInputStride, out, kOutputStride,
John Koleszar04c24072013-02-20 16:32:02 -0800712 filters[filter_x], 16, kInvalidFilter, 16,
John Koleszar557a1b22013-02-20 16:13:01 -0800713 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800714
John Koleszar557a1b22013-02-20 16:13:01 -0800715 CheckGuardBlocks();
John Koleszar5ca6a362013-01-25 09:47:09 -0800716
John Koleszar557a1b22013-02-20 16:13:01 -0800717 for (int y = 0; y < Height(); ++y)
718 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700719 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
720 lookup(out, y * kOutputStride + x))
John Koleszar557a1b22013-02-20 16:13:01 -0800721 << "mismatch at (" << x << "," << y << "), "
722 << "filters (" << filter_bank << ","
723 << filter_x << "," << filter_y << ")";
724 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800725 }
726 }
727}
728
729TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
730 uint8_t* const in = input();
731 uint8_t* const out = output();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700732#if CONFIG_VP9_HIGHBITDEPTH
733 uint8_t ref8[kOutputStride * kMaxDimension];
734 uint16_t ref16[kOutputStride * kMaxDimension];
735 uint8_t* ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700736 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700737 ref = ref8;
738 } else {
739 ref = CONVERT_TO_BYTEPTR(ref16);
740 }
741#else
John Koleszar5ca6a362013-01-25 09:47:09 -0800742 uint8_t ref[kOutputStride * kMaxDimension];
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700743#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800744
745 // Populate ref and out with some random data
746 ::libvpx_test::ACMRandom prng;
747 for (int y = 0; y < Height(); ++y) {
748 for (int x = 0; x < Width(); ++x) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700749 uint16_t r;
750#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700751 if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700752 r = prng.Rand8Extremes();
753 } else {
754 r = prng.Rand16() & mask_;
755 }
756#else
757 r = prng.Rand8Extremes();
758#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800759
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700760 assign_val(out, y * kOutputStride + x, r);
761 assign_val(ref, y * kOutputStride + x, r);
John Koleszar5ca6a362013-01-25 09:47:09 -0800762 }
763 }
764
John Koleszar557a1b22013-02-20 16:13:01 -0800765 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700766 const InterpKernel *filters =
767 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700768 const InterpKernel *const eighttap_smooth =
769 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
John Koleszar5ca6a362013-01-25 09:47:09 -0800770
John Koleszar557a1b22013-02-20 16:13:01 -0800771 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
772 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700773 wrapper_filter_average_block2d_8_c(in, kInputStride,
774 filters[filter_x], filters[filter_y],
775 ref, kOutputStride,
776 Width(), Height());
John Koleszar5ca6a362013-01-25 09:47:09 -0800777
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700778 if (filters == eighttap_smooth || (filter_x && filter_y))
James Zern29e1b1a2014-07-09 21:02:02 -0700779 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800780 UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,
781 filters[filter_x], 16, filters[filter_y], 16,
782 Width(), Height()));
783 else if (filter_y)
James Zern29e1b1a2014-07-09 21:02:02 -0700784 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800785 UUT_->v8_avg_(in, kInputStride, out, kOutputStride,
786 filters[filter_x], 16, filters[filter_y], 16,
787 Width(), Height()));
788 else
James Zern29e1b1a2014-07-09 21:02:02 -0700789 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800790 UUT_->h8_avg_(in, kInputStride, out, kOutputStride,
791 filters[filter_x], 16, filters[filter_y], 16,
792 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800793
John Koleszar557a1b22013-02-20 16:13:01 -0800794 CheckGuardBlocks();
John Koleszar5ca6a362013-01-25 09:47:09 -0800795
John Koleszar557a1b22013-02-20 16:13:01 -0800796 for (int y = 0; y < Height(); ++y)
797 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700798 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
799 lookup(out, y * kOutputStride + x))
John Koleszar557a1b22013-02-20 16:13:01 -0800800 << "mismatch at (" << x << "," << y << "), "
801 << "filters (" << filter_bank << ","
802 << filter_x << "," << filter_y << ")";
803 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800804 }
805 }
806}
807
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700808TEST_P(ConvolveTest, FilterExtremes) {
809 uint8_t *const in = input();
810 uint8_t *const out = output();
811#if CONFIG_VP9_HIGHBITDEPTH
812 uint8_t ref8[kOutputStride * kMaxDimension];
813 uint16_t ref16[kOutputStride * kMaxDimension];
814 uint8_t *ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700815 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700816 ref = ref8;
817 } else {
818 ref = CONVERT_TO_BYTEPTR(ref16);
819 }
820#else
821 uint8_t ref[kOutputStride * kMaxDimension];
822#endif
823
824 // Populate ref and out with some random data
825 ::libvpx_test::ACMRandom prng;
826 for (int y = 0; y < Height(); ++y) {
827 for (int x = 0; x < Width(); ++x) {
828 uint16_t r;
829#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700830 if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700831 r = prng.Rand8Extremes();
832 } else {
833 r = prng.Rand16() & mask_;
834 }
835#else
836 r = prng.Rand8Extremes();
837#endif
838 assign_val(out, y * kOutputStride + x, r);
839 assign_val(ref, y * kOutputStride + x, r);
840 }
841 }
842
843 for (int axis = 0; axis < 2; axis++) {
844 int seed_val = 0;
845 while (seed_val < 256) {
846 for (int y = 0; y < 8; ++y) {
847 for (int x = 0; x < 8; ++x) {
848#if CONFIG_VP9_HIGHBITDEPTH
849 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
850 ((seed_val >> (axis ? y : x)) & 1) * mask_);
851#else
852 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
853 ((seed_val >> (axis ? y : x)) & 1) * 255);
854#endif
855 if (axis) seed_val++;
856 }
857 if (axis)
858 seed_val-= 8;
859 else
860 seed_val++;
861 }
862 if (axis) seed_val += 8;
863
864 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
865 const InterpKernel *filters =
866 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
867 const InterpKernel *const eighttap_smooth =
868 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
869 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
870 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
871 wrapper_filter_block2d_8_c(in, kInputStride,
872 filters[filter_x], filters[filter_y],
873 ref, kOutputStride,
874 Width(), Height());
875 if (filters == eighttap_smooth || (filter_x && filter_y))
876 ASM_REGISTER_STATE_CHECK(
877 UUT_->hv8_(in, kInputStride, out, kOutputStride,
878 filters[filter_x], 16, filters[filter_y], 16,
879 Width(), Height()));
880 else if (filter_y)
881 ASM_REGISTER_STATE_CHECK(
882 UUT_->v8_(in, kInputStride, out, kOutputStride,
883 kInvalidFilter, 16, filters[filter_y], 16,
884 Width(), Height()));
885 else
886 ASM_REGISTER_STATE_CHECK(
887 UUT_->h8_(in, kInputStride, out, kOutputStride,
888 filters[filter_x], 16, kInvalidFilter, 16,
889 Width(), Height()));
890
891 for (int y = 0; y < Height(); ++y)
892 for (int x = 0; x < Width(); ++x)
893 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
894 lookup(out, y * kOutputStride + x))
895 << "mismatch at (" << x << "," << y << "), "
896 << "filters (" << filter_bank << ","
897 << filter_x << "," << filter_y << ")";
898 }
899 }
900 }
901 }
902 }
903}
904
John Koleszar6fd7dd12013-02-20 15:59:20 -0800905DECLARE_ALIGNED(256, const int16_t, kChangeFilters[16][8]) = {
906 { 0, 0, 0, 0, 0, 0, 0, 128},
907 { 0, 0, 0, 0, 0, 0, 128},
908 { 0, 0, 0, 0, 0, 128},
909 { 0, 0, 0, 0, 128},
910 { 0, 0, 0, 128},
911 { 0, 0, 128},
912 { 0, 128},
913 { 128},
914 { 0, 0, 0, 0, 0, 0, 0, 128},
915 { 0, 0, 0, 0, 0, 0, 128},
916 { 0, 0, 0, 0, 0, 128},
917 { 0, 0, 0, 0, 128},
918 { 0, 0, 0, 128},
919 { 0, 0, 128},
920 { 0, 128},
921 { 128}
922};
923
Adrian Grange3f108312013-08-22 16:02:18 -0700924/* This test exercises the horizontal and vertical filter functions. */
John Koleszar5ca6a362013-01-25 09:47:09 -0800925TEST_P(ConvolveTest, ChangeFilterWorks) {
926 uint8_t* const in = input();
927 uint8_t* const out = output();
Adrian Grange3f108312013-08-22 16:02:18 -0700928
929 /* Assume that the first input sample is at the 8/16th position. */
930 const int kInitialSubPelOffset = 8;
931
932 /* Filters are 8-tap, so the first filter tap will be applied to the pixel
933 * at position -3 with respect to the current filtering position. Since
934 * kInitialSubPelOffset is set to 8, we first select sub-pixel filter 8,
935 * which is non-zero only in the last tap. So, applying the filter at the
936 * current input position will result in an output equal to the pixel at
937 * offset +4 (-3 + 7) with respect to the current filtering position.
938 */
John Koleszara9ebbcc2013-04-18 13:05:38 -0700939 const int kPixelSelected = 4;
John Koleszar5ca6a362013-01-25 09:47:09 -0800940
Adrian Grange3f108312013-08-22 16:02:18 -0700941 /* Assume that each output pixel requires us to step on by 17/16th pixels in
942 * the input.
943 */
944 const int kInputPixelStep = 17;
945
946 /* The filters are setup in such a way that the expected output produces
947 * sets of 8 identical output samples. As the filter position moves to the
948 * next 1/16th pixel position the only active (=128) filter tap moves one
949 * position to the left, resulting in the same input pixel being replicated
950 * in to the output for 8 consecutive samples. After each set of 8 positions
951 * the filters select a different input pixel. kFilterPeriodAdjust below
952 * computes which input pixel is written to the output for a specified
953 * x or y position.
954 */
955
956 /* Test the horizontal filter. */
James Zern29e1b1a2014-07-09 21:02:02 -0700957 ASM_REGISTER_STATE_CHECK(
958 UUT_->h8_(in, kInputStride, out, kOutputStride,
959 kChangeFilters[kInitialSubPelOffset],
960 kInputPixelStep, NULL, 0, Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800961
John Koleszar6fd7dd12013-02-20 15:59:20 -0800962 for (int x = 0; x < Width(); ++x) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700963 const int kFilterPeriodAdjust = (x >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700964 const int ref_x =
965 kPixelSelected + ((kInitialSubPelOffset
966 + kFilterPeriodAdjust * kInputPixelStep)
967 >> SUBPEL_BITS);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700968 ASSERT_EQ(lookup(in, ref_x), lookup(out, x))
969 << "x == " << x << "width = " << Width();
John Koleszar5ca6a362013-01-25 09:47:09 -0800970 }
971
Adrian Grange3f108312013-08-22 16:02:18 -0700972 /* Test the vertical filter. */
James Zern29e1b1a2014-07-09 21:02:02 -0700973 ASM_REGISTER_STATE_CHECK(
974 UUT_->v8_(in, kInputStride, out, kOutputStride,
975 NULL, 0, kChangeFilters[kInitialSubPelOffset],
976 kInputPixelStep, Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800977
John Koleszar6fd7dd12013-02-20 15:59:20 -0800978 for (int y = 0; y < Height(); ++y) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700979 const int kFilterPeriodAdjust = (y >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700980 const int ref_y =
981 kPixelSelected + ((kInitialSubPelOffset
982 + kFilterPeriodAdjust * kInputPixelStep)
983 >> SUBPEL_BITS);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700984 ASSERT_EQ(lookup(in, ref_y * kInputStride), lookup(out, y * kInputStride))
985 << "y == " << y;
John Koleszar5ca6a362013-01-25 09:47:09 -0800986 }
987
Adrian Grange3f108312013-08-22 16:02:18 -0700988 /* Test the horizontal and vertical filters in combination. */
James Zern29e1b1a2014-07-09 21:02:02 -0700989 ASM_REGISTER_STATE_CHECK(
990 UUT_->hv8_(in, kInputStride, out, kOutputStride,
991 kChangeFilters[kInitialSubPelOffset], kInputPixelStep,
992 kChangeFilters[kInitialSubPelOffset], kInputPixelStep,
993 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800994
John Koleszar6fd7dd12013-02-20 15:59:20 -0800995 for (int y = 0; y < Height(); ++y) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700996 const int kFilterPeriodAdjustY = (y >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700997 const int ref_y =
998 kPixelSelected + ((kInitialSubPelOffset
999 + kFilterPeriodAdjustY * kInputPixelStep)
1000 >> SUBPEL_BITS);
John Koleszar6fd7dd12013-02-20 15:59:20 -08001001 for (int x = 0; x < Width(); ++x) {
John Koleszara9ebbcc2013-04-18 13:05:38 -07001002 const int kFilterPeriodAdjustX = (x >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -07001003 const int ref_x =
1004 kPixelSelected + ((kInitialSubPelOffset
1005 + kFilterPeriodAdjustX * kInputPixelStep)
1006 >> SUBPEL_BITS);
John Koleszar6fd7dd12013-02-20 15:59:20 -08001007
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001008 ASSERT_EQ(lookup(in, ref_y * kInputStride + ref_x),
1009 lookup(out, y * kOutputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -08001010 << "x == " << x << ", y == " << y;
1011 }
1012 }
1013}
1014
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001015/* This test exercises that enough rows and columns are filtered with every
1016 possible initial fractional positions and scaling steps. */
1017TEST_P(ConvolveTest, CheckScalingFiltering) {
1018 uint8_t* const in = input();
1019 uint8_t* const out = output();
Dmitry Kovalev021eaab2014-05-14 16:21:41 -07001020 const InterpKernel *const eighttap = vp9_get_interp_kernel(EIGHTTAP);
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001021
1022 SetConstantInput(127);
1023
1024 for (int frac = 0; frac < 16; ++frac) {
1025 for (int step = 1; step <= 32; ++step) {
1026 /* Test the horizontal and vertical filters in combination. */
James Zern29e1b1a2014-07-09 21:02:02 -07001027 ASM_REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
1028 eighttap[frac], step,
1029 eighttap[frac], step,
1030 Width(), Height()));
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001031
1032 CheckGuardBlocks();
1033
1034 for (int y = 0; y < Height(); ++y) {
1035 for (int x = 0; x < Width(); ++x) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001036 ASSERT_EQ(lookup(in, y * kInputStride + x),
1037 lookup(out, y * kOutputStride + x))
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001038 << "x == " << x << ", y == " << y
1039 << ", frac == " << frac << ", step == " << step;
1040 }
1041 }
1042 }
1043 }
1044}
1045
John Koleszar5ca6a362013-01-25 09:47:09 -08001046using std::tr1::make_tuple;
1047
Deb Mukherjee10783d42014-09-02 16:34:09 -07001048#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001049#if HAVE_SSE2 && ARCH_X86_64
1050void wrap_convolve8_horiz_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1051 uint8_t *dst, ptrdiff_t dst_stride,
1052 const int16_t *filter_x,
1053 int filter_x_stride,
1054 const int16_t *filter_y,
1055 int filter_y_stride,
1056 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001057 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride, filter_x,
1058 filter_x_stride, filter_y, filter_y_stride,
1059 w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001060}
1061
1062void wrap_convolve8_avg_horiz_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1063 uint8_t *dst, ptrdiff_t dst_stride,
1064 const int16_t *filter_x,
1065 int filter_x_stride,
1066 const int16_t *filter_y,
1067 int filter_y_stride,
1068 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001069 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1070 filter_x, filter_x_stride,
1071 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001072}
1073
1074void wrap_convolve8_vert_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1075 uint8_t *dst, ptrdiff_t dst_stride,
1076 const int16_t *filter_x,
1077 int filter_x_stride,
1078 const int16_t *filter_y,
1079 int filter_y_stride,
1080 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001081 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1082 filter_x, filter_x_stride,
1083 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001084}
1085
1086void wrap_convolve8_avg_vert_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1087 uint8_t *dst, ptrdiff_t dst_stride,
1088 const int16_t *filter_x,
1089 int filter_x_stride,
1090 const int16_t *filter_y,
1091 int filter_y_stride,
1092 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001093 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1094 filter_x, filter_x_stride,
1095 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001096}
1097
1098void wrap_convolve8_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1099 uint8_t *dst, ptrdiff_t dst_stride,
1100 const int16_t *filter_x,
1101 int filter_x_stride,
1102 const int16_t *filter_y,
1103 int filter_y_stride,
1104 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001105 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1106 filter_x, filter_x_stride,
1107 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001108}
1109
1110void wrap_convolve8_avg_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1111 uint8_t *dst, ptrdiff_t dst_stride,
1112 const int16_t *filter_x,
1113 int filter_x_stride,
1114 const int16_t *filter_y,
1115 int filter_y_stride,
1116 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001117 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1118 filter_x, filter_x_stride,
1119 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001120}
1121
1122void wrap_convolve8_horiz_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1123 uint8_t *dst, ptrdiff_t dst_stride,
1124 const int16_t *filter_x,
1125 int filter_x_stride,
1126 const int16_t *filter_y,
1127 int filter_y_stride,
1128 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001129 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride,
1130 filter_x, filter_x_stride,
1131 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001132}
1133
1134void wrap_convolve8_avg_horiz_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1135 uint8_t *dst, ptrdiff_t dst_stride,
1136 const int16_t *filter_x,
1137 int filter_x_stride,
1138 const int16_t *filter_y,
1139 int filter_y_stride,
1140 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001141 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1142 filter_x, filter_x_stride,
1143 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001144}
1145
1146void wrap_convolve8_vert_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1147 uint8_t *dst, ptrdiff_t dst_stride,
1148 const int16_t *filter_x,
1149 int filter_x_stride,
1150 const int16_t *filter_y,
1151 int filter_y_stride,
1152 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001153 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1154 filter_x, filter_x_stride,
1155 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001156}
1157
1158void wrap_convolve8_avg_vert_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1159 uint8_t *dst, ptrdiff_t dst_stride,
1160 const int16_t *filter_x,
1161 int filter_x_stride,
1162 const int16_t *filter_y,
1163 int filter_y_stride,
1164 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001165 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1166 filter_x, filter_x_stride,
1167 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001168}
1169
1170void wrap_convolve8_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1171 uint8_t *dst, ptrdiff_t dst_stride,
1172 const int16_t *filter_x,
1173 int filter_x_stride,
1174 const int16_t *filter_y,
1175 int filter_y_stride,
1176 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001177 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1178 filter_x, filter_x_stride,
1179 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001180}
1181
1182void wrap_convolve8_avg_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1183 uint8_t *dst, ptrdiff_t dst_stride,
1184 const int16_t *filter_x,
1185 int filter_x_stride,
1186 const int16_t *filter_y,
1187 int filter_y_stride,
1188 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001189 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1190 filter_x, filter_x_stride,
1191 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001192}
1193
1194void wrap_convolve8_horiz_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1195 uint8_t *dst, ptrdiff_t dst_stride,
1196 const int16_t *filter_x,
1197 int filter_x_stride,
1198 const int16_t *filter_y,
1199 int filter_y_stride,
1200 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001201 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride,
1202 filter_x, filter_x_stride,
1203 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001204}
1205
1206void wrap_convolve8_avg_horiz_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1207 uint8_t *dst, ptrdiff_t dst_stride,
1208 const int16_t *filter_x,
1209 int filter_x_stride,
1210 const int16_t *filter_y,
1211 int filter_y_stride,
1212 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001213 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1214 filter_x, filter_x_stride,
1215 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001216}
1217
1218void wrap_convolve8_vert_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1219 uint8_t *dst, ptrdiff_t dst_stride,
1220 const int16_t *filter_x,
1221 int filter_x_stride,
1222 const int16_t *filter_y,
1223 int filter_y_stride,
1224 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001225 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1226 filter_x, filter_x_stride,
1227 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001228}
1229
1230void wrap_convolve8_avg_vert_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1231 uint8_t *dst, ptrdiff_t dst_stride,
1232 const int16_t *filter_x,
1233 int filter_x_stride,
1234 const int16_t *filter_y,
1235 int filter_y_stride,
1236 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001237 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1238 filter_x, filter_x_stride,
1239 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001240}
1241
1242void wrap_convolve8_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1243 uint8_t *dst, ptrdiff_t dst_stride,
1244 const int16_t *filter_x,
1245 int filter_x_stride,
1246 const int16_t *filter_y,
1247 int filter_y_stride,
1248 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001249 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1250 filter_x, filter_x_stride,
1251 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001252}
1253
1254void wrap_convolve8_avg_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1255 uint8_t *dst, ptrdiff_t dst_stride,
1256 const int16_t *filter_x,
1257 int filter_x_stride,
1258 const int16_t *filter_y,
1259 int filter_y_stride,
1260 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001261 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1262 filter_x, filter_x_stride,
1263 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001264}
1265#endif // HAVE_SSE2 && ARCH_X86_64
1266
Johann1c3594c2014-12-09 12:05:15 -08001267void wrap_convolve_copy_c_8(const uint8_t *src, ptrdiff_t src_stride,
1268 uint8_t *dst, ptrdiff_t dst_stride,
1269 const int16_t *filter_x,
1270 int filter_x_stride,
1271 const int16_t *filter_y,
1272 int filter_y_stride,
1273 int w, int h) {
1274 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1275 filter_x, filter_x_stride,
1276 filter_y, filter_y_stride, w, h, 8);
1277}
1278
1279void wrap_convolve_avg_c_8(const uint8_t *src, ptrdiff_t src_stride,
1280 uint8_t *dst, ptrdiff_t dst_stride,
1281 const int16_t *filter_x,
1282 int filter_x_stride,
1283 const int16_t *filter_y,
1284 int filter_y_stride,
1285 int w, int h) {
1286 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1287 filter_x, filter_x_stride,
1288 filter_y, filter_y_stride, w, h, 8);
1289}
1290
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001291void wrap_convolve8_horiz_c_8(const uint8_t *src, ptrdiff_t src_stride,
1292 uint8_t *dst, ptrdiff_t dst_stride,
1293 const int16_t *filter_x,
1294 int filter_x_stride,
1295 const int16_t *filter_y,
1296 int filter_y_stride,
1297 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001298 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1299 filter_x, filter_x_stride,
1300 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001301}
1302
1303void wrap_convolve8_avg_horiz_c_8(const uint8_t *src, ptrdiff_t src_stride,
1304 uint8_t *dst, ptrdiff_t dst_stride,
1305 const int16_t *filter_x,
1306 int filter_x_stride,
1307 const int16_t *filter_y,
1308 int filter_y_stride,
1309 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001310 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1311 filter_x, filter_x_stride,
1312 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001313}
1314
1315void wrap_convolve8_vert_c_8(const uint8_t *src, ptrdiff_t src_stride,
1316 uint8_t *dst, ptrdiff_t dst_stride,
1317 const int16_t *filter_x,
1318 int filter_x_stride,
1319 const int16_t *filter_y,
1320 int filter_y_stride,
1321 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001322 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1323 filter_x, filter_x_stride,
1324 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001325}
1326
1327void wrap_convolve8_avg_vert_c_8(const uint8_t *src, ptrdiff_t src_stride,
1328 uint8_t *dst, ptrdiff_t dst_stride,
1329 const int16_t *filter_x,
1330 int filter_x_stride,
1331 const int16_t *filter_y,
1332 int filter_y_stride,
1333 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001334 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1335 filter_x, filter_x_stride,
1336 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001337}
1338
1339void wrap_convolve8_c_8(const uint8_t *src, ptrdiff_t src_stride,
1340 uint8_t *dst, ptrdiff_t dst_stride,
1341 const int16_t *filter_x,
1342 int filter_x_stride,
1343 const int16_t *filter_y,
1344 int filter_y_stride,
1345 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001346 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1347 filter_x, filter_x_stride,
1348 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001349}
1350
1351void wrap_convolve8_avg_c_8(const uint8_t *src, ptrdiff_t src_stride,
1352 uint8_t *dst, ptrdiff_t dst_stride,
1353 const int16_t *filter_x,
1354 int filter_x_stride,
1355 const int16_t *filter_y,
1356 int filter_y_stride,
1357 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001358 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1359 filter_x, filter_x_stride,
1360 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001361}
1362
Johann1c3594c2014-12-09 12:05:15 -08001363void wrap_convolve_copy_c_10(const uint8_t *src, ptrdiff_t src_stride,
1364 uint8_t *dst, ptrdiff_t dst_stride,
1365 const int16_t *filter_x,
1366 int filter_x_stride,
1367 const int16_t *filter_y,
1368 int filter_y_stride,
1369 int w, int h) {
1370 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1371 filter_x, filter_x_stride,
1372 filter_y, filter_y_stride, w, h, 10);
1373}
1374
1375void wrap_convolve_avg_c_10(const uint8_t *src, ptrdiff_t src_stride,
1376 uint8_t *dst, ptrdiff_t dst_stride,
1377 const int16_t *filter_x,
1378 int filter_x_stride,
1379 const int16_t *filter_y,
1380 int filter_y_stride,
1381 int w, int h) {
1382 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1383 filter_x, filter_x_stride,
1384 filter_y, filter_y_stride, w, h, 10);
1385}
1386
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001387void wrap_convolve8_horiz_c_10(const uint8_t *src, ptrdiff_t src_stride,
1388 uint8_t *dst, ptrdiff_t dst_stride,
1389 const int16_t *filter_x,
1390 int filter_x_stride,
1391 const int16_t *filter_y,
1392 int filter_y_stride,
1393 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001394 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1395 filter_x, filter_x_stride,
1396 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001397}
1398
1399void wrap_convolve8_avg_horiz_c_10(const uint8_t *src, ptrdiff_t src_stride,
1400 uint8_t *dst, ptrdiff_t dst_stride,
1401 const int16_t *filter_x,
1402 int filter_x_stride,
1403 const int16_t *filter_y,
1404 int filter_y_stride,
1405 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001406 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1407 filter_x, filter_x_stride,
1408 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001409}
1410
1411void wrap_convolve8_vert_c_10(const uint8_t *src, ptrdiff_t src_stride,
1412 uint8_t *dst, ptrdiff_t dst_stride,
1413 const int16_t *filter_x,
1414 int filter_x_stride,
1415 const int16_t *filter_y,
1416 int filter_y_stride,
1417 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001418 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1419 filter_x, filter_x_stride,
1420 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001421}
1422
1423void wrap_convolve8_avg_vert_c_10(const uint8_t *src, ptrdiff_t src_stride,
1424 uint8_t *dst, ptrdiff_t dst_stride,
1425 const int16_t *filter_x,
1426 int filter_x_stride,
1427 const int16_t *filter_y,
1428 int filter_y_stride,
1429 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001430 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1431 filter_x, filter_x_stride,
1432 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001433}
1434
1435void wrap_convolve8_c_10(const uint8_t *src, ptrdiff_t src_stride,
1436 uint8_t *dst, ptrdiff_t dst_stride,
1437 const int16_t *filter_x,
1438 int filter_x_stride,
1439 const int16_t *filter_y,
1440 int filter_y_stride,
1441 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001442 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1443 filter_x, filter_x_stride,
1444 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001445}
1446
1447void wrap_convolve8_avg_c_10(const uint8_t *src, ptrdiff_t src_stride,
1448 uint8_t *dst, ptrdiff_t dst_stride,
1449 const int16_t *filter_x,
1450 int filter_x_stride,
1451 const int16_t *filter_y,
1452 int filter_y_stride,
1453 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001454 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1455 filter_x, filter_x_stride,
1456 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001457}
1458
Johann1c3594c2014-12-09 12:05:15 -08001459void wrap_convolve_copy_c_12(const uint8_t *src, ptrdiff_t src_stride,
1460 uint8_t *dst, ptrdiff_t dst_stride,
1461 const int16_t *filter_x,
1462 int filter_x_stride,
1463 const int16_t *filter_y,
1464 int filter_y_stride,
1465 int w, int h) {
1466 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1467 filter_x, filter_x_stride,
1468 filter_y, filter_y_stride, w, h, 12);
1469}
1470
1471void wrap_convolve_avg_c_12(const uint8_t *src, ptrdiff_t src_stride,
1472 uint8_t *dst, ptrdiff_t dst_stride,
1473 const int16_t *filter_x,
1474 int filter_x_stride,
1475 const int16_t *filter_y,
1476 int filter_y_stride,
1477 int w, int h) {
1478 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1479 filter_x, filter_x_stride,
1480 filter_y, filter_y_stride, w, h, 12);
1481}
1482
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001483void wrap_convolve8_horiz_c_12(const uint8_t *src, ptrdiff_t src_stride,
1484 uint8_t *dst, ptrdiff_t dst_stride,
1485 const int16_t *filter_x,
1486 int filter_x_stride,
1487 const int16_t *filter_y,
1488 int filter_y_stride,
1489 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001490 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1491 filter_x, filter_x_stride,
1492 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001493}
1494
1495void wrap_convolve8_avg_horiz_c_12(const uint8_t *src, ptrdiff_t src_stride,
1496 uint8_t *dst, ptrdiff_t dst_stride,
1497 const int16_t *filter_x,
1498 int filter_x_stride,
1499 const int16_t *filter_y,
1500 int filter_y_stride,
1501 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001502 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1503 filter_x, filter_x_stride,
1504 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001505}
1506
1507void wrap_convolve8_vert_c_12(const uint8_t *src, ptrdiff_t src_stride,
1508 uint8_t *dst, ptrdiff_t dst_stride,
1509 const int16_t *filter_x,
1510 int filter_x_stride,
1511 const int16_t *filter_y,
1512 int filter_y_stride,
1513 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001514 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1515 filter_x, filter_x_stride,
1516 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001517}
1518
1519void wrap_convolve8_avg_vert_c_12(const uint8_t *src, ptrdiff_t src_stride,
1520 uint8_t *dst, ptrdiff_t dst_stride,
1521 const int16_t *filter_x,
1522 int filter_x_stride,
1523 const int16_t *filter_y,
1524 int filter_y_stride,
1525 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001526 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1527 filter_x, filter_x_stride,
1528 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001529}
1530
1531void wrap_convolve8_c_12(const uint8_t *src, ptrdiff_t src_stride,
1532 uint8_t *dst, ptrdiff_t dst_stride,
1533 const int16_t *filter_x,
1534 int filter_x_stride,
1535 const int16_t *filter_y,
1536 int filter_y_stride,
1537 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001538 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1539 filter_x, filter_x_stride,
1540 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001541}
1542
1543void wrap_convolve8_avg_c_12(const uint8_t *src, ptrdiff_t src_stride,
1544 uint8_t *dst, ptrdiff_t dst_stride,
1545 const int16_t *filter_x,
1546 int filter_x_stride,
1547 const int16_t *filter_y,
1548 int filter_y_stride,
1549 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001550 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1551 filter_x, filter_x_stride,
1552 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001553}
1554
1555const ConvolveFunctions convolve8_c(
Johann1c3594c2014-12-09 12:05:15 -08001556 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001557 wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
1558 wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8,
1559 wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 8);
1560INSTANTIATE_TEST_CASE_P(C_8, ConvolveTest, ::testing::Values(
1561 make_tuple(4, 4, &convolve8_c),
1562 make_tuple(8, 4, &convolve8_c),
1563 make_tuple(4, 8, &convolve8_c),
1564 make_tuple(8, 8, &convolve8_c),
1565 make_tuple(16, 8, &convolve8_c),
1566 make_tuple(8, 16, &convolve8_c),
1567 make_tuple(16, 16, &convolve8_c),
1568 make_tuple(32, 16, &convolve8_c),
1569 make_tuple(16, 32, &convolve8_c),
1570 make_tuple(32, 32, &convolve8_c),
1571 make_tuple(64, 32, &convolve8_c),
1572 make_tuple(32, 64, &convolve8_c),
1573 make_tuple(64, 64, &convolve8_c)));
1574const ConvolveFunctions convolve10_c(
Johann1c3594c2014-12-09 12:05:15 -08001575 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001576 wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
1577 wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10,
1578 wrap_convolve8_c_10, wrap_convolve8_avg_c_10, 10);
1579INSTANTIATE_TEST_CASE_P(C_10, ConvolveTest, ::testing::Values(
1580 make_tuple(4, 4, &convolve10_c),
1581 make_tuple(8, 4, &convolve10_c),
1582 make_tuple(4, 8, &convolve10_c),
1583 make_tuple(8, 8, &convolve10_c),
1584 make_tuple(16, 8, &convolve10_c),
1585 make_tuple(8, 16, &convolve10_c),
1586 make_tuple(16, 16, &convolve10_c),
1587 make_tuple(32, 16, &convolve10_c),
1588 make_tuple(16, 32, &convolve10_c),
1589 make_tuple(32, 32, &convolve10_c),
1590 make_tuple(64, 32, &convolve10_c),
1591 make_tuple(32, 64, &convolve10_c),
1592 make_tuple(64, 64, &convolve10_c)));
1593const ConvolveFunctions convolve12_c(
Johann1c3594c2014-12-09 12:05:15 -08001594 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001595 wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,
1596 wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12,
1597 wrap_convolve8_c_12, wrap_convolve8_avg_c_12, 12);
1598INSTANTIATE_TEST_CASE_P(C_12, ConvolveTest, ::testing::Values(
1599 make_tuple(4, 4, &convolve12_c),
1600 make_tuple(8, 4, &convolve12_c),
1601 make_tuple(4, 8, &convolve12_c),
1602 make_tuple(8, 8, &convolve12_c),
1603 make_tuple(16, 8, &convolve12_c),
1604 make_tuple(8, 16, &convolve12_c),
1605 make_tuple(16, 16, &convolve12_c),
1606 make_tuple(32, 16, &convolve12_c),
1607 make_tuple(16, 32, &convolve12_c),
1608 make_tuple(32, 32, &convolve12_c),
1609 make_tuple(64, 32, &convolve12_c),
1610 make_tuple(32, 64, &convolve12_c),
1611 make_tuple(64, 64, &convolve12_c)));
1612
Deb Mukherjee10783d42014-09-02 16:34:09 -07001613#else
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001614
John Koleszar5ca6a362013-01-25 09:47:09 -08001615const ConvolveFunctions convolve8_c(
Johann1c3594c2014-12-09 12:05:15 -08001616 vp9_convolve_copy_c, vp9_convolve_avg_c,
John Koleszar5ca6a362013-01-25 09:47:09 -08001617 vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
1618 vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001619 vp9_convolve8_c, vp9_convolve8_avg_c, 0);
John Koleszar5ca6a362013-01-25 09:47:09 -08001620
1621INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
John Koleszar5ca6a362013-01-25 09:47:09 -08001622 make_tuple(4, 4, &convolve8_c),
1623 make_tuple(8, 4, &convolve8_c),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001624 make_tuple(4, 8, &convolve8_c),
John Koleszar5ca6a362013-01-25 09:47:09 -08001625 make_tuple(8, 8, &convolve8_c),
John Koleszar6a4f7082013-02-08 17:49:44 -08001626 make_tuple(16, 8, &convolve8_c),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001627 make_tuple(8, 16, &convolve8_c),
1628 make_tuple(16, 16, &convolve8_c),
1629 make_tuple(32, 16, &convolve8_c),
1630 make_tuple(16, 32, &convolve8_c),
1631 make_tuple(32, 32, &convolve8_c),
1632 make_tuple(64, 32, &convolve8_c),
1633 make_tuple(32, 64, &convolve8_c),
1634 make_tuple(64, 64, &convolve8_c)));
Deb Mukherjee10783d42014-09-02 16:34:09 -07001635#endif
John Koleszar29d47ac2013-02-07 17:00:37 -08001636
Deb Mukherjee10783d42014-09-02 16:34:09 -07001637#if HAVE_SSE2 && ARCH_X86_64
1638#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001639const ConvolveFunctions convolve8_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001640 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001641 wrap_convolve8_horiz_sse2_8, wrap_convolve8_avg_horiz_sse2_8,
1642 wrap_convolve8_vert_sse2_8, wrap_convolve8_avg_vert_sse2_8,
1643 wrap_convolve8_sse2_8, wrap_convolve8_avg_sse2_8, 8);
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001644const ConvolveFunctions convolve10_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001645 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001646 wrap_convolve8_horiz_sse2_10, wrap_convolve8_avg_horiz_sse2_10,
1647 wrap_convolve8_vert_sse2_10, wrap_convolve8_avg_vert_sse2_10,
1648 wrap_convolve8_sse2_10, wrap_convolve8_avg_sse2_10, 10);
1649const ConvolveFunctions convolve12_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001650 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001651 wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12,
1652 wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,
1653 wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);
1654INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001655 make_tuple(4, 4, &convolve8_sse2),
1656 make_tuple(8, 4, &convolve8_sse2),
1657 make_tuple(4, 8, &convolve8_sse2),
1658 make_tuple(8, 8, &convolve8_sse2),
1659 make_tuple(16, 8, &convolve8_sse2),
1660 make_tuple(8, 16, &convolve8_sse2),
1661 make_tuple(16, 16, &convolve8_sse2),
1662 make_tuple(32, 16, &convolve8_sse2),
1663 make_tuple(16, 32, &convolve8_sse2),
1664 make_tuple(32, 32, &convolve8_sse2),
1665 make_tuple(64, 32, &convolve8_sse2),
1666 make_tuple(32, 64, &convolve8_sse2),
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001667 make_tuple(64, 64, &convolve8_sse2),
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001668 make_tuple(4, 4, &convolve10_sse2),
1669 make_tuple(8, 4, &convolve10_sse2),
1670 make_tuple(4, 8, &convolve10_sse2),
1671 make_tuple(8, 8, &convolve10_sse2),
1672 make_tuple(16, 8, &convolve10_sse2),
1673 make_tuple(8, 16, &convolve10_sse2),
1674 make_tuple(16, 16, &convolve10_sse2),
1675 make_tuple(32, 16, &convolve10_sse2),
1676 make_tuple(16, 32, &convolve10_sse2),
1677 make_tuple(32, 32, &convolve10_sse2),
1678 make_tuple(64, 32, &convolve10_sse2),
1679 make_tuple(32, 64, &convolve10_sse2),
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001680 make_tuple(64, 64, &convolve10_sse2),
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001681 make_tuple(4, 4, &convolve12_sse2),
1682 make_tuple(8, 4, &convolve12_sse2),
1683 make_tuple(4, 8, &convolve12_sse2),
1684 make_tuple(8, 8, &convolve12_sse2),
1685 make_tuple(16, 8, &convolve12_sse2),
1686 make_tuple(8, 16, &convolve12_sse2),
1687 make_tuple(16, 16, &convolve12_sse2),
1688 make_tuple(32, 16, &convolve12_sse2),
1689 make_tuple(16, 32, &convolve12_sse2),
1690 make_tuple(32, 32, &convolve12_sse2),
1691 make_tuple(64, 32, &convolve12_sse2),
1692 make_tuple(32, 64, &convolve12_sse2),
1693 make_tuple(64, 64, &convolve12_sse2)));
Deb Mukherjee10783d42014-09-02 16:34:09 -07001694#else
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001695const ConvolveFunctions convolve8_sse2(
Johannff8505a2015-06-29 16:44:30 -07001696#if CONFIG_USE_X86INC
Johann1c3594c2014-12-09 12:05:15 -08001697 vp9_convolve_copy_sse2, vp9_convolve_avg_sse2,
Johannff8505a2015-06-29 16:44:30 -07001698#else
1699 vp9_convolve_copy_c, vp9_convolve_avg_c,
1700#endif // CONFIG_USE_X86INC
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001701 vp9_convolve8_horiz_sse2, vp9_convolve8_avg_horiz_sse2,
1702 vp9_convolve8_vert_sse2, vp9_convolve8_avg_vert_sse2,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001703 vp9_convolve8_sse2, vp9_convolve8_avg_sse2, 0);
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001704
1705INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
1706 make_tuple(4, 4, &convolve8_sse2),
1707 make_tuple(8, 4, &convolve8_sse2),
1708 make_tuple(4, 8, &convolve8_sse2),
1709 make_tuple(8, 8, &convolve8_sse2),
1710 make_tuple(16, 8, &convolve8_sse2),
1711 make_tuple(8, 16, &convolve8_sse2),
1712 make_tuple(16, 16, &convolve8_sse2),
1713 make_tuple(32, 16, &convolve8_sse2),
1714 make_tuple(16, 32, &convolve8_sse2),
1715 make_tuple(32, 32, &convolve8_sse2),
1716 make_tuple(64, 32, &convolve8_sse2),
1717 make_tuple(32, 64, &convolve8_sse2),
1718 make_tuple(64, 64, &convolve8_sse2)));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001719#endif // CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -07001720#endif
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001721
John Koleszar29d47ac2013-02-07 17:00:37 -08001722#if HAVE_SSSE3
1723const ConvolveFunctions convolve8_ssse3(
Johann1c3594c2014-12-09 12:05:15 -08001724 vp9_convolve_copy_c, vp9_convolve_avg_c,
Jim Bankoskic3809f32013-08-05 12:07:30 -07001725 vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_ssse3,
1726 vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_ssse3,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001727 vp9_convolve8_ssse3, vp9_convolve8_avg_ssse3, 0);
John Koleszar29d47ac2013-02-07 17:00:37 -08001728
1729INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
1730 make_tuple(4, 4, &convolve8_ssse3),
1731 make_tuple(8, 4, &convolve8_ssse3),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001732 make_tuple(4, 8, &convolve8_ssse3),
John Koleszar29d47ac2013-02-07 17:00:37 -08001733 make_tuple(8, 8, &convolve8_ssse3),
John Koleszar6a4f7082013-02-08 17:49:44 -08001734 make_tuple(16, 8, &convolve8_ssse3),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001735 make_tuple(8, 16, &convolve8_ssse3),
1736 make_tuple(16, 16, &convolve8_ssse3),
1737 make_tuple(32, 16, &convolve8_ssse3),
1738 make_tuple(16, 32, &convolve8_ssse3),
1739 make_tuple(32, 32, &convolve8_ssse3),
1740 make_tuple(64, 32, &convolve8_ssse3),
1741 make_tuple(32, 64, &convolve8_ssse3),
1742 make_tuple(64, 64, &convolve8_ssse3)));
John Koleszar29d47ac2013-02-07 17:00:37 -08001743#endif
Johann158c80c2013-05-23 12:50:41 -07001744
Johann8645a532014-09-10 10:27:58 -07001745#if HAVE_AVX2 && HAVE_SSSE3
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001746const ConvolveFunctions convolve8_avx2(
Johann1c3594c2014-12-09 12:05:15 -08001747 vp9_convolve_copy_c, vp9_convolve_avg_c,
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001748 vp9_convolve8_horiz_avx2, vp9_convolve8_avg_horiz_ssse3,
1749 vp9_convolve8_vert_avx2, vp9_convolve8_avg_vert_ssse3,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001750 vp9_convolve8_avx2, vp9_convolve8_avg_ssse3, 0);
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001751
1752INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, ::testing::Values(
1753 make_tuple(4, 4, &convolve8_avx2),
1754 make_tuple(8, 4, &convolve8_avx2),
1755 make_tuple(4, 8, &convolve8_avx2),
1756 make_tuple(8, 8, &convolve8_avx2),
levytamar82839911f2014-07-27 16:45:55 -07001757 make_tuple(8, 16, &convolve8_avx2),
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001758 make_tuple(16, 8, &convolve8_avx2),
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001759 make_tuple(16, 16, &convolve8_avx2),
1760 make_tuple(32, 16, &convolve8_avx2),
1761 make_tuple(16, 32, &convolve8_avx2),
1762 make_tuple(32, 32, &convolve8_avx2),
1763 make_tuple(64, 32, &convolve8_avx2),
1764 make_tuple(32, 64, &convolve8_avx2),
1765 make_tuple(64, 64, &convolve8_avx2)));
Johann8645a532014-09-10 10:27:58 -07001766#endif // HAVE_AVX2 && HAVE_SSSE3
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001767
Scott LaVarnway617382a2014-09-10 09:49:34 -07001768#if HAVE_NEON
Johannce239312014-05-07 11:01:31 -07001769#if HAVE_NEON_ASM
Johann158c80c2013-05-23 12:50:41 -07001770const ConvolveFunctions convolve8_neon(
Johann1c3594c2014-12-09 12:05:15 -08001771 vp9_convolve_copy_neon, vp9_convolve_avg_neon,
Johanna15bebf2013-07-12 16:12:58 -07001772 vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon,
1773 vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001774 vp9_convolve8_neon, vp9_convolve8_avg_neon, 0);
Scott LaVarnway617382a2014-09-10 09:49:34 -07001775#else // HAVE_NEON
1776const ConvolveFunctions convolve8_neon(
James Yud12757f2014-01-21 17:23:27 +08001777 vp9_convolve_copy_neon, vp9_convolve_avg_neon,
James Yu01fc6f52014-01-29 23:12:41 +08001778 vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon,
1779 vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon,
1780 vp9_convolve8_neon, vp9_convolve8_avg_neon, 0);
Scott LaVarnway617382a2014-09-10 09:49:34 -07001781#endif // HAVE_NEON_ASM
Johann158c80c2013-05-23 12:50:41 -07001782
1783INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, ::testing::Values(
1784 make_tuple(4, 4, &convolve8_neon),
1785 make_tuple(8, 4, &convolve8_neon),
1786 make_tuple(4, 8, &convolve8_neon),
1787 make_tuple(8, 8, &convolve8_neon),
1788 make_tuple(16, 8, &convolve8_neon),
1789 make_tuple(8, 16, &convolve8_neon),
1790 make_tuple(16, 16, &convolve8_neon),
1791 make_tuple(32, 16, &convolve8_neon),
1792 make_tuple(16, 32, &convolve8_neon),
1793 make_tuple(32, 32, &convolve8_neon),
1794 make_tuple(64, 32, &convolve8_neon),
1795 make_tuple(32, 64, &convolve8_neon),
1796 make_tuple(64, 64, &convolve8_neon)));
Scott LaVarnway617382a2014-09-10 09:49:34 -07001797#endif // HAVE_NEON
Parag Salasakar40edab52013-09-13 15:18:32 +05301798
1799#if HAVE_DSPR2
1800const ConvolveFunctions convolve8_dspr2(
Johann1c3594c2014-12-09 12:05:15 -08001801 vp9_convolve_copy_dspr2, vp9_convolve_avg_dspr2,
Parag Salasakar40edab52013-09-13 15:18:32 +05301802 vp9_convolve8_horiz_dspr2, vp9_convolve8_avg_horiz_dspr2,
1803 vp9_convolve8_vert_dspr2, vp9_convolve8_avg_vert_dspr2,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001804 vp9_convolve8_dspr2, vp9_convolve8_avg_dspr2, 0);
Parag Salasakar40edab52013-09-13 15:18:32 +05301805
1806INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, ::testing::Values(
1807 make_tuple(4, 4, &convolve8_dspr2),
1808 make_tuple(8, 4, &convolve8_dspr2),
1809 make_tuple(4, 8, &convolve8_dspr2),
1810 make_tuple(8, 8, &convolve8_dspr2),
1811 make_tuple(16, 8, &convolve8_dspr2),
1812 make_tuple(8, 16, &convolve8_dspr2),
1813 make_tuple(16, 16, &convolve8_dspr2),
1814 make_tuple(32, 16, &convolve8_dspr2),
1815 make_tuple(16, 32, &convolve8_dspr2),
1816 make_tuple(32, 32, &convolve8_dspr2),
1817 make_tuple(64, 32, &convolve8_dspr2),
1818 make_tuple(32, 64, &convolve8_dspr2),
1819 make_tuple(64, 64, &convolve8_dspr2)));
1820#endif
Parag Salasakar27d083c2015-04-16 11:03:24 +05301821
Parag Salasakarebf74662015-06-02 10:29:56 +05301822#if HAVE_MSA
Parag Salasakar27d083c2015-04-16 11:03:24 +05301823const ConvolveFunctions convolve8_msa(
Parag Salasakar2301d102015-04-27 12:26:10 +05301824 vp9_convolve_copy_msa, vp9_convolve_avg_msa,
Parag Salasakarb8c1cdc2015-06-03 11:33:42 +05301825 vp9_convolve8_horiz_msa, vp9_convolve8_avg_horiz_msa,
Parag Salasakarc543d382015-06-03 09:55:25 +05301826 vp9_convolve8_vert_msa, vp9_convolve8_avg_vert_msa,
Parag Salasakarbdfbc3e2015-06-04 08:11:01 +05301827 vp9_convolve8_msa, vp9_convolve8_avg_msa, 0);
Parag Salasakar27d083c2015-04-16 11:03:24 +05301828
1829INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest, ::testing::Values(
1830 make_tuple(4, 4, &convolve8_msa),
1831 make_tuple(8, 4, &convolve8_msa),
1832 make_tuple(4, 8, &convolve8_msa),
1833 make_tuple(8, 8, &convolve8_msa),
1834 make_tuple(16, 8, &convolve8_msa),
1835 make_tuple(8, 16, &convolve8_msa),
1836 make_tuple(16, 16, &convolve8_msa),
1837 make_tuple(32, 16, &convolve8_msa),
1838 make_tuple(16, 32, &convolve8_msa),
1839 make_tuple(32, 32, &convolve8_msa),
1840 make_tuple(64, 32, &convolve8_msa),
1841 make_tuple(32, 64, &convolve8_msa),
1842 make_tuple(64, 64, &convolve8_msa)));
1843#endif // HAVE_MSA
James Zern8fb48af2013-05-02 13:08:19 -07001844} // namespace