Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions av2/common/av2_rtcd_defs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,16 @@ ()
add_proto qw/void av2_highbd_convolve_2d_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_convolve_x_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_convolve_y_sr/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, int bd";
add_proto qw/void av2_highbd_dist_wtd_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_dist_wtd_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_dist_wtd_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_dist_wtd_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_cwp_convolve_2d/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int subpel_y_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_cwp_convolve_x/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_cwp_convolve_y/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_cwp_convolve_2d_copy/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, ConvolveParams *conv_params, int bd";
add_proto qw/void av2_highbd_convolve_2d_scale/, "const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams *filter_params_x, const InterpFilterParams *filter_params_y, const int subpel_x_qn, const int x_step_qn, const int subpel_y_qn, const int y_step_qn, ConvolveParams *conv_params, int bd";

specialize qw/av2_highbd_dist_wtd_convolve_2d sse4_1 avx2/;
specialize qw/av2_highbd_dist_wtd_convolve_x sse4_1 avx2/;
specialize qw/av2_highbd_dist_wtd_convolve_y sse4_1 avx2/;
specialize qw/av2_highbd_dist_wtd_convolve_2d_copy sse4_1 avx2/;
specialize qw/av2_highbd_cwp_convolve_2d sse4_1 avx2/;
specialize qw/av2_highbd_cwp_convolve_x sse4_1 avx2/;
specialize qw/av2_highbd_cwp_convolve_y sse4_1 avx2/;
specialize qw/av2_highbd_cwp_convolve_2d_copy sse4_1 avx2/;
specialize qw/av2_highbd_convolve_2d_sr ssse3 avx2/;
specialize qw/av2_highbd_convolve_x_sr ssse3 avx2/;
specialize qw/av2_highbd_convolve_y_sr ssse3 avx2/;
Expand Down
4 changes: 2 additions & 2 deletions av2/common/blockd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1794,10 +1794,10 @@ typedef struct cfl_ctx {
#endif // CONFIG_DEBUG
} CFL_CTX;

typedef struct dist_wtd_comp_params {
typedef struct cwp_params {
int fwd_offset;
int bck_offset;
} DIST_WTD_COMP_PARAMS;
} CWP_PARAMS;

struct scale_factors;

Expand Down
62 changes: 29 additions & 33 deletions av2/common/convolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ void av2_highbd_convolve_2d_sr_c(const uint16_t *src, int src_stride,
}
}

void av2_highbd_dist_wtd_convolve_2d_c(
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_qn,
const int subpel_y_qn, ConvolveParams *conv_params, int bd) {
void av2_highbd_cwp_convolve_2d_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y,
const int subpel_x_qn, const int subpel_y_qn,
ConvolveParams *conv_params, int bd) {
int x, y, k;
int16_t im_block[(MAX_SB_SIZE + MAX_FILTER_TAP - 1) * MAX_SB_SIZE];
CONV_BUF_TYPE *dst16 = conv_params->dst;
Expand Down Expand Up @@ -221,12 +222,11 @@ void av2_highbd_dist_wtd_convolve_2d_c(
}
}

void av2_highbd_dist_wtd_convolve_x_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w,
int h,
const InterpFilterParams *filter_params_x,
const int subpel_x_qn,
ConvolveParams *conv_params, int bd) {
void av2_highbd_cwp_convolve_x_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w, int h,
const InterpFilterParams *filter_params_x,
const int subpel_x_qn,
ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst16 = conv_params->dst;
int dst16_stride = conv_params->dst_stride;
const int fo_horiz = filter_params_x->taps / 2 - 1;
Expand Down Expand Up @@ -271,12 +271,11 @@ void av2_highbd_dist_wtd_convolve_x_c(const uint16_t *src, int src_stride,
}
}

void av2_highbd_dist_wtd_convolve_y_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w,
int h,
const InterpFilterParams *filter_params_y,
const int subpel_y_qn,
ConvolveParams *conv_params, int bd) {
void av2_highbd_cwp_convolve_y_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w, int h,
const InterpFilterParams *filter_params_y,
const int subpel_y_qn,
ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst16 = conv_params->dst;
int dst16_stride = conv_params->dst_stride;
const int fo_vert = filter_params_y->taps / 2 - 1;
Expand Down Expand Up @@ -320,11 +319,10 @@ void av2_highbd_dist_wtd_convolve_y_c(const uint16_t *src, int src_stride,
}
}

void av2_highbd_dist_wtd_convolve_2d_copy_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride,
int w, int h,
ConvolveParams *conv_params,
int bd) {
void av2_highbd_cwp_convolve_2d_copy_c(const uint16_t *src, int src_stride,
uint16_t *dst, int dst_stride, int w,
int h, ConvolveParams *conv_params,
int bd) {
CONV_BUF_TYPE *dst16 = conv_params->dst;
int dst16_stride = conv_params->dst_stride;
const int bits =
Expand Down Expand Up @@ -453,21 +451,19 @@ static void highbd_convolve_2d_facade_compound(
const bool need_x = subpel_x_qn != 0;
const bool need_y = subpel_y_qn != 0;
if (!need_x && !need_y) {
av2_highbd_dist_wtd_convolve_2d_copy(src, src_stride, dst, dst_stride, w, h,
conv_params, bd);
av2_highbd_cwp_convolve_2d_copy(src, src_stride, dst, dst_stride, w, h,
conv_params, bd);
} else if (need_x && !need_y) {
av2_highbd_dist_wtd_convolve_x(src, src_stride, dst, dst_stride, w, h,
filter_params_x, subpel_x_qn, conv_params,
bd);
av2_highbd_cwp_convolve_x(src, src_stride, dst, dst_stride, w, h,
filter_params_x, subpel_x_qn, conv_params, bd);
} else if (!need_x && need_y) {
av2_highbd_dist_wtd_convolve_y(src, src_stride, dst, dst_stride, w, h,
filter_params_y, subpel_y_qn, conv_params,
bd);
av2_highbd_cwp_convolve_y(src, src_stride, dst, dst_stride, w, h,
filter_params_y, subpel_y_qn, conv_params, bd);
} else {
assert(need_x && need_y);
av2_highbd_dist_wtd_convolve_2d(src, src_stride, dst, dst_stride, w, h,
filter_params_x, filter_params_y,
subpel_x_qn, subpel_y_qn, conv_params, bd);
av2_highbd_cwp_convolve_2d(src, src_stride, dst, dst_stride, w, h,
filter_params_x, filter_params_y, subpel_x_qn,
subpel_y_qn, conv_params, bd);
}
}

Expand Down
12 changes: 6 additions & 6 deletions av2/common/x86/highbd_convolve_2d_sse4.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
#include "avm_dsp/x86/convolve_sse4_1.h"
#include "av2/common/convolve.h"

void av2_highbd_dist_wtd_convolve_2d_copy_sse4_1(const uint16_t *src,
int src_stride, uint16_t *dst0,
int dst_stride0, int w, int h,
ConvolveParams *conv_params,
int bd) {
void av2_highbd_cwp_convolve_2d_copy_sse4_1(const uint16_t *src, int src_stride,
uint16_t *dst0, int dst_stride0,
int w, int h,
ConvolveParams *conv_params,
int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;

Expand Down Expand Up @@ -163,7 +163,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_sse4_1(const uint16_t *src,
}
}

void av2_highbd_dist_wtd_convolve_2d_sse4_1(
void av2_highbd_cwp_convolve_2d_sse4_1(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_qn,
Expand Down
69 changes: 37 additions & 32 deletions av2/common/x86/highbd_jnt_convolve_avx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "avm_dsp/avm_filter.h"
#include "av2/common/convolve.h"

#define CONVOLVE_DIST_WTD_VERT_FILTER_8TAP \
#define CONVOLVE_CWP_VERT_FILTER_8TAP \
const __m256i s0 = \
_mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \
const __m256i s1 = \
Expand Down Expand Up @@ -182,7 +182,7 @@
} \
}

#define CONVOLVE_DIST_WTD_VERT_FILTER_6TAP \
#define CONVOLVE_CWP_VERT_FILTER_6TAP \
const __m256i s0 = \
_mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \
const __m256i s1 = \
Expand Down Expand Up @@ -331,7 +331,7 @@
} \
}

#define CONVOLVE_DIST_WTD_VERT_FILTER_4TAP \
#define CONVOLVE_CWP_VERT_FILTER_4TAP \
const __m256i s0 = \
_mm256_loadu_si256((__m256i *)(im_block + 0 * im_stride)); \
const __m256i s1 = \
Expand Down Expand Up @@ -470,7 +470,7 @@
} \
}

#define CONVOLVE_DIST_WTD_VERT_FILTER_2TAP \
#define CONVOLVE_CWP_VERT_FILTER_2TAP \
if (w - j < 8) { \
for (i = 0; i < h; i += 2) { \
const int16_t *data = &im_block[i * im_stride]; \
Expand Down Expand Up @@ -605,7 +605,7 @@ static INLINE void _mm_storeh_epi64(__m128i *const d, __m128i s) {
_mm_storeh_pi((__m64 *)d, _mm_castsi128_ps(s));
}

static INLINE void highbd_dist_wtd_convolve_2d_copy_do_average(
static INLINE void highbd_cwp_convolve_2d_copy_do_average(
__m256i data, __m256i zero, __m256i res, const __m256i *offset_const,
const __m256i *wt0, const __m256i *wt1, int use_wtd_comp_avg,
const __m256i *const rounding_const, int rounding_shift,
Expand Down Expand Up @@ -634,11 +634,10 @@ static INLINE void highbd_dist_wtd_convolve_2d_copy_do_average(
*res_clip = _mm256_min_epi16(res_16b, clip_pixel_to_bd);
}

void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src,
int src_stride, uint16_t *dst0,
int dst_stride0, int w, int h,
ConvolveParams *conv_params,
int bd) {
void av2_highbd_cwp_convolve_2d_copy_avx2(const uint16_t *src, int src_stride,
uint16_t *dst0, int dst_stride0,
int w, int h,
ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;

Expand Down Expand Up @@ -680,7 +679,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src,
const __m256i data_0 =
_mm256_loadu_si256((__m256i *)(&dst[i * dst_stride + j]));

highbd_dist_wtd_convolve_2d_copy_do_average(
highbd_cwp_convolve_2d_copy_do_average(
data_0, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg,
&rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip);

Expand Down Expand Up @@ -709,7 +708,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src,
const __m256i data_01 =
_mm256_permute2x128_si256(data_0, data_1, 0x20);

highbd_dist_wtd_convolve_2d_copy_do_average(
highbd_cwp_convolve_2d_copy_do_average(
data_01, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg,
&rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip);

Expand Down Expand Up @@ -749,7 +748,7 @@ void av2_highbd_dist_wtd_convolve_2d_copy_avx2(const uint16_t *src,
const __m256i data_01 =
_mm256_permute2x128_si256(data_0, data_1, 0x20);

highbd_dist_wtd_convolve_2d_copy_do_average(
highbd_cwp_convolve_2d_copy_do_average(
data_01, zero, res, &offset_const, &wt0, &wt1, use_wtd_comp_avg,
&rounding_const, rounding_shift, clip_pixel_to_bd, &res_clip);

Expand Down Expand Up @@ -845,10 +844,12 @@ DECLARE_ALIGNED(32, static const uint8_t, shuffle_mask1[32]) = {
4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13
};

static INLINE void dist_wtd_convolve_horiz_w4(
const uint16_t *src_ptr, int src_stride, const __m256i *const coeffs,
int im_h, int16_t *im_block, int im_stride, const __m256i *round_const_x,
const __m128i *round_shift_x) {
static INLINE void cwp_convolve_horiz_w4(const uint16_t *src_ptr,
int src_stride,
const __m256i *const coeffs, int im_h,
int16_t *im_block, int im_stride,
const __m256i *round_const_x,
const __m128i *round_shift_x) {
__m256i s[2];
for (int i = 0; i < im_h; i += 2) {
const __m256i row0 =
Expand All @@ -872,7 +873,7 @@ static INLINE void dist_wtd_convolve_horiz_w4(
}
}

void av2_highbd_dist_wtd_convolve_2d_avx2(
void av2_highbd_cwp_convolve_2d_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x,
const InterpFilterParams *filter_params_y, const int subpel_x_qn,
Expand Down Expand Up @@ -951,8 +952,8 @@ void av2_highbd_dist_wtd_convolve_2d_avx2(
/* Horizontal filter */
if (w == 4) {
assert(tap_x == 2 || tap_x == 4);
dist_wtd_convolve_horiz_w4(src_ptr, src_stride, coeffs_x, im_h, im_block,
im_stride, &round_const_x, &round_shift_x);
cwp_convolve_horiz_w4(src_ptr, src_stride, coeffs_x, im_h, im_block,
im_stride, &round_const_x, &round_shift_x);
} else {
if (tap_x == 8) {
CONVOLVE_HORIZ_FILTER_8TAP
Expand All @@ -967,21 +968,23 @@ void av2_highbd_dist_wtd_convolve_2d_avx2(

/* Vertical filter */
if (tap_y == 8) {
CONVOLVE_DIST_WTD_VERT_FILTER_8TAP
CONVOLVE_CWP_VERT_FILTER_8TAP
} else if (tap_y == 6) {
CONVOLVE_DIST_WTD_VERT_FILTER_6TAP
CONVOLVE_CWP_VERT_FILTER_6TAP
} else if (tap_y == 4) {
CONVOLVE_DIST_WTD_VERT_FILTER_4TAP
CONVOLVE_CWP_VERT_FILTER_4TAP
} else {
CONVOLVE_DIST_WTD_VERT_FILTER_2TAP
CONVOLVE_CWP_VERT_FILTER_2TAP
}
}
}

void av2_highbd_dist_wtd_convolve_x_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_x, const int subpel_x_qn,
ConvolveParams *conv_params, int bd) {
void av2_highbd_cwp_convolve_x_avx2(const uint16_t *src, int src_stride,
uint16_t *dst0, int dst_stride0, int w,
int h,
const InterpFilterParams *filter_params_x,
const int subpel_x_qn,
ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_horiz = filter_params_x->taps / 2 - 1;
Expand Down Expand Up @@ -1142,10 +1145,12 @@ void av2_highbd_dist_wtd_convolve_x_avx2(
}
}

void av2_highbd_dist_wtd_convolve_y_avx2(
const uint16_t *src, int src_stride, uint16_t *dst0, int dst_stride0, int w,
int h, const InterpFilterParams *filter_params_y, const int subpel_y_qn,
ConvolveParams *conv_params, int bd) {
void av2_highbd_cwp_convolve_y_avx2(const uint16_t *src, int src_stride,
uint16_t *dst0, int dst_stride0, int w,
int h,
const InterpFilterParams *filter_params_y,
const int subpel_y_qn,
ConvolveParams *conv_params, int bd) {
CONV_BUF_TYPE *dst = conv_params->dst;
int dst_stride = conv_params->dst_stride;
const int fo_vert = filter_params_y->taps / 2 - 1;
Expand Down
Loading
Loading