Remove unused av1_convolve_scale and highbd version Change-Id: I46911318d15e6d1a4fa70f4656404651c0f913f8
diff --git a/av1/common/convolve.c b/av1/common/convolve.c index 2851f59..a51d562 100644 --- a/av1/common/convolve.c +++ b/av1/common/convolve.c
@@ -105,37 +105,6 @@ } } -void av1_convolve_horiz_scale(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, - const InterpFilterParams filter_params, - const int subpel_x_qn, int x_step_qn, - ConvolveParams *conv_params) { - int filter_size = filter_params.taps; - src -= filter_size / 2 - 1; - for (int y = 0; y < h; ++y) { - int x_qn = subpel_x_qn; - for (int x = 0; x < w; ++x) { - const uint8_t *const src_x = &src[x_qn >> SCALE_SUBPEL_BITS]; - const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; - assert(x_filter_idx < SUBPEL_SHIFTS); - const int16_t *x_filter = - av1_get_interp_filter_subpel_kernel(filter_params, x_filter_idx); - int sum = 0; - for (int k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k]; - - sum = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); - if (conv_params->do_average) - dst[x] = ROUND_POWER_OF_TWO(dst[x] + sum, 1); - else - dst[x] = sum; - - x_qn += x_step_qn; - } - src += src_stride; - dst += dst_stride; - } -} - void av1_convolve_vert_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams filter_params, @@ -166,39 +135,6 @@ } } -static void convolve_vert_scale(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, int w, int h, - const InterpFilterParams filter_params, - const int subpel_y_qn, int y_step_qn, - ConvolveParams *conv_params) { - int filter_size = filter_params.taps; - src -= src_stride * (filter_size / 2 - 1); - for (int x = 0; x < w; ++x) { - int y_qn = subpel_y_qn; - for (int y = 0; y < h; ++y) { - const uint8_t *const src_y = - &src[(y_qn >> SCALE_SUBPEL_BITS) * src_stride]; - const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; - assert(y_filter_idx < SUBPEL_SHIFTS); - const int16_t *y_filter = - av1_get_interp_filter_subpel_kernel(filter_params, y_filter_idx); - int sum = 0; - for (int k = 0; k < filter_size; ++k) - sum += src_y[k * src_stride] * y_filter[k]; - - sum = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)); - if (conv_params->do_average) - dst[y * dst_stride] = ROUND_POWER_OF_TWO(dst[y * dst_stride] + sum, 1); - else - dst[y * dst_stride] = sum; - - y_qn += y_step_qn; - } - ++src; - ++dst; - } -} - static void convolve_copy(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, ConvolveParams *conv_params) { @@ -259,27 +195,6 @@ } } -void av1_convolve_horiz_facade_scale(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, int w, int h, - const InterpFilterParams filter_params, - const int subpel_x_qn, int x_step_qn, - ConvolveParams *conv_params) { - if (filter_params.taps == SUBPEL_TAPS) { - const int16_t *filter_x = av1_get_interp_filter_subpel_kernel( - filter_params, subpel_x_qn >> SCALE_EXTRA_BITS); - if (conv_params->do_average == 0) - aom_convolve8_horiz_scale(src, src_stride, dst, dst_stride, filter_x, - subpel_x_qn, x_step_qn, NULL, 0, -1, w, h); - else - aom_convolve8_avg_horiz_scale(src, src_stride, dst, dst_stride, filter_x, - subpel_x_qn, x_step_qn, NULL, 0, -1, w, h); - } else { - av1_convolve_horiz_scale(src, src_stride, dst, dst_stride, w, h, - filter_params, subpel_x_qn, x_step_qn, - conv_params); - } -} - static void convolve_vert_facade(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, const InterpFilterParams filter_params, @@ -322,27 +237,6 @@ } } -void av1_convolve_vert_facade_scale(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, int w, int h, - const InterpFilterParams filter_params, - const int subpel_y_qn, int y_step_qn, - ConvolveParams *conv_params) { - if (filter_params.taps == SUBPEL_TAPS) { - const int16_t *filter_y = av1_get_interp_filter_subpel_kernel( - filter_params, subpel_y_qn >> SCALE_EXTRA_BITS); - if (conv_params->do_average == 0) { - aom_convolve8_vert_scale(src, src_stride, dst, dst_stride, NULL, 0, -1, - filter_y, subpel_y_qn, y_step_qn, w, h); - } else { - aom_convolve8_avg_vert_scale(src, src_stride, dst, dst_stride, NULL, 0, - -1, filter_y, subpel_y_qn, y_step_qn, w, h); - } - } else { - convolve_vert_scale(src, src_stride, dst, dst_stride, w, h, filter_params, - subpel_y_qn, y_step_qn, conv_params); - } -} - void av1_convolve_rounding_c(const int32_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, int bits) { for (int r = 0; r < h; ++r) { @@ -1718,75 +1612,6 @@ } } -static void convolve_scale_helper(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, int w, int h, - const InterpFilters interp_filters, - const int subpel_x_qn, int x_step_qn, - const int subpel_y_qn, int y_step_qn, - ConvolveParams *conv_params, - ConvolveFunc convolve_horiz, - ConvolveFunc convolve_vert) { - int ignore_horiz = x_step_qn == SCALE_SUBPEL_SHIFTS && subpel_x_qn == 0; - int ignore_vert = y_step_qn == SCALE_SUBPEL_SHIFTS && subpel_y_qn == 0; - - InterpFilterParams filter_params_x, filter_params_y; - -#if CONFIG_SHORT_FILTER - av1_get_convolve_filter_params(interp_filters, &filter_params_x, - &filter_params_y, w, h); -#else - av1_get_convolve_filter_params(interp_filters, &filter_params_x, - &filter_params_y); -#endif - - assert(w <= MAX_BLOCK_WIDTH); - assert(h <= MAX_BLOCK_HEIGHT); - assert(y_step_qn <= (MAX_STEP << SCALE_EXTRA_BITS)); - assert(x_step_qn <= (MAX_STEP << SCALE_EXTRA_BITS)); - - if (ignore_horiz && ignore_vert) { - convolve_copy(src, src_stride, dst, dst_stride, w, h, conv_params); - } else if (ignore_vert) { - assert(filter_params_x.taps <= MAX_FILTER_TAP); - convolve_horiz(src, src_stride, dst, dst_stride, w, h, filter_params_x, - subpel_x_qn, x_step_qn, conv_params); - } else if (ignore_horiz) { - assert(filter_params_y.taps <= MAX_FILTER_TAP); - convolve_vert(src, src_stride, dst, dst_stride, w, h, filter_params_y, - subpel_y_qn, y_step_qn, conv_params); - } else { - // temp's size is set to a 256 aligned value to facilitate SIMD - // implementation. The value is greater than (maximum possible intermediate - // height or width) * MAX_SB_SIZE - DECLARE_ALIGNED(16, uint8_t, - temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]); - int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); - int filter_size; - const int temp_stride = MAX_SB_SIZE; - ConvolveParams temp_conv_params; - temp_conv_params.ref = 0; - temp_conv_params.do_average = 0; - filter_size = filter_params_y.taps; - const int intermediate_height = - (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + - filter_size; - assert(intermediate_height <= max_intermediate_size); - (void)max_intermediate_size; - - assert(filter_params_x.taps <= MAX_FILTER_TAP); - - convolve_horiz(src - src_stride * (filter_size / 2 - 1), src_stride, temp, - temp_stride, w, intermediate_height, filter_params_x, - subpel_x_qn, x_step_qn, &temp_conv_params); - - assert(filter_params_y.taps <= MAX_FILTER_TAP); - - convolve_vert(temp + temp_stride * (filter_size / 2 - 1), temp_stride, dst, - dst_stride, w, h, filter_params_y, subpel_y_qn, y_step_qn, - conv_params); - } -} - void av1_convolve(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x_q4, int x_step_q4, const int subpel_y_q4, @@ -1805,17 +1630,6 @@ convolve_horiz_facade_c, convolve_vert_facade_c); } -void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, - InterpFilters interp_filters, const int subpel_x_qn, - int x_step_qn, const int subpel_y_qn, int y_step_qn, - ConvolveParams *conv_params) { - convolve_scale_helper(src, src_stride, dst, dst_stride, w, h, interp_filters, - subpel_x_qn, x_step_qn, subpel_y_qn, y_step_qn, - conv_params, av1_convolve_horiz_facade_scale, - av1_convolve_vert_facade_scale); -} - void av1_highbd_convolve_horiz_c(const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams filter_params, @@ -1845,38 +1659,6 @@ } } -static void highbd_convolve_horiz_scale(const uint16_t *src, int src_stride, - uint16_t *dst, int dst_stride, int w, - int h, - const InterpFilterParams filter_params, - const int subpel_x_qn, int x_step_qn, - int avg, int bd) { - int filter_size = filter_params.taps; - src -= filter_size / 2 - 1; - for (int y = 0; y < h; ++y) { - int x_qn = subpel_x_qn; - for (int x = 0; x < w; ++x) { - const uint16_t *const src_x = &src[x_qn >> SCALE_SUBPEL_BITS]; - const int x_filter_idx = (x_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; - assert(x_filter_idx < SUBPEL_SHIFTS); - const int16_t *x_filter = - av1_get_interp_filter_subpel_kernel(filter_params, x_filter_idx); - int sum = 0; - for (int k = 0; k < filter_size; ++k) sum += src_x[k] * x_filter[k]; - if (avg) - dst[x] = ROUND_POWER_OF_TWO( - dst[x] + - clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd), - 1); - else - dst[x] = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); - x_qn += x_step_qn; - } - src += src_stride; - dst += dst_stride; - } -} - void av1_highbd_convolve_vert_c(const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, const InterpFilterParams filter_params, @@ -1910,43 +1692,6 @@ } } -static void highbd_convolve_vert_scale(const uint16_t *src, int src_stride, - uint16_t *dst, int dst_stride, int w, - int h, - const InterpFilterParams filter_params, - const int subpel_y_qn, int y_step_qn, - int avg, int bd) { - int filter_size = filter_params.taps; - src -= src_stride * (filter_size / 2 - 1); - - for (int x = 0; x < w; ++x) { - int y_qn = subpel_y_qn; - for (int y = 0; y < h; ++y) { - const uint16_t *const src_y = - &src[(y_qn >> SCALE_SUBPEL_BITS) * src_stride]; - const int y_filter_idx = (y_qn & SCALE_SUBPEL_MASK) >> SCALE_EXTRA_BITS; - assert(y_filter_idx < SUBPEL_SHIFTS); - const int16_t *y_filter = - av1_get_interp_filter_subpel_kernel(filter_params, y_filter_idx); - int sum = 0; - for (int k = 0; k < filter_size; ++k) - sum += src_y[k * src_stride] * y_filter[k]; - if (avg) { - dst[y * dst_stride] = ROUND_POWER_OF_TWO( - dst[y * dst_stride] + - clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd), - 1); - } else { - dst[y * dst_stride] = - clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd); - } - y_qn += y_step_qn; - } - ++src; - ++dst; - } -} - static void highbd_convolve_copy(const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride, int w, int h, int avg, int bd) { @@ -1990,18 +1735,6 @@ } } -static void highbd_convolve_horiz_facade_scale( - const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, - int h, const InterpFilterParams filter_params, const int subpel_x_qn, - int x_step_qn, int avg, int bd) { - uint16_t *src = CONVERT_TO_SHORTPTR(src8); - uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); - // TODO(debargha): Add special functions for filter_params.taps == SUBPEL_TAPS - // as in the function above. - highbd_convolve_horiz_scale(src, src_stride, dst, dst_stride, w, h, - filter_params, subpel_x_qn, x_step_qn, avg, bd); -} - static void highbd_convolve_vert_facade(const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, int h, @@ -2027,18 +1760,6 @@ } } -static void highbd_convolve_vert_facade_scale( - const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, - int h, const InterpFilterParams filter_params, const int subpel_y_qn, - int y_step_qn, int avg, int bd) { - uint16_t *src = CONVERT_TO_SHORTPTR(src8); - uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); - // TODO(debargha): Add special functions for filter_params.taps == SUBPEL_TAPS - // as in the function above. - highbd_convolve_vert_scale(src, src_stride, dst, dst_stride, w, h, - filter_params, subpel_y_qn, y_step_qn, avg, bd); -} - void av1_highbd_convolve(const uint8_t *src8, int src_stride, uint8_t *dst8, int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x_q4, @@ -2106,72 +1827,3 @@ dst_stride, w, h, filter_params_y, subpel_y_q4, y_step_q4, ref_idx, bd); } } - -void av1_highbd_convolve_scale(const uint8_t *src8, int src_stride, - uint8_t *dst8, int dst_stride, int w, int h, - InterpFilters interp_filters, - const int subpel_x_qn, int x_step_qn, - const int subpel_y_qn, int y_step_qn, - int ref_idx, int bd) { - int ignore_horiz = x_step_qn == SCALE_SUBPEL_SHIFTS && subpel_x_qn == 0; - int ignore_vert = y_step_qn == SCALE_SUBPEL_SHIFTS && subpel_y_qn == 0; - - assert(w <= MAX_BLOCK_WIDTH); - assert(h <= MAX_BLOCK_HEIGHT); - assert(y_step_qn <= (MAX_STEP << SCALE_EXTRA_BITS)); - assert(x_step_qn <= (MAX_STEP << SCALE_EXTRA_BITS)); - - if (ignore_horiz && ignore_vert) { - uint16_t *src = CONVERT_TO_SHORTPTR(src8); - uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); - highbd_convolve_copy(src, src_stride, dst, dst_stride, w, h, ref_idx, bd); - return; - } - - InterpFilterParams filter_params_x, filter_params_y; -#if CONFIG_SHORT_FILTER - av1_get_convolve_filter_params(interp_filters, &filter_params_x, - &filter_params_y, w, h); -#else - av1_get_convolve_filter_params(interp_filters, &filter_params_x, - &filter_params_y); -#endif - - if (ignore_vert) { - highbd_convolve_horiz_facade_scale(src8, src_stride, dst8, dst_stride, w, h, - filter_params_x, subpel_x_qn, x_step_qn, - ref_idx, bd); - } else if (ignore_horiz) { - highbd_convolve_vert_facade_scale(src8, src_stride, dst8, dst_stride, w, h, - filter_params_y, subpel_y_qn, y_step_qn, - ref_idx, bd); - } else { - // temp's size is set to a 256 aligned value to facilitate SIMD - // implementation. The value is greater than (maximum possible intermediate - // height or width) * MAX_SB_SIZE - DECLARE_ALIGNED(16, uint16_t, - temp[((MAX_SB_SIZE * 2 + 16) + 16) * MAX_SB_SIZE]); - uint8_t *temp8 = CONVERT_TO_BYTEPTR(temp); - int max_intermediate_size = ((MAX_SB_SIZE * 2 + 16) + 16); - int filter_size; - const int temp_stride = MAX_SB_SIZE; - filter_size = filter_params_y.taps; - const int intermediate_height = - (((h - 1) * y_step_qn + subpel_y_qn) >> SCALE_SUBPEL_BITS) + - filter_size; - assert(intermediate_height <= max_intermediate_size); - (void)max_intermediate_size; - - highbd_convolve_horiz_facade_scale( - src8 - src_stride * (filter_size / 2 - 1), src_stride, temp8, - temp_stride, w, intermediate_height, filter_params_x, subpel_x_qn, - x_step_qn, 0, bd); - - filter_size = filter_params_y.taps; - assert(filter_params_y.taps <= MAX_FILTER_TAP); - - highbd_convolve_vert_facade_scale( - temp8 + temp_stride * (filter_size / 2 - 1), temp_stride, dst8, - dst_stride, w, h, filter_params_y, subpel_y_qn, y_step_qn, ref_idx, bd); - } -}
diff --git a/av1/common/convolve.h b/av1/common/convolve.h index 554d144..555c671 100644 --- a/av1/common/convolve.h +++ b/av1/common/convolve.h
@@ -138,23 +138,11 @@ const int subpel_x, int xstep, const int subpel_y, int ystep, ConvolveParams *conv_params); -void av1_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, - InterpFilters interp_filters, const int subpel_x, - int xstep, const int subpel_y, int ystep, - ConvolveParams *conv_params); - void av1_highbd_convolve(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int w, int h, InterpFilters interp_filters, const int subpel_x, int xstep, const int subpel_y, int ystep, int avg, int bd); - -void av1_highbd_convolve_scale(const uint8_t *src, int src_stride, uint8_t *dst, - int dst_stride, int w, int h, - InterpFilters interp_filters, const int subpel_x, - int xstep, const int subpel_y, int ystep, - int avg, int bd); #ifdef __cplusplus } // extern "C" #endif