mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
update to libvpx b46243d from repo https://chromium.googlesource.com/webm/libvpx
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
|
||||
static void convolve_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *x_filters,
|
||||
int x0_q4, int x_step_q4, int w, int h) {
|
||||
const InterpKernel *x_filters, int x0_q4,
|
||||
int x_step_q4, int w, int h) {
|
||||
int x, y;
|
||||
src -= SUBPEL_TAPS / 2 - 1;
|
||||
for (y = 0; y < h; ++y) {
|
||||
@@ -31,8 +31,7 @@ static void convolve_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_x[k] * x_filter[k];
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
|
||||
dst[x] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
@@ -43,8 +42,8 @@ static void convolve_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
|
||||
static void convolve_avg_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *x_filters,
|
||||
int x0_q4, int x_step_q4, int w, int h) {
|
||||
const InterpKernel *x_filters, int x0_q4,
|
||||
int x_step_q4, int w, int h) {
|
||||
int x, y;
|
||||
src -= SUBPEL_TAPS / 2 - 1;
|
||||
for (y = 0; y < h; ++y) {
|
||||
@@ -53,10 +52,9 @@ static void convolve_avg_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_x[k] * x_filter[k];
|
||||
dst[x] = ROUND_POWER_OF_TWO(dst[x] +
|
||||
clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
|
||||
dst[x] = ROUND_POWER_OF_TWO(
|
||||
dst[x] + clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
src += src_stride;
|
||||
@@ -66,8 +64,8 @@ static void convolve_avg_horiz(const uint8_t *src, ptrdiff_t src_stride,
|
||||
|
||||
static void convolve_vert(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *y_filters,
|
||||
int y0_q4, int y_step_q4, int w, int h) {
|
||||
const InterpKernel *y_filters, int y0_q4,
|
||||
int y_step_q4, int w, int h) {
|
||||
int x, y;
|
||||
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
|
||||
|
||||
@@ -89,8 +87,8 @@ static void convolve_vert(const uint8_t *src, ptrdiff_t src_stride,
|
||||
|
||||
static void convolve_avg_vert(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *y_filters,
|
||||
int y0_q4, int y_step_q4, int w, int h) {
|
||||
const InterpKernel *y_filters, int y0_q4,
|
||||
int y_step_q4, int w, int h) {
|
||||
int x, y;
|
||||
src -= src_stride * (SUBPEL_TAPS / 2 - 1);
|
||||
|
||||
@@ -102,8 +100,10 @@ static void convolve_avg_vert(const uint8_t *src, ptrdiff_t src_stride,
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_y[k * src_stride] * y_filter[k];
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(dst[y * dst_stride] +
|
||||
clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(
|
||||
dst[y * dst_stride] +
|
||||
clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)),
|
||||
1);
|
||||
y_q4 += y_step_q4;
|
||||
}
|
||||
++src;
|
||||
@@ -111,13 +111,11 @@ 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 *const x_filters,
|
||||
static void convolve(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const InterpKernel *const x_filters,
|
||||
int x0_q4, int x_step_q4,
|
||||
const InterpKernel *const y_filters,
|
||||
int y0_q4, int y_step_q4,
|
||||
int w, int h) {
|
||||
const InterpKernel *const y_filters, 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.
|
||||
@@ -132,7 +130,7 @@ static void convolve(const uint8_t *src, ptrdiff_t src_stride,
|
||||
// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
|
||||
uint8_t temp[135 * 64];
|
||||
int intermediate_height =
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
|
||||
assert(w <= 64);
|
||||
assert(h <= 64);
|
||||
@@ -158,67 +156,66 @@ static int get_filter_offset(const int16_t *f, const InterpKernel *base) {
|
||||
void vpx_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
const InterpKernel *const filters_x = get_filter_base(filter_x);
|
||||
const int x0_q4 = get_filter_offset(filter_x, filters_x);
|
||||
|
||||
(void)filter_y;
|
||||
(void)y_step_q4;
|
||||
|
||||
convolve_horiz(src, src_stride, dst, dst_stride, filters_x,
|
||||
x0_q4, x_step_q4, w, h);
|
||||
convolve_horiz(src, src_stride, dst, dst_stride, filters_x, x0_q4, x_step_q4,
|
||||
w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
const InterpKernel *const filters_x = get_filter_base(filter_x);
|
||||
const int x0_q4 = get_filter_offset(filter_x, filters_x);
|
||||
|
||||
(void)filter_y;
|
||||
(void)y_step_q4;
|
||||
|
||||
convolve_avg_horiz(src, src_stride, dst, dst_stride, filters_x,
|
||||
x0_q4, x_step_q4, w, h);
|
||||
convolve_avg_horiz(src, src_stride, dst, dst_stride, filters_x, x0_q4,
|
||||
x_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
const InterpKernel *const filters_y = get_filter_base(filter_y);
|
||||
const int y0_q4 = get_filter_offset(filter_y, filters_y);
|
||||
|
||||
(void)filter_x;
|
||||
(void)x_step_q4;
|
||||
|
||||
convolve_vert(src, src_stride, dst, dst_stride, filters_y,
|
||||
y0_q4, y_step_q4, w, h);
|
||||
convolve_vert(src, src_stride, dst, dst_stride, filters_y, y0_q4, y_step_q4,
|
||||
w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
const InterpKernel *const filters_y = get_filter_base(filter_y);
|
||||
const int y0_q4 = get_filter_offset(filter_y, filters_y);
|
||||
|
||||
(void)filter_x;
|
||||
(void)x_step_q4;
|
||||
|
||||
convolve_avg_vert(src, src_stride, dst, dst_stride, filters_y,
|
||||
y0_q4, y_step_q4, w, h);
|
||||
convolve_avg_vert(src, src_stride, dst, dst_stride, filters_y, y0_q4,
|
||||
y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const InterpKernel *const filters_x = get_filter_base(filter_x);
|
||||
const int x0_q4 = get_filter_offset(filter_x, filters_x);
|
||||
@@ -226,35 +223,34 @@ void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
const InterpKernel *const filters_y = get_filter_base(filter_y);
|
||||
const int y0_q4 = get_filter_offset(filter_y, filters_y);
|
||||
|
||||
convolve(src, src_stride, dst, dst_stride,
|
||||
filters_x, x0_q4, x_step_q4,
|
||||
convolve(src, src_stride, dst, dst_stride, filters_x, x0_q4, x_step_q4,
|
||||
filters_y, y0_q4, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
void vpx_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
/* Fixed size intermediate buffer places limits on parameters. */
|
||||
DECLARE_ALIGNED(16, uint8_t, temp[64 * 64]);
|
||||
assert(w <= 64);
|
||||
assert(h <= 64);
|
||||
|
||||
vpx_convolve8_c(src, src_stride, temp, 64,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4, w, h);
|
||||
vpx_convolve8_c(src, src_stride, temp, 64, filter_x, x_step_q4, filter_y,
|
||||
y_step_q4, w, h);
|
||||
vpx_convolve_avg_c(temp, 64, dst, dst_stride, NULL, 0, NULL, 0, w, h);
|
||||
}
|
||||
|
||||
void vpx_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int filter_x_stride,
|
||||
const int16_t *filter_y, int filter_y_stride,
|
||||
int w, int h) {
|
||||
void vpx_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int filter_x_stride, const int16_t *filter_y,
|
||||
int filter_y_stride, int w, int h) {
|
||||
int r;
|
||||
|
||||
(void)filter_x; (void)filter_x_stride;
|
||||
(void)filter_y; (void)filter_y_stride;
|
||||
(void)filter_x;
|
||||
(void)filter_x_stride;
|
||||
(void)filter_y;
|
||||
(void)filter_y_stride;
|
||||
|
||||
for (r = h; r > 0; --r) {
|
||||
memcpy(dst, src, w);
|
||||
@@ -263,47 +259,44 @@ void vpx_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
}
|
||||
}
|
||||
|
||||
void vpx_convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int filter_x_stride,
|
||||
const int16_t *filter_y, int filter_y_stride,
|
||||
int w, int h) {
|
||||
void vpx_convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int filter_x_stride, const int16_t *filter_y,
|
||||
int filter_y_stride, int w, int h) {
|
||||
int x, y;
|
||||
|
||||
(void)filter_x; (void)filter_x_stride;
|
||||
(void)filter_y; (void)filter_y_stride;
|
||||
(void)filter_x;
|
||||
(void)filter_x_stride;
|
||||
(void)filter_y;
|
||||
(void)filter_y_stride;
|
||||
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < w; ++x)
|
||||
dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
|
||||
for (x = 0; x < w; ++x) dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
|
||||
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
void vpx_scaled_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
void vpx_scaled_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
vpx_convolve8_horiz_c(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
|
||||
filter_y, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_scaled_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
void vpx_scaled_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
vpx_convolve8_vert_c(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
|
||||
filter_y, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
void vpx_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
vpx_convolve8_c(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
|
||||
filter_y, y_step_q4, w, h);
|
||||
@@ -312,8 +305,8 @@ void vpx_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
void vpx_scaled_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
vpx_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride, filter_x,
|
||||
x_step_q4, filter_y, y_step_q4, w, h);
|
||||
}
|
||||
@@ -321,17 +314,16 @@ void vpx_scaled_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
void vpx_scaled_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h) {
|
||||
vpx_convolve8_avg_vert_c(src, src_stride, dst, dst_stride, filter_x,
|
||||
x_step_q4, filter_y, y_step_q4, w, h);
|
||||
}
|
||||
|
||||
void vpx_scaled_avg_2d_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
void vpx_scaled_avg_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
|
||||
ptrdiff_t dst_stride, const int16_t *filter_x,
|
||||
int x_step_q4, const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h) {
|
||||
vpx_convolve8_avg_c(src, src_stride, dst, dst_stride, filter_x, x_step_q4,
|
||||
filter_y, y_step_q4, w, h);
|
||||
}
|
||||
@@ -339,9 +331,8 @@ void vpx_scaled_avg_2d_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static void highbd_convolve_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
uint8_t *dst8, ptrdiff_t dst_stride,
|
||||
const InterpKernel *x_filters,
|
||||
int x0_q4, int x_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const InterpKernel *x_filters, int x0_q4,
|
||||
int x_step_q4, int w, int h, int bd) {
|
||||
int x, y;
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
@@ -352,8 +343,7 @@ static void highbd_convolve_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_x[k] * x_filter[k];
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
|
||||
dst[x] = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
@@ -364,9 +354,8 @@ static void highbd_convolve_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
|
||||
static void highbd_convolve_avg_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
uint8_t *dst8, ptrdiff_t dst_stride,
|
||||
const InterpKernel *x_filters,
|
||||
int x0_q4, int x_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const InterpKernel *x_filters, int x0_q4,
|
||||
int x_step_q4, int w, int h, int bd) {
|
||||
int x, y;
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
@@ -377,10 +366,10 @@ static void highbd_convolve_avg_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
|
||||
const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_x[k] * x_filter[k];
|
||||
dst[x] = ROUND_POWER_OF_TWO(dst[x] +
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd), 1);
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
|
||||
dst[x] = ROUND_POWER_OF_TWO(
|
||||
dst[x] + clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
|
||||
1);
|
||||
x_q4 += x_step_q4;
|
||||
}
|
||||
src += src_stride;
|
||||
@@ -390,9 +379,8 @@ static void highbd_convolve_avg_horiz(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
|
||||
static void highbd_convolve_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
uint8_t *dst8, ptrdiff_t dst_stride,
|
||||
const InterpKernel *y_filters,
|
||||
int y0_q4, int y_step_q4, int w, int h,
|
||||
int bd) {
|
||||
const InterpKernel *y_filters, int y0_q4,
|
||||
int y_step_q4, int w, int h, int bd) {
|
||||
int x, y;
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
@@ -405,8 +393,8 @@ static void highbd_convolve_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_y[k * src_stride] * y_filter[k];
|
||||
dst[y * dst_stride] = clip_pixel_highbd(
|
||||
ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
dst[y * dst_stride] =
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
|
||||
y_q4 += y_step_q4;
|
||||
}
|
||||
++src;
|
||||
@@ -416,9 +404,8 @@ static void highbd_convolve_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
|
||||
static void highbd_convolve_avg_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
uint8_t *dst8, ptrdiff_t dst_stride,
|
||||
const InterpKernel *y_filters,
|
||||
int y0_q4, int y_step_q4, int w, int h,
|
||||
int bd) {
|
||||
const InterpKernel *y_filters, int y0_q4,
|
||||
int y_step_q4, int w, int h, int bd) {
|
||||
int x, y;
|
||||
uint16_t *src = CONVERT_TO_SHORTPTR(src8);
|
||||
uint16_t *dst = CONVERT_TO_SHORTPTR(dst8);
|
||||
@@ -431,8 +418,10 @@ static void highbd_convolve_avg_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
int k, sum = 0;
|
||||
for (k = 0; k < SUBPEL_TAPS; ++k)
|
||||
sum += src_y[k * src_stride] * y_filter[k];
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(dst[y * dst_stride] +
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd), 1);
|
||||
dst[y * dst_stride] = ROUND_POWER_OF_TWO(
|
||||
dst[y * dst_stride] +
|
||||
clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
|
||||
1);
|
||||
y_q4 += y_step_q4;
|
||||
}
|
||||
++src;
|
||||
@@ -442,11 +431,9 @@ static void highbd_convolve_avg_vert(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
|
||||
static void highbd_convolve(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const InterpKernel *const x_filters,
|
||||
int x0_q4, int x_step_q4,
|
||||
const InterpKernel *const y_filters,
|
||||
int y0_q4, int y_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const InterpKernel *const x_filters, int x0_q4,
|
||||
int x_step_q4, const InterpKernel *const y_filters,
|
||||
int y0_q4, int y_step_q4, int w, int h, int bd) {
|
||||
// Note: Fixed size intermediate buffer, temp, places limits on parameters.
|
||||
// 2d filtering proceeds in 2 steps:
|
||||
// (1) Interpolate horizontally into an intermediate buffer, temp.
|
||||
@@ -461,35 +448,33 @@ static void highbd_convolve(const uint8_t *src, ptrdiff_t src_stride,
|
||||
// --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
|
||||
uint16_t temp[64 * 135];
|
||||
int intermediate_height =
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
(((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
|
||||
|
||||
assert(w <= 64);
|
||||
assert(h <= 64);
|
||||
assert(y_step_q4 <= 32);
|
||||
assert(x_step_q4 <= 32);
|
||||
|
||||
highbd_convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1),
|
||||
src_stride, CONVERT_TO_BYTEPTR(temp), 64,
|
||||
x_filters, x0_q4, x_step_q4, w,
|
||||
intermediate_height, bd);
|
||||
highbd_convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride,
|
||||
CONVERT_TO_BYTEPTR(temp), 64, x_filters, x0_q4,
|
||||
x_step_q4, w, intermediate_height, bd);
|
||||
highbd_convolve_vert(CONVERT_TO_BYTEPTR(temp) + 64 * (SUBPEL_TAPS / 2 - 1),
|
||||
64, dst, dst_stride, y_filters, y0_q4, y_step_q4,
|
||||
w, h, bd);
|
||||
64, dst, dst_stride, y_filters, y0_q4, y_step_q4, w, h,
|
||||
bd);
|
||||
}
|
||||
|
||||
|
||||
void vpx_highbd_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h, int bd) {
|
||||
const InterpKernel *const filters_x = get_filter_base(filter_x);
|
||||
const int x0_q4 = get_filter_offset(filter_x, filters_x);
|
||||
(void)filter_y;
|
||||
(void)y_step_q4;
|
||||
|
||||
highbd_convolve_horiz(src, src_stride, dst, dst_stride, filters_x,
|
||||
x0_q4, x_step_q4, w, h, bd);
|
||||
highbd_convolve_horiz(src, src_stride, dst, dst_stride, filters_x, x0_q4,
|
||||
x_step_q4, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
@@ -502,22 +487,22 @@ void vpx_highbd_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
(void)filter_y;
|
||||
(void)y_step_q4;
|
||||
|
||||
highbd_convolve_avg_horiz(src, src_stride, dst, dst_stride, filters_x,
|
||||
x0_q4, x_step_q4, w, h, bd);
|
||||
highbd_convolve_avg_horiz(src, src_stride, dst, dst_stride, filters_x, x0_q4,
|
||||
x_step_q4, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve8_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h, int bd) {
|
||||
const InterpKernel *const filters_y = get_filter_base(filter_y);
|
||||
const int y0_q4 = get_filter_offset(filter_y, filters_y);
|
||||
(void)filter_x;
|
||||
(void)x_step_q4;
|
||||
|
||||
highbd_convolve_vert(src, src_stride, dst, dst_stride, filters_y,
|
||||
y0_q4, y_step_q4, w, h, bd);
|
||||
highbd_convolve_vert(src, src_stride, dst, dst_stride, filters_y, y0_q4,
|
||||
y_step_q4, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
@@ -530,31 +515,30 @@ void vpx_highbd_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
(void)filter_x;
|
||||
(void)x_step_q4;
|
||||
|
||||
highbd_convolve_avg_vert(src, src_stride, dst, dst_stride, filters_y,
|
||||
y0_q4, y_step_q4, w, h, bd);
|
||||
highbd_convolve_avg_vert(src, src_stride, dst, dst_stride, filters_y, y0_q4,
|
||||
y_step_q4, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve8_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h, int bd) {
|
||||
const InterpKernel *const filters_x = get_filter_base(filter_x);
|
||||
const int x0_q4 = get_filter_offset(filter_x, filters_x);
|
||||
|
||||
const InterpKernel *const filters_y = get_filter_base(filter_y);
|
||||
const int y0_q4 = get_filter_offset(filter_y, filters_y);
|
||||
|
||||
highbd_convolve(src, src_stride, dst, dst_stride,
|
||||
filters_x, x0_q4, x_step_q4,
|
||||
highbd_convolve(src, src_stride, dst, dst_stride, filters_x, x0_q4, x_step_q4,
|
||||
filters_y, y0_q4, y_step_q4, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
uint8_t *dst, ptrdiff_t dst_stride,
|
||||
const int16_t *filter_x, int x_step_q4,
|
||||
const int16_t *filter_y, int y_step_q4,
|
||||
int w, int h, int bd) {
|
||||
const int16_t *filter_y, int y_step_q4, int w,
|
||||
int h, int bd) {
|
||||
// Fixed size intermediate buffer places limits on parameters.
|
||||
DECLARE_ALIGNED(16, uint16_t, temp[64 * 64]);
|
||||
assert(w <= 64);
|
||||
@@ -562,8 +546,8 @@ void vpx_highbd_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride,
|
||||
|
||||
vpx_highbd_convolve8_c(src, src_stride, CONVERT_TO_BYTEPTR(temp), 64,
|
||||
filter_x, x_step_q4, filter_y, y_step_q4, w, h, bd);
|
||||
vpx_highbd_convolve_avg_c(CONVERT_TO_BYTEPTR(temp), 64, dst, dst_stride,
|
||||
NULL, 0, NULL, 0, w, h, bd);
|
||||
vpx_highbd_convolve_avg_c(CONVERT_TO_BYTEPTR(temp), 64, dst, dst_stride, NULL,
|
||||
0, NULL, 0, w, h, bd);
|
||||
}
|
||||
|
||||
void vpx_highbd_convolve_copy_c(const uint8_t *src8, ptrdiff_t src_stride,
|
||||
|
Reference in New Issue
Block a user