Commit 39bdf36a authored by Yi Luo's avatar Yi Luo

Lowbd rect intrapred DC/LEFT/TOP/128 sse2 optimization

Add lowbd unit test functionality to intrapred_test.cc
Function speedup against C (i7-6700):
Predictor   DC     LEFT   TOP    128
4x8        ~1.4x  ~1.4x  ~1.7x  ~1.9x
8x4        ~1.2x  ~1.6x  ~1.6x  ~2.6x
8x16       ~1.4x  ~1.3x  ~1.4x  ~2.1x
16x8       ~2.0x  ~1.8x  ~2.3x  ~2.1x
16x32      ~2.0x  ~1.9x  ~1.8x  ~2.2x
32x16      ~2.0x  ~2.0x  ~1.9x  ~2.2x

Change-Id: I33db512020ca3c6853a9205a8079f3d00134f584
parent 8b80d232
......@@ -45,6 +45,7 @@ set(AOM_DSP_COMMON_ASM_SSE2
set(AOM_DSP_COMMON_INTRIN_SSE2
"${AOM_ROOT}/aom_dsp/x86/aom_asm_stubs.c"
"${AOM_ROOT}/aom_dsp/x86/convolve.h"
"${AOM_ROOT}/aom_dsp/x86/intrapred_sse2.c"
"${AOM_ROOT}/aom_dsp/x86/txfm_common_sse2.h"
"${AOM_ROOT}/aom_dsp/x86/lpf_common_sse2.h"
"${AOM_ROOT}/aom_dsp/x86/loopfilter_sse2.c")
......
......@@ -75,6 +75,8 @@ DSP_SRCS-$(HAVE_SSE2) += x86/intrapred_sse2.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/intrapred_ssse3.asm
DSP_SRCS-$(HAVE_SSSE3) += x86/aom_subpixel_8t_ssse3.asm
DSP_SRCS-$(HAVE_SSE2) += x86/intrapred_sse2.c
ifeq ($(CONFIG_HIGHBITDEPTH),yes)
DSP_SRCS-$(HAVE_SSE) += x86/highbd_intrapred_sse2.asm
DSP_SRCS-$(HAVE_SSE2) += x86/highbd_intrapred_sse2.asm
......
......@@ -83,36 +83,61 @@ foreach (@tx_sizes) {
}
}
specialize qw/aom_dc_top_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_top_predictor_4x8 sse2/;
specialize qw/aom_dc_top_predictor_8x4 sse2/;
specialize qw/aom_dc_top_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_top_predictor_8x16 sse2/;
specialize qw/aom_dc_top_predictor_16x8 sse2/;
specialize qw/aom_dc_top_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_top_predictor_16x32 sse2/;
specialize qw/aom_dc_top_predictor_32x16 sse2/;
specialize qw/aom_dc_top_predictor_32x32 msa neon sse2/;
specialize qw/aom_dc_left_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_left_predictor_4x8 sse2/;
specialize qw/aom_dc_left_predictor_8x4 sse2/;
specialize qw/aom_dc_left_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_left_predictor_8x16 sse2/;
specialize qw/aom_dc_left_predictor_16x8 sse2/;
specialize qw/aom_dc_left_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_left_predictor_16x32 sse2/;
specialize qw/aom_dc_left_predictor_32x16 sse2/;
specialize qw/aom_dc_left_predictor_32x32 msa neon sse2/;
specialize qw/aom_dc_128_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_128_predictor_4x8 sse2/;
specialize qw/aom_dc_128_predictor_8x4 sse2/;
specialize qw/aom_dc_128_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_128_predictor_8x16 sse2/;
specialize qw/aom_dc_128_predictor_16x8 sse2/;
specialize qw/aom_dc_128_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_128_predictor_16x32 sse2/;
specialize qw/aom_dc_128_predictor_32x16 sse2/;
specialize qw/aom_dc_128_predictor_32x32 msa neon sse2/;
specialize qw/aom_d63e_predictor_4x4 ssse3/;
specialize qw/aom_h_predictor_4x4 neon dspr2 msa sse2/;
specialize qw/aom_d135_predictor_4x4 neon/;
specialize qw/aom_d153_predictor_4x4 ssse3/;
specialize qw/aom_v_predictor_4x4 neon msa sse2/;
specialize qw/aom_dc_predictor_4x4 dspr2 msa neon sse2/;
specialize qw/aom_dc_top_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_left_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_128_predictor_4x4 msa neon sse2/;
specialize qw/aom_dc_predictor_4x8 sse2/;
specialize qw/aom_h_predictor_8x8 neon dspr2 msa sse2/;
specialize qw/aom_d153_predictor_8x8 ssse3/;
specialize qw/aom_v_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_predictor_8x4 sse2/;
specialize qw/aom_dc_predictor_8x8 dspr2 neon msa sse2/;
specialize qw/aom_dc_top_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_left_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_128_predictor_8x8 neon msa sse2/;
specialize qw/aom_dc_predictor_8x16 sse2/;
specialize qw/aom_h_predictor_16x16 neon dspr2 msa sse2/;
specialize qw/aom_d153_predictor_16x16 ssse3/;
specialize qw/aom_v_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_predictor_16x8 sse2/;
specialize qw/aom_dc_predictor_16x16 dspr2 neon msa sse2/;
specialize qw/aom_dc_top_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_left_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_128_predictor_16x16 neon msa sse2/;
specialize qw/aom_dc_predictor_16x32 sse2/;
specialize qw/aom_h_predictor_32x32 neon msa sse2/;
specialize qw/aom_d153_predictor_32x32 ssse3/;
specialize qw/aom_v_predictor_32x32 neon msa sse2/;
specialize qw/aom_dc_predictor_32x16 sse2/;
specialize qw/aom_dc_predictor_32x32 msa neon sse2/;
specialize qw/aom_dc_top_predictor_32x32 msa neon sse2/;
specialize qw/aom_dc_left_predictor_32x32 msa neon sse2/;
specialize qw/aom_dc_128_predictor_32x32 msa neon sse2/;
if (aom_config("CONFIG_HIGHBITDEPTH") eq "yes") {
specialize qw/aom_highbd_v_predictor_4x4 sse2/;
......
/*
* Copyright (c) 2017, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <emmintrin.h>
#include "./aom_dsp_rtcd.h"
static INLINE void dc_store_4x8(uint32_t dc, uint8_t *dst, ptrdiff_t stride) {
int i;
for (i = 0; i < 4; ++i) {
*(uint32_t *)dst = dc;
dst += stride;
*(uint32_t *)dst = dc;
dst += stride;
}
}
static INLINE void dc_store_8xh(const __m128i *row, int height, uint8_t *dst,
ptrdiff_t stride) {
int i;
for (i = 0; i < height; ++i) {
_mm_storel_epi64((__m128i *)dst, *row);
dst += stride;
}
}
static INLINE void dc_store_16xh(const __m128i *row, int height, uint8_t *dst,
ptrdiff_t stride) {
int i;
for (i = 0; i < height; ++i) {
_mm_store_si128((__m128i *)dst, *row);
dst += stride;
}
}
static INLINE void dc_store_32xh(const __m128i *row, int height, uint8_t *dst,
ptrdiff_t stride) {
int i;
for (i = 0; i < height; ++i) {
_mm_store_si128((__m128i *)dst, *row);
_mm_store_si128((__m128i *)(dst + 16), *row);
dst += stride;
}
}
static INLINE __m128i dc_sum_4(const uint8_t *ref) {
__m128i x = _mm_loadl_epi64((__m128i const *)ref);
const __m128i zero = _mm_setzero_si128();
x = _mm_unpacklo_epi8(x, zero);
return _mm_sad_epu8(x, zero);
}
static INLINE __m128i dc_sum_8(const uint8_t *ref) {
__m128i x = _mm_loadl_epi64((__m128i const *)ref);
const __m128i zero = _mm_setzero_si128();
return _mm_sad_epu8(x, zero);
}
static INLINE __m128i dc_sum_16(const uint8_t *ref) {
__m128i x = _mm_load_si128((__m128i const *)ref);
const __m128i zero = _mm_setzero_si128();
x = _mm_sad_epu8(x, zero);
const __m128i high = _mm_unpackhi_epi64(x, x);
return _mm_add_epi16(x, high);
}
static INLINE __m128i dc_sum_32(const uint8_t *ref) {
__m128i x0 = _mm_load_si128((__m128i const *)ref);
__m128i x1 = _mm_load_si128((__m128i const *)(ref + 16));
const __m128i zero = _mm_setzero_si128();
x0 = _mm_sad_epu8(x0, zero);
x1 = _mm_sad_epu8(x1, zero);
x0 = _mm_add_epi16(x0, x1);
const __m128i high = _mm_unpackhi_epi64(x0, x0);
return _mm_add_epi16(x0, high);
}
// -----------------------------------------------------------------------------
// DC_PRED
void aom_dc_predictor_4x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const __m128i sum_left = dc_sum_8(left);
__m128i sum_above = dc_sum_4(above);
sum_above = _mm_add_epi16(sum_left, sum_above);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 6;
sum /= 12;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
const uint32_t pred = _mm_cvtsi128_si32(row);
dc_store_4x8(pred, dst, stride);
}
void aom_dc_predictor_8x4_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const __m128i sum_left = dc_sum_4(left);
__m128i sum_above = dc_sum_8(above);
sum_above = _mm_add_epi16(sum_above, sum_left);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 6;
sum /= 12;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
dc_store_8xh(&row, 4, dst, stride);
}
void aom_dc_predictor_8x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const __m128i sum_left = dc_sum_16(left);
__m128i sum_above = dc_sum_8(above);
sum_above = _mm_add_epi16(sum_above, sum_left);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 12;
sum /= 24;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
dc_store_8xh(&row, 16, dst, stride);
}
void aom_dc_predictor_16x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const __m128i sum_left = dc_sum_8(left);
__m128i sum_above = dc_sum_16(above);
sum_above = _mm_add_epi16(sum_above, sum_left);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 12;
sum /= 24;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
dc_store_16xh(&row, 8, dst, stride);
}
void aom_dc_predictor_16x32_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
const __m128i sum_left = dc_sum_32(left);
__m128i sum_above = dc_sum_16(above);
sum_above = _mm_add_epi16(sum_left, sum_above);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 24;
sum /= 48;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
dc_store_16xh(&row, 32, dst, stride);
}
void aom_dc_predictor_32x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
__m128i sum_above = dc_sum_32(above);
const __m128i sum_left = dc_sum_16(left);
sum_above = _mm_add_epi16(sum_above, sum_left);
uint32_t sum = _mm_cvtsi128_si32(sum_above);
sum += 24;
sum /= 48;
const __m128i row = _mm_set1_epi8((uint8_t)sum);
dc_store_32xh(&row, 16, dst, stride);
}
// -----------------------------------------------------------------------------
// DC_TOP
void aom_dc_top_predictor_4x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_4(above);
const __m128i two = _mm_set1_epi16((int16_t)2);
sum_above = _mm_add_epi16(sum_above, two);
sum_above = _mm_srai_epi16(sum_above, 2);
sum_above = _mm_shufflelo_epi16(sum_above, 0);
sum_above = _mm_packus_epi16(sum_above, sum_above);
const uint32_t pred = _mm_cvtsi128_si32(sum_above);
dc_store_4x8(pred, dst, stride);
}
void aom_dc_top_predictor_8x4_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_8(above);
const __m128i four = _mm_set1_epi16((uint16_t)4);
sum_above = _mm_add_epi16(sum_above, four);
sum_above = _mm_srai_epi16(sum_above, 3);
sum_above = _mm_unpacklo_epi8(sum_above, sum_above);
const __m128i row = _mm_shufflelo_epi16(sum_above, 0);
dc_store_8xh(&row, 4, dst, stride);
}
void aom_dc_top_predictor_8x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_8(above);
const __m128i four = _mm_set1_epi16((uint16_t)4);
sum_above = _mm_add_epi16(sum_above, four);
sum_above = _mm_srai_epi16(sum_above, 3);
sum_above = _mm_unpacklo_epi8(sum_above, sum_above);
const __m128i row = _mm_shufflelo_epi16(sum_above, 0);
dc_store_8xh(&row, 16, dst, stride);
}
void aom_dc_top_predictor_16x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_16(above);
const __m128i eight = _mm_set1_epi16((uint16_t)8);
sum_above = _mm_add_epi16(sum_above, eight);
sum_above = _mm_srai_epi16(sum_above, 4);
sum_above = _mm_unpacklo_epi8(sum_above, sum_above);
sum_above = _mm_shufflelo_epi16(sum_above, 0);
const __m128i row = _mm_unpacklo_epi64(sum_above, sum_above);
dc_store_16xh(&row, 8, dst, stride);
}
void aom_dc_top_predictor_16x32_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_16(above);
const __m128i eight = _mm_set1_epi16((uint16_t)8);
sum_above = _mm_add_epi16(sum_above, eight);
sum_above = _mm_srai_epi16(sum_above, 4);
sum_above = _mm_unpacklo_epi8(sum_above, sum_above);
sum_above = _mm_shufflelo_epi16(sum_above, 0);
const __m128i row = _mm_unpacklo_epi64(sum_above, sum_above);
dc_store_16xh(&row, 32, dst, stride);
}
void aom_dc_top_predictor_32x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)left;
__m128i sum_above = dc_sum_32(above);
const __m128i sixteen = _mm_set1_epi16((uint16_t)16);
sum_above = _mm_add_epi16(sum_above, sixteen);
sum_above = _mm_srai_epi16(sum_above, 5);
sum_above = _mm_unpacklo_epi8(sum_above, sum_above);
sum_above = _mm_shufflelo_epi16(sum_above, 0);
const __m128i row = _mm_unpacklo_epi64(sum_above, sum_above);
dc_store_32xh(&row, 16, dst, stride);
}
// -----------------------------------------------------------------------------
// DC_LEFT
void aom_dc_left_predictor_4x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_8(left);
const __m128i four = _mm_set1_epi16((uint16_t)4);
sum_left = _mm_add_epi16(sum_left, four);
sum_left = _mm_srai_epi16(sum_left, 3);
sum_left = _mm_shufflelo_epi16(sum_left, 0);
sum_left = _mm_packus_epi16(sum_left, sum_left);
const uint32_t pred = _mm_cvtsi128_si32(sum_left);
dc_store_4x8(pred, dst, stride);
}
void aom_dc_left_predictor_8x4_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_4(left);
const __m128i two = _mm_set1_epi16((uint16_t)2);
sum_left = _mm_add_epi16(sum_left, two);
sum_left = _mm_srai_epi16(sum_left, 2);
sum_left = _mm_unpacklo_epi8(sum_left, sum_left);
const __m128i row = _mm_shufflelo_epi16(sum_left, 0);
dc_store_8xh(&row, 4, dst, stride);
}
void aom_dc_left_predictor_8x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_16(left);
const __m128i eight = _mm_set1_epi16((uint16_t)8);
sum_left = _mm_add_epi16(sum_left, eight);
sum_left = _mm_srai_epi16(sum_left, 4);
sum_left = _mm_unpacklo_epi8(sum_left, sum_left);
const __m128i row = _mm_shufflelo_epi16(sum_left, 0);
dc_store_8xh(&row, 16, dst, stride);
}
void aom_dc_left_predictor_16x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_8(left);
const __m128i four = _mm_set1_epi16((uint16_t)4);
sum_left = _mm_add_epi16(sum_left, four);
sum_left = _mm_srai_epi16(sum_left, 3);
sum_left = _mm_unpacklo_epi8(sum_left, sum_left);
sum_left = _mm_shufflelo_epi16(sum_left, 0);
const __m128i row = _mm_unpacklo_epi64(sum_left, sum_left);
dc_store_16xh(&row, 8, dst, stride);
}
void aom_dc_left_predictor_16x32_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_32(left);
const __m128i sixteen = _mm_set1_epi16((uint16_t)16);
sum_left = _mm_add_epi16(sum_left, sixteen);
sum_left = _mm_srai_epi16(sum_left, 5);
sum_left = _mm_unpacklo_epi8(sum_left, sum_left);
sum_left = _mm_shufflelo_epi16(sum_left, 0);
const __m128i row = _mm_unpacklo_epi64(sum_left, sum_left);
dc_store_16xh(&row, 32, dst, stride);
}
void aom_dc_left_predictor_32x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
__m128i sum_left = dc_sum_16(left);
const __m128i eight = _mm_set1_epi16((uint16_t)8);
sum_left = _mm_add_epi16(sum_left, eight);
sum_left = _mm_srai_epi16(sum_left, 4);
sum_left = _mm_unpacklo_epi8(sum_left, sum_left);
sum_left = _mm_shufflelo_epi16(sum_left, 0);
const __m128i row = _mm_unpacklo_epi64(sum_left, sum_left);
dc_store_32xh(&row, 16, dst, stride);
}
// -----------------------------------------------------------------------------
// DC_128
void aom_dc_128_predictor_4x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
(void)left;
const uint32_t pred = 0x80808080;
dc_store_4x8(pred, dst, stride);
}
void aom_dc_128_predictor_8x4_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
(void)left;
const __m128i row = _mm_set1_epi8((uint8_t)128);
dc_store_8xh(&row, 4, dst, stride);
}
void aom_dc_128_predictor_8x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
(void)left;
const __m128i row = _mm_set1_epi8((uint8_t)128);
dc_store_8xh(&row, 16, dst, stride);
}
void aom_dc_128_predictor_16x8_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above, const uint8_t *left) {
(void)above;
(void)left;
const __m128i row = _mm_set1_epi8((uint8_t)128);
dc_store_16xh(&row, 8, dst, stride);
}
void aom_dc_128_predictor_16x32_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
(void)left;
const __m128i row = _mm_set1_epi8((uint8_t)128);
dc_store_16xh(&row, 32, dst, stride);
}
void aom_dc_128_predictor_32x16_sse2(uint8_t *dst, ptrdiff_t stride,
const uint8_t *above,
const uint8_t *left) {
(void)above;
(void)left;
const __m128i row = _mm_set1_epi8((uint8_t)128);
dc_store_32xh(&row, 16, dst, stride);
}
......@@ -29,27 +29,32 @@ using libaom_test::ACMRandom;
const int count_test_block = 100000;
typedef void (*IntraPred)(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above, const uint16_t *left, int bps);
typedef void (*HighbdIntraPred)(uint16_t *dst, ptrdiff_t stride,
const uint16_t *above, const uint16_t *left,
int bps);
typedef void (*IntraPred)(uint8_t *dst, ptrdiff_t stride, const uint8_t *above,
const uint8_t *left);
template <typename FuncType>
struct IntraPredFunc {
IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,
IntraPredFunc(FuncType pred = NULL, FuncType ref = NULL,
int block_width_value = 0, int block_height_value = 0,
int bit_depth_value = 0)
: pred_fn(pred), ref_fn(ref), block_width(block_width_value),
block_height(block_height_value), bit_depth(bit_depth_value) {}
IntraPred pred_fn;
IntraPred ref_fn;
FuncType pred_fn;
FuncType ref_fn;
int block_width;
int block_height;
int bit_depth;
};
class AV1IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
template <typename FuncType, typename Pixel>
class AV1IntraPredTest
: public ::testing::TestWithParam<IntraPredFunc<FuncType> > {
public:
void RunTest(uint16_t *left_col, uint16_t *above_data, uint16_t *dst,
uint16_t *ref_dst) {
void RunTest(Pixel *left_col, Pixel *above_data, Pixel *dst, Pixel *ref_dst) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int block_width = params_.block_width;
const int block_height = params_.block_height;
......@@ -82,17 +87,12 @@ class AV1IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
protected:
virtual void SetUp() {
params_ = GetParam();
params_ = this->GetParam();
stride_ = params_.block_width * 3;
mask_ = (1 << params_.bit_depth) - 1;
}
void Predict() {
const int bit_depth = params_.bit_depth;
params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
ASM_REGISTER_STATE_CHECK(
params_.pred_fn(dst_, stride_, above_row_, left_col_, bit_depth));
}
virtual void Predict() = 0;
void CheckPrediction(int test_case_number, int *error_count) const {
// For each pixel ensure that the calculated value is the same as reference.
......@@ -109,17 +109,36 @@ class AV1IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
}
}
uint16_t *above_row_;
uint16_t *left_col_;
uint16_t *dst_;
uint16_t *ref_dst_;
Pixel *above_row_;
Pixel *left_col_;
Pixel *dst_;
Pixel *ref_dst_;
ptrdiff_t stride_;
int mask_;
IntraPredFunc params_;
IntraPredFunc<FuncType> params_;
};
class HighbdIntraPredTest : public AV1IntraPredTest<HighbdIntraPred, uint16_t> {
protected:
void Predict() {
const int bit_depth = params_.bit_depth;
params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
ASM_REGISTER_STATE_CHECK(
params_.pred_fn(dst_, stride_, above_row_, left_col_, bit_depth));
}
};
TEST_P(AV1IntraPredTest, IntraPredTests) {
class LowbdIntraPredTest : public AV1IntraPredTest<IntraPred, uint8_t> {
protected:
void Predict() {
params_.ref_fn(ref_dst_, stride_, above_row_, left_col_);
ASM_REGISTER_STATE_CHECK(
params_.pred_fn(dst_, stride_, above_row_, left_col_));
}
};
TEST_P(HighbdIntraPredTest, IntraPredTests) {
// max block size is 32
DECLARE_ALIGNED(16, uint16_t, left_col[2 * 32]);
DECLARE_ALIGNED(16, uint16_t, above_data[2 * 32 + 32]);
......@@ -128,229 +147,82 @@ TEST_P(AV1IntraPredTest, IntraPredTests) {
RunTest(left_col, above_data, dst, ref_dst);
}
#define highbd_entry(type, width, height, opt, bd) \
IntraPredFunc(&aom_highbd_##type##_predictor_##width##x##height##_##opt, \
&aom_highbd_##type##_predictor_##width##x##height##_c, width, \
height, bd)
TEST_P(LowbdIntraPredTest, IntraPredTests) {
// max block size is 32
DECLARE_ALIGNED(16, uint8_t, left_col[2 * 32]);
DECLARE_ALIGNED(16, uint8_t, above_data[2 * 32 + 32]);
DECLARE_ALIGNED(16, uint8_t, dst[3 * 32 * 32]);
DECLARE_ALIGNED(16, uint8_t, ref_dst[3 * 32 * 32]);
RunTest(left_col, above_data, dst, ref_dst);
}
#define highbd_entry(type, width, height, opt, bd) \
IntraPredFunc<HighbdIntraPred>( \