blob: 12ac4c3e9aee6065caa973ba8b08d560ebda068b [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"
13#include "test/register_state_check.h"
14#include "test/util.h"
15#include "third_party/googletest/src/include/gtest/gtest.h"
John Koleszar5ca6a362013-01-25 09:47:09 -080016
John Koleszar5ca6a362013-01-25 09:47:09 -080017#include "./vpx_config.h"
18#include "./vp9_rtcd.h"
Johann1c3594c2014-12-09 12:05:15 -080019#include "vp9/common/vp9_common.h"
John Koleszar557a1b22013-02-20 16:13:01 -080020#include "vp9/common/vp9_filter.h"
John Koleszar29d47ac2013-02-07 17:00:37 -080021#include "vpx_mem/vpx_mem.h"
John Koleszar6fd7dd12013-02-20 15:59:20 -080022#include "vpx_ports/mem.h"
John Koleszar5ca6a362013-01-25 09:47:09 -080023
24namespace {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070025
hkuangdb71c1b2014-09-19 22:47:28 -070026static const unsigned int kMaxDimension = 64;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070027
James Zerndfc4e8f2014-07-16 18:48:20 -070028typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
29 uint8_t *dst, ptrdiff_t dst_stride,
30 const int16_t *filter_x, int filter_x_stride,
31 const int16_t *filter_y, int filter_y_stride,
32 int w, int h);
John Koleszar5ca6a362013-01-25 09:47:09 -080033
34struct ConvolveFunctions {
Johann1c3594c2014-12-09 12:05:15 -080035 ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg,
36 ConvolveFunc h8, ConvolveFunc h8_avg,
James Zerndfc4e8f2014-07-16 18:48:20 -070037 ConvolveFunc v8, ConvolveFunc v8_avg,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070038 ConvolveFunc hv8, ConvolveFunc hv8_avg,
39 int bd)
Johann1c3594c2014-12-09 12:05:15 -080040 : copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),
41 v8_avg_(v8_avg), hv8_avg_(hv8_avg), use_highbd_(bd) {}
John Koleszar5ca6a362013-01-25 09:47:09 -080042
Johann1c3594c2014-12-09 12:05:15 -080043 ConvolveFunc copy_;
44 ConvolveFunc avg_;
James Zerndfc4e8f2014-07-16 18:48:20 -070045 ConvolveFunc h8_;
46 ConvolveFunc v8_;
47 ConvolveFunc hv8_;
48 ConvolveFunc h8_avg_;
49 ConvolveFunc v8_avg_;
50 ConvolveFunc hv8_avg_;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -070051 int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
John Koleszar5ca6a362013-01-25 09:47:09 -080052};
53
James Zerndfc4e8f2014-07-16 18:48:20 -070054typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
Joshua Litt51490e52013-11-18 17:07:55 -080055
John Koleszar5ca6a362013-01-25 09:47:09 -080056// Reference 8-tap subpixel filter, slightly modified to fit into this test.
57#define VP9_FILTER_WEIGHT 128
58#define VP9_FILTER_SHIFT 7
James Zern8fb48af2013-05-02 13:08:19 -070059uint8_t clip_pixel(int x) {
John Koleszar5ca6a362013-01-25 09:47:09 -080060 return x < 0 ? 0 :
61 x > 255 ? 255 :
62 x;
63}
64
James Zern8fb48af2013-05-02 13:08:19 -070065void filter_block2d_8_c(const uint8_t *src_ptr,
66 const unsigned int src_stride,
67 const int16_t *HFilter,
68 const int16_t *VFilter,
69 uint8_t *dst_ptr,
70 unsigned int dst_stride,
71 unsigned int output_width,
72 unsigned int output_height) {
John Koleszar5ca6a362013-01-25 09:47:09 -080073 // Between passes, we use an intermediate buffer whose height is extended to
74 // have enough horizontally filtered values as input for the vertical pass.
75 // This buffer is allocated to be big enough for the largest block type we
76 // support.
77 const int kInterp_Extend = 4;
78 const unsigned int intermediate_height =
James Zern8fb48af2013-05-02 13:08:19 -070079 (kInterp_Extend - 1) + output_height + kInterp_Extend;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070080 unsigned int i, j;
John Koleszar5ca6a362013-01-25 09:47:09 -080081
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070082 // Size of intermediate_buffer is max_intermediate_height * filter_max_width,
83 // where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
84 // + kInterp_Extend
85 // = 3 + 16 + 4
86 // = 23
87 // and filter_max_width = 16
88 //
89 uint8_t intermediate_buffer[71 * kMaxDimension];
John Koleszar5ca6a362013-01-25 09:47:09 -080090 const int intermediate_next_stride = 1 - intermediate_height * output_width;
91
92 // Horizontal pass (src -> transposed intermediate).
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -070093 uint8_t *output_ptr = intermediate_buffer;
94 const int src_next_row_stride = src_stride - output_width;
95 src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
96 for (i = 0; i < intermediate_height; ++i) {
97 for (j = 0; j < output_width; ++j) {
98 // Apply filter...
99 const int temp = (src_ptr[0] * HFilter[0]) +
100 (src_ptr[1] * HFilter[1]) +
101 (src_ptr[2] * HFilter[2]) +
102 (src_ptr[3] * HFilter[3]) +
103 (src_ptr[4] * HFilter[4]) +
104 (src_ptr[5] * HFilter[5]) +
105 (src_ptr[6] * HFilter[6]) +
106 (src_ptr[7] * HFilter[7]) +
107 (VP9_FILTER_WEIGHT >> 1); // Rounding
John Koleszar5ca6a362013-01-25 09:47:09 -0800108
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700109 // Normalize back to 0-255...
110 *output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
111 ++src_ptr;
112 output_ptr += intermediate_height;
John Koleszar5ca6a362013-01-25 09:47:09 -0800113 }
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700114 src_ptr += src_next_row_stride;
115 output_ptr += intermediate_next_stride;
John Koleszar5ca6a362013-01-25 09:47:09 -0800116 }
117
118 // Vertical pass (transposed intermediate -> dst).
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700119 src_ptr = intermediate_buffer;
120 const int dst_next_row_stride = dst_stride - output_width;
121 for (i = 0; i < output_height; ++i) {
122 for (j = 0; j < output_width; ++j) {
123 // Apply filter...
124 const int temp = (src_ptr[0] * VFilter[0]) +
125 (src_ptr[1] * VFilter[1]) +
126 (src_ptr[2] * VFilter[2]) +
127 (src_ptr[3] * VFilter[3]) +
128 (src_ptr[4] * VFilter[4]) +
129 (src_ptr[5] * VFilter[5]) +
130 (src_ptr[6] * VFilter[6]) +
131 (src_ptr[7] * VFilter[7]) +
132 (VP9_FILTER_WEIGHT >> 1); // Rounding
John Koleszar5ca6a362013-01-25 09:47:09 -0800133
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700134 // Normalize back to 0-255...
135 *dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
136 src_ptr += intermediate_height;
John Koleszar5ca6a362013-01-25 09:47:09 -0800137 }
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700138 src_ptr += intermediate_next_stride;
139 dst_ptr += dst_next_row_stride;
John Koleszar5ca6a362013-01-25 09:47:09 -0800140 }
141}
142
James Zern8fb48af2013-05-02 13:08:19 -0700143void block2d_average_c(uint8_t *src,
144 unsigned int src_stride,
145 uint8_t *output_ptr,
146 unsigned int output_stride,
147 unsigned int output_width,
148 unsigned int output_height) {
John Koleszar5ca6a362013-01-25 09:47:09 -0800149 unsigned int i, j;
150 for (i = 0; i < output_height; ++i) {
151 for (j = 0; j < output_width; ++j) {
152 output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
153 }
154 output_ptr += output_stride;
155 }
156}
157
James Zern8fb48af2013-05-02 13:08:19 -0700158void filter_average_block2d_8_c(const uint8_t *src_ptr,
159 const unsigned int src_stride,
160 const int16_t *HFilter,
161 const int16_t *VFilter,
162 uint8_t *dst_ptr,
163 unsigned int dst_stride,
164 unsigned int output_width,
165 unsigned int output_height) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700166 uint8_t tmp[kMaxDimension * kMaxDimension];
John Koleszar5ca6a362013-01-25 09:47:09 -0800167
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700168 assert(output_width <= kMaxDimension);
169 assert(output_height <= kMaxDimension);
John Koleszara9ebbcc2013-04-18 13:05:38 -0700170 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
John Koleszar5ca6a362013-01-25 09:47:09 -0800171 output_width, output_height);
John Koleszara9ebbcc2013-04-18 13:05:38 -0700172 block2d_average_c(tmp, 64, dst_ptr, dst_stride,
John Koleszar5ca6a362013-01-25 09:47:09 -0800173 output_width, output_height);
174}
175
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700176#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700177void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
178 const unsigned int src_stride,
179 const int16_t *HFilter,
180 const int16_t *VFilter,
181 uint16_t *dst_ptr,
182 unsigned int dst_stride,
183 unsigned int output_width,
184 unsigned int output_height,
185 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700186 // Between passes, we use an intermediate buffer whose height is extended to
187 // have enough horizontally filtered values as input for the vertical pass.
188 // This buffer is allocated to be big enough for the largest block type we
189 // support.
190 const int kInterp_Extend = 4;
191 const unsigned int intermediate_height =
192 (kInterp_Extend - 1) + output_height + kInterp_Extend;
193
194 /* Size of intermediate_buffer is max_intermediate_height * filter_max_width,
195 * where max_intermediate_height = (kInterp_Extend - 1) + filter_max_height
196 * + kInterp_Extend
197 * = 3 + 16 + 4
198 * = 23
199 * and filter_max_width = 16
200 */
201 uint16_t intermediate_buffer[71 * kMaxDimension];
202 const int intermediate_next_stride = 1 - intermediate_height * output_width;
203
204 // Horizontal pass (src -> transposed intermediate).
205 {
206 uint16_t *output_ptr = intermediate_buffer;
207 const int src_next_row_stride = src_stride - output_width;
208 unsigned int i, j;
209 src_ptr -= (kInterp_Extend - 1) * src_stride + (kInterp_Extend - 1);
210 for (i = 0; i < intermediate_height; ++i) {
211 for (j = 0; j < output_width; ++j) {
212 // Apply filter...
213 const int temp = (src_ptr[0] * HFilter[0]) +
214 (src_ptr[1] * HFilter[1]) +
215 (src_ptr[2] * HFilter[2]) +
216 (src_ptr[3] * HFilter[3]) +
217 (src_ptr[4] * HFilter[4]) +
218 (src_ptr[5] * HFilter[5]) +
219 (src_ptr[6] * HFilter[6]) +
220 (src_ptr[7] * HFilter[7]) +
221 (VP9_FILTER_WEIGHT >> 1); // Rounding
222
223 // Normalize back to 0-255...
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700224 *output_ptr = clip_pixel_highbd(temp >> VP9_FILTER_SHIFT, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700225 ++src_ptr;
226 output_ptr += intermediate_height;
227 }
228 src_ptr += src_next_row_stride;
229 output_ptr += intermediate_next_stride;
230 }
231 }
232
233 // Vertical pass (transposed intermediate -> dst).
234 {
235 uint16_t *src_ptr = intermediate_buffer;
236 const int dst_next_row_stride = dst_stride - output_width;
237 unsigned int i, j;
238 for (i = 0; i < output_height; ++i) {
239 for (j = 0; j < output_width; ++j) {
240 // Apply filter...
241 const int temp = (src_ptr[0] * VFilter[0]) +
242 (src_ptr[1] * VFilter[1]) +
243 (src_ptr[2] * VFilter[2]) +
244 (src_ptr[3] * VFilter[3]) +
245 (src_ptr[4] * VFilter[4]) +
246 (src_ptr[5] * VFilter[5]) +
247 (src_ptr[6] * VFilter[6]) +
248 (src_ptr[7] * VFilter[7]) +
249 (VP9_FILTER_WEIGHT >> 1); // Rounding
250
251 // Normalize back to 0-255...
Deb Mukherjeed50716f2014-10-02 15:43:27 -0700252 *dst_ptr++ = clip_pixel_highbd(temp >> VP9_FILTER_SHIFT, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700253 src_ptr += intermediate_height;
254 }
255 src_ptr += intermediate_next_stride;
256 dst_ptr += dst_next_row_stride;
257 }
258 }
259}
260
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700261void highbd_block2d_average_c(uint16_t *src,
262 unsigned int src_stride,
263 uint16_t *output_ptr,
264 unsigned int output_stride,
265 unsigned int output_width,
266 unsigned int output_height,
267 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700268 unsigned int i, j;
269 for (i = 0; i < output_height; ++i) {
270 for (j = 0; j < output_width; ++j) {
271 output_ptr[j] = (output_ptr[j] + src[i * src_stride + j] + 1) >> 1;
272 }
273 output_ptr += output_stride;
274 }
275}
276
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700277void highbd_filter_average_block2d_8_c(const uint16_t *src_ptr,
278 const unsigned int src_stride,
279 const int16_t *HFilter,
280 const int16_t *VFilter,
281 uint16_t *dst_ptr,
282 unsigned int dst_stride,
283 unsigned int output_width,
284 unsigned int output_height,
285 int bd) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700286 uint16_t tmp[kMaxDimension * kMaxDimension];
287
288 assert(output_width <= kMaxDimension);
289 assert(output_height <= kMaxDimension);
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700290 highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
291 output_width, output_height, bd);
292 highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride,
293 output_width, output_height, bd);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700294}
295#endif // CONFIG_VP9_HIGHBITDEPTH
296
James Zerndfc4e8f2014-07-16 18:48:20 -0700297class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
John Koleszar29d47ac2013-02-07 17:00:37 -0800298 public:
299 static void SetUpTestCase() {
300 // Force input_ to be unaligned, output to be 16 byte aligned.
301 input_ = reinterpret_cast<uint8_t*>(
James Zernb0e57752013-05-02 12:29:34 -0700302 vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;
John Koleszar29d47ac2013-02-07 17:00:37 -0800303 output_ = reinterpret_cast<uint8_t*>(
James Zernb0e57752013-05-02 12:29:34 -0700304 vpx_memalign(kDataAlignment, kOutputBufferSize));
Johann1c3594c2014-12-09 12:05:15 -0800305 output_ref_ = reinterpret_cast<uint8_t*>(
306 vpx_memalign(kDataAlignment, kOutputBufferSize));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700307#if CONFIG_VP9_HIGHBITDEPTH
308 input16_ = reinterpret_cast<uint16_t*>(
309 vpx_memalign(kDataAlignment,
310 (kInputBufferSize + 1) * sizeof(uint16_t))) + 1;
311 output16_ = reinterpret_cast<uint16_t*>(
312 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
Johann1c3594c2014-12-09 12:05:15 -0800313 output16_ref_ = reinterpret_cast<uint16_t*>(
314 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700315#endif
John Koleszar29d47ac2013-02-07 17:00:37 -0800316 }
317
318 static void TearDownTestCase() {
319 vpx_free(input_ - 1);
320 input_ = NULL;
321 vpx_free(output_);
322 output_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800323 vpx_free(output_ref_);
324 output_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700325#if CONFIG_VP9_HIGHBITDEPTH
326 vpx_free(input16_ - 1);
327 input16_ = NULL;
328 vpx_free(output16_);
329 output16_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800330 vpx_free(output16_ref_);
331 output16_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700332#endif
John Koleszar29d47ac2013-02-07 17:00:37 -0800333 }
334
James Zern8fb48af2013-05-02 13:08:19 -0700335 protected:
336 static const int kDataAlignment = 16;
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300337 static const int kOuterBlockSize = 256;
James Zern8fb48af2013-05-02 13:08:19 -0700338 static const int kInputStride = kOuterBlockSize;
339 static const int kOutputStride = kOuterBlockSize;
James Zern8fb48af2013-05-02 13:08:19 -0700340 static const int kInputBufferSize = kOuterBlockSize * kOuterBlockSize;
341 static const int kOutputBufferSize = kOuterBlockSize * kOuterBlockSize;
John Koleszar5ca6a362013-01-25 09:47:09 -0800342
James Zern8fb48af2013-05-02 13:08:19 -0700343 int Width() const { return GET_PARAM(0); }
344 int Height() const { return GET_PARAM(1); }
345 int BorderLeft() const {
346 const int center = (kOuterBlockSize - Width()) / 2;
347 return (center + (kDataAlignment - 1)) & ~(kDataAlignment - 1);
348 }
349 int BorderTop() const { return (kOuterBlockSize - Height()) / 2; }
John Koleszar5ca6a362013-01-25 09:47:09 -0800350
James Zern8fb48af2013-05-02 13:08:19 -0700351 bool IsIndexInBorder(int i) {
352 return (i < BorderTop() * kOuterBlockSize ||
353 i >= (BorderTop() + Height()) * kOuterBlockSize ||
354 i % kOuterBlockSize < BorderLeft() ||
355 i % kOuterBlockSize >= (BorderLeft() + Width()));
356 }
357
358 virtual void SetUp() {
359 UUT_ = GET_PARAM(2);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700360#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700361 if (UUT_->use_highbd_ != 0)
362 mask_ = (1 << UUT_->use_highbd_) - 1;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700363 else
364 mask_ = 255;
365#endif
Johann158c80c2013-05-23 12:50:41 -0700366 /* Set up guard blocks for an inner block centered in the outer block */
James Zern8fb48af2013-05-02 13:08:19 -0700367 for (int i = 0; i < kOutputBufferSize; ++i) {
368 if (IsIndexInBorder(i))
369 output_[i] = 255;
370 else
371 output_[i] = 0;
John Koleszar5ca6a362013-01-25 09:47:09 -0800372 }
373
James Zern8fb48af2013-05-02 13:08:19 -0700374 ::libvpx_test::ACMRandom prng;
Yaowu Xu077144d2014-05-23 12:23:29 -0700375 for (int i = 0; i < kInputBufferSize; ++i) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700376 if (i & 1) {
Yaowu Xu077144d2014-05-23 12:23:29 -0700377 input_[i] = 255;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700378#if CONFIG_VP9_HIGHBITDEPTH
379 input16_[i] = mask_;
380#endif
381 } else {
Yaowu Xu077144d2014-05-23 12:23:29 -0700382 input_[i] = prng.Rand8Extremes();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700383#if CONFIG_VP9_HIGHBITDEPTH
384 input16_[i] = prng.Rand16() & mask_;
385#endif
386 }
Yaowu Xu077144d2014-05-23 12:23:29 -0700387 }
James Zern8fb48af2013-05-02 13:08:19 -0700388 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800389
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300390 void SetConstantInput(int value) {
391 memset(input_, value, kInputBufferSize);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700392#if CONFIG_VP9_HIGHBITDEPTH
393 vpx_memset16(input16_, value, kInputBufferSize);
394#endif
Tero Rintaluomae326cec2013-08-22 11:29:19 +0300395 }
396
Johann1c3594c2014-12-09 12:05:15 -0800397 void CopyOutputToRef() {
398 vpx_memcpy(output_ref_, output_, kOutputBufferSize);
399#if CONFIG_VP9_HIGHBITDEPTH
400 vpx_memcpy(output16_ref_, output16_, kOutputBufferSize);
401#endif
402 }
403
James Zern8fb48af2013-05-02 13:08:19 -0700404 void CheckGuardBlocks() {
405 for (int i = 0; i < kOutputBufferSize; ++i) {
406 if (IsIndexInBorder(i))
407 EXPECT_EQ(255, output_[i]);
John Koleszar5ca6a362013-01-25 09:47:09 -0800408 }
James Zern8fb48af2013-05-02 13:08:19 -0700409 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800410
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700411 uint8_t *input() const {
412#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700413 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700414 return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
415 } else {
416 return CONVERT_TO_BYTEPTR(input16_ + BorderTop() * kOuterBlockSize +
417 BorderLeft());
418 }
419#else
James Zern8fb48af2013-05-02 13:08:19 -0700420 return input_ + BorderTop() * kOuterBlockSize + BorderLeft();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700421#endif
James Zern8fb48af2013-05-02 13:08:19 -0700422 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800423
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700424 uint8_t *output() const {
425#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700426 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700427 return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
428 } else {
429 return CONVERT_TO_BYTEPTR(output16_ + BorderTop() * kOuterBlockSize +
430 BorderLeft());
431 }
432#else
James Zern8fb48af2013-05-02 13:08:19 -0700433 return output_ + BorderTop() * kOuterBlockSize + BorderLeft();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700434#endif
435 }
436
Johann1c3594c2014-12-09 12:05:15 -0800437 uint8_t *output_ref() const {
438#if CONFIG_VP9_HIGHBITDEPTH
439 if (UUT_->use_highbd_ == 0) {
440 return output_ref_ + BorderTop() * kOuterBlockSize + BorderLeft();
441 } else {
442 return CONVERT_TO_BYTEPTR(output16_ref_ + BorderTop() * kOuterBlockSize +
443 BorderLeft());
444 }
445#else
446 return output_ref_ + BorderTop() * kOuterBlockSize + BorderLeft();
447#endif
448 }
449
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700450 uint16_t lookup(uint8_t *list, int index) const {
451#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700452 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700453 return list[index];
454 } else {
455 return CONVERT_TO_SHORTPTR(list)[index];
456 }
457#else
458 return list[index];
459#endif
460 }
461
462 void assign_val(uint8_t *list, int index, uint16_t val) const {
463#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700464 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700465 list[index] = (uint8_t) val;
466 } else {
467 CONVERT_TO_SHORTPTR(list)[index] = val;
468 }
469#else
470 list[index] = (uint8_t) val;
471#endif
472 }
473
474 void wrapper_filter_average_block2d_8_c(const uint8_t *src_ptr,
475 const unsigned int src_stride,
476 const int16_t *HFilter,
477 const int16_t *VFilter,
478 uint8_t *dst_ptr,
479 unsigned int dst_stride,
480 unsigned int output_width,
481 unsigned int output_height) {
482#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700483 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700484 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
485 dst_ptr, dst_stride, output_width,
486 output_height);
487 } else {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700488 highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr),
489 src_stride, HFilter, VFilter,
490 CONVERT_TO_SHORTPTR(dst_ptr),
491 dst_stride, output_width, output_height,
492 UUT_->use_highbd_);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700493 }
494#else
495 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
496 dst_ptr, dst_stride, output_width,
497 output_height);
498#endif
499 }
500
501 void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
502 const unsigned int src_stride,
503 const int16_t *HFilter,
504 const int16_t *VFilter,
505 uint8_t *dst_ptr,
506 unsigned int dst_stride,
507 unsigned int output_width,
508 unsigned int output_height) {
509#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700510 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700511 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
512 dst_ptr, dst_stride, output_width, output_height);
513 } else {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700514 highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
515 HFilter, VFilter,
516 CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,
517 output_width, output_height, UUT_->use_highbd_);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700518 }
519#else
520 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,
521 dst_ptr, dst_stride, output_width, output_height);
522#endif
James Zern8fb48af2013-05-02 13:08:19 -0700523 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800524
James Zern8fb48af2013-05-02 13:08:19 -0700525 const ConvolveFunctions* UUT_;
526 static uint8_t* input_;
527 static uint8_t* output_;
Johann1c3594c2014-12-09 12:05:15 -0800528 static uint8_t* output_ref_;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700529#if CONFIG_VP9_HIGHBITDEPTH
530 static uint16_t* input16_;
531 static uint16_t* output16_;
Johann1c3594c2014-12-09 12:05:15 -0800532 static uint16_t* output16_ref_;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700533 int mask_;
534#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800535};
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700536
John Koleszar29d47ac2013-02-07 17:00:37 -0800537uint8_t* ConvolveTest::input_ = NULL;
538uint8_t* ConvolveTest::output_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800539uint8_t* ConvolveTest::output_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700540#if CONFIG_VP9_HIGHBITDEPTH
541uint16_t* ConvolveTest::input16_ = NULL;
542uint16_t* ConvolveTest::output16_ = NULL;
Johann1c3594c2014-12-09 12:05:15 -0800543uint16_t* ConvolveTest::output16_ref_ = NULL;
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700544#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800545
546TEST_P(ConvolveTest, GuardBlocks) {
547 CheckGuardBlocks();
548}
549
Johann1c3594c2014-12-09 12:05:15 -0800550TEST_P(ConvolveTest, Copy) {
551 uint8_t* const in = input();
552 uint8_t* const out = output();
553
554 ASM_REGISTER_STATE_CHECK(
555 UUT_->copy_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
556 Width(), Height()));
557
558 CheckGuardBlocks();
559
560 for (int y = 0; y < Height(); ++y)
561 for (int x = 0; x < Width(); ++x)
562 ASSERT_EQ(lookup(out, y * kOutputStride + x),
563 lookup(in, y * kInputStride + x))
564 << "(" << x << "," << y << ")";
565}
566
567TEST_P(ConvolveTest, Avg) {
568 uint8_t* const in = input();
569 uint8_t* const out = output();
570 uint8_t* const out_ref = output_ref();
571 CopyOutputToRef();
572
573 ASM_REGISTER_STATE_CHECK(
574 UUT_->avg_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,
575 Width(), Height()));
576
577 CheckGuardBlocks();
578
579 for (int y = 0; y < Height(); ++y)
580 for (int x = 0; x < Width(); ++x)
581 ASSERT_EQ(lookup(out, y * kOutputStride + x),
582 ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) +
583 lookup(out_ref, y * kOutputStride + x), 1))
584 << "(" << x << "," << y << ")";
585}
586
John Koleszar5ca6a362013-01-25 09:47:09 -0800587TEST_P(ConvolveTest, CopyHoriz) {
588 uint8_t* const in = input();
589 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700590 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800591
James Zern29e1b1a2014-07-09 21:02:02 -0700592 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800593 UUT_->h8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
594 Width(), Height()));
595
596 CheckGuardBlocks();
597
598 for (int y = 0; y < Height(); ++y)
599 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700600 ASSERT_EQ(lookup(out, y * kOutputStride + x),
601 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800602 << "(" << x << "," << y << ")";
603}
604
605TEST_P(ConvolveTest, CopyVert) {
606 uint8_t* const in = input();
607 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700608 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800609
James Zern29e1b1a2014-07-09 21:02:02 -0700610 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800611 UUT_->v8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
612 Width(), Height()));
613
614 CheckGuardBlocks();
615
616 for (int y = 0; y < Height(); ++y)
617 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700618 ASSERT_EQ(lookup(out, y * kOutputStride + x),
619 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800620 << "(" << x << "," << y << ")";
621}
622
623TEST_P(ConvolveTest, Copy2D) {
624 uint8_t* const in = input();
625 uint8_t* const out = output();
James Zerne7b599f2013-06-17 23:11:01 -0700626 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};
John Koleszar5ca6a362013-01-25 09:47:09 -0800627
James Zern29e1b1a2014-07-09 21:02:02 -0700628 ASM_REGISTER_STATE_CHECK(
John Koleszar5ca6a362013-01-25 09:47:09 -0800629 UUT_->hv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,
630 Width(), Height()));
631
632 CheckGuardBlocks();
633
634 for (int y = 0; y < Height(); ++y)
635 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700636 ASSERT_EQ(lookup(out, y * kOutputStride + x),
637 lookup(in, y * kInputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -0800638 << "(" << x << "," << y << ")";
639}
640
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700641const int kNumFilterBanks = 4;
John Koleszara9ebbcc2013-04-18 13:05:38 -0700642const int kNumFilters = 16;
643
644TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
645 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700646 const InterpKernel *filters =
647 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
John Koleszara9ebbcc2013-04-18 13:05:38 -0700648 for (int i = 0; i < kNumFilters; i++) {
649 const int p0 = filters[i][0] + filters[i][1];
650 const int p1 = filters[i][2] + filters[i][3];
651 const int p2 = filters[i][4] + filters[i][5];
652 const int p3 = filters[i][6] + filters[i][7];
653 EXPECT_LE(p0, 128);
654 EXPECT_LE(p1, 128);
655 EXPECT_LE(p2, 128);
656 EXPECT_LE(p3, 128);
657 EXPECT_LE(p0 + p3, 128);
658 EXPECT_LE(p0 + p3 + p1, 128);
659 EXPECT_LE(p0 + p3 + p1 + p2, 128);
660 EXPECT_EQ(p0 + p1 + p2 + p3, 128);
661 }
662 }
663}
John Koleszar557a1b22013-02-20 16:13:01 -0800664
John Koleszar04c24072013-02-20 16:32:02 -0800665const int16_t kInvalidFilter[8] = { 0 };
666
John Koleszar5ca6a362013-01-25 09:47:09 -0800667TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
668 uint8_t* const in = input();
669 uint8_t* const out = output();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700670#if CONFIG_VP9_HIGHBITDEPTH
671 uint8_t ref8[kOutputStride * kMaxDimension];
672 uint16_t ref16[kOutputStride * kMaxDimension];
673 uint8_t* ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700674 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700675 ref = ref8;
676 } else {
677 ref = CONVERT_TO_BYTEPTR(ref16);
678 }
679#else
John Koleszar5ca6a362013-01-25 09:47:09 -0800680 uint8_t ref[kOutputStride * kMaxDimension];
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700681#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800682
John Koleszar557a1b22013-02-20 16:13:01 -0800683 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700684 const InterpKernel *filters =
685 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700686 const InterpKernel *const eighttap_smooth =
687 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
688
John Koleszar557a1b22013-02-20 16:13:01 -0800689 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
690 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700691 wrapper_filter_block2d_8_c(in, kInputStride,
692 filters[filter_x], filters[filter_y],
693 ref, kOutputStride,
694 Width(), Height());
John Koleszar5ca6a362013-01-25 09:47:09 -0800695
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700696 if (filters == eighttap_smooth || (filter_x && filter_y))
James Zern29e1b1a2014-07-09 21:02:02 -0700697 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800698 UUT_->hv8_(in, kInputStride, out, kOutputStride,
699 filters[filter_x], 16, filters[filter_y], 16,
700 Width(), Height()));
701 else if (filter_y)
James Zern29e1b1a2014-07-09 21:02:02 -0700702 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800703 UUT_->v8_(in, kInputStride, out, kOutputStride,
John Koleszar04c24072013-02-20 16:32:02 -0800704 kInvalidFilter, 16, filters[filter_y], 16,
John Koleszar557a1b22013-02-20 16:13:01 -0800705 Width(), Height()));
706 else
James Zern29e1b1a2014-07-09 21:02:02 -0700707 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800708 UUT_->h8_(in, kInputStride, out, kOutputStride,
John Koleszar04c24072013-02-20 16:32:02 -0800709 filters[filter_x], 16, kInvalidFilter, 16,
John Koleszar557a1b22013-02-20 16:13:01 -0800710 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800711
John Koleszar557a1b22013-02-20 16:13:01 -0800712 CheckGuardBlocks();
John Koleszar5ca6a362013-01-25 09:47:09 -0800713
John Koleszar557a1b22013-02-20 16:13:01 -0800714 for (int y = 0; y < Height(); ++y)
715 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700716 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
717 lookup(out, y * kOutputStride + x))
John Koleszar557a1b22013-02-20 16:13:01 -0800718 << "mismatch at (" << x << "," << y << "), "
719 << "filters (" << filter_bank << ","
720 << filter_x << "," << filter_y << ")";
721 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800722 }
723 }
724}
725
726TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
727 uint8_t* const in = input();
728 uint8_t* const out = output();
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700729#if CONFIG_VP9_HIGHBITDEPTH
730 uint8_t ref8[kOutputStride * kMaxDimension];
731 uint16_t ref16[kOutputStride * kMaxDimension];
732 uint8_t* ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700733 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700734 ref = ref8;
735 } else {
736 ref = CONVERT_TO_BYTEPTR(ref16);
737 }
738#else
John Koleszar5ca6a362013-01-25 09:47:09 -0800739 uint8_t ref[kOutputStride * kMaxDimension];
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700740#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800741
742 // Populate ref and out with some random data
743 ::libvpx_test::ACMRandom prng;
744 for (int y = 0; y < Height(); ++y) {
745 for (int x = 0; x < Width(); ++x) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700746 uint16_t r;
747#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700748 if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700749 r = prng.Rand8Extremes();
750 } else {
751 r = prng.Rand16() & mask_;
752 }
753#else
754 r = prng.Rand8Extremes();
755#endif
John Koleszar5ca6a362013-01-25 09:47:09 -0800756
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700757 assign_val(out, y * kOutputStride + x, r);
758 assign_val(ref, y * kOutputStride + x, r);
John Koleszar5ca6a362013-01-25 09:47:09 -0800759 }
760 }
761
John Koleszar557a1b22013-02-20 16:13:01 -0800762 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
Dmitry Kovalev3d4ed272014-04-21 14:15:35 -0700763 const InterpKernel *filters =
764 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700765 const InterpKernel *const eighttap_smooth =
766 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
John Koleszar5ca6a362013-01-25 09:47:09 -0800767
John Koleszar557a1b22013-02-20 16:13:01 -0800768 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
769 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700770 wrapper_filter_average_block2d_8_c(in, kInputStride,
771 filters[filter_x], filters[filter_y],
772 ref, kOutputStride,
773 Width(), Height());
John Koleszar5ca6a362013-01-25 09:47:09 -0800774
Dmitry Kovalev021eaab2014-05-14 16:21:41 -0700775 if (filters == eighttap_smooth || (filter_x && filter_y))
James Zern29e1b1a2014-07-09 21:02:02 -0700776 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800777 UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,
778 filters[filter_x], 16, filters[filter_y], 16,
779 Width(), Height()));
780 else if (filter_y)
James Zern29e1b1a2014-07-09 21:02:02 -0700781 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800782 UUT_->v8_avg_(in, kInputStride, out, kOutputStride,
783 filters[filter_x], 16, filters[filter_y], 16,
784 Width(), Height()));
785 else
James Zern29e1b1a2014-07-09 21:02:02 -0700786 ASM_REGISTER_STATE_CHECK(
John Koleszar557a1b22013-02-20 16:13:01 -0800787 UUT_->h8_avg_(in, kInputStride, out, kOutputStride,
788 filters[filter_x], 16, filters[filter_y], 16,
789 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800790
John Koleszar557a1b22013-02-20 16:13:01 -0800791 CheckGuardBlocks();
John Koleszar5ca6a362013-01-25 09:47:09 -0800792
John Koleszar557a1b22013-02-20 16:13:01 -0800793 for (int y = 0; y < Height(); ++y)
794 for (int x = 0; x < Width(); ++x)
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700795 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
796 lookup(out, y * kOutputStride + x))
John Koleszar557a1b22013-02-20 16:13:01 -0800797 << "mismatch at (" << x << "," << y << "), "
798 << "filters (" << filter_bank << ","
799 << filter_x << "," << filter_y << ")";
800 }
John Koleszar5ca6a362013-01-25 09:47:09 -0800801 }
802 }
803}
804
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700805TEST_P(ConvolveTest, FilterExtremes) {
806 uint8_t *const in = input();
807 uint8_t *const out = output();
808#if CONFIG_VP9_HIGHBITDEPTH
809 uint8_t ref8[kOutputStride * kMaxDimension];
810 uint16_t ref16[kOutputStride * kMaxDimension];
811 uint8_t *ref;
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700812 if (UUT_->use_highbd_ == 0) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700813 ref = ref8;
814 } else {
815 ref = CONVERT_TO_BYTEPTR(ref16);
816 }
817#else
818 uint8_t ref[kOutputStride * kMaxDimension];
819#endif
820
821 // Populate ref and out with some random data
822 ::libvpx_test::ACMRandom prng;
823 for (int y = 0; y < Height(); ++y) {
824 for (int x = 0; x < Width(); ++x) {
825 uint16_t r;
826#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee1929c9b2014-10-08 12:43:22 -0700827 if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700828 r = prng.Rand8Extremes();
829 } else {
830 r = prng.Rand16() & mask_;
831 }
832#else
833 r = prng.Rand8Extremes();
834#endif
835 assign_val(out, y * kOutputStride + x, r);
836 assign_val(ref, y * kOutputStride + x, r);
837 }
838 }
839
840 for (int axis = 0; axis < 2; axis++) {
841 int seed_val = 0;
842 while (seed_val < 256) {
843 for (int y = 0; y < 8; ++y) {
844 for (int x = 0; x < 8; ++x) {
845#if CONFIG_VP9_HIGHBITDEPTH
846 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
847 ((seed_val >> (axis ? y : x)) & 1) * mask_);
848#else
849 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
850 ((seed_val >> (axis ? y : x)) & 1) * 255);
851#endif
852 if (axis) seed_val++;
853 }
854 if (axis)
855 seed_val-= 8;
856 else
857 seed_val++;
858 }
859 if (axis) seed_val += 8;
860
861 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
862 const InterpKernel *filters =
863 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank));
864 const InterpKernel *const eighttap_smooth =
865 vp9_get_interp_kernel(EIGHTTAP_SMOOTH);
866 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
867 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
868 wrapper_filter_block2d_8_c(in, kInputStride,
869 filters[filter_x], filters[filter_y],
870 ref, kOutputStride,
871 Width(), Height());
872 if (filters == eighttap_smooth || (filter_x && filter_y))
873 ASM_REGISTER_STATE_CHECK(
874 UUT_->hv8_(in, kInputStride, out, kOutputStride,
875 filters[filter_x], 16, filters[filter_y], 16,
876 Width(), Height()));
877 else if (filter_y)
878 ASM_REGISTER_STATE_CHECK(
879 UUT_->v8_(in, kInputStride, out, kOutputStride,
880 kInvalidFilter, 16, filters[filter_y], 16,
881 Width(), Height()));
882 else
883 ASM_REGISTER_STATE_CHECK(
884 UUT_->h8_(in, kInputStride, out, kOutputStride,
885 filters[filter_x], 16, kInvalidFilter, 16,
886 Width(), Height()));
887
888 for (int y = 0; y < Height(); ++y)
889 for (int x = 0; x < Width(); ++x)
890 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
891 lookup(out, y * kOutputStride + x))
892 << "mismatch at (" << x << "," << y << "), "
893 << "filters (" << filter_bank << ","
894 << filter_x << "," << filter_y << ")";
895 }
896 }
897 }
898 }
899 }
900}
901
John Koleszar6fd7dd12013-02-20 15:59:20 -0800902DECLARE_ALIGNED(256, const int16_t, kChangeFilters[16][8]) = {
903 { 0, 0, 0, 0, 0, 0, 0, 128},
904 { 0, 0, 0, 0, 0, 0, 128},
905 { 0, 0, 0, 0, 0, 128},
906 { 0, 0, 0, 0, 128},
907 { 0, 0, 0, 128},
908 { 0, 0, 128},
909 { 0, 128},
910 { 128},
911 { 0, 0, 0, 0, 0, 0, 0, 128},
912 { 0, 0, 0, 0, 0, 0, 128},
913 { 0, 0, 0, 0, 0, 128},
914 { 0, 0, 0, 0, 128},
915 { 0, 0, 0, 128},
916 { 0, 0, 128},
917 { 0, 128},
918 { 128}
919};
920
Adrian Grange3f108312013-08-22 16:02:18 -0700921/* This test exercises the horizontal and vertical filter functions. */
John Koleszar5ca6a362013-01-25 09:47:09 -0800922TEST_P(ConvolveTest, ChangeFilterWorks) {
923 uint8_t* const in = input();
924 uint8_t* const out = output();
Adrian Grange3f108312013-08-22 16:02:18 -0700925
926 /* Assume that the first input sample is at the 8/16th position. */
927 const int kInitialSubPelOffset = 8;
928
929 /* Filters are 8-tap, so the first filter tap will be applied to the pixel
930 * at position -3 with respect to the current filtering position. Since
931 * kInitialSubPelOffset is set to 8, we first select sub-pixel filter 8,
932 * which is non-zero only in the last tap. So, applying the filter at the
933 * current input position will result in an output equal to the pixel at
934 * offset +4 (-3 + 7) with respect to the current filtering position.
935 */
John Koleszara9ebbcc2013-04-18 13:05:38 -0700936 const int kPixelSelected = 4;
John Koleszar5ca6a362013-01-25 09:47:09 -0800937
Adrian Grange3f108312013-08-22 16:02:18 -0700938 /* Assume that each output pixel requires us to step on by 17/16th pixels in
939 * the input.
940 */
941 const int kInputPixelStep = 17;
942
943 /* The filters are setup in such a way that the expected output produces
944 * sets of 8 identical output samples. As the filter position moves to the
945 * next 1/16th pixel position the only active (=128) filter tap moves one
946 * position to the left, resulting in the same input pixel being replicated
947 * in to the output for 8 consecutive samples. After each set of 8 positions
948 * the filters select a different input pixel. kFilterPeriodAdjust below
949 * computes which input pixel is written to the output for a specified
950 * x or y position.
951 */
952
953 /* Test the horizontal filter. */
James Zern29e1b1a2014-07-09 21:02:02 -0700954 ASM_REGISTER_STATE_CHECK(
955 UUT_->h8_(in, kInputStride, out, kOutputStride,
956 kChangeFilters[kInitialSubPelOffset],
957 kInputPixelStep, NULL, 0, Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800958
John Koleszar6fd7dd12013-02-20 15:59:20 -0800959 for (int x = 0; x < Width(); ++x) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700960 const int kFilterPeriodAdjust = (x >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700961 const int ref_x =
962 kPixelSelected + ((kInitialSubPelOffset
963 + kFilterPeriodAdjust * kInputPixelStep)
964 >> SUBPEL_BITS);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700965 ASSERT_EQ(lookup(in, ref_x), lookup(out, x))
966 << "x == " << x << "width = " << Width();
John Koleszar5ca6a362013-01-25 09:47:09 -0800967 }
968
Adrian Grange3f108312013-08-22 16:02:18 -0700969 /* Test the vertical filter. */
James Zern29e1b1a2014-07-09 21:02:02 -0700970 ASM_REGISTER_STATE_CHECK(
971 UUT_->v8_(in, kInputStride, out, kOutputStride,
972 NULL, 0, kChangeFilters[kInitialSubPelOffset],
973 kInputPixelStep, Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800974
John Koleszar6fd7dd12013-02-20 15:59:20 -0800975 for (int y = 0; y < Height(); ++y) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700976 const int kFilterPeriodAdjust = (y >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700977 const int ref_y =
978 kPixelSelected + ((kInitialSubPelOffset
979 + kFilterPeriodAdjust * kInputPixelStep)
980 >> SUBPEL_BITS);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -0700981 ASSERT_EQ(lookup(in, ref_y * kInputStride), lookup(out, y * kInputStride))
982 << "y == " << y;
John Koleszar5ca6a362013-01-25 09:47:09 -0800983 }
984
Adrian Grange3f108312013-08-22 16:02:18 -0700985 /* Test the horizontal and vertical filters in combination. */
James Zern29e1b1a2014-07-09 21:02:02 -0700986 ASM_REGISTER_STATE_CHECK(
987 UUT_->hv8_(in, kInputStride, out, kOutputStride,
988 kChangeFilters[kInitialSubPelOffset], kInputPixelStep,
989 kChangeFilters[kInitialSubPelOffset], kInputPixelStep,
990 Width(), Height()));
John Koleszar5ca6a362013-01-25 09:47:09 -0800991
John Koleszar6fd7dd12013-02-20 15:59:20 -0800992 for (int y = 0; y < Height(); ++y) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700993 const int kFilterPeriodAdjustY = (y >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -0700994 const int ref_y =
995 kPixelSelected + ((kInitialSubPelOffset
996 + kFilterPeriodAdjustY * kInputPixelStep)
997 >> SUBPEL_BITS);
John Koleszar6fd7dd12013-02-20 15:59:20 -0800998 for (int x = 0; x < Width(); ++x) {
John Koleszara9ebbcc2013-04-18 13:05:38 -0700999 const int kFilterPeriodAdjustX = (x >> 3) << 3;
Adrian Grange3f108312013-08-22 16:02:18 -07001000 const int ref_x =
1001 kPixelSelected + ((kInitialSubPelOffset
1002 + kFilterPeriodAdjustX * kInputPixelStep)
1003 >> SUBPEL_BITS);
John Koleszar6fd7dd12013-02-20 15:59:20 -08001004
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001005 ASSERT_EQ(lookup(in, ref_y * kInputStride + ref_x),
1006 lookup(out, y * kOutputStride + x))
John Koleszar5ca6a362013-01-25 09:47:09 -08001007 << "x == " << x << ", y == " << y;
1008 }
1009 }
1010}
1011
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001012/* This test exercises that enough rows and columns are filtered with every
1013 possible initial fractional positions and scaling steps. */
1014TEST_P(ConvolveTest, CheckScalingFiltering) {
1015 uint8_t* const in = input();
1016 uint8_t* const out = output();
Dmitry Kovalev021eaab2014-05-14 16:21:41 -07001017 const InterpKernel *const eighttap = vp9_get_interp_kernel(EIGHTTAP);
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001018
1019 SetConstantInput(127);
1020
1021 for (int frac = 0; frac < 16; ++frac) {
1022 for (int step = 1; step <= 32; ++step) {
1023 /* Test the horizontal and vertical filters in combination. */
James Zern29e1b1a2014-07-09 21:02:02 -07001024 ASM_REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
1025 eighttap[frac], step,
1026 eighttap[frac], step,
1027 Width(), Height()));
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001028
1029 CheckGuardBlocks();
1030
1031 for (int y = 0; y < Height(); ++y) {
1032 for (int x = 0; x < Width(); ++x) {
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001033 ASSERT_EQ(lookup(in, y * kInputStride + x),
1034 lookup(out, y * kOutputStride + x))
Tero Rintaluomae326cec2013-08-22 11:29:19 +03001035 << "x == " << x << ", y == " << y
1036 << ", frac == " << frac << ", step == " << step;
1037 }
1038 }
1039 }
1040 }
1041}
1042
John Koleszar5ca6a362013-01-25 09:47:09 -08001043using std::tr1::make_tuple;
1044
Deb Mukherjee10783d42014-09-02 16:34:09 -07001045#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001046#if HAVE_SSE2 && ARCH_X86_64
1047void wrap_convolve8_horiz_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1048 uint8_t *dst, ptrdiff_t dst_stride,
1049 const int16_t *filter_x,
1050 int filter_x_stride,
1051 const int16_t *filter_y,
1052 int filter_y_stride,
1053 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001054 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride, filter_x,
1055 filter_x_stride, filter_y, filter_y_stride,
1056 w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001057}
1058
1059void wrap_convolve8_avg_horiz_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1060 uint8_t *dst, ptrdiff_t dst_stride,
1061 const int16_t *filter_x,
1062 int filter_x_stride,
1063 const int16_t *filter_y,
1064 int filter_y_stride,
1065 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001066 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1067 filter_x, filter_x_stride,
1068 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001069}
1070
1071void wrap_convolve8_vert_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1072 uint8_t *dst, ptrdiff_t dst_stride,
1073 const int16_t *filter_x,
1074 int filter_x_stride,
1075 const int16_t *filter_y,
1076 int filter_y_stride,
1077 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001078 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1079 filter_x, filter_x_stride,
1080 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001081}
1082
1083void wrap_convolve8_avg_vert_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1084 uint8_t *dst, ptrdiff_t dst_stride,
1085 const int16_t *filter_x,
1086 int filter_x_stride,
1087 const int16_t *filter_y,
1088 int filter_y_stride,
1089 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001090 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1091 filter_x, filter_x_stride,
1092 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001093}
1094
1095void wrap_convolve8_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1096 uint8_t *dst, ptrdiff_t dst_stride,
1097 const int16_t *filter_x,
1098 int filter_x_stride,
1099 const int16_t *filter_y,
1100 int filter_y_stride,
1101 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001102 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1103 filter_x, filter_x_stride,
1104 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001105}
1106
1107void wrap_convolve8_avg_sse2_8(const uint8_t *src, ptrdiff_t src_stride,
1108 uint8_t *dst, ptrdiff_t dst_stride,
1109 const int16_t *filter_x,
1110 int filter_x_stride,
1111 const int16_t *filter_y,
1112 int filter_y_stride,
1113 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001114 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1115 filter_x, filter_x_stride,
1116 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001117}
1118
1119void wrap_convolve8_horiz_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1120 uint8_t *dst, ptrdiff_t dst_stride,
1121 const int16_t *filter_x,
1122 int filter_x_stride,
1123 const int16_t *filter_y,
1124 int filter_y_stride,
1125 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001126 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride,
1127 filter_x, filter_x_stride,
1128 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001129}
1130
1131void wrap_convolve8_avg_horiz_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1132 uint8_t *dst, ptrdiff_t dst_stride,
1133 const int16_t *filter_x,
1134 int filter_x_stride,
1135 const int16_t *filter_y,
1136 int filter_y_stride,
1137 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001138 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1139 filter_x, filter_x_stride,
1140 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001141}
1142
1143void wrap_convolve8_vert_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1144 uint8_t *dst, ptrdiff_t dst_stride,
1145 const int16_t *filter_x,
1146 int filter_x_stride,
1147 const int16_t *filter_y,
1148 int filter_y_stride,
1149 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001150 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1151 filter_x, filter_x_stride,
1152 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001153}
1154
1155void wrap_convolve8_avg_vert_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1156 uint8_t *dst, ptrdiff_t dst_stride,
1157 const int16_t *filter_x,
1158 int filter_x_stride,
1159 const int16_t *filter_y,
1160 int filter_y_stride,
1161 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001162 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1163 filter_x, filter_x_stride,
1164 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001165}
1166
1167void wrap_convolve8_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1168 uint8_t *dst, ptrdiff_t dst_stride,
1169 const int16_t *filter_x,
1170 int filter_x_stride,
1171 const int16_t *filter_y,
1172 int filter_y_stride,
1173 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001174 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1175 filter_x, filter_x_stride,
1176 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001177}
1178
1179void wrap_convolve8_avg_sse2_10(const uint8_t *src, ptrdiff_t src_stride,
1180 uint8_t *dst, ptrdiff_t dst_stride,
1181 const int16_t *filter_x,
1182 int filter_x_stride,
1183 const int16_t *filter_y,
1184 int filter_y_stride,
1185 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001186 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1187 filter_x, filter_x_stride,
1188 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001189}
1190
1191void wrap_convolve8_horiz_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1192 uint8_t *dst, ptrdiff_t dst_stride,
1193 const int16_t *filter_x,
1194 int filter_x_stride,
1195 const int16_t *filter_y,
1196 int filter_y_stride,
1197 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001198 vp9_highbd_convolve8_horiz_sse2(src, src_stride, dst, dst_stride,
1199 filter_x, filter_x_stride,
1200 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001201}
1202
1203void wrap_convolve8_avg_horiz_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1204 uint8_t *dst, ptrdiff_t dst_stride,
1205 const int16_t *filter_x,
1206 int filter_x_stride,
1207 const int16_t *filter_y,
1208 int filter_y_stride,
1209 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001210 vp9_highbd_convolve8_avg_horiz_sse2(src, src_stride, dst, dst_stride,
1211 filter_x, filter_x_stride,
1212 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001213}
1214
1215void wrap_convolve8_vert_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1216 uint8_t *dst, ptrdiff_t dst_stride,
1217 const int16_t *filter_x,
1218 int filter_x_stride,
1219 const int16_t *filter_y,
1220 int filter_y_stride,
1221 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001222 vp9_highbd_convolve8_vert_sse2(src, src_stride, dst, dst_stride,
1223 filter_x, filter_x_stride,
1224 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001225}
1226
1227void wrap_convolve8_avg_vert_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1228 uint8_t *dst, ptrdiff_t dst_stride,
1229 const int16_t *filter_x,
1230 int filter_x_stride,
1231 const int16_t *filter_y,
1232 int filter_y_stride,
1233 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001234 vp9_highbd_convolve8_avg_vert_sse2(src, src_stride, dst, dst_stride,
1235 filter_x, filter_x_stride,
1236 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001237}
1238
1239void wrap_convolve8_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1240 uint8_t *dst, ptrdiff_t dst_stride,
1241 const int16_t *filter_x,
1242 int filter_x_stride,
1243 const int16_t *filter_y,
1244 int filter_y_stride,
1245 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001246 vp9_highbd_convolve8_sse2(src, src_stride, dst, dst_stride,
1247 filter_x, filter_x_stride,
1248 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001249}
1250
1251void wrap_convolve8_avg_sse2_12(const uint8_t *src, ptrdiff_t src_stride,
1252 uint8_t *dst, ptrdiff_t dst_stride,
1253 const int16_t *filter_x,
1254 int filter_x_stride,
1255 const int16_t *filter_y,
1256 int filter_y_stride,
1257 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001258 vp9_highbd_convolve8_avg_sse2(src, src_stride, dst, dst_stride,
1259 filter_x, filter_x_stride,
1260 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001261}
1262#endif // HAVE_SSE2 && ARCH_X86_64
1263
Johann1c3594c2014-12-09 12:05:15 -08001264void wrap_convolve_copy_c_8(const uint8_t *src, ptrdiff_t src_stride,
1265 uint8_t *dst, ptrdiff_t dst_stride,
1266 const int16_t *filter_x,
1267 int filter_x_stride,
1268 const int16_t *filter_y,
1269 int filter_y_stride,
1270 int w, int h) {
1271 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1272 filter_x, filter_x_stride,
1273 filter_y, filter_y_stride, w, h, 8);
1274}
1275
1276void wrap_convolve_avg_c_8(const uint8_t *src, ptrdiff_t src_stride,
1277 uint8_t *dst, ptrdiff_t dst_stride,
1278 const int16_t *filter_x,
1279 int filter_x_stride,
1280 const int16_t *filter_y,
1281 int filter_y_stride,
1282 int w, int h) {
1283 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1284 filter_x, filter_x_stride,
1285 filter_y, filter_y_stride, w, h, 8);
1286}
1287
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001288void wrap_convolve8_horiz_c_8(const uint8_t *src, ptrdiff_t src_stride,
1289 uint8_t *dst, ptrdiff_t dst_stride,
1290 const int16_t *filter_x,
1291 int filter_x_stride,
1292 const int16_t *filter_y,
1293 int filter_y_stride,
1294 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001295 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1296 filter_x, filter_x_stride,
1297 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001298}
1299
1300void wrap_convolve8_avg_horiz_c_8(const uint8_t *src, ptrdiff_t src_stride,
1301 uint8_t *dst, ptrdiff_t dst_stride,
1302 const int16_t *filter_x,
1303 int filter_x_stride,
1304 const int16_t *filter_y,
1305 int filter_y_stride,
1306 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001307 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1308 filter_x, filter_x_stride,
1309 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001310}
1311
1312void wrap_convolve8_vert_c_8(const uint8_t *src, ptrdiff_t src_stride,
1313 uint8_t *dst, ptrdiff_t dst_stride,
1314 const int16_t *filter_x,
1315 int filter_x_stride,
1316 const int16_t *filter_y,
1317 int filter_y_stride,
1318 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001319 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1320 filter_x, filter_x_stride,
1321 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001322}
1323
1324void wrap_convolve8_avg_vert_c_8(const uint8_t *src, ptrdiff_t src_stride,
1325 uint8_t *dst, ptrdiff_t dst_stride,
1326 const int16_t *filter_x,
1327 int filter_x_stride,
1328 const int16_t *filter_y,
1329 int filter_y_stride,
1330 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001331 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1332 filter_x, filter_x_stride,
1333 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001334}
1335
1336void wrap_convolve8_c_8(const uint8_t *src, ptrdiff_t src_stride,
1337 uint8_t *dst, ptrdiff_t dst_stride,
1338 const int16_t *filter_x,
1339 int filter_x_stride,
1340 const int16_t *filter_y,
1341 int filter_y_stride,
1342 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001343 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1344 filter_x, filter_x_stride,
1345 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001346}
1347
1348void wrap_convolve8_avg_c_8(const uint8_t *src, ptrdiff_t src_stride,
1349 uint8_t *dst, ptrdiff_t dst_stride,
1350 const int16_t *filter_x,
1351 int filter_x_stride,
1352 const int16_t *filter_y,
1353 int filter_y_stride,
1354 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001355 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1356 filter_x, filter_x_stride,
1357 filter_y, filter_y_stride, w, h, 8);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001358}
1359
Johann1c3594c2014-12-09 12:05:15 -08001360void wrap_convolve_copy_c_10(const uint8_t *src, ptrdiff_t src_stride,
1361 uint8_t *dst, ptrdiff_t dst_stride,
1362 const int16_t *filter_x,
1363 int filter_x_stride,
1364 const int16_t *filter_y,
1365 int filter_y_stride,
1366 int w, int h) {
1367 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1368 filter_x, filter_x_stride,
1369 filter_y, filter_y_stride, w, h, 10);
1370}
1371
1372void wrap_convolve_avg_c_10(const uint8_t *src, ptrdiff_t src_stride,
1373 uint8_t *dst, ptrdiff_t dst_stride,
1374 const int16_t *filter_x,
1375 int filter_x_stride,
1376 const int16_t *filter_y,
1377 int filter_y_stride,
1378 int w, int h) {
1379 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1380 filter_x, filter_x_stride,
1381 filter_y, filter_y_stride, w, h, 10);
1382}
1383
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001384void wrap_convolve8_horiz_c_10(const uint8_t *src, ptrdiff_t src_stride,
1385 uint8_t *dst, ptrdiff_t dst_stride,
1386 const int16_t *filter_x,
1387 int filter_x_stride,
1388 const int16_t *filter_y,
1389 int filter_y_stride,
1390 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001391 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1392 filter_x, filter_x_stride,
1393 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001394}
1395
1396void wrap_convolve8_avg_horiz_c_10(const uint8_t *src, ptrdiff_t src_stride,
1397 uint8_t *dst, ptrdiff_t dst_stride,
1398 const int16_t *filter_x,
1399 int filter_x_stride,
1400 const int16_t *filter_y,
1401 int filter_y_stride,
1402 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001403 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1404 filter_x, filter_x_stride,
1405 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001406}
1407
1408void wrap_convolve8_vert_c_10(const uint8_t *src, ptrdiff_t src_stride,
1409 uint8_t *dst, ptrdiff_t dst_stride,
1410 const int16_t *filter_x,
1411 int filter_x_stride,
1412 const int16_t *filter_y,
1413 int filter_y_stride,
1414 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001415 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1416 filter_x, filter_x_stride,
1417 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001418}
1419
1420void wrap_convolve8_avg_vert_c_10(const uint8_t *src, ptrdiff_t src_stride,
1421 uint8_t *dst, ptrdiff_t dst_stride,
1422 const int16_t *filter_x,
1423 int filter_x_stride,
1424 const int16_t *filter_y,
1425 int filter_y_stride,
1426 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001427 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1428 filter_x, filter_x_stride,
1429 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001430}
1431
1432void wrap_convolve8_c_10(const uint8_t *src, ptrdiff_t src_stride,
1433 uint8_t *dst, ptrdiff_t dst_stride,
1434 const int16_t *filter_x,
1435 int filter_x_stride,
1436 const int16_t *filter_y,
1437 int filter_y_stride,
1438 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001439 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1440 filter_x, filter_x_stride,
1441 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001442}
1443
1444void wrap_convolve8_avg_c_10(const uint8_t *src, ptrdiff_t src_stride,
1445 uint8_t *dst, ptrdiff_t dst_stride,
1446 const int16_t *filter_x,
1447 int filter_x_stride,
1448 const int16_t *filter_y,
1449 int filter_y_stride,
1450 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001451 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1452 filter_x, filter_x_stride,
1453 filter_y, filter_y_stride, w, h, 10);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001454}
1455
Johann1c3594c2014-12-09 12:05:15 -08001456void wrap_convolve_copy_c_12(const uint8_t *src, ptrdiff_t src_stride,
1457 uint8_t *dst, ptrdiff_t dst_stride,
1458 const int16_t *filter_x,
1459 int filter_x_stride,
1460 const int16_t *filter_y,
1461 int filter_y_stride,
1462 int w, int h) {
1463 vp9_highbd_convolve_copy_c(src, src_stride, dst, dst_stride,
1464 filter_x, filter_x_stride,
1465 filter_y, filter_y_stride, w, h, 12);
1466}
1467
1468void wrap_convolve_avg_c_12(const uint8_t *src, ptrdiff_t src_stride,
1469 uint8_t *dst, ptrdiff_t dst_stride,
1470 const int16_t *filter_x,
1471 int filter_x_stride,
1472 const int16_t *filter_y,
1473 int filter_y_stride,
1474 int w, int h) {
1475 vp9_highbd_convolve_avg_c(src, src_stride, dst, dst_stride,
1476 filter_x, filter_x_stride,
1477 filter_y, filter_y_stride, w, h, 12);
1478}
1479
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001480void wrap_convolve8_horiz_c_12(const uint8_t *src, ptrdiff_t src_stride,
1481 uint8_t *dst, ptrdiff_t dst_stride,
1482 const int16_t *filter_x,
1483 int filter_x_stride,
1484 const int16_t *filter_y,
1485 int filter_y_stride,
1486 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001487 vp9_highbd_convolve8_horiz_c(src, src_stride, dst, dst_stride,
1488 filter_x, filter_x_stride,
1489 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001490}
1491
1492void wrap_convolve8_avg_horiz_c_12(const uint8_t *src, ptrdiff_t src_stride,
1493 uint8_t *dst, ptrdiff_t dst_stride,
1494 const int16_t *filter_x,
1495 int filter_x_stride,
1496 const int16_t *filter_y,
1497 int filter_y_stride,
1498 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001499 vp9_highbd_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride,
1500 filter_x, filter_x_stride,
1501 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001502}
1503
1504void wrap_convolve8_vert_c_12(const uint8_t *src, ptrdiff_t src_stride,
1505 uint8_t *dst, ptrdiff_t dst_stride,
1506 const int16_t *filter_x,
1507 int filter_x_stride,
1508 const int16_t *filter_y,
1509 int filter_y_stride,
1510 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001511 vp9_highbd_convolve8_vert_c(src, src_stride, dst, dst_stride,
1512 filter_x, filter_x_stride,
1513 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001514}
1515
1516void wrap_convolve8_avg_vert_c_12(const uint8_t *src, ptrdiff_t src_stride,
1517 uint8_t *dst, ptrdiff_t dst_stride,
1518 const int16_t *filter_x,
1519 int filter_x_stride,
1520 const int16_t *filter_y,
1521 int filter_y_stride,
1522 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001523 vp9_highbd_convolve8_avg_vert_c(src, src_stride, dst, dst_stride,
1524 filter_x, filter_x_stride,
1525 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001526}
1527
1528void wrap_convolve8_c_12(const uint8_t *src, ptrdiff_t src_stride,
1529 uint8_t *dst, ptrdiff_t dst_stride,
1530 const int16_t *filter_x,
1531 int filter_x_stride,
1532 const int16_t *filter_y,
1533 int filter_y_stride,
1534 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001535 vp9_highbd_convolve8_c(src, src_stride, dst, dst_stride,
1536 filter_x, filter_x_stride,
1537 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001538}
1539
1540void wrap_convolve8_avg_c_12(const uint8_t *src, ptrdiff_t src_stride,
1541 uint8_t *dst, ptrdiff_t dst_stride,
1542 const int16_t *filter_x,
1543 int filter_x_stride,
1544 const int16_t *filter_y,
1545 int filter_y_stride,
1546 int w, int h) {
Deb Mukherjee1929c9b2014-10-08 12:43:22 -07001547 vp9_highbd_convolve8_avg_c(src, src_stride, dst, dst_stride,
1548 filter_x, filter_x_stride,
1549 filter_y, filter_y_stride, w, h, 12);
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001550}
1551
1552const ConvolveFunctions convolve8_c(
Johann1c3594c2014-12-09 12:05:15 -08001553 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001554 wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
1555 wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8,
1556 wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 8);
1557INSTANTIATE_TEST_CASE_P(C_8, ConvolveTest, ::testing::Values(
1558 make_tuple(4, 4, &convolve8_c),
1559 make_tuple(8, 4, &convolve8_c),
1560 make_tuple(4, 8, &convolve8_c),
1561 make_tuple(8, 8, &convolve8_c),
1562 make_tuple(16, 8, &convolve8_c),
1563 make_tuple(8, 16, &convolve8_c),
1564 make_tuple(16, 16, &convolve8_c),
1565 make_tuple(32, 16, &convolve8_c),
1566 make_tuple(16, 32, &convolve8_c),
1567 make_tuple(32, 32, &convolve8_c),
1568 make_tuple(64, 32, &convolve8_c),
1569 make_tuple(32, 64, &convolve8_c),
1570 make_tuple(64, 64, &convolve8_c)));
1571const ConvolveFunctions convolve10_c(
Johann1c3594c2014-12-09 12:05:15 -08001572 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001573 wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
1574 wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10,
1575 wrap_convolve8_c_10, wrap_convolve8_avg_c_10, 10);
1576INSTANTIATE_TEST_CASE_P(C_10, ConvolveTest, ::testing::Values(
1577 make_tuple(4, 4, &convolve10_c),
1578 make_tuple(8, 4, &convolve10_c),
1579 make_tuple(4, 8, &convolve10_c),
1580 make_tuple(8, 8, &convolve10_c),
1581 make_tuple(16, 8, &convolve10_c),
1582 make_tuple(8, 16, &convolve10_c),
1583 make_tuple(16, 16, &convolve10_c),
1584 make_tuple(32, 16, &convolve10_c),
1585 make_tuple(16, 32, &convolve10_c),
1586 make_tuple(32, 32, &convolve10_c),
1587 make_tuple(64, 32, &convolve10_c),
1588 make_tuple(32, 64, &convolve10_c),
1589 make_tuple(64, 64, &convolve10_c)));
1590const ConvolveFunctions convolve12_c(
Johann1c3594c2014-12-09 12:05:15 -08001591 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001592 wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,
1593 wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12,
1594 wrap_convolve8_c_12, wrap_convolve8_avg_c_12, 12);
1595INSTANTIATE_TEST_CASE_P(C_12, ConvolveTest, ::testing::Values(
1596 make_tuple(4, 4, &convolve12_c),
1597 make_tuple(8, 4, &convolve12_c),
1598 make_tuple(4, 8, &convolve12_c),
1599 make_tuple(8, 8, &convolve12_c),
1600 make_tuple(16, 8, &convolve12_c),
1601 make_tuple(8, 16, &convolve12_c),
1602 make_tuple(16, 16, &convolve12_c),
1603 make_tuple(32, 16, &convolve12_c),
1604 make_tuple(16, 32, &convolve12_c),
1605 make_tuple(32, 32, &convolve12_c),
1606 make_tuple(64, 32, &convolve12_c),
1607 make_tuple(32, 64, &convolve12_c),
1608 make_tuple(64, 64, &convolve12_c)));
1609
Deb Mukherjee10783d42014-09-02 16:34:09 -07001610#else
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001611
John Koleszar5ca6a362013-01-25 09:47:09 -08001612const ConvolveFunctions convolve8_c(
Johann1c3594c2014-12-09 12:05:15 -08001613 vp9_convolve_copy_c, vp9_convolve_avg_c,
John Koleszar5ca6a362013-01-25 09:47:09 -08001614 vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
1615 vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001616 vp9_convolve8_c, vp9_convolve8_avg_c, 0);
John Koleszar5ca6a362013-01-25 09:47:09 -08001617
1618INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
John Koleszar5ca6a362013-01-25 09:47:09 -08001619 make_tuple(4, 4, &convolve8_c),
1620 make_tuple(8, 4, &convolve8_c),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001621 make_tuple(4, 8, &convolve8_c),
John Koleszar5ca6a362013-01-25 09:47:09 -08001622 make_tuple(8, 8, &convolve8_c),
John Koleszar6a4f7082013-02-08 17:49:44 -08001623 make_tuple(16, 8, &convolve8_c),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001624 make_tuple(8, 16, &convolve8_c),
1625 make_tuple(16, 16, &convolve8_c),
1626 make_tuple(32, 16, &convolve8_c),
1627 make_tuple(16, 32, &convolve8_c),
1628 make_tuple(32, 32, &convolve8_c),
1629 make_tuple(64, 32, &convolve8_c),
1630 make_tuple(32, 64, &convolve8_c),
1631 make_tuple(64, 64, &convolve8_c)));
Deb Mukherjee10783d42014-09-02 16:34:09 -07001632#endif
John Koleszar29d47ac2013-02-07 17:00:37 -08001633
Deb Mukherjee10783d42014-09-02 16:34:09 -07001634#if HAVE_SSE2 && ARCH_X86_64
1635#if CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001636const ConvolveFunctions convolve8_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001637 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001638 wrap_convolve8_horiz_sse2_8, wrap_convolve8_avg_horiz_sse2_8,
1639 wrap_convolve8_vert_sse2_8, wrap_convolve8_avg_vert_sse2_8,
1640 wrap_convolve8_sse2_8, wrap_convolve8_avg_sse2_8, 8);
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001641const ConvolveFunctions convolve10_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001642 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001643 wrap_convolve8_horiz_sse2_10, wrap_convolve8_avg_horiz_sse2_10,
1644 wrap_convolve8_vert_sse2_10, wrap_convolve8_avg_vert_sse2_10,
1645 wrap_convolve8_sse2_10, wrap_convolve8_avg_sse2_10, 10);
1646const ConvolveFunctions convolve12_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001647 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001648 wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12,
1649 wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,
1650 wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);
1651INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001652 make_tuple(4, 4, &convolve8_sse2),
1653 make_tuple(8, 4, &convolve8_sse2),
1654 make_tuple(4, 8, &convolve8_sse2),
1655 make_tuple(8, 8, &convolve8_sse2),
1656 make_tuple(16, 8, &convolve8_sse2),
1657 make_tuple(8, 16, &convolve8_sse2),
1658 make_tuple(16, 16, &convolve8_sse2),
1659 make_tuple(32, 16, &convolve8_sse2),
1660 make_tuple(16, 32, &convolve8_sse2),
1661 make_tuple(32, 32, &convolve8_sse2),
1662 make_tuple(64, 32, &convolve8_sse2),
1663 make_tuple(32, 64, &convolve8_sse2),
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001664 make_tuple(64, 64, &convolve8_sse2),
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001665 make_tuple(4, 4, &convolve10_sse2),
1666 make_tuple(8, 4, &convolve10_sse2),
1667 make_tuple(4, 8, &convolve10_sse2),
1668 make_tuple(8, 8, &convolve10_sse2),
1669 make_tuple(16, 8, &convolve10_sse2),
1670 make_tuple(8, 16, &convolve10_sse2),
1671 make_tuple(16, 16, &convolve10_sse2),
1672 make_tuple(32, 16, &convolve10_sse2),
1673 make_tuple(16, 32, &convolve10_sse2),
1674 make_tuple(32, 32, &convolve10_sse2),
1675 make_tuple(64, 32, &convolve10_sse2),
1676 make_tuple(32, 64, &convolve10_sse2),
Deb Mukherjee27dce0f2014-11-07 10:19:46 -08001677 make_tuple(64, 64, &convolve10_sse2),
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001678 make_tuple(4, 4, &convolve12_sse2),
1679 make_tuple(8, 4, &convolve12_sse2),
1680 make_tuple(4, 8, &convolve12_sse2),
1681 make_tuple(8, 8, &convolve12_sse2),
1682 make_tuple(16, 8, &convolve12_sse2),
1683 make_tuple(8, 16, &convolve12_sse2),
1684 make_tuple(16, 16, &convolve12_sse2),
1685 make_tuple(32, 16, &convolve12_sse2),
1686 make_tuple(16, 32, &convolve12_sse2),
1687 make_tuple(32, 32, &convolve12_sse2),
1688 make_tuple(64, 32, &convolve12_sse2),
1689 make_tuple(32, 64, &convolve12_sse2),
1690 make_tuple(64, 64, &convolve12_sse2)));
Deb Mukherjee10783d42014-09-02 16:34:09 -07001691#else
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001692const ConvolveFunctions convolve8_sse2(
Johann1c3594c2014-12-09 12:05:15 -08001693 vp9_convolve_copy_sse2, vp9_convolve_avg_sse2,
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001694 vp9_convolve8_horiz_sse2, vp9_convolve8_avg_horiz_sse2,
1695 vp9_convolve8_vert_sse2, vp9_convolve8_avg_vert_sse2,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001696 vp9_convolve8_sse2, vp9_convolve8_avg_sse2, 0);
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001697
1698INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, ::testing::Values(
1699 make_tuple(4, 4, &convolve8_sse2),
1700 make_tuple(8, 4, &convolve8_sse2),
1701 make_tuple(4, 8, &convolve8_sse2),
1702 make_tuple(8, 8, &convolve8_sse2),
1703 make_tuple(16, 8, &convolve8_sse2),
1704 make_tuple(8, 16, &convolve8_sse2),
1705 make_tuple(16, 16, &convolve8_sse2),
1706 make_tuple(32, 16, &convolve8_sse2),
1707 make_tuple(16, 32, &convolve8_sse2),
1708 make_tuple(32, 32, &convolve8_sse2),
1709 make_tuple(64, 32, &convolve8_sse2),
1710 make_tuple(32, 64, &convolve8_sse2),
1711 make_tuple(64, 64, &convolve8_sse2)));
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001712#endif // CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjee10783d42014-09-02 16:34:09 -07001713#endif
Yunqing Wang3fb728c2013-10-10 13:51:35 -07001714
John Koleszar29d47ac2013-02-07 17:00:37 -08001715#if HAVE_SSSE3
1716const ConvolveFunctions convolve8_ssse3(
Johann1c3594c2014-12-09 12:05:15 -08001717 vp9_convolve_copy_c, vp9_convolve_avg_c,
Jim Bankoskic3809f32013-08-05 12:07:30 -07001718 vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_ssse3,
1719 vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_ssse3,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001720 vp9_convolve8_ssse3, vp9_convolve8_avg_ssse3, 0);
John Koleszar29d47ac2013-02-07 17:00:37 -08001721
1722INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
1723 make_tuple(4, 4, &convolve8_ssse3),
1724 make_tuple(8, 4, &convolve8_ssse3),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001725 make_tuple(4, 8, &convolve8_ssse3),
John Koleszar29d47ac2013-02-07 17:00:37 -08001726 make_tuple(8, 8, &convolve8_ssse3),
John Koleszar6a4f7082013-02-08 17:49:44 -08001727 make_tuple(16, 8, &convolve8_ssse3),
John Koleszara9ebbcc2013-04-18 13:05:38 -07001728 make_tuple(8, 16, &convolve8_ssse3),
1729 make_tuple(16, 16, &convolve8_ssse3),
1730 make_tuple(32, 16, &convolve8_ssse3),
1731 make_tuple(16, 32, &convolve8_ssse3),
1732 make_tuple(32, 32, &convolve8_ssse3),
1733 make_tuple(64, 32, &convolve8_ssse3),
1734 make_tuple(32, 64, &convolve8_ssse3),
1735 make_tuple(64, 64, &convolve8_ssse3)));
John Koleszar29d47ac2013-02-07 17:00:37 -08001736#endif
Johann158c80c2013-05-23 12:50:41 -07001737
Johann8645a532014-09-10 10:27:58 -07001738#if HAVE_AVX2 && HAVE_SSSE3
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001739const ConvolveFunctions convolve8_avx2(
Johann1c3594c2014-12-09 12:05:15 -08001740 vp9_convolve_copy_c, vp9_convolve_avg_c,
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001741 vp9_convolve8_horiz_avx2, vp9_convolve8_avg_horiz_ssse3,
1742 vp9_convolve8_vert_avx2, vp9_convolve8_avg_vert_ssse3,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001743 vp9_convolve8_avx2, vp9_convolve8_avg_ssse3, 0);
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001744
1745INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, ::testing::Values(
1746 make_tuple(4, 4, &convolve8_avx2),
1747 make_tuple(8, 4, &convolve8_avx2),
1748 make_tuple(4, 8, &convolve8_avx2),
1749 make_tuple(8, 8, &convolve8_avx2),
levytamar82839911f2014-07-27 16:45:55 -07001750 make_tuple(8, 16, &convolve8_avx2),
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001751 make_tuple(16, 8, &convolve8_avx2),
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001752 make_tuple(16, 16, &convolve8_avx2),
1753 make_tuple(32, 16, &convolve8_avx2),
1754 make_tuple(16, 32, &convolve8_avx2),
1755 make_tuple(32, 32, &convolve8_avx2),
1756 make_tuple(64, 32, &convolve8_avx2),
1757 make_tuple(32, 64, &convolve8_avx2),
1758 make_tuple(64, 64, &convolve8_avx2)));
Johann8645a532014-09-10 10:27:58 -07001759#endif // HAVE_AVX2 && HAVE_SSSE3
Yunqing Wang4f0943b2014-05-27 10:36:56 -07001760
Scott LaVarnway617382a2014-09-10 09:49:34 -07001761#if HAVE_NEON
Johannce239312014-05-07 11:01:31 -07001762#if HAVE_NEON_ASM
Johann158c80c2013-05-23 12:50:41 -07001763const ConvolveFunctions convolve8_neon(
Johann1c3594c2014-12-09 12:05:15 -08001764 vp9_convolve_copy_neon, vp9_convolve_avg_neon,
Johanna15bebf2013-07-12 16:12:58 -07001765 vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon,
1766 vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001767 vp9_convolve8_neon, vp9_convolve8_avg_neon, 0);
Scott LaVarnway617382a2014-09-10 09:49:34 -07001768#else // HAVE_NEON
1769const ConvolveFunctions convolve8_neon(
1770 vp9_convolve_copy_c, vp9_convolve_avg_neon,
1771 vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
1772 vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
1773 vp9_convolve8_c, vp9_convolve8_avg_c, 0);
1774#endif // HAVE_NEON_ASM
Johann158c80c2013-05-23 12:50:41 -07001775
1776INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, ::testing::Values(
1777 make_tuple(4, 4, &convolve8_neon),
1778 make_tuple(8, 4, &convolve8_neon),
1779 make_tuple(4, 8, &convolve8_neon),
1780 make_tuple(8, 8, &convolve8_neon),
1781 make_tuple(16, 8, &convolve8_neon),
1782 make_tuple(8, 16, &convolve8_neon),
1783 make_tuple(16, 16, &convolve8_neon),
1784 make_tuple(32, 16, &convolve8_neon),
1785 make_tuple(16, 32, &convolve8_neon),
1786 make_tuple(32, 32, &convolve8_neon),
1787 make_tuple(64, 32, &convolve8_neon),
1788 make_tuple(32, 64, &convolve8_neon),
1789 make_tuple(64, 64, &convolve8_neon)));
Scott LaVarnway617382a2014-09-10 09:49:34 -07001790#endif // HAVE_NEON
Parag Salasakar40edab52013-09-13 15:18:32 +05301791
1792#if HAVE_DSPR2
1793const ConvolveFunctions convolve8_dspr2(
Johann1c3594c2014-12-09 12:05:15 -08001794 vp9_convolve_copy_dspr2, vp9_convolve_avg_dspr2,
Parag Salasakar40edab52013-09-13 15:18:32 +05301795 vp9_convolve8_horiz_dspr2, vp9_convolve8_avg_horiz_dspr2,
1796 vp9_convolve8_vert_dspr2, vp9_convolve8_avg_vert_dspr2,
Deb Mukherjee0d3c3d32014-09-16 12:47:18 -07001797 vp9_convolve8_dspr2, vp9_convolve8_avg_dspr2, 0);
Parag Salasakar40edab52013-09-13 15:18:32 +05301798
1799INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, ::testing::Values(
1800 make_tuple(4, 4, &convolve8_dspr2),
1801 make_tuple(8, 4, &convolve8_dspr2),
1802 make_tuple(4, 8, &convolve8_dspr2),
1803 make_tuple(8, 8, &convolve8_dspr2),
1804 make_tuple(16, 8, &convolve8_dspr2),
1805 make_tuple(8, 16, &convolve8_dspr2),
1806 make_tuple(16, 16, &convolve8_dspr2),
1807 make_tuple(32, 16, &convolve8_dspr2),
1808 make_tuple(16, 32, &convolve8_dspr2),
1809 make_tuple(32, 32, &convolve8_dspr2),
1810 make_tuple(64, 32, &convolve8_dspr2),
1811 make_tuple(32, 64, &convolve8_dspr2),
1812 make_tuple(64, 64, &convolve8_dspr2)));
1813#endif
James Zern8fb48af2013-05-02 13:08:19 -07001814} // namespace