From: Deb Mukherjee Date: Mon, 22 Apr 2013 23:29:34 +0000 (-0700) Subject: Removing the implicit compound inter experiment X-Git-Tag: v1.3.0~1106^2~175^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=735febf1ce071569e8aba26ae3c27df03626d09a;p=platform%2Fupstream%2Flibvpx.git Removing the implicit compound inter experiment Removing this experiment for now, since it has been broken with the latest code changes. Change-Id: I1be2181b56de490fcb577f5905b5e147a8ed82d8 --- diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 715df98..0baadfc 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -326,11 +326,7 @@ struct scale_factors { int den, int offset_q4); -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - convolve_fn_t predict[2][2][8]; // horiz, vert, weight (0 - 7) -#else convolve_fn_t predict[2][2][2]; // horiz, vert, avg -#endif }; enum { MAX_MB_PLANE = 3 }; diff --git a/vp9/common/vp9_convolve.c b/vp9/common/vp9_convolve.c index a27ca6f..46ae503 100644 --- a/vp9/common/vp9_convolve.c +++ b/vp9/common/vp9_convolve.c @@ -122,78 +122,6 @@ static void convolve_avg_horiz_c(const uint8_t *src, int src_stride, } } -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - -static inline uint8_t combine_qtr(uint8_t a, uint8_t b) { - return (((a) + (b) * 3 + 2) >> 2); -} - -static inline uint8_t combine_3qtr(uint8_t a, uint8_t b) { - return (((a) * 3 + (b) + 2) >> 2); -} - -static inline uint8_t combine_1by8(uint8_t a, uint8_t b) { - return (((a) * 1 + (b) * 7 + 4) >> 3); -} - -static inline uint8_t combine_3by8(uint8_t a, uint8_t b) { - return (((a) * 3 + (b) * 5 + 4) >> 3); -} - -static inline uint8_t combine_5by8(uint8_t a, uint8_t b) { - return (((a) * 5 + (b) * 3 + 4) >> 3); -} - -static inline uint8_t combine_7by8(uint8_t a, uint8_t b) { - return (((a) * 7 + (b) * 1 + 4) >> 3); -} - -// TODO(debargha): Implment with a separate weight parameter -static void convolve_wtd_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x0, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h, int taps, - uint8_t (*combine)(uint8_t a, uint8_t b)) { - int x, y, k, sum; - const int16_t *filter_x_base = filter_x0; - -#if ALIGN_FILTERS_256 - filter_x_base = (const int16_t *)(((intptr_t)filter_x0) & ~(intptr_t)0xff); -#endif - - /* Adjust base pointer address for this source line */ - src -= taps / 2 - 1; - - for (y = 0; y < h; ++y) { - /* Pointer to filter to use */ - const int16_t *filter_x = filter_x0; - - /* Initial phase offset */ - int x0_q4 = (filter_x - filter_x_base) / taps; - int x_q4 = x0_q4; - - for (x = 0; x < w; ++x) { - /* Per-pixel src offset */ - int src_x = (x_q4 - x0_q4) >> 4; - - for (sum = 0, k = 0; k < taps; ++k) { - sum += src[src_x + k] * filter_x[k]; - } - sum += (VP9_FILTER_WEIGHT >> 1); - dst[x] = combine(dst[x], clip_pixel(sum >> VP9_FILTER_SHIFT)); - - /* Adjust source and filter to use for the next pixel */ - x_q4 += x_step_q4; - filter_x = filter_x_base + (x_q4 & 0xf) * taps; - } - src += src_stride; - dst += dst_stride; - } -} - -#endif - static void convolve_vert_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, @@ -279,52 +207,6 @@ static void convolve_avg_vert_c(const uint8_t *src, int src_stride, } } -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -static void convolve_wtd_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y0, int y_step_q4, - int w, int h, int taps, - uint8_t (*combine)(uint8_t a, uint8_t b)) { - int x, y, k, sum; - - const int16_t *filter_y_base = filter_y0; - -#if ALIGN_FILTERS_256 - filter_y_base = (const int16_t *)(((intptr_t)filter_y0) & ~(intptr_t)0xff); -#endif - - /* Adjust base pointer address for this source column */ - src -= src_stride * (taps / 2 - 1); - for (x = 0; x < w; ++x) { - /* Pointer to filter to use */ - const int16_t *filter_y = filter_y0; - - /* Initial phase offset */ - int y0_q4 = (filter_y - filter_y_base) / taps; - int y_q4 = y0_q4; - - for (y = 0; y < h; ++y) { - /* Per-pixel src offset */ - int src_y = (y_q4 - y0_q4) >> 4; - - for (sum = 0, k = 0; k < taps; ++k) { - sum += src[(src_y + k) * src_stride] * filter_y[k]; - } - sum += (VP9_FILTER_WEIGHT >> 1); - dst[y * dst_stride] = combine(dst[y * dst_stride], - clip_pixel(sum >> VP9_FILTER_SHIFT)); - - /* Adjust source and filter to use for the next pixel */ - y_q4 += y_step_q4; - filter_y = filter_y_base + (y_q4 & 0xf) * taps; - } - ++src; - ++dst; - } -} -#endif - static void convolve_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, @@ -403,68 +285,6 @@ void vp9_convolve8_avg_horiz_c(const uint8_t *src, int src_stride, w, h, 8); } -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -void vp9_convolve8_1by8_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_1by8); -} - -void vp9_convolve8_qtr_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_qtr); -} - -void vp9_convolve8_3by8_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_3by8); -} - -void vp9_convolve8_5by8_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_5by8); -} - -void vp9_convolve8_3qtr_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_3qtr); -} - -void vp9_convolve8_7by8_horiz_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_horiz_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_7by8); -} -#endif - void vp9_convolve8_vert_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, @@ -485,68 +305,6 @@ void vp9_convolve8_avg_vert_c(const uint8_t *src, int src_stride, w, h, 8); } -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -void vp9_convolve8_1by8_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_1by8); -} - -void vp9_convolve8_qtr_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_qtr); -} - -void vp9_convolve8_3by8_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_3by8); -} - -void vp9_convolve8_5by8_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_5by8); -} - -void vp9_convolve8_3qtr_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_3qtr); -} - -void vp9_convolve8_7by8_vert_c(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h) { - convolve_wtd_vert_c(src, src_stride, dst, dst_stride, - filter_x, x_step_q4, filter_y, y_step_q4, - w, h, 8, combine_7by8); -} -#endif - void vp9_convolve8_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, @@ -579,140 +337,6 @@ void vp9_convolve8_avg_c(const uint8_t *src, int src_stride, w, h); } -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -void vp9_convolve8_1by8_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_1by8(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} - -void vp9_convolve8_qtr_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_qtr(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} - -void vp9_convolve8_3by8_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_3by8(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} - -void vp9_convolve8_5by8_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_5by8(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} - -void vp9_convolve8_3qtr_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_3qtr(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} - -void vp9_convolve8_7by8_c(const uint8_t *src, int src_stride, - uint8_t *dst, int 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_ARRAY(16, uint8_t, temp, 16 * 16); - assert(w <= 16); - assert(h <= 16); - - vp9_convolve8(src, src_stride, - temp, 16, - filter_x, x_step_q4, - filter_y, y_step_q4, - w, h); - vp9_convolve_7by8(temp, 16, - dst, dst_stride, - NULL, 0, /* These unused parameter should be removed! */ - NULL, 0, /* These unused parameter should be removed! */ - w, h); -} -#endif - void vp9_convolve_copy(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int filter_x_stride, @@ -750,101 +374,3 @@ void vp9_convolve_avg(const uint8_t *src, int src_stride, dst += dst_stride; } } - -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -void vp9_convolve_1by8(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_1by8(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} - -void vp9_convolve_qtr(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_qtr(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} - -void vp9_convolve_3by8(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_3by8(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} - -void vp9_convolve_5by8(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_5by8(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} - -void vp9_convolve_3qtr(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_3qtr(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} - -void vp9_convolve_7by8(const uint8_t *src, int src_stride, - uint8_t *dst, int 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; - - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - dst[x] = combine_7by8(dst[x], src[x]); - } - src += src_stride; - dst += dst_stride; - } -} -#endif diff --git a/vp9/common/vp9_convolve.h b/vp9/common/vp9_convolve.h index bef2d85..0596080 100644 --- a/vp9/common/vp9_convolve.h +++ b/vp9/common/vp9_convolve.h @@ -33,50 +33,6 @@ void vp9_convolve_avg(const uint8_t *src, int src_stride, const int16_t *filter_y, int y_step_q4, int w, int h); -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -// Not a convolution, a block wtd (1/8, 7/8) average for (dst, src) -void vp9_convolve_1by8(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); - -// Not a convolution, a block wtd (1/4, 3/4) average for (dst, src) -void vp9_convolve_qtr(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); - -// Not a convolution, a block wtd (3/8, 5/8) average for (dst, src) -void vp9_convolve_3by8(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); - -// Not a convolution, a block wtd (5/8, 3/8) average for (dst, src) -void vp9_convolve_5by8(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); - -// Not a convolution, a block wtd (3/4, 1/4) average for (dst, src) -void vp9_convolve_3qtr(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); - -// Not a convolution, a block wtd (7/8, 1/8) average for (dst, src) -void vp9_convolve_7by8(const uint8_t *src, int src_stride, - uint8_t *dst, int dst_stride, - const int16_t *filter_x, int x_step_q4, - const int16_t *filter_y, int y_step_q4, - int w, int h); -#endif - struct subpix_fn_table { const int16_t (*filter_x)[8]; const int16_t (*filter_y)[8]; diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index 2697bd2..80eb2c6 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -57,127 +57,6 @@ void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, // applied in one direction only, and not at all for 0,0, seems to give the // best quality, but it may be worth trying an additional mode that does // do the filtering on full-pel. -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - if (scale->x_step_q4 == 16) { - if (scale->y_step_q4 == 16) { - // No scaling in either direction. - scale->predict[0][0][0] = vp9_convolve_copy; - scale->predict[0][0][1] = vp9_convolve_1by8; - scale->predict[0][0][2] = vp9_convolve_qtr; - scale->predict[0][0][3] = vp9_convolve_3by8; - scale->predict[0][0][4] = vp9_convolve_avg; - scale->predict[0][0][5] = vp9_convolve_5by8; - scale->predict[0][0][6] = vp9_convolve_3qtr; - scale->predict[0][0][7] = vp9_convolve_7by8; - scale->predict[0][1][0] = vp9_convolve8_vert; - scale->predict[0][1][1] = vp9_convolve8_1by8_vert; - scale->predict[0][1][2] = vp9_convolve8_qtr_vert; - scale->predict[0][1][3] = vp9_convolve8_3by8_vert; - scale->predict[0][1][4] = vp9_convolve8_avg_vert; - scale->predict[0][1][5] = vp9_convolve8_5by8_vert; - scale->predict[0][1][6] = vp9_convolve8_3qtr_vert; - scale->predict[0][1][7] = vp9_convolve8_7by8_vert; - scale->predict[1][0][0] = vp9_convolve8_horiz; - scale->predict[1][0][1] = vp9_convolve8_1by8_horiz; - scale->predict[1][0][2] = vp9_convolve8_qtr_horiz; - scale->predict[1][0][3] = vp9_convolve8_3by8_horiz; - scale->predict[1][0][4] = vp9_convolve8_avg_horiz; - scale->predict[1][0][5] = vp9_convolve8_5by8_horiz; - scale->predict[1][0][6] = vp9_convolve8_3qtr_horiz; - scale->predict[1][0][7] = vp9_convolve8_7by8_horiz; - } else { - // No scaling in x direction. Must always scale in the y direction. - scale->predict[0][0][0] = vp9_convolve8_vert; - scale->predict[0][0][1] = vp9_convolve8_1by8_vert; - scale->predict[0][0][2] = vp9_convolve8_qtr_vert; - scale->predict[0][0][3] = vp9_convolve8_3by8_vert; - scale->predict[0][0][4] = vp9_convolve8_avg_vert; - scale->predict[0][0][5] = vp9_convolve8_5by8_vert; - scale->predict[0][0][6] = vp9_convolve8_3qtr_vert; - scale->predict[0][0][7] = vp9_convolve8_7by8_vert; - scale->predict[0][1][0] = vp9_convolve8_vert; - scale->predict[0][1][1] = vp9_convolve8_1by8_vert; - scale->predict[0][1][2] = vp9_convolve8_qtr_vert; - scale->predict[0][1][3] = vp9_convolve8_3by8_vert; - scale->predict[0][1][4] = vp9_convolve8_avg_vert; - scale->predict[0][1][5] = vp9_convolve8_5by8_vert; - scale->predict[0][1][6] = vp9_convolve8_3qtr_vert; - scale->predict[0][1][7] = vp9_convolve8_7by8_vert; - scale->predict[1][0][0] = vp9_convolve8; - scale->predict[1][0][1] = vp9_convolve8_1by8; - scale->predict[1][0][2] = vp9_convolve8_qtr; - scale->predict[1][0][3] = vp9_convolve8_3by8; - scale->predict[1][0][4] = vp9_convolve8_avg; - scale->predict[1][0][5] = vp9_convolve8_5by8; - scale->predict[1][0][6] = vp9_convolve8_3qtr; - scale->predict[1][0][7] = vp9_convolve8_7by8; - } - } else { - if (scale->y_step_q4 == 16) { - // No scaling in the y direction. Must always scale in the x direction. - scale->predict[0][0][0] = vp9_convolve8_horiz; - scale->predict[0][0][1] = vp9_convolve8_1by8_horiz; - scale->predict[0][0][2] = vp9_convolve8_qtr_horiz; - scale->predict[0][0][3] = vp9_convolve8_3by8_horiz; - scale->predict[0][0][4] = vp9_convolve8_avg_horiz; - scale->predict[0][0][5] = vp9_convolve8_5by8_horiz; - scale->predict[0][0][6] = vp9_convolve8_3qtr_horiz; - scale->predict[0][0][7] = vp9_convolve8_7by8_horiz; - scale->predict[0][1][0] = vp9_convolve8; - scale->predict[0][1][1] = vp9_convolve8_1by8; - scale->predict[0][1][2] = vp9_convolve8_qtr; - scale->predict[0][1][3] = vp9_convolve8_3by8; - scale->predict[0][1][4] = vp9_convolve8_avg; - scale->predict[0][1][5] = vp9_convolve8_5by8; - scale->predict[0][1][6] = vp9_convolve8_3qtr; - scale->predict[0][1][7] = vp9_convolve8_7by8; - scale->predict[1][0][0] = vp9_convolve8_horiz; - scale->predict[1][0][1] = vp9_convolve8_1by8_horiz; - scale->predict[1][0][2] = vp9_convolve8_qtr_horiz; - scale->predict[1][0][3] = vp9_convolve8_3by8_horiz; - scale->predict[1][0][4] = vp9_convolve8_avg_horiz; - scale->predict[1][0][5] = vp9_convolve8_5by8_horiz; - scale->predict[1][0][6] = vp9_convolve8_3qtr_horiz; - scale->predict[1][0][7] = vp9_convolve8_7by8_horiz; - } else { - // Must always scale in both directions. - scale->predict[0][0][0] = vp9_convolve8; - scale->predict[0][0][1] = vp9_convolve8_1by8; - scale->predict[0][0][2] = vp9_convolve8_qtr; - scale->predict[0][0][3] = vp9_convolve8_3by8; - scale->predict[0][0][4] = vp9_convolve8_avg; - scale->predict[0][0][5] = vp9_convolve8_5by8; - scale->predict[0][0][6] = vp9_convolve8_3qtr; - scale->predict[0][0][7] = vp9_convolve8_7by8; - scale->predict[0][1][0] = vp9_convolve8; - scale->predict[0][1][1] = vp9_convolve8_1by8; - scale->predict[0][1][2] = vp9_convolve8_qtr; - scale->predict[0][1][3] = vp9_convolve8_3by8; - scale->predict[0][1][4] = vp9_convolve8_avg; - scale->predict[0][1][5] = vp9_convolve8_5by8; - scale->predict[0][1][6] = vp9_convolve8_3qtr; - scale->predict[0][1][7] = vp9_convolve8_7by8; - scale->predict[1][0][0] = vp9_convolve8; - scale->predict[1][0][1] = vp9_convolve8_1by8; - scale->predict[1][0][2] = vp9_convolve8_qtr; - scale->predict[1][0][3] = vp9_convolve8_3by8; - scale->predict[1][0][4] = vp9_convolve8_avg; - scale->predict[1][0][5] = vp9_convolve8_5by8; - scale->predict[1][0][6] = vp9_convolve8_3qtr; - scale->predict[1][0][7] = vp9_convolve8_7by8; - } - } - // 2D subpel motion always gets filtered in both directions - scale->predict[1][1][0] = vp9_convolve8; - scale->predict[1][1][1] = vp9_convolve8_1by8; - scale->predict[1][1][2] = vp9_convolve8_qtr; - scale->predict[1][1][3] = vp9_convolve8_3by8; - scale->predict[1][1][4] = vp9_convolve8_avg; - scale->predict[1][1][5] = vp9_convolve8_5by8; - scale->predict[1][1][6] = vp9_convolve8_3qtr; - scale->predict[1][1][7] = vp9_convolve8_7by8; -} -#else if (scale->x_step_q4 == 16) { if (scale->y_step_q4 == 16) { // No scaling in either direction. @@ -219,7 +98,6 @@ void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, scale->predict[1][1][0] = vp9_convolve8; scale->predict[1][1][1] = vp9_convolve8_avg; } -#endif void vp9_setup_interp_filters(MACROBLOCKD *xd, INTERPOLATIONFILTERTYPE mcomp_filter_type, @@ -383,60 +261,6 @@ void vp9_build_inter_predictor_q4(const uint8_t *src, int src_stride, w, h); } -static void build_2x1_inter_predictor_wh(const BLOCKD *d0, const BLOCKD *d1, - struct scale_factors *s, - uint8_t *predictor, - int block_size, int stride, - int which_mv, int weight, - int width, int height, - const struct subpix_fn_table *subpix, - int row, int col) { - struct scale_factors * scale = &s[which_mv]; - - assert(d1->dst - d0->dst == block_size); - assert(d1->pre == d0->pre + block_size); - - scale->set_scaled_offsets(scale, row, col); - - if (d0->bmi.as_mv[which_mv].as_int == d1->bmi.as_mv[which_mv].as_int) { - uint8_t **base_pre = which_mv ? d0->base_second_pre : d0->base_pre; - - vp9_build_inter_predictor(*base_pre + d0->pre, - d0->pre_stride, - predictor, stride, - &d0->bmi.as_mv[which_mv], - scale, - width, height, - weight, subpix); - - } else { - uint8_t **base_pre0 = which_mv ? d0->base_second_pre : d0->base_pre; - uint8_t **base_pre1 = which_mv ? d1->base_second_pre : d1->base_pre; - - vp9_build_inter_predictor(*base_pre0 + d0->pre, - d0->pre_stride, - predictor, stride, - &d0->bmi.as_mv[which_mv], - scale, - width > block_size ? block_size : width, height, - weight, subpix); - - if (width <= block_size) return; - - scale->set_scaled_offsets(scale, row, col + block_size); - - vp9_build_inter_predictor(*base_pre1 + d1->pre, - d1->pre_stride, - predictor + block_size, stride, - &d1->bmi.as_mv[which_mv], - scale, - width - block_size, height, - weight, subpix); - } -} - -#if !CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - static INLINE int round_mv_comp_q4(int value) { return (value < 0 ? value - 2 : value + 2) / 4; } @@ -633,580 +457,6 @@ void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, } #endif } -#endif // !CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - -#define AVERAGE_WEIGHT (1 << (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT)) - -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT - -static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) { - /* If the MV points so far into the UMV border that no visible pixels - * are used for reconstruction, the subpel part of the MV can be - * discarded and the MV limited to 16 pixels with equivalent results. - * - * This limit kicks in at 19 pixels for the top and left edges, for - * the 16 pixels plus 3 taps right of the central pixel when subpel - * filtering. The bottom and right edges use 16 pixels plus 2 pixels - * left of the central pixel when filtering. - */ - if (mv->col < (xd->mb_to_left_edge - ((16 + VP9_INTERP_EXTEND) << 3))) - mv->col = xd->mb_to_left_edge - (16 << 3); - else if (mv->col > xd->mb_to_right_edge + ((15 + VP9_INTERP_EXTEND) << 3)) - mv->col = xd->mb_to_right_edge + (16 << 3); - - if (mv->row < (xd->mb_to_top_edge - ((16 + VP9_INTERP_EXTEND) << 3))) - mv->row = xd->mb_to_top_edge - (16 << 3); - else if (mv->row > xd->mb_to_bottom_edge + ((15 + VP9_INTERP_EXTEND) << 3)) - mv->row = xd->mb_to_bottom_edge + (16 << 3); -} - -// Whether to use implicit weighting for UV -#define USE_IMPLICIT_WEIGHT_UV - -// Whether to use implicit weighting for SplitMV -// #define USE_IMPLICIT_WEIGHT_SPLITMV - -// #define SEARCH_MIN3 -static int64_t get_consistency_metric(MACROBLOCKD *xd, - uint8_t *tmp_y, int tmp_ystride) { - int block_size = 16 << xd->mode_info_context->mbmi.sb_type; - uint8_t *rec_y = xd->plane[0].dst.buf; - int rec_ystride = xd->plane[0].dst.stride; - int64_t metric = 0; - int i; - if (xd->up_available) { - for (i = 0; i < block_size; ++i) { - int diff = abs(*(rec_y - rec_ystride + i) - - *(tmp_y + i)); -#ifdef SEARCH_MIN3 - // Searches for the min abs diff among 3 pixel neighbors in the border - int diff1 = xd->left_available ? - abs(*(rec_y - rec_ystride + i - 1) - *(tmp_y + i)) : diff; - int diff2 = i < block_size - 1 ? - abs(*(rec_y - rec_ystride + i + 1) - *(tmp_y + i)) : diff; - diff = diff <= diff1 ? diff : diff1; - diff = diff <= diff2 ? diff : diff2; -#endif - metric += diff; - } - } - if (xd->left_available) { - for (i = 0; i < block_size; ++i) { - int diff = abs(*(rec_y - 1 + i * rec_ystride) - - *(tmp_y + i * tmp_ystride)); -#ifdef SEARCH_MIN3 - // Searches for the min abs diff among 3 pixel neighbors in the border - int diff1 = xd->up_available ? - abs(*(rec_y - 1 + (i - 1) * rec_ystride) - - *(tmp_y + i * tmp_ystride)) : diff; - int diff2 = i < block_size - 1 ? - abs(*(rec_y - 1 + (i + 1) * rec_ystride) - - *(tmp_y + i * tmp_ystride)) : diff; - diff = diff <= diff1 ? diff : diff1; - diff = diff <= diff2 ? diff : diff2; -#endif - metric += diff; - } - } - return metric; -} - -static int get_weight(MACROBLOCKD *xd, int64_t metric_1, int64_t metric_2) { - int weight = AVERAGE_WEIGHT; - if (2 * metric_1 < metric_2) - weight = 6; - else if (4 * metric_1 < 3 * metric_2) - weight = 5; - else if (2 * metric_2 < metric_1) - weight = 2; - else if (4 * metric_2 < 3 * metric_1) - weight = 3; - return weight; -} - -#ifdef USE_IMPLICIT_WEIGHT_SPLITMV -static int get_implicit_compoundinter_weight_splitmv( - MACROBLOCKD *xd, int mb_row, int mb_col) { - MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; - BLOCKD *blockd = xd->block; - const int use_second_ref = mbmi->second_ref_frame > 0; - int64_t metric_2 = 0, metric_1 = 0; - int i, which_mv, weight; - uint8_t tmp_y[256]; - const int tmp_ystride = 16; - - if (!use_second_ref) return 0; - if (!(xd->up_available || xd->left_available)) - return AVERAGE_WEIGHT; - - assert(xd->mode_info_context->mbmi.mode == SPLITMV); - - which_mv = 1; // second predictor - if (xd->mode_info_context->mbmi.partitioning != PARTITIONING_4X4) { - for (i = 0; i < 16; i += 8) { - BLOCKD *d0 = &blockd[i]; - BLOCKD *d1 = &blockd[i + 2]; - const int y = i & 8; - - blockd[i + 0].bmi = xd->mode_info_context->bmi[i + 0]; - blockd[i + 2].bmi = xd->mode_info_context->bmi[i + 2]; - - if (mbmi->need_to_clamp_mvs) { - clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv[which_mv].as_mv, xd); - clamp_mv_to_umv_border(&blockd[i + 2].bmi.as_mv[which_mv].as_mv, xd); - } - if (i == 0) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 8, 16, - which_mv, 0, 16, 1, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 8, 16, - which_mv, 0, 1, 8, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - } else { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + 8 * 16, - 8, 16, which_mv, 0, 1, 8, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - } - } - } else { - for (i = 0; i < 16; i += 2) { - BLOCKD *d0 = &blockd[i]; - BLOCKD *d1 = &blockd[i + 1]; - const int x = (i & 3) * 4; - const int y = (i >> 2) * 4; - - blockd[i + 0].bmi = xd->mode_info_context->bmi[i + 0]; - blockd[i + 1].bmi = xd->mode_info_context->bmi[i + 1]; - - if (i >= 4 && (i & 3) != 0) continue; - - if (i == 0) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 4, 16, - which_mv, 0, 8, 1, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 4, 16, - which_mv, 0, 1, 4, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } else if (i < 4) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + x, 4, 16, - which_mv, 0, 8, 1, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } else { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + y * 16, - 4, 16, which_mv, 0, 1, 4, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } - } - } - metric_2 = get_consistency_metric(xd, tmp_y, tmp_ystride); - - which_mv = 0; // first predictor - if (xd->mode_info_context->mbmi.partitioning != PARTITIONING_4X4) { - for (i = 0; i < 16; i += 8) { - BLOCKD *d0 = &blockd[i]; - BLOCKD *d1 = &blockd[i + 2]; - const int y = i & 8; - - blockd[i + 0].bmi = xd->mode_info_context->bmi[i + 0]; - blockd[i + 2].bmi = xd->mode_info_context->bmi[i + 2]; - - if (mbmi->need_to_clamp_mvs) { - clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv[which_mv].as_mv, xd); - clamp_mv_to_umv_border(&blockd[i + 2].bmi.as_mv[which_mv].as_mv, xd); - } - if (i == 0) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 8, 16, - which_mv, 0, 16, 1, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 8, 16, - which_mv, 0, 1, 8, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - } else { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + 8 * 16, - 8, 16, which_mv, 0, 1, 8, - &xd->subpix, mb_row * 16 + y, mb_col * 16); - } - } - } else { - for (i = 0; i < 16; i += 2) { - BLOCKD *d0 = &blockd[i]; - BLOCKD *d1 = &blockd[i + 1]; - const int x = (i & 3) * 4; - const int y = (i >> 2) * 4; - - blockd[i + 0].bmi = xd->mode_info_context->bmi[i + 0]; - blockd[i + 1].bmi = xd->mode_info_context->bmi[i + 1]; - - if (i >= 4 && (i & 3) != 0) continue; - - if (i == 0) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 4, 16, - which_mv, 0, 8, 1, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y, 4, 16, - which_mv, 0, 1, 4, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } else if (i < 4) { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + x, 4, 16, - which_mv, 0, 8, 1, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } else { - build_2x1_inter_predictor_wh(d0, d1, xd->scale_factor, tmp_y + y * 16, - 4, 16, which_mv, 0, 1, 4, &xd->subpix, - mb_row * 16 + y, mb_col * 16 + x); - } - } - } - metric_1 = get_consistency_metric(xd, tmp_y, tmp_ystride); - - // Choose final weight for averaging - weight = get_weight(xd, metric_1, metric_2); - return weight; -} -#endif - -static int get_implicit_compoundinter_weight(MACROBLOCKD *xd, - int mb_row, - int mb_col) { - const int use_second_ref = xd->mode_info_context->mbmi.second_ref_frame > 0; - int64_t metric_2 = 0, metric_1 = 0; - int n, clamp_mvs, pre_stride; - uint8_t *base_pre; - int_mv ymv; - uint8_t tmp_y[4096]; - const int tmp_ystride = 64; - int weight; - int edge[4]; - int block_size = 16 << xd->mode_info_context->mbmi.sb_type; - struct scale_factors *scale; - - if (!use_second_ref) return 0; - if (!(xd->up_available || xd->left_available)) - return AVERAGE_WEIGHT; - - edge[0] = xd->mb_to_top_edge; - edge[1] = xd->mb_to_bottom_edge; - edge[2] = xd->mb_to_left_edge; - edge[3] = xd->mb_to_right_edge; - - clamp_mvs = xd->mode_info_context->mbmi.need_to_clamp_secondmv; - base_pre = xd->plane[0].pre[1].buf; - pre_stride = xd->plane[0].pre[1].stride; - ymv.as_int = xd->mode_info_context->mbmi.mv[1].as_int; - // First generate the second predictor - scale = &xd->scale_factor[1]; - for (n = 0; n < block_size; n += 16) { - xd->mb_to_left_edge = edge[2] - (n << 3); - xd->mb_to_right_edge = edge[3] + ((16 - n) << 3); - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - scale->set_scaled_offsets(scale, mb_row * 16, mb_col * 16 + n); - // predict a single row of pixels - vp9_build_inter_predictor(base_pre + - scaled_buffer_offset(n, 0, pre_stride, scale), - pre_stride, tmp_y + n, tmp_ystride, &ymv, scale, 16, 1, 0, &xd->subpix); - } - xd->mb_to_left_edge = edge[2]; - xd->mb_to_right_edge = edge[3]; - for (n = 0; n < block_size; n += 16) { - xd->mb_to_top_edge = edge[0] - (n << 3); - xd->mb_to_bottom_edge = edge[1] + ((16 - n) << 3); - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - scale->set_scaled_offsets(scale, mb_row * 16 + n, mb_col * 16); - // predict a single col of pixels - vp9_build_inter_predictor(base_pre + - scaled_buffer_offset(0, n, pre_stride, scale), - pre_stride, tmp_y + n * tmp_ystride, tmp_ystride, &ymv, - scale, 1, 16, 0, &xd->subpix); - } - xd->mb_to_top_edge = edge[0]; - xd->mb_to_bottom_edge = edge[1]; - // Compute consistency metric - metric_2 = get_consistency_metric(xd, tmp_y, tmp_ystride); - - clamp_mvs = xd->mode_info_context->mbmi.need_to_clamp_mvs; - base_pre = xd->plane[0].pre[0].buf; - pre_stride = xd->plane[0].pre[0].stride; - ymv.as_int = xd->mode_info_context->mbmi.mv[0].as_int; - // Now generate the first predictor - scale = &xd->scale_factor[0]; - for (n = 0; n < block_size; n += 16) { - xd->mb_to_left_edge = edge[2] - (n << 3); - xd->mb_to_right_edge = edge[3] + ((16 - n) << 3); - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - scale->set_scaled_offsets(scale, mb_row * 16, mb_col * 16 + n); - // predict a single row of pixels - vp9_build_inter_predictor(base_pre + - scaled_buffer_offset(n, 0, pre_stride, scale), - pre_stride, tmp_y + n, tmp_ystride, &ymv, scale, 16, 1, 0, &xd->subpix); - } - xd->mb_to_left_edge = edge[2]; - xd->mb_to_right_edge = edge[3]; - for (n = 0; n < block_size; n += 16) { - xd->mb_to_top_edge = edge[0] - (n << 3); - xd->mb_to_bottom_edge = edge[1] + ((16 - n) << 3); - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - scale->set_scaled_offsets(scale, mb_row * 16 + n, mb_col * 16); - // predict a single col of pixels - vp9_build_inter_predictor(base_pre + - scaled_buffer_offset(0, n, pre_stride, scale), - pre_stride, tmp_y + n * tmp_ystride, tmp_ystride, &ymv, - scale, 1, 16, 0, &xd->subpix); - } - xd->mb_to_top_edge = edge[0]; - xd->mb_to_bottom_edge = edge[1]; - metric_1 = get_consistency_metric(xd, tmp_y, tmp_ystride); - - // Choose final weight for averaging - weight = get_weight(xd, metric_1, metric_2); - return weight; -} - -static void build_inter16x16_predictors_mby_w(MACROBLOCKD *xd, - uint8_t *dst_y, - int dst_ystride, - int weight, - int mb_row, - int mb_col) { - const int use_second_ref = xd->mode_info_context->mbmi.second_ref_frame > 0; - int which_mv; - - for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { - const int clamp_mvs = which_mv ? - xd->mode_info_context->mbmi.need_to_clamp_secondmv : - xd->mode_info_context->mbmi.need_to_clamp_mvs; - - uint8_t *base_pre = xd->plane[0].pre[which_mv].buf; - int pre_stride = xd->plane[0].pre[which_mv].stride; - int_mv ymv; - struct scale_factors *scale = &xd->scale_factor[which_mv]; - - ymv.as_int = xd->mode_info_context->mbmi.mv[which_mv].as_int; - - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - - scale->set_scaled_offsets(scale, mb_row * 16, mb_col * 16); - - vp9_build_inter_predictor(base_pre, pre_stride, dst_y, dst_ystride, - &ymv, scale, 16, 16, - which_mv ? weight : 0, &xd->subpix); - } -} - -static void build_inter16x16_predictors_mbuv_w(MACROBLOCKD *xd, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride, - int weight, - int mb_row, - int mb_col) { - const int use_second_ref = xd->mode_info_context->mbmi.second_ref_frame > 0; - int which_mv; - - for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { - const int clamp_mvs = - which_mv ? xd->mode_info_context->mbmi.need_to_clamp_secondmv - : xd->mode_info_context->mbmi.need_to_clamp_mvs; - uint8_t *uptr, *vptr; - int pre_stride = which_mv ? xd->plane[1].pre[1].stride - : xd->plane[1].pre[0].stride; - int_mv mv; - - struct scale_factors *scale = &xd->scale_factor_uv[which_mv]; - mv.as_int = xd->mode_info_context->mbmi.mv[which_mv].as_int; - - - if (clamp_mvs) - clamp_mv_to_umv_border(&mv.as_mv, xd); - - uptr = (which_mv ? xd->plane[1].pre[1].buf : xd->plane[1].pre[0].buf); - vptr = (which_mv ? xd->plane[2].pre[1].buf : xd->plane[2].pre[0].buf); - - scale->set_scaled_offsets(scale, mb_row * 16, mb_col * 16); - - vp9_build_inter_predictor_q4( - uptr, pre_stride, dst_u, dst_uvstride, &mv, - scale, 8, 8, which_mv ? weight : 0, &xd->subpix); - - vp9_build_inter_predictor_q4( - vptr, pre_stride, dst_v, dst_uvstride, &mv, - scale, 8, 8, which_mv ? weight : 0, &xd->subpix); - } -} -static void build_inter_predictors_sby_w(MACROBLOCKD *x, - uint8_t *dst_y, - int dst_ystride, - int weight, - int mb_row, - int mb_col, - BLOCK_SIZE_TYPE bsize) { - const int bwl = mb_width_log2(bsize), bw = 1 << bwl; - const int bhl = mb_height_log2(bsize), bh = 1 << bhl; - uint8_t *y1 = x->plane[0].pre[0].buf; - uint8_t *y2 = x->plane[0].pre[1].buf; - int edge[4], n; - - edge[0] = x->mb_to_top_edge; - edge[1] = x->mb_to_bottom_edge; - edge[2] = x->mb_to_left_edge; - edge[3] = x->mb_to_right_edge; - - for (n = 0; n < bw * bh; n++) { - const int x_idx = n & (bw - 1), y_idx = n >> bwl; - - x->mb_to_top_edge = edge[0] - ((y_idx * 16) << 3); - x->mb_to_bottom_edge = edge[1] + (((bh - 1 - y_idx) * 16) << 3); - x->mb_to_left_edge = edge[2] - ((x_idx * 16) << 3); - x->mb_to_right_edge = edge[3] + (((bw - 1 - x_idx) * 16) << 3); - - x->plane[0].pre[0].buf = y1 + scaled_buffer_offset(x_idx * 16, - y_idx * 16, - x->plane[0].pre[0].stride, - &x->scale_factor[0]); - if (x->mode_info_context->mbmi.second_ref_frame > 0) { - x->plane[0].pre[1].buf = y2 + - scaled_buffer_offset(x_idx * 16, - y_idx * 16, - x->plane[0].pre[1].stride, - &x->scale_factor[1]); - } - build_inter16x16_predictors_mby_w(x, - dst_y + y_idx * 16 * dst_ystride + x_idx * 16, - dst_ystride, weight, mb_row + y_idx, mb_col + x_idx); - } - x->mb_to_top_edge = edge[0]; - x->mb_to_bottom_edge = edge[1]; - x->mb_to_left_edge = edge[2]; - x->mb_to_right_edge = edge[3]; - - x->plane[0].pre[0].buf = y1; - if (x->mode_info_context->mbmi.second_ref_frame > 0) { - x->plane[0].pre[1].buf = y2; - } -} - -void vp9_build_inter_predictors_sby(MACROBLOCKD *x, - int mb_row, - int mb_col, - BLOCK_SIZE_TYPE bsize) { - uint8_t * const dst_y = x->plane[0].dst.buf; - const int dst_ystride = x->plane[0].dst.stride; - - int weight = get_implicit_compoundinter_weight(x, mb_row, mb_col); - build_inter_predictors_sby_w(x, dst_y, dst_ystride, weight, - mb_row, mb_col, bsize); -} - -static void build_inter_predictors_sbuv_w(MACROBLOCKD *x, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride, - int weight, - int mb_row, - int mb_col, - BLOCK_SIZE_TYPE bsize) { - const int bwl = mb_width_log2(bsize), bw = 1 << bwl; - const int bhl = mb_height_log2(bsize), bh = 1 << bhl; - uint8_t *u1 = x->plane[1].pre[0].buf, *v1 = x->plane[2].pre[0].buf; - uint8_t *u2 = x->plane[1].pre[1].buf, *v2 = x->plane[2].pre[1].buf; - int edge[4], n; - - edge[0] = x->mb_to_top_edge; - edge[1] = x->mb_to_bottom_edge; - edge[2] = x->mb_to_left_edge; - edge[3] = x->mb_to_right_edge; - - for (n = 0; n < bw * bh; n++) { - int scaled_uv_offset; - const int x_idx = n & (bw - 1), y_idx = n >> bwl; - - x->mb_to_top_edge = edge[0] - ((y_idx * 16) << 3); - x->mb_to_bottom_edge = edge[1] + (((bh - 1 - y_idx) * 16) << 3); - x->mb_to_left_edge = edge[2] - ((x_idx * 16) << 3); - x->mb_to_right_edge = edge[3] + (((bw - 1 - x_idx) * 16) << 3); - - scaled_uv_offset = scaled_buffer_offset(x_idx * 8, - y_idx * 8, - x->plane[1].pre[0].stride, - &x->scale_factor_uv[0]); - x->plane[1].pre[0].buf = u1 + scaled_uv_offset; - x->plane[2].pre[0].buf = v1 + scaled_uv_offset; - - if (x->mode_info_context->mbmi.second_ref_frame > 0) { - scaled_uv_offset = scaled_buffer_offset(x_idx * 8, - y_idx * 8, - x->plane[1].pre[1].stride, - &x->scale_factor_uv[1]); - x->plane[1].pre[1].buf = u2 + scaled_uv_offset; - x->plane[2].pre[1].buf = v2 + scaled_uv_offset; - } - - build_inter16x16_predictors_mbuv_w(x, - dst_u + y_idx * 8 * dst_uvstride + x_idx * 8, - dst_v + y_idx * 8 * dst_uvstride + x_idx * 8, - dst_uvstride, weight, mb_row + y_idx, mb_col + x_idx); - } - x->mb_to_top_edge = edge[0]; - x->mb_to_bottom_edge = edge[1]; - x->mb_to_left_edge = edge[2]; - x->mb_to_right_edge = edge[3]; - - x->plane[1].pre[0].buf = u1; - x->plane[2].pre[0].buf = v1; - - if (x->mode_info_context->mbmi.second_ref_frame > 0) { - x->plane[1].pre[1].buf = u2; - x->plane[2].pre[1].buf = v2; - } -} - -void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, - int mb_row, - int mb_col, - BLOCK_SIZE_TYPE bsize) { - uint8_t *const dst_u = xd->plane[1].dst.buf; - uint8_t *const dst_v = xd->plane[2].dst.buf; - const int dst_uvstride = xd->plane[1].dst.stride; - -#ifdef USE_IMPLICIT_WEIGHT_UV - int weight = get_implicit_compoundinter_weight(xd, mb_row, mb_col); -#else - int weight = AVERAGE_WEIGHT; -#endif - build_inter_predictors_sbuv_w(xd, dst_u, dst_v, dst_uvstride, - weight, mb_row, mb_col, bsize); -} - -void vp9_build_inter_predictors_sb(MACROBLOCKD *mb, - int mb_row, int mb_col, - BLOCK_SIZE_TYPE bsize) { -#if CONFIG_COMP_INTERINTRA_PRED - uint8_t *const y = mb->plane[0].dst.buf; - uint8_t *const u = mb->plane[1].dst.buf; - uint8_t *const v = mb->plane[2].dst.buf; - const int y_stride = mb->plane[0].dst.stride; - const int uv_stride = mb->plane[1].dst.stride; -#endif - - vp9_build_inter_predictors_sby(mb, mb_row, mb_col, bsize); - vp9_build_inter_predictors_sbuv(mb, mb_row, mb_col, bsize); - -#if CONFIG_COMP_INTERINTRA_PRED - if (mb->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME) { - if (bsize == BLOCK_SIZE_SB32X32) - vp9_build_interintra_32x32_predictors_sb(mb, y, u, v, - y_stride, uv_stride); - else - vp9_build_interintra_64x64_predictors_sb(mb, y, u, v, - y_stride, uv_stride); - } -#endif -} -#endif // CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT static INLINE int round_mv_comp(int value) { return (value < 0 ? value - 2 : value + 2) / 4; diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh index 1f838a5..ecca21a 100644 --- a/vp9/common/vp9_rtcd_defs.sh +++ b/vp9/common/vp9_rtcd_defs.sh @@ -230,62 +230,6 @@ specialize vp9_convolve8_avg_horiz ssse3 prototype void vp9_convolve8_avg_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" specialize vp9_convolve8_avg_vert ssse3 -#if CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT -prototype void vp9_convolve8_1by8 "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_1by8 - -prototype void vp9_convolve8_qtr "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_qtr - -prototype void vp9_convolve8_3by8 "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3by8 - -prototype void vp9_convolve8_5by8 "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_5by8 - -prototype void vp9_convolve8_3qtr "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3qtr - -prototype void vp9_convolve8_7by8 "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_7by8 - -prototype void vp9_convolve8_1by8_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_1by8_horiz - -prototype void vp9_convolve8_qtr_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_qtr_horiz - -prototype void vp9_convolve8_3by8_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3by8_horiz - -prototype void vp9_convolve8_5by8_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_5by8_horiz - -prototype void vp9_convolve8_3qtr_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3qtr_horiz - -prototype void vp9_convolve8_7by8_horiz "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_7by8_horiz - -prototype void vp9_convolve8_1by8_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_1by8_vert - -prototype void vp9_convolve8_qtr_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_qtr_vert - -prototype void vp9_convolve8_3by8_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3by8_vert - -prototype void vp9_convolve8_5by8_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_5by8_vert - -prototype void vp9_convolve8_3qtr_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_3qtr_vert - -prototype void vp9_convolve8_7by8_vert "const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h" -specialize vp9_convolve8_7by8_vert -#endif - # # dct # diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 18ad10b..b341470 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1755,8 +1755,7 @@ static int64_t encode_inter_mb_segment(VP9_COMMON *const cm, vp9_build_inter_predictor( *(bd->base_second_pre) + bd->pre, bd->pre_stride, *(bd->base_dst) + bd->dst, bd->dst_stride, - &bd->bmi.as_mv[1], &xd->scale_factor[1], 4, 4, - 1 << (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT) /* avg */, + &bd->bmi.as_mv[1], &xd->scale_factor[1], 4, 4, 1, &xd->subpix); } @@ -1822,8 +1821,7 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm, *base_pre + bd->pre, bd->pre_stride, *(bd->base_dst) + bd->dst, bd->dst_stride, &bd->bmi.as_mv[which_mv], &xd->scale_factor[which_mv], 8, 8, - which_mv << (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT), - &xd->subpix); + which_mv, &xd->subpix); } vp9_subtract_4b_c(be, bd, 16); diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index be3875a..a6c5f71 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -51,8 +51,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, &mv, &xd->scale_factor[which_mv], 16, 16, - which_mv << - (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT), + which_mv, &xd->subpix); stride = (stride + 1) >> 1; @@ -62,8 +61,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, &mv, &xd->scale_factor_uv[which_mv], 8, 8, - which_mv << - (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT), + which_mv, &xd->subpix); vp9_build_inter_predictor_q4(v_mb_ptr, stride, @@ -71,8 +69,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, &mv, &xd->scale_factor_uv[which_mv], 8, 8, - which_mv << - (2 * CONFIG_IMPLICIT_COMPOUNDINTER_WEIGHT), + which_mv, &xd->subpix); }