Merge changes Ib9105462,Idfac00ed,If8d8a0e2
* changes: cosmetics: NEON scaling code Refactor convolve NEON code Refactor convolve code
This commit is contained in:
commit
28762341ac
@ -78,7 +78,16 @@ class ScaleTest : public VpxScaleBase,
|
||||
src_width, src_height, dst_width, dst_height));
|
||||
ReferenceScaleFrame(filter_type, phase_scaler);
|
||||
ScaleFrame(filter_type, phase_scaler);
|
||||
PrintDiff();
|
||||
if (memcmp(dst_img_.buffer_alloc, ref_img_.buffer_alloc,
|
||||
ref_img_.frame_size)) {
|
||||
printf(
|
||||
"filter_type = %d, phase_scaler = %d, src_width = %4d, "
|
||||
"src_height = %4d, dst_width = %4d, dst_height = %4d, "
|
||||
"scale factor = %d:%d\n",
|
||||
filter_type, phase_scaler, src_width, src_height,
|
||||
dst_width, dst_height, sf_down, sf_up);
|
||||
PrintDiff();
|
||||
}
|
||||
CompareImages(dst_img_);
|
||||
DeallocScaleImages();
|
||||
}
|
||||
@ -134,8 +143,8 @@ TEST_P(ScaleTest, DISABLED_Speed) {
|
||||
static const int kCountSpeedTestBlock = 100;
|
||||
static const int kNumScaleFactorsToTest = 4;
|
||||
static const int kScaleFactors[] = { 1, 2, 3, 4 };
|
||||
const int src_height = 1280;
|
||||
const int src_width = 720;
|
||||
const int src_width = 1280;
|
||||
const int src_height = 720;
|
||||
for (INTERP_FILTER filter_type = 2; filter_type < 4; ++filter_type) {
|
||||
for (int phase_scaler = 0; phase_scaler < 2; ++phase_scaler) {
|
||||
for (int sf_up_idx = 0; sf_up_idx < kNumScaleFactorsToTest; ++sf_up_idx) {
|
||||
|
@ -170,37 +170,18 @@ static INLINE void scale_plane_4_to_1_bilinear_phase_non_0_neon(
|
||||
} while (--y);
|
||||
}
|
||||
|
||||
static INLINE uint8x8_t scale_filter(const uint8x8_t *const s,
|
||||
const int16x8_t filters) {
|
||||
const int16x8_t filter3 = vdupq_lane_s16(vget_low_s16(filters), 3);
|
||||
const int16x8_t filter4 = vdupq_lane_s16(vget_high_s16(filters), 0);
|
||||
int16x8_t ss[8];
|
||||
|
||||
ss[0] = vreinterpretq_s16_u16(vmovl_u8(s[0]));
|
||||
ss[1] = vreinterpretq_s16_u16(vmovl_u8(s[1]));
|
||||
ss[2] = vreinterpretq_s16_u16(vmovl_u8(s[2]));
|
||||
ss[3] = vreinterpretq_s16_u16(vmovl_u8(s[3]));
|
||||
ss[4] = vreinterpretq_s16_u16(vmovl_u8(s[4]));
|
||||
ss[5] = vreinterpretq_s16_u16(vmovl_u8(s[5]));
|
||||
ss[6] = vreinterpretq_s16_u16(vmovl_u8(s[6]));
|
||||
ss[7] = vreinterpretq_s16_u16(vmovl_u8(s[7]));
|
||||
|
||||
return convolve8_8(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7],
|
||||
filters, filter3, filter4);
|
||||
}
|
||||
|
||||
static void scale_plane_2_to_1_general_neon(const uint8_t *src,
|
||||
const int src_stride, uint8_t *dst,
|
||||
const int dst_stride, const int w,
|
||||
const int h,
|
||||
const int16_t *const coef,
|
||||
uint8_t *const temp_buffer) {
|
||||
const int max_width_hor = (w + 3) & ~3;
|
||||
const int max_width_ver = (w + 7) & ~7;
|
||||
const int max_height_hor = (2 * h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int max_height_ver = (h + 3) & ~3;
|
||||
const int width_hor = (w + 3) & ~3;
|
||||
const int width_ver = (w + 7) & ~7;
|
||||
const int height_hor = (2 * h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int height_ver = (h + 3) & ~3;
|
||||
const int16x8_t filters = vld1q_s16(coef);
|
||||
int x, y = max_height_hor;
|
||||
int x, y = height_hor;
|
||||
uint8_t *t = temp_buffer;
|
||||
uint8x8_t s[14], d[4];
|
||||
|
||||
@ -208,14 +189,14 @@ static void scale_plane_2_to_1_general_neon(const uint8_t *src,
|
||||
|
||||
src -= (SUBPEL_TAPS / 2 - 1) * src_stride + SUBPEL_TAPS / 2 + 1;
|
||||
|
||||
// horizontal
|
||||
// horizontal 4x8
|
||||
// Note: processing 4x8 is about 20% faster than processing row by row using
|
||||
// vld4_u8().
|
||||
do {
|
||||
load_u8_8x8(src + 2, src_stride, &s[0], &s[1], &s[2], &s[3], &s[4], &s[5],
|
||||
&s[6], &s[7]);
|
||||
transpose_u8_8x8(&s[0], &s[1], &s[2], &s[3], &s[4], &s[5], &s[6], &s[7]);
|
||||
x = max_width_hor;
|
||||
x = width_hor;
|
||||
|
||||
do {
|
||||
src += 8;
|
||||
@ -224,31 +205,31 @@ static void scale_plane_2_to_1_general_neon(const uint8_t *src,
|
||||
transpose_u8_8x8(&s[6], &s[7], &s[8], &s[9], &s[10], &s[11], &s[12],
|
||||
&s[13]);
|
||||
|
||||
d[0] = scale_filter(&s[0], filters); // 00 10 20 30 40 50 60 70
|
||||
d[1] = scale_filter(&s[2], filters); // 01 11 21 31 41 51 61 71
|
||||
d[2] = scale_filter(&s[4], filters); // 02 12 22 32 42 52 62 72
|
||||
d[3] = scale_filter(&s[6], filters); // 03 13 23 33 43 53 63 73
|
||||
d[0] = scale_filter_8(&s[0], filters); // 00 10 20 30 40 50 60 70
|
||||
d[1] = scale_filter_8(&s[2], filters); // 01 11 21 31 41 51 61 71
|
||||
d[2] = scale_filter_8(&s[4], filters); // 02 12 22 32 42 52 62 72
|
||||
d[3] = scale_filter_8(&s[6], filters); // 03 13 23 33 43 53 63 73
|
||||
// 00 01 02 03 40 41 42 43
|
||||
// 10 11 12 13 50 51 52 53
|
||||
// 20 21 22 23 60 61 62 63
|
||||
// 30 31 32 33 70 71 72 73
|
||||
transpose_u8_8x4(&d[0], &d[1], &d[2], &d[3]);
|
||||
vst1_lane_u32((uint32_t *)(t + 0 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[0]), 0);
|
||||
vst1_lane_u32((uint32_t *)(t + 1 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[1]), 0);
|
||||
vst1_lane_u32((uint32_t *)(t + 2 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[2]), 0);
|
||||
vst1_lane_u32((uint32_t *)(t + 3 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[3]), 0);
|
||||
vst1_lane_u32((uint32_t *)(t + 4 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[0]), 1);
|
||||
vst1_lane_u32((uint32_t *)(t + 5 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[1]), 1);
|
||||
vst1_lane_u32((uint32_t *)(t + 6 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[2]), 1);
|
||||
vst1_lane_u32((uint32_t *)(t + 7 * max_width_hor),
|
||||
vreinterpret_u32_u8(d[3]), 1);
|
||||
vst1_lane_u32((uint32_t *)(t + 0 * width_hor), vreinterpret_u32_u8(d[0]),
|
||||
0);
|
||||
vst1_lane_u32((uint32_t *)(t + 1 * width_hor), vreinterpret_u32_u8(d[1]),
|
||||
0);
|
||||
vst1_lane_u32((uint32_t *)(t + 2 * width_hor), vreinterpret_u32_u8(d[2]),
|
||||
0);
|
||||
vst1_lane_u32((uint32_t *)(t + 3 * width_hor), vreinterpret_u32_u8(d[3]),
|
||||
0);
|
||||
vst1_lane_u32((uint32_t *)(t + 4 * width_hor), vreinterpret_u32_u8(d[0]),
|
||||
1);
|
||||
vst1_lane_u32((uint32_t *)(t + 5 * width_hor), vreinterpret_u32_u8(d[1]),
|
||||
1);
|
||||
vst1_lane_u32((uint32_t *)(t + 6 * width_hor), vreinterpret_u32_u8(d[2]),
|
||||
1);
|
||||
vst1_lane_u32((uint32_t *)(t + 7 * width_hor), vreinterpret_u32_u8(d[3]),
|
||||
1);
|
||||
|
||||
s[0] = s[8];
|
||||
s[1] = s[9];
|
||||
@ -260,29 +241,29 @@ static void scale_plane_2_to_1_general_neon(const uint8_t *src,
|
||||
t += 4;
|
||||
x -= 4;
|
||||
} while (x);
|
||||
src += 8 * src_stride - 2 * max_width_hor;
|
||||
t += 7 * max_width_hor;
|
||||
src += 8 * src_stride - 2 * width_hor;
|
||||
t += 7 * width_hor;
|
||||
y -= 8;
|
||||
} while (y);
|
||||
|
||||
// vertical
|
||||
x = max_width_ver;
|
||||
// vertical 8x4
|
||||
x = width_ver;
|
||||
t = temp_buffer;
|
||||
do {
|
||||
load_u8_8x8(t, max_width_hor, &s[0], &s[1], &s[2], &s[3], &s[4], &s[5],
|
||||
&s[6], &s[7]);
|
||||
t += 6 * max_width_hor;
|
||||
y = max_height_ver;
|
||||
load_u8_8x8(t, width_hor, &s[0], &s[1], &s[2], &s[3], &s[4], &s[5], &s[6],
|
||||
&s[7]);
|
||||
t += 6 * width_hor;
|
||||
y = height_ver;
|
||||
|
||||
do {
|
||||
load_u8_8x8(t, max_width_hor, &s[6], &s[7], &s[8], &s[9], &s[10], &s[11],
|
||||
load_u8_8x8(t, width_hor, &s[6], &s[7], &s[8], &s[9], &s[10], &s[11],
|
||||
&s[12], &s[13]);
|
||||
t += 8 * max_width_hor;
|
||||
t += 8 * width_hor;
|
||||
|
||||
d[0] = scale_filter(&s[0], filters);
|
||||
d[1] = scale_filter(&s[2], filters);
|
||||
d[2] = scale_filter(&s[4], filters);
|
||||
d[3] = scale_filter(&s[6], filters);
|
||||
d[0] = scale_filter_8(&s[0], filters);
|
||||
d[1] = scale_filter_8(&s[2], filters);
|
||||
d[2] = scale_filter_8(&s[4], filters);
|
||||
d[3] = scale_filter_8(&s[6], filters);
|
||||
vst1_u8(dst + 0 * dst_stride, d[0]);
|
||||
vst1_u8(dst + 1 * dst_stride, d[1]);
|
||||
vst1_u8(dst + 2 * dst_stride, d[2]);
|
||||
@ -298,9 +279,9 @@ static void scale_plane_2_to_1_general_neon(const uint8_t *src,
|
||||
dst += 4 * dst_stride;
|
||||
y -= 4;
|
||||
} while (y);
|
||||
t -= max_width_hor * (2 * max_height_ver + 6);
|
||||
t -= width_hor * (2 * height_ver + 6);
|
||||
t += 8;
|
||||
dst -= max_height_ver * dst_stride;
|
||||
dst -= height_ver * dst_stride;
|
||||
dst += 8;
|
||||
x -= 8;
|
||||
} while (x);
|
||||
@ -312,12 +293,12 @@ static void scale_plane_4_to_1_general_neon(const uint8_t *src,
|
||||
const int h,
|
||||
const int16_t *const coef,
|
||||
uint8_t *const temp_buffer) {
|
||||
const int max_width_hor = (w + 1) & ~1;
|
||||
const int max_width_ver = (w + 7) & ~7;
|
||||
const int max_height_hor = (4 * h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int max_height_ver = (h + 1) & ~1;
|
||||
const int width_hor = (w + 1) & ~1;
|
||||
const int width_ver = (w + 7) & ~7;
|
||||
const int height_hor = (4 * h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int height_ver = (h + 1) & ~1;
|
||||
const int16x8_t filters = vld1q_s16(coef);
|
||||
int x, y = max_height_hor;
|
||||
int x, y = height_hor;
|
||||
uint8_t *t = temp_buffer;
|
||||
uint8x8_t s[12], d[2];
|
||||
|
||||
@ -325,14 +306,14 @@ static void scale_plane_4_to_1_general_neon(const uint8_t *src,
|
||||
|
||||
src -= (SUBPEL_TAPS / 2 - 1) * src_stride + SUBPEL_TAPS / 2 + 3;
|
||||
|
||||
// horizontal
|
||||
// horizontal 2x8
|
||||
// Note: processing 2x8 is about 20% faster than processing row by row using
|
||||
// vld4_u8().
|
||||
do {
|
||||
load_u8_8x8(src + 4, src_stride, &s[0], &s[1], &s[2], &s[3], &s[4], &s[5],
|
||||
&s[6], &s[7]);
|
||||
transpose_u8_4x8(&s[0], &s[1], &s[2], &s[3], s[4], s[5], s[6], s[7]);
|
||||
x = max_width_hor;
|
||||
x = width_hor;
|
||||
|
||||
do {
|
||||
uint8x8x2_t dd;
|
||||
@ -342,26 +323,26 @@ static void scale_plane_4_to_1_general_neon(const uint8_t *src,
|
||||
transpose_u8_8x8(&s[4], &s[5], &s[6], &s[7], &s[8], &s[9], &s[10],
|
||||
&s[11]);
|
||||
|
||||
d[0] = scale_filter(&s[0], filters); // 00 10 20 30 40 50 60 70
|
||||
d[1] = scale_filter(&s[4], filters); // 01 11 21 31 41 51 61 71
|
||||
d[0] = scale_filter_8(&s[0], filters); // 00 10 20 30 40 50 60 70
|
||||
d[1] = scale_filter_8(&s[4], filters); // 01 11 21 31 41 51 61 71
|
||||
// dd.val[0]: 00 01 20 21 40 41 60 61
|
||||
// dd.val[1]: 10 11 30 31 50 51 70 71
|
||||
dd = vtrn_u8(d[0], d[1]);
|
||||
vst1_lane_u16((uint16_t *)(t + 0 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 0 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[0]), 0);
|
||||
vst1_lane_u16((uint16_t *)(t + 1 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 1 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[1]), 0);
|
||||
vst1_lane_u16((uint16_t *)(t + 2 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 2 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[0]), 1);
|
||||
vst1_lane_u16((uint16_t *)(t + 3 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 3 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[1]), 1);
|
||||
vst1_lane_u16((uint16_t *)(t + 4 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 4 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[0]), 2);
|
||||
vst1_lane_u16((uint16_t *)(t + 5 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 5 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[1]), 2);
|
||||
vst1_lane_u16((uint16_t *)(t + 6 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 6 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[0]), 3);
|
||||
vst1_lane_u16((uint16_t *)(t + 7 * max_width_hor),
|
||||
vst1_lane_u16((uint16_t *)(t + 7 * width_hor),
|
||||
vreinterpret_u16_u8(dd.val[1]), 3);
|
||||
|
||||
s[0] = s[8];
|
||||
@ -372,26 +353,26 @@ static void scale_plane_4_to_1_general_neon(const uint8_t *src,
|
||||
t += 2;
|
||||
x -= 2;
|
||||
} while (x);
|
||||
src += 8 * src_stride - 4 * max_width_hor;
|
||||
t += 7 * max_width_hor;
|
||||
src += 8 * src_stride - 4 * width_hor;
|
||||
t += 7 * width_hor;
|
||||
y -= 8;
|
||||
} while (y);
|
||||
|
||||
// vertical
|
||||
x = max_width_ver;
|
||||
// vertical 8x2
|
||||
x = width_ver;
|
||||
t = temp_buffer;
|
||||
do {
|
||||
load_u8_8x4(t, max_width_hor, &s[0], &s[1], &s[2], &s[3]);
|
||||
t += 4 * max_width_hor;
|
||||
y = max_height_ver;
|
||||
load_u8_8x4(t, width_hor, &s[0], &s[1], &s[2], &s[3]);
|
||||
t += 4 * width_hor;
|
||||
y = height_ver;
|
||||
|
||||
do {
|
||||
load_u8_8x8(t, max_width_hor, &s[4], &s[5], &s[6], &s[7], &s[8], &s[9],
|
||||
load_u8_8x8(t, width_hor, &s[4], &s[5], &s[6], &s[7], &s[8], &s[9],
|
||||
&s[10], &s[11]);
|
||||
t += 8 * max_width_hor;
|
||||
t += 8 * width_hor;
|
||||
|
||||
d[0] = scale_filter(&s[0], filters);
|
||||
d[1] = scale_filter(&s[4], filters);
|
||||
d[0] = scale_filter_8(&s[0], filters);
|
||||
d[1] = scale_filter_8(&s[4], filters);
|
||||
vst1_u8(dst + 0 * dst_stride, d[0]);
|
||||
vst1_u8(dst + 1 * dst_stride, d[1]);
|
||||
|
||||
@ -403,9 +384,9 @@ static void scale_plane_4_to_1_general_neon(const uint8_t *src,
|
||||
dst += 2 * dst_stride;
|
||||
y -= 2;
|
||||
} while (y);
|
||||
t -= max_width_hor * (4 * max_height_ver + 4);
|
||||
t -= width_hor * (4 * height_ver + 4);
|
||||
t += 8;
|
||||
dst -= max_height_ver * dst_stride;
|
||||
dst -= height_ver * dst_stride;
|
||||
dst += 8;
|
||||
x -= 8;
|
||||
} while (x);
|
||||
@ -423,7 +404,11 @@ void vp9_scale_and_extend_frame_neon(const YV12_BUFFER_CONFIG *src,
|
||||
const int dst_uv_h = dst_h / 2;
|
||||
int scaled = 0;
|
||||
|
||||
// phase_scaler is usually 0 or 8.
|
||||
assert(phase_scaler >= 0 && phase_scaler < 16);
|
||||
|
||||
if (2 * dst_w == src_w && 2 * dst_h == src_h) {
|
||||
// 2 to 1
|
||||
scaled = 1;
|
||||
if (phase_scaler == 0) {
|
||||
scale_plane_2_to_1_phase_0_neon(src->y_buffer, src->y_stride,
|
||||
@ -448,10 +433,10 @@ void vp9_scale_and_extend_frame_neon(const YV12_BUFFER_CONFIG *src,
|
||||
src->v_buffer, src->uv_stride, dst->v_buffer, dst->uv_stride,
|
||||
dst_uv_w, dst_uv_h, c0, c1);
|
||||
} else {
|
||||
const int buffer_max_width = (dst_w + 3) & ~3;
|
||||
const int buffer_max_height = (2 * dst_h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int buffer_stride = (dst_w + 3) & ~3;
|
||||
const int buffer_height = (2 * dst_h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
uint8_t *const temp_buffer =
|
||||
(uint8_t *)malloc(buffer_max_width * buffer_max_height);
|
||||
(uint8_t *)malloc(buffer_stride * buffer_height);
|
||||
if (temp_buffer) {
|
||||
scale_plane_2_to_1_general_neon(
|
||||
src->y_buffer, src->y_stride, dst->y_buffer, dst->y_stride, dst_w,
|
||||
@ -470,6 +455,7 @@ void vp9_scale_and_extend_frame_neon(const YV12_BUFFER_CONFIG *src,
|
||||
}
|
||||
}
|
||||
} else if (4 * dst_w == src_w && 4 * dst_h == src_h) {
|
||||
// 4 to 1
|
||||
scaled = 1;
|
||||
if (phase_scaler == 0) {
|
||||
scale_plane_4_to_1_phase_0_neon(src->y_buffer, src->y_stride,
|
||||
@ -494,10 +480,10 @@ void vp9_scale_and_extend_frame_neon(const YV12_BUFFER_CONFIG *src,
|
||||
src->v_buffer, src->uv_stride, dst->v_buffer, dst->uv_stride,
|
||||
dst_uv_w, dst_uv_h, c0, c1);
|
||||
} else {
|
||||
const int buffer_max_width = (dst_w + 1) & ~1;
|
||||
const int buffer_max_height = (4 * dst_h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
const int buffer_stride = (dst_w + 1) & ~1;
|
||||
const int buffer_height = (4 * dst_h + SUBPEL_TAPS - 2 + 7) & ~7;
|
||||
uint8_t *const temp_buffer =
|
||||
(uint8_t *)malloc(buffer_max_width * buffer_max_height);
|
||||
(uint8_t *)malloc(buffer_stride * buffer_height);
|
||||
if (temp_buffer) {
|
||||
scale_plane_4_to_1_general_neon(
|
||||
src->y_buffer, src->y_stride, dst->y_buffer, dst->y_stride, dst_w,
|
||||
@ -520,6 +506,7 @@ void vp9_scale_and_extend_frame_neon(const YV12_BUFFER_CONFIG *src,
|
||||
if (scaled) {
|
||||
vpx_extend_frame_borders(dst);
|
||||
} else {
|
||||
// Call c version for all other scaling ratios.
|
||||
vp9_scale_and_extend_frame_c(src, dst, filter_type, phase_scaler);
|
||||
}
|
||||
}
|
||||
|
@ -85,11 +85,10 @@ static INLINE void store_8x8(uint16_t *s, const ptrdiff_t p,
|
||||
vst1q_u16(s, s7);
|
||||
}
|
||||
|
||||
static INLINE int32x4_t convolve8_4(const int16x4_t s0, const int16x4_t s1,
|
||||
const int16x4_t s2, const int16x4_t s3,
|
||||
const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7,
|
||||
const int16x8_t filters) {
|
||||
static INLINE int32x4_t highbd_convolve8_4(
|
||||
const int16x4_t s0, const int16x4_t s1, const int16x4_t s2,
|
||||
const int16x4_t s3, const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7, const int16x8_t filters) {
|
||||
const int16x4_t filters_lo = vget_low_s16(filters);
|
||||
const int16x4_t filters_hi = vget_high_s16(filters);
|
||||
int32x4_t sum;
|
||||
@ -105,12 +104,11 @@ static INLINE int32x4_t convolve8_4(const int16x4_t s0, const int16x4_t s1,
|
||||
return sum;
|
||||
}
|
||||
|
||||
static INLINE uint16x8_t convolve8_8(const int16x8_t s0, const int16x8_t s1,
|
||||
const int16x8_t s2, const int16x8_t s3,
|
||||
const int16x8_t s4, const int16x8_t s5,
|
||||
const int16x8_t s6, const int16x8_t s7,
|
||||
const int16x8_t filters,
|
||||
const uint16x8_t max) {
|
||||
static INLINE uint16x8_t
|
||||
highbd_convolve8_8(const int16x8_t s0, const int16x8_t s1, const int16x8_t s2,
|
||||
const int16x8_t s3, const int16x8_t s4, const int16x8_t s5,
|
||||
const int16x8_t s6, const int16x8_t s7,
|
||||
const int16x8_t filters, const uint16x8_t max) {
|
||||
const int16x4_t filters_lo = vget_low_s16(filters);
|
||||
const int16x4_t filters_hi = vget_high_s16(filters);
|
||||
int32x4_t sum0, sum1;
|
||||
@ -183,10 +181,10 @@ void vpx_highbd_convolve8_horiz_neon(const uint16_t *src, ptrdiff_t src_stride,
|
||||
load_4x4((const int16_t *)src, src_stride, &s7, &s8, &s9, &s10);
|
||||
transpose_s16_4x4d(&s7, &s8, &s9, &s10);
|
||||
|
||||
d0 = convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
d0 = highbd_convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = highbd_convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = highbd_convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = highbd_convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
|
||||
d01 = vcombine_u16(vqrshrun_n_s32(d0, 7), vqrshrun_n_s32(d1, 7));
|
||||
d23 = vcombine_u16(vqrshrun_n_s32(d2, 7), vqrshrun_n_s32(d3, 7));
|
||||
@ -242,10 +240,11 @@ void vpx_highbd_convolve8_horiz_neon(const uint16_t *src, ptrdiff_t src_stride,
|
||||
__builtin_prefetch(src + 5 * src_stride);
|
||||
__builtin_prefetch(src + 6 * src_stride);
|
||||
__builtin_prefetch(src + 7 * src_stride);
|
||||
d0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
d0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 =
|
||||
highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
|
||||
transpose_u16_8x4(&d0, &d1, &d2, &d3);
|
||||
vst1_u16(dst, vget_low_u16(d0));
|
||||
@ -303,14 +302,22 @@ void vpx_highbd_convolve8_horiz_neon(const uint16_t *src, ptrdiff_t src_stride,
|
||||
&s12, &s13, &s14);
|
||||
transpose_s16_8x8(&s7, &s8, &s9, &s10, &s11, &s12, &s13, &s14);
|
||||
|
||||
d0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
d4 = convolve8_8(s4, s5, s6, s7, s8, s9, s10, s11, filters, max);
|
||||
d5 = convolve8_8(s5, s6, s7, s8, s9, s10, s11, s12, filters, max);
|
||||
d6 = convolve8_8(s6, s7, s8, s9, s10, s11, s12, s13, filters, max);
|
||||
d7 = convolve8_8(s7, s8, s9, s10, s11, s12, s13, s14, filters, max);
|
||||
d0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters,
|
||||
max);
|
||||
d1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters,
|
||||
max);
|
||||
d2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters,
|
||||
max);
|
||||
d3 = highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters,
|
||||
max);
|
||||
d4 = highbd_convolve8_8(s4, s5, s6, s7, s8, s9, s10, s11, filters,
|
||||
max);
|
||||
d5 = highbd_convolve8_8(s5, s6, s7, s8, s9, s10, s11, s12, filters,
|
||||
max);
|
||||
d6 = highbd_convolve8_8(s6, s7, s8, s9, s10, s11, s12, s13, filters,
|
||||
max);
|
||||
d7 = highbd_convolve8_8(s7, s8, s9, s10, s11, s12, s13, s14,
|
||||
filters, max);
|
||||
|
||||
transpose_u16_8x8(&d0, &d1, &d2, &d3, &d4, &d5, &d6, &d7);
|
||||
store_8x8(d, dst_stride, d0, d1, d2, d3, d4, d5, d6, d7);
|
||||
@ -383,10 +390,10 @@ void vpx_highbd_convolve8_avg_horiz_neon(const uint16_t *src,
|
||||
load_4x4((const int16_t *)src, src_stride, &s7, &s8, &s9, &s10);
|
||||
transpose_s16_4x4d(&s7, &s8, &s9, &s10);
|
||||
|
||||
d0 = convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
d0 = highbd_convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = highbd_convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = highbd_convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = highbd_convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
|
||||
t01 = vcombine_u16(vqrshrun_n_s32(d0, 7), vqrshrun_n_s32(d1, 7));
|
||||
t23 = vcombine_u16(vqrshrun_n_s32(d2, 7), vqrshrun_n_s32(d3, 7));
|
||||
@ -449,10 +456,11 @@ void vpx_highbd_convolve8_avg_horiz_neon(const uint16_t *src,
|
||||
__builtin_prefetch(src + 5 * src_stride);
|
||||
__builtin_prefetch(src + 6 * src_stride);
|
||||
__builtin_prefetch(src + 7 * src_stride);
|
||||
t0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
t1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
t2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
t3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
t0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
t1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
t2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
t3 =
|
||||
highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
transpose_u16_8x4(&t0, &t1, &t2, &t3);
|
||||
|
||||
d0 = vcombine_u16(vld1_u16(dst + 0 * dst_stride),
|
||||
@ -523,14 +531,22 @@ void vpx_highbd_convolve8_avg_horiz_neon(const uint16_t *src,
|
||||
&s12, &s13, &s14);
|
||||
transpose_s16_8x8(&s7, &s8, &s9, &s10, &s11, &s12, &s13, &s14);
|
||||
|
||||
d0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
d4 = convolve8_8(s4, s5, s6, s7, s8, s9, s10, s11, filters, max);
|
||||
d5 = convolve8_8(s5, s6, s7, s8, s9, s10, s11, s12, filters, max);
|
||||
d6 = convolve8_8(s6, s7, s8, s9, s10, s11, s12, s13, filters, max);
|
||||
d7 = convolve8_8(s7, s8, s9, s10, s11, s12, s13, s14, filters, max);
|
||||
d0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters,
|
||||
max);
|
||||
d1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters,
|
||||
max);
|
||||
d2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters,
|
||||
max);
|
||||
d3 = highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters,
|
||||
max);
|
||||
d4 = highbd_convolve8_8(s4, s5, s6, s7, s8, s9, s10, s11, filters,
|
||||
max);
|
||||
d5 = highbd_convolve8_8(s5, s6, s7, s8, s9, s10, s11, s12, filters,
|
||||
max);
|
||||
d6 = highbd_convolve8_8(s6, s7, s8, s9, s10, s11, s12, s13, filters,
|
||||
max);
|
||||
d7 = highbd_convolve8_8(s7, s8, s9, s10, s11, s12, s13, s14,
|
||||
filters, max);
|
||||
|
||||
transpose_u16_8x8(&d0, &d1, &d2, &d3, &d4, &d5, &d6, &d7);
|
||||
|
||||
@ -620,10 +636,10 @@ void vpx_highbd_convolve8_vert_neon(const uint16_t *src, ptrdiff_t src_stride,
|
||||
__builtin_prefetch(src + 1 * src_stride);
|
||||
__builtin_prefetch(src + 2 * src_stride);
|
||||
__builtin_prefetch(src + 3 * src_stride);
|
||||
d0 = convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
d0 = highbd_convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = highbd_convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = highbd_convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = highbd_convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
|
||||
d01 = vcombine_u16(vqrshrun_n_s32(d0, 7), vqrshrun_n_s32(d1, 7));
|
||||
d23 = vcombine_u16(vqrshrun_n_s32(d2, 7), vqrshrun_n_s32(d3, 7));
|
||||
@ -698,10 +714,11 @@ void vpx_highbd_convolve8_vert_neon(const uint16_t *src, ptrdiff_t src_stride,
|
||||
__builtin_prefetch(s + 1 * src_stride);
|
||||
__builtin_prefetch(s + 2 * src_stride);
|
||||
__builtin_prefetch(s + 3 * src_stride);
|
||||
d0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
d0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
d1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
d2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
d3 =
|
||||
highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
|
||||
vst1q_u16(d, d0);
|
||||
d += dst_stride;
|
||||
@ -786,10 +803,10 @@ void vpx_highbd_convolve8_avg_vert_neon(const uint16_t *src,
|
||||
__builtin_prefetch(src + 1 * src_stride);
|
||||
__builtin_prefetch(src + 2 * src_stride);
|
||||
__builtin_prefetch(src + 3 * src_stride);
|
||||
d0 = convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
d0 = highbd_convolve8_4(s0, s1, s2, s3, s4, s5, s6, s7, filters);
|
||||
d1 = highbd_convolve8_4(s1, s2, s3, s4, s5, s6, s7, s8, filters);
|
||||
d2 = highbd_convolve8_4(s2, s3, s4, s5, s6, s7, s8, s9, filters);
|
||||
d3 = highbd_convolve8_4(s3, s4, s5, s6, s7, s8, s9, s10, filters);
|
||||
|
||||
t01 = vcombine_u16(vqrshrun_n_s32(d0, 7), vqrshrun_n_s32(d1, 7));
|
||||
t23 = vcombine_u16(vqrshrun_n_s32(d2, 7), vqrshrun_n_s32(d3, 7));
|
||||
@ -872,10 +889,11 @@ void vpx_highbd_convolve8_avg_vert_neon(const uint16_t *src,
|
||||
__builtin_prefetch(s + 1 * src_stride);
|
||||
__builtin_prefetch(s + 2 * src_stride);
|
||||
__builtin_prefetch(s + 3 * src_stride);
|
||||
t0 = convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
t1 = convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
t2 = convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
t3 = convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
t0 = highbd_convolve8_8(s0, s1, s2, s3, s4, s5, s6, s7, filters, max);
|
||||
t1 = highbd_convolve8_8(s1, s2, s3, s4, s5, s6, s7, s8, filters, max);
|
||||
t2 = highbd_convolve8_8(s2, s3, s4, s5, s6, s7, s8, s9, filters, max);
|
||||
t3 =
|
||||
highbd_convolve8_8(s3, s4, s5, s6, s7, s8, s9, s10, filters, max);
|
||||
|
||||
d0 = vld1q_u16(d + 0 * dst_stride);
|
||||
d1 = vld1q_u16(d + 1 * dst_stride);
|
||||
|
@ -52,28 +52,6 @@ static INLINE void store_u8_8x8(uint8_t *s, const ptrdiff_t p,
|
||||
vst1_u8(s, s7);
|
||||
}
|
||||
|
||||
static INLINE int16x4_t convolve8_4(const int16x4_t s0, const int16x4_t s1,
|
||||
const int16x4_t s2, const int16x4_t s3,
|
||||
const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7,
|
||||
const int16x8_t filters,
|
||||
const int16x4_t filter3,
|
||||
const int16x4_t filter4) {
|
||||
const int16x4_t filters_lo = vget_low_s16(filters);
|
||||
const int16x4_t filters_hi = vget_high_s16(filters);
|
||||
int16x4_t sum;
|
||||
|
||||
sum = vmul_lane_s16(s0, filters_lo, 0);
|
||||
sum = vmla_lane_s16(sum, s1, filters_lo, 1);
|
||||
sum = vmla_lane_s16(sum, s2, filters_lo, 2);
|
||||
sum = vmla_lane_s16(sum, s5, filters_hi, 1);
|
||||
sum = vmla_lane_s16(sum, s6, filters_hi, 2);
|
||||
sum = vmla_lane_s16(sum, s7, filters_hi, 3);
|
||||
sum = vqadd_s16(sum, vmul_s16(s3, filter3));
|
||||
sum = vqadd_s16(sum, vmul_s16(s4, filter4));
|
||||
return sum;
|
||||
}
|
||||
|
||||
void vpx_convolve8_horiz_neon(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *filter, int x0_q4,
|
||||
|
@ -47,6 +47,28 @@ static INLINE void load_u8_8x8(const uint8_t *s, const ptrdiff_t p,
|
||||
*s7 = vld1_u8(s);
|
||||
}
|
||||
|
||||
static INLINE int16x4_t convolve8_4(const int16x4_t s0, const int16x4_t s1,
|
||||
const int16x4_t s2, const int16x4_t s3,
|
||||
const int16x4_t s4, const int16x4_t s5,
|
||||
const int16x4_t s6, const int16x4_t s7,
|
||||
const int16x8_t filters,
|
||||
const int16x4_t filter3,
|
||||
const int16x4_t filter4) {
|
||||
const int16x4_t filters_lo = vget_low_s16(filters);
|
||||
const int16x4_t filters_hi = vget_high_s16(filters);
|
||||
int16x4_t sum;
|
||||
|
||||
sum = vmul_lane_s16(s0, filters_lo, 0);
|
||||
sum = vmla_lane_s16(sum, s1, filters_lo, 1);
|
||||
sum = vmla_lane_s16(sum, s2, filters_lo, 2);
|
||||
sum = vmla_lane_s16(sum, s5, filters_hi, 1);
|
||||
sum = vmla_lane_s16(sum, s6, filters_hi, 2);
|
||||
sum = vmla_lane_s16(sum, s7, filters_hi, 3);
|
||||
sum = vqadd_s16(sum, vmul_s16(s3, filter3));
|
||||
sum = vqadd_s16(sum, vmul_s16(s4, filter4));
|
||||
return sum;
|
||||
}
|
||||
|
||||
static INLINE uint8x8_t convolve8_8(const int16x8_t s0, const int16x8_t s1,
|
||||
const int16x8_t s2, const int16x8_t s3,
|
||||
const int16x8_t s4, const int16x8_t s5,
|
||||
@ -68,3 +90,22 @@ static INLINE uint8x8_t convolve8_8(const int16x8_t s0, const int16x8_t s1,
|
||||
sum = vqaddq_s16(sum, vmulq_s16(s4, filter4));
|
||||
return vqrshrun_n_s16(sum, 7);
|
||||
}
|
||||
|
||||
static INLINE uint8x8_t scale_filter_8(const uint8x8_t *const s,
|
||||
const int16x8_t filters) {
|
||||
const int16x8_t filter3 = vdupq_lane_s16(vget_low_s16(filters), 3);
|
||||
const int16x8_t filter4 = vdupq_lane_s16(vget_high_s16(filters), 0);
|
||||
int16x8_t ss[8];
|
||||
|
||||
ss[0] = vreinterpretq_s16_u16(vmovl_u8(s[0]));
|
||||
ss[1] = vreinterpretq_s16_u16(vmovl_u8(s[1]));
|
||||
ss[2] = vreinterpretq_s16_u16(vmovl_u8(s[2]));
|
||||
ss[3] = vreinterpretq_s16_u16(vmovl_u8(s[3]));
|
||||
ss[4] = vreinterpretq_s16_u16(vmovl_u8(s[4]));
|
||||
ss[5] = vreinterpretq_s16_u16(vmovl_u8(s[5]));
|
||||
ss[6] = vreinterpretq_s16_u16(vmovl_u8(s[6]));
|
||||
ss[7] = vreinterpretq_s16_u16(vmovl_u8(s[7]));
|
||||
|
||||
return convolve8_8(ss[0], ss[1], ss[2], ss[3], ss[4], ss[5], ss[6], ss[7],
|
||||
filters, filter3, filter4);
|
||||
}
|
||||
|
@ -113,40 +113,6 @@ static void convolve_avg_vert(const uint8_t *src, ptrdiff_t src_stride,
|
||||
}
|
||||
}
|
||||
|
||||
static void convolve(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const InterpKernel *filter,
|
||||
int x0_q4, int x_step_q4, int y0_q4, int y_step_q4, int w,
|
||||
int h) {
|
||||
// Note: Fixed size intermediate buffer, temp, places limits on parameters.
|
||||
// 2d filtering proceeds in 2 steps:
|
||||
// (1) Interpolate horizontally into an intermediate buffer, temp.
|
||||
// (2) Interpolate temp vertically to derive the sub-pixel result.
|
||||
// Deriving the maximum number of rows in the temp buffer (135):
|
||||
// --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
|
||||
// --Largest block size is 64x64 pixels.
|
||||
// --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
|
||||
// original frame (in 1/16th pixel units).
|
||||
// --Must round-up because block may be located at sub-pixel position.
|
||||
// --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
|
||||
// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
|
||||
// When calling in frame scaling function, the smallest scaling factor is x1/4
|
||||
// ==> y_step_q4 = 64. Since w and h are at most 16, the temp buffer is still
|
||||
// big enough.
|
||||
uint8_t temp[64 * 135];
|
||||
const int intermediate_height =
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
|
||||
assert(w <= 64);
|
||||
assert(h <= 64);
|
||||
assert(y_step_q4 <= 32 || (y_step_q4 <= 64 && h <= 32));
|
||||
assert(x_step_q4 <= 64);
|
||||
|
||||
convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, 64,
|
||||
filter, x0_q4, x_step_q4, w, intermediate_height);
|
||||
convolve_vert(temp + 64 * (SUBPEL_TAPS / 2 - 1), 64, dst, dst_stride, filter,
|
||||
y0_q4, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *filter, int x0_q4, int x_step_q4,
|
||||
@ -193,8 +159,34 @@ void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const InterpKernel *filter,
|
||||
int x0_q4, int x_step_q4, int y0_q4, int y_step_q4, int w,
|
||||
int h) {
|
||||
convolve(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4, y0_q4,
|
||||
y_step_q4, w, h);
|
||||
// Note: Fixed size intermediate buffer, temp, places limits on parameters.
|
||||
// 2d filtering proceeds in 2 steps:
|
||||
// (1) Interpolate horizontally into an intermediate buffer, temp.
|
||||
// (2) Interpolate temp vertically to derive the sub-pixel result.
|
||||
// Deriving the maximum number of rows in the temp buffer (135):
|
||||
// --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
|
||||
// --Largest block size is 64x64 pixels.
|
||||
// --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
|
||||
// original frame (in 1/16th pixel units).
|
||||
// --Must round-up because block may be located at sub-pixel position.
|
||||
// --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
|
||||
// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
|
||||
// When calling in frame scaling function, the smallest scaling factor is x1/4
|
||||
// ==> y_step_q4 = 64. Since w and h are at most 16, the temp buffer is still
|
||||
// big enough.
|
||||
uint8_t temp[64 * 135];
|
||||
const int intermediate_height =
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
|
||||
assert(w <= 64);
|
||||
assert(h <= 64);
|
||||
assert(y_step_q4 <= 32 || (y_step_q4 <= 64 && h <= 32));
|
||||
assert(x_step_q4 <= 64);
|
||||
|
||||
convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, 64,
|
||||
filter, x0_q4, x_step_q4, w, intermediate_height);
|
||||
convolve_vert(temp + 64 * (SUBPEL_TAPS / 2 - 1), 64, dst, dst_stride, filter,
|
||||
y0_q4, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include <tmmintrin.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "./vpx_dsp_rtcd.h"
|
||||
#include "vpx_dsp/vpx_filter.h"
|
||||
#include "vpx_dsp/x86/convolve.h"
|
||||
@ -447,7 +449,7 @@ static void scaledconvolve_horiz_w8(const uint8_t *src, ptrdiff_t src_stride,
|
||||
int x, y, z;
|
||||
src -= SUBPEL_TAPS / 2 - 1;
|
||||
|
||||
// This function processes 8x8 areas. The intermediate height is not always
|
||||
// This function processes 8x8 areas. The intermediate height is not always
|
||||
// a multiple of 8, so force it to be a multiple of 8 here.
|
||||
y = h + (8 - (h & 0x7));
|
||||
|
||||
@ -810,11 +812,10 @@ static void scaledconvolve_vert_w16(const uint8_t *src, ptrdiff_t src_stride,
|
||||
}
|
||||
}
|
||||
|
||||
static void scaledconvolve2d(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *const filter, int x0_q4,
|
||||
int x_step_q4, int y0_q4, int y_step_q4, int w,
|
||||
int h) {
|
||||
void vpx_scaled_2d_ssse3(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const InterpKernel *filter,
|
||||
int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
|
||||
int w, int h) {
|
||||
// Note: Fixed size intermediate buffer, temp, places limits on parameters.
|
||||
// 2d filtering proceeds in 2 steps:
|
||||
// (1) Interpolate horizontally into an intermediate buffer, temp.
|
||||
@ -862,14 +863,6 @@ static void scaledconvolve2d(const uint8_t *src, ptrdiff_t src_stride,
|
||||
}
|
||||
}
|
||||
|
||||
void vpx_scaled_2d_ssse3(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const InterpKernel *filter,
|
||||
int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
|
||||
int w, int h) {
|
||||
scaledconvolve2d(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4,
|
||||
y0_q4, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
// void vp9_convolve8_ssse3(const uint8_t *src, ptrdiff_t src_stride,
|
||||
// uint8_t *dst, ptrdiff_t dst_stride,
|
||||
// const InterpKernel *filter, int x0_q4,
|
||||
|
Loading…
x
Reference in New Issue
Block a user