diff options
Diffstat (limited to 'vp9/common')
-rw-r--r-- | vp9/common/vp9_blockd.h | 14 | ||||
-rw-r--r-- | vp9/common/vp9_convolve.c | 74 | ||||
-rw-r--r-- | vp9/common/vp9_convolve.h | 3 | ||||
-rw-r--r-- | vp9/common/vp9_filter.c | 15 | ||||
-rw-r--r-- | vp9/common/vp9_idct.h | 7 | ||||
-rw-r--r-- | vp9/common/vp9_idctllm.c | 25 | ||||
-rw-r--r-- | vp9/common/vp9_invtrans.c | 10 | ||||
-rw-r--r-- | vp9/common/vp9_mv.h | 10 | ||||
-rw-r--r-- | vp9/common/vp9_onyxc_int.h | 9 | ||||
-rw-r--r-- | vp9/common/vp9_reconinter.c | 826 | ||||
-rw-r--r-- | vp9/common/vp9_reconinter.h | 187 | ||||
-rw-r--r-- | vp9/common/vp9_reconintra.h | 64 | ||||
-rw-r--r-- | vp9/common/vp9_rtcd.c | 5 | ||||
-rw-r--r-- | vp9/common/vp9_setupintrarecon.h | 2 |
14 files changed, 696 insertions, 555 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index d1da5fe0c..2f60e38fa 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -288,6 +288,18 @@ typedef struct superblockd { DECLARE_ALIGNED(16, int16_t, dqcoeff[32*32+16*16*2]); } SUPERBLOCKD; +struct scale_factors { + int x_num; + int x_den; + int x_offset_q4; + int x_step_q4; + int y_num; + int y_den; + int y_offset_q4; + int y_step_q4; + convolve_fn_t predict[2][2][2]; // horiz, vert, avg +}; + typedef struct macroblockd { DECLARE_ALIGNED(16, int16_t, diff[384]); /* from idct diff */ DECLARE_ALIGNED(16, uint8_t, predictor[384]); @@ -303,6 +315,8 @@ typedef struct macroblockd { YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */ YV12_BUFFER_CONFIG second_pre; YV12_BUFFER_CONFIG dst; + struct scale_factors scale_factor[2]; + struct scale_factors scale_factor_uv[2]; MODE_INFO *prev_mode_info_context; MODE_INFO *mode_info_context; diff --git a/vp9/common/vp9_convolve.c b/vp9/common/vp9_convolve.c index b87c410df..b062e7dc7 100644 --- a/vp9/common/vp9_convolve.c +++ b/vp9/common/vp9_convolve.c @@ -19,7 +19,6 @@ #define VP9_FILTER_WEIGHT 128 #define VP9_FILTER_SHIFT 7 -#define ALIGN_FILTERS_256 0 /* Assume a bank of 16 filters to choose from. There are two implementations * for filter wrapping behavior, since we want to be able to pick which filter @@ -34,8 +33,11 @@ * always 256 byte aligned. * * Implementations 2 and 3 are likely preferable, as they avoid an extra 2 - * parameters, and switching between them is trivial. + * parameters, and switching between them is trivial, with the + * ALIGN_FILTERS_256 macro, below. */ + #define ALIGN_FILTERS_256 1 + static void convolve_horiz_c(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, const int16_t *filter_x0, int x_step_q4, @@ -56,11 +58,12 @@ static void convolve_horiz_c(const uint8_t *src, int src_stride, const int16_t *filter_x = filter_x0; /* Initial phase offset */ - int x_q4 = (filter_x - filter_x_base) / taps; + 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 >> 4; + int src_x = (x_q4 - x0_q4) >> 4; for (sum = 0, k = 0; k < taps; ++k) { sum += src[src_x + k] * filter_x[k]; @@ -97,11 +100,12 @@ static void convolve_avg_horiz_c(const uint8_t *src, int src_stride, const int16_t *filter_x = filter_x0; /* Initial phase offset */ - int x_q4 = (filter_x - filter_x_base) / taps; + 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 >> 4; + int src_x = (x_q4 - x0_q4) >> 4; for (sum = 0, k = 0; k < taps; ++k) { sum += src[src_x + k] * filter_x[k]; @@ -138,11 +142,12 @@ static void convolve_vert_c(const uint8_t *src, int src_stride, const int16_t *filter_y = filter_y0; /* Initial phase offset */ - int y_q4 = (filter_y - filter_y_base) / taps; + 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 >> 4; + 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]; @@ -179,11 +184,12 @@ static void convolve_avg_vert_c(const uint8_t *src, int src_stride, const int16_t *filter_y = filter_y0; /* Initial phase offset */ - int y_q4 = (filter_y - filter_y_base) / taps; + 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 >> 4; + 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]; @@ -206,16 +212,25 @@ static void convolve_c(const uint8_t *src, int src_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int taps) { - /* Fixed size intermediate buffer places limits on parameters. */ - uint8_t temp[16 * 23]; + /* Fixed size intermediate buffer places limits on parameters. + * Maximum intermediate_height is 39, for y_step_q4 == 32, + * h == 16, taps == 8. + */ + uint8_t temp[16 * 39]; + int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1; + assert(w <= 16); assert(h <= 16); assert(taps <= 8); + assert(y_step_q4 <= 32); + + if (intermediate_height < h) + intermediate_height = h; convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride, temp, 16, filter_x, x_step_q4, filter_y, y_step_q4, - w, h + taps - 1, taps); + w, intermediate_height, taps); convolve_vert_c(temp + 16 * (taps / 2 - 1), 16, dst, dst_stride, filter_x, x_step_q4, filter_y, y_step_q4, w, h, taps); @@ -226,16 +241,25 @@ static void convolve_avg_c(const uint8_t *src, int src_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int taps) { - /* Fixed size intermediate buffer places limits on parameters. */ - uint8_t temp[16 * 23]; + /* Fixed size intermediate buffer places limits on parameters. + * Maximum intermediate_height is 39, for y_step_q4 == 32, + * h == 16, taps == 8. + */ + uint8_t temp[16 * 39]; + int intermediate_height = ((h * y_step_q4) >> 4) + taps - 1; + assert(w <= 16); assert(h <= 16); assert(taps <= 8); + assert(y_step_q4 <= 32); + + if (intermediate_height < h) + intermediate_height = h; convolve_horiz_c(src - src_stride * (taps / 2 - 1), src_stride, temp, 16, filter_x, x_step_q4, filter_y, y_step_q4, - w, h + taps - 1, taps); + w, intermediate_height, taps); convolve_avg_vert_c(temp + 16 * (taps / 2 - 1), 16, dst, dst_stride, filter_x, x_step_q4, filter_y, y_step_q4, w, h, taps); @@ -318,25 +342,17 @@ void vp9_convolve_copy(const uint8_t *src, int src_stride, const int16_t *filter_x, int filter_x_stride, const int16_t *filter_y, int filter_y_stride, int w, int h) { - if (h == 16) { + if (w == 16 && h == 16) { vp9_copy_mem16x16(src, src_stride, dst, dst_stride); - } else if (h == 8) { + } else if (w == 8 && h == 8) { vp9_copy_mem8x8(src, src_stride, dst, dst_stride); - } else if (w == 8) { + } else if (w == 8 && h == 4) { vp9_copy_mem8x4(src, src_stride, dst, dst_stride); } else { - // 4x4 int r; - for (r = 0; r < 4; ++r) { -#if !(CONFIG_FAST_UNALIGNED) - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; -#else - *(uint32_t *)dst = *(const uint32_t *)src; -#endif + for (r = h; r > 0; --r) { + memcpy(dst, src, w); src += src_stride; dst += dst_stride; } diff --git a/vp9/common/vp9_convolve.h b/vp9/common/vp9_convolve.h index 46c935ab7..8c4856187 100644 --- a/vp9/common/vp9_convolve.h +++ b/vp9/common/vp9_convolve.h @@ -33,11 +33,8 @@ void vp9_convolve_avg(const uint8_t *src, int src_stride, int w, int h); struct subpix_fn_table { - convolve_fn_t predict[2][2][2]; // horiz, vert, avg const int16_t (*filter_x)[8]; const int16_t (*filter_y)[8]; - int x_step_q4; - int y_step_q4; }; #endif // VP9_COMMON_CONVOLVE_H_ diff --git a/vp9/common/vp9_filter.c b/vp9/common/vp9_filter.c index 5e425895f..434c63e7e 100644 --- a/vp9/common/vp9_filter.c +++ b/vp9/common/vp9_filter.c @@ -15,7 +15,7 @@ #include "vp9_rtcd.h" #include "vp9/common/vp9_common.h" -DECLARE_ALIGNED(16, const int16_t, vp9_bilinear_filters[SUBPEL_SHIFTS][8]) = { +DECLARE_ALIGNED(256, const int16_t, vp9_bilinear_filters[SUBPEL_SHIFTS][8]) = { { 0, 0, 0, 128, 0, 0, 0, 0 }, { 0, 0, 0, 120, 8, 0, 0, 0 }, { 0, 0, 0, 112, 16, 0, 0, 0 }, @@ -36,7 +36,8 @@ DECLARE_ALIGNED(16, const int16_t, vp9_bilinear_filters[SUBPEL_SHIFTS][8]) = { #define FILTER_ALPHA 0 #define FILTER_ALPHA_SHARP 1 -DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = { +DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) + = { #if FILTER_ALPHA == 0 /* Lagrangian interpolation filter */ { 0, 0, 0, 128, 0, 0, 0, 0}, @@ -55,6 +56,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = { { -1, 3, -9, 27, 118, -13, 4, -1}, { 0, 2, -6, 18, 122, -10, 3, -1}, { 0, 1, -3, 8, 126, -5, 1, 0} + #elif FILTER_ALPHA == 50 /* Generated using MATLAB: * alpha = 0.5; @@ -82,7 +84,8 @@ DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8[SUBPEL_SHIFTS][8]) = { #endif /* FILTER_ALPHA */ }; -DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = { +DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) + = { #if FILTER_ALPHA_SHARP == 1 /* dct based filter */ {0, 0, 0, 128, 0, 0, 0, 0}, @@ -101,6 +104,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = { {-2, 5, -10, 27, 121, -17, 7, -3}, {-1, 3, -6, 17, 125, -13, 5, -2}, {0, 1, -3, 8, 127, -7, 3, -1} + #elif FILTER_ALPHA_SHARP == 75 /* alpha = 0.75 */ {0, 0, 0, 128, 0, 0, 0, 0}, @@ -122,7 +126,7 @@ DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][8]) = { #endif /* FILTER_ALPHA_SHARP */ }; -DECLARE_ALIGNED(16, const int16_t, +DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][8]) = { /* 8-tap lowpass filter */ /* Hamming window */ @@ -144,7 +148,8 @@ DECLARE_ALIGNED(16, const int16_t, { 1, -2, -7, 37, 80, 28, -8, -1} }; -DECLARE_ALIGNED(16, const int16_t, vp9_sub_pel_filters_6[SUBPEL_SHIFTS][8]) = { +DECLARE_ALIGNED(256, const int16_t, vp9_sub_pel_filters_6[SUBPEL_SHIFTS][8]) + = { {0, 0, 0, 128, 0, 0, 0, 0}, {0, 1, -5, 125, 8, -2, 1, 0}, {0, 1, -8, 122, 17, -5, 1, 0}, diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h index d25d0ac2a..3e0ee4b63 100644 --- a/vp9/common/vp9_idct.h +++ b/vp9/common/vp9_idct.h @@ -68,4 +68,11 @@ static INLINE int dct_const_round_shift(int input) { assert(INT16_MIN <= rv && rv <= INT16_MAX); return rv; } + +static INLINE int dct_32_round(int input) { + int rv = (input + DCT_CONST_ROUNDING) >> DCT_CONST_BITS; + assert(-131072 <= rv && rv <= 131071); + return rv; +} + #endif diff --git a/vp9/common/vp9_idctllm.c b/vp9/common/vp9_idctllm.c index 19397028b..f34823b36 100644 --- a/vp9/common/vp9_idctllm.c +++ b/vp9/common/vp9_idctllm.c @@ -115,7 +115,7 @@ void vp9_dc_only_inv_walsh_add_c(int input_dc, uint8_t *pred_ptr, } } -void idct4_1d(int16_t *input, int16_t *output) { +static void idct4_1d(int16_t *input, int16_t *output) { int16_t step[4]; int temp1, temp2; // stage 1 @@ -193,7 +193,7 @@ void vp9_dc_only_idct_add_c(int input_dc, uint8_t *pred_ptr, } } -void idct8_1d(int16_t *input, int16_t *output) { +static void idct8_1d(int16_t *input, int16_t *output) { int16_t step1[8], step2[8]; int temp1, temp2; // stage 1 @@ -313,10 +313,9 @@ static const transform_2d IHT_4[] = { void vp9_short_iht4x4_c(int16_t *input, int16_t *output, int pitch, TX_TYPE tx_type) { + int i, j; int16_t out[4 * 4]; int16_t *outptr = out; - const int half_pitch = pitch >> 1; - int i, j; int16_t temp_in[4], temp_out[4]; const transform_2d ht = IHT_4[tx_type]; @@ -333,7 +332,7 @@ void vp9_short_iht4x4_c(int16_t *input, int16_t *output, temp_in[j] = out[j * 4 + i]; ht.cols(temp_in, temp_out); for (j = 0; j < 4; ++j) - output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4); + output[j * pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 4); } } @@ -423,10 +422,9 @@ static const transform_2d IHT_8[] = { void vp9_short_iht8x8_c(int16_t *input, int16_t *output, int pitch, TX_TYPE tx_type) { + int i, j; int16_t out[8 * 8]; int16_t *outptr = out; - const int half_pitch = pitch >> 1; - int i, j; int16_t temp_in[8], temp_out[8]; const transform_2d ht = IHT_8[tx_type]; @@ -443,7 +441,7 @@ void vp9_short_iht8x8_c(int16_t *input, int16_t *output, temp_in[j] = out[j * 8 + i]; ht.cols(temp_in, temp_out); for (j = 0; j < 8; ++j) - output[j * half_pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5); + output[j * pitch + i] = ROUND_POWER_OF_TWO(temp_out[j], 5); } } @@ -479,7 +477,7 @@ void vp9_short_idct1_8x8_c(int16_t *input, int16_t *output) { output[0] = ROUND_POWER_OF_TWO(out, 5); } -void idct16_1d(int16_t *input, int16_t *output) { +static void idct16_1d(int16_t *input, int16_t *output) { int16_t step1[16], step2[16]; int temp1, temp2; @@ -846,18 +844,17 @@ static const transform_2d IHT_16[] = { }; void vp9_short_iht16x16_c(int16_t *input, int16_t *output, - int pitch, TX_TYPE tx_type) { + int input_pitch, TX_TYPE tx_type) { + int i, j; int16_t out[16 * 16]; int16_t *outptr = out; - const int half_pitch = pitch >> 1; - int i, j; int16_t temp_in[16], temp_out[16]; const transform_2d ht = IHT_16[tx_type]; // Rows for (i = 0; i < 16; ++i) { ht.rows(input, outptr); - input += half_pitch; + input += input_pitch; outptr += 16; } @@ -905,7 +902,7 @@ void vp9_short_idct1_16x16_c(int16_t *input, int16_t *output) { output[0] = ROUND_POWER_OF_TWO(out, 6); } -void idct32_1d(int16_t *input, int16_t *output) { +static void idct32_1d(int16_t *input, int16_t *output) { int16_t step1[32], step2[32]; int temp1, temp2; diff --git a/vp9/common/vp9_invtrans.c b/vp9/common/vp9_invtrans.c index c6b961894..d431ea24b 100644 --- a/vp9/common/vp9_invtrans.c +++ b/vp9/common/vp9_invtrans.c @@ -25,8 +25,7 @@ void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) { for (i = 0; i < 16; i++) { TX_TYPE tx_type = get_tx_type_4x4(xd, &xd->block[i]); if (tx_type != DCT_DCT) { - vp9_short_iht4x4(xd->block[i].dqcoeff, xd->block[i].diff, - 32, tx_type); + vp9_short_iht4x4(xd->block[i].dqcoeff, xd->block[i].diff, 16, tx_type); } else { vp9_inverse_transform_b_4x4(xd, i, 32); } @@ -58,8 +57,7 @@ void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) { for (i = 0; i < 9; i += 8) { TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]); if (tx_type != DCT_DCT) { - vp9_short_iht8x8(xd->block[i].dqcoeff, xd->block[i].diff, - 32, tx_type); + vp9_short_iht8x8(xd->block[i].dqcoeff, xd->block[i].diff, 16, tx_type); } else { vp9_inverse_transform_b_8x8(&blockd[i].dqcoeff[0], &blockd[i].diff[0], 32); @@ -69,7 +67,7 @@ void vp9_inverse_transform_mby_8x8(MACROBLOCKD *xd) { TX_TYPE tx_type = get_tx_type_8x8(xd, &xd->block[i]); if (tx_type != DCT_DCT) { vp9_short_iht8x8(xd->block[i + 2].dqcoeff, xd->block[i].diff, - 32, tx_type); + 16, tx_type); } else { vp9_inverse_transform_b_8x8(&blockd[i + 2].dqcoeff[0], &blockd[i].diff[0], 32); @@ -101,7 +99,7 @@ void vp9_inverse_transform_mby_16x16(MACROBLOCKD *xd) { BLOCKD *bd = &xd->block[0]; TX_TYPE tx_type = get_tx_type_16x16(xd, bd); if (tx_type != DCT_DCT) { - vp9_short_iht16x16(bd->dqcoeff, bd->diff, 32, tx_type); + vp9_short_iht16x16(bd->dqcoeff, bd->diff, 16, tx_type); } else { vp9_inverse_transform_b_16x16(&xd->block[0].dqcoeff[0], &xd->block[0].diff[0], 32); diff --git a/vp9/common/vp9_mv.h b/vp9/common/vp9_mv.h index 8acd4046b..a1eef4649 100644 --- a/vp9/common/vp9_mv.h +++ b/vp9/common/vp9_mv.h @@ -23,4 +23,14 @@ typedef union int_mv { MV as_mv; } int_mv; /* facilitates faster equality tests and copies */ +struct mv32 { + int32_t row; + int32_t col; +}; + +typedef union int_mv32 { + uint64_t as_int; + struct mv32 as_mv; +} int_mv32; /* facilitates faster equality tests and copies */ + #endif // VP9_COMMON_VP9_MV_H_ diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index e952fe933..c4bb12340 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -39,7 +39,11 @@ void vp9_initialize_common(void); #define NUM_REF_FRAMES 3 #define NUM_REF_FRAMES_LG2 2 -#define NUM_YV12_BUFFERS (NUM_REF_FRAMES + 1) + +// 1 scratch frame for the new frame, 3 for scaled references on the encoder +// TODO(jkoleszar): These 3 extra references could probably come from the +// normal reference pool. +#define NUM_YV12_BUFFERS (NUM_REF_FRAMES + 4) #define NUM_FRAME_CONTEXTS_LG2 2 #define NUM_FRAME_CONTEXTS (1 << NUM_FRAME_CONTEXTS_LG2) @@ -128,6 +132,8 @@ typedef struct VP9Common { int Width; int Height; + int last_width; + int last_height; int horiz_scale; int vert_scale; @@ -145,6 +151,7 @@ typedef struct VP9Common { */ int active_ref_idx[3]; /* each frame can reference 3 buffers */ int new_fb_idx; + struct scale_factors active_ref_scale[3]; YV12_BUFFER_CONFIG post_proc_buffer; YV12_BUFFER_CONFIG temp_scale_frame; diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index b75525e2c..30e8951af 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -17,26 +17,97 @@ #include "vp9/common/vp9_reconinter.h" #include "vp9/common/vp9_reconintra.h" -void vp9_setup_interp_filters(MACROBLOCKD *xd, - INTERPOLATIONFILTERTYPE mcomp_filter_type, - VP9_COMMON *cm) { +void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, + YV12_BUFFER_CONFIG *other, + int this_w, int this_h) { + int other_w, other_h; + + other_h = other->y_height; + other_w = other->y_width; + scale->x_num = other_w; + scale->x_den = this_w; + scale->x_offset_q4 = 0; // calculated per-mb + scale->x_step_q4 = 16 * other_w / this_w; + scale->y_num = other_h; + scale->y_den = this_h; + scale->y_offset_q4 = 0; // calculated per-mb + scale->y_step_q4 = 16 * other_h / this_h; + // TODO(agrange): Investigate the best choice of functions to use here // for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what // to do at full-pel offsets. The current selection, where the filter is // 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. - xd->subpix.predict[0][0][0] = vp9_convolve_copy; - xd->subpix.predict[0][0][1] = vp9_convolve_avg; - xd->subpix.predict[0][1][0] = vp9_convolve8_vert; - xd->subpix.predict[0][1][1] = vp9_convolve8_avg_vert; - xd->subpix.predict[1][0][0] = vp9_convolve8_horiz; - xd->subpix.predict[1][0][1] = vp9_convolve8_avg_horiz; - xd->subpix.predict[1][1][0] = vp9_convolve8; - xd->subpix.predict[1][1][1] = vp9_convolve8_avg; - - xd->subpix.x_step_q4 = 16; - xd->subpix.y_step_q4 = 16; + 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_avg; + scale->predict[0][1][0] = vp9_convolve8_vert; + scale->predict[0][1][1] = vp9_convolve8_avg_vert; + scale->predict[1][0][0] = vp9_convolve8_horiz; + scale->predict[1][0][1] = vp9_convolve8_avg_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_avg_vert; + scale->predict[0][1][0] = vp9_convolve8_vert; + scale->predict[0][1][1] = vp9_convolve8_avg_vert; + scale->predict[1][0][0] = vp9_convolve8; + scale->predict[1][0][1] = vp9_convolve8_avg; + } + } 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_avg_horiz; + scale->predict[0][1][0] = vp9_convolve8; + scale->predict[0][1][1] = vp9_convolve8_avg; + scale->predict[1][0][0] = vp9_convolve8_horiz; + scale->predict[1][0][1] = vp9_convolve8_avg_horiz; + } else { + // Must always scale in both directions. + scale->predict[0][0][0] = vp9_convolve8; + scale->predict[0][0][1] = vp9_convolve8_avg; + scale->predict[0][1][0] = vp9_convolve8; + scale->predict[0][1][1] = vp9_convolve8_avg; + scale->predict[1][0][0] = vp9_convolve8; + scale->predict[1][0][1] = vp9_convolve8_avg; + } + } + // 2D subpel motion always gets filtered in both directions + scale->predict[1][1][0] = vp9_convolve8; + scale->predict[1][1][1] = vp9_convolve8_avg; +} + +void vp9_setup_interp_filters(MACROBLOCKD *xd, + INTERPOLATIONFILTERTYPE mcomp_filter_type, + VP9_COMMON *cm) { + int i; + + /* Calculate scaling factors for each of the 3 available references */ + for (i = 0; i < 3; ++i) { + if (cm->active_ref_idx[i] >= NUM_YV12_BUFFERS) { + memset(&cm->active_ref_scale[i], 0, sizeof(cm->active_ref_scale[i])); + continue; + } + + vp9_setup_scale_factors_for_frame(&cm->active_ref_scale[i], + &cm->yv12_fb[cm->active_ref_idx[i]], + cm->mb_cols * 16, cm->mb_rows * 16); + } + + if (xd->mode_info_context) { + MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; + + set_scale_factors(xd, + mbmi->ref_frame - 1, + mbmi->second_ref_frame - 1, + cm->active_ref_scale); + } + + switch (mcomp_filter_type) { case EIGHTTAP: case SWITCHABLE: @@ -57,6 +128,7 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd, break; #endif } + assert(((intptr_t)xd->subpix.filter_x & 0xff) == 0); } void vp9_copy_mem16x16_c(const uint8_t *src, @@ -146,113 +218,151 @@ void vp9_copy_mem8x4_c(const uint8_t *src, } } -void vp9_build_inter_predictors_b(BLOCKD *d, int pitch, - struct subpix_fn_table *subpix) { - uint8_t *ptr_base; - uint8_t *ptr; - uint8_t *pred_ptr = d->predictor; - int_mv mv; - - ptr_base = *(d->base_pre); - mv.as_int = d->bmi.as_mv[0].as_int; - ptr = ptr_base + d->pre + (mv.as_mv.row >> 3) * d->pre_stride + - (mv.as_mv.col >> 3); - - subpix->predict[!!(mv.as_mv.col & 7)][!!(mv.as_mv.row & 7)][0]( - ptr, d->pre_stride, pred_ptr, pitch, - subpix->filter_x[(mv.as_mv.col & 7) << 1], subpix->x_step_q4, - subpix->filter_y[(mv.as_mv.row & 7) << 1], subpix->y_step_q4, - 4, 4); +static void set_scaled_offsets(struct scale_factors *scale, + int row, int col) { + const int x_q4 = 16 * col; + const int y_q4 = 16 * row; + + scale->x_offset_q4 = (x_q4 * scale->x_num / scale->x_den) & 0xf; + scale->y_offset_q4 = (y_q4 * scale->y_num / scale->y_den) & 0xf; } -/* - * Similar to vp9_build_inter_predictors_b(), but instead of storing the - * results in d->predictor, we average the contents of d->predictor (which - * come from an earlier call to vp9_build_inter_predictors_b()) with the - * predictor of the second reference frame / motion vector. - */ -void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch, - struct subpix_fn_table *subpix) { - uint8_t *ptr_base; - uint8_t *ptr; - uint8_t *pred_ptr = d->predictor; - int_mv mv; - - ptr_base = *(d->base_second_pre); - mv.as_int = d->bmi.as_mv[1].as_int; - ptr = ptr_base + d->pre + (mv.as_mv.row >> 3) * d->pre_stride + - (mv.as_mv.col >> 3); - - subpix->predict[!!(mv.as_mv.col & 7)][!!(mv.as_mv.row & 7)][1]( - ptr, d->pre_stride, pred_ptr, pitch, - subpix->filter_x[(mv.as_mv.col & 7) << 1], subpix->x_step_q4, - subpix->filter_y[(mv.as_mv.row & 7) << 1], subpix->y_step_q4, - 4, 4); +static int32_t scale_motion_vector_component_q3(int mv_q3, + int num, + int den, + int offset_q4) { + // returns the scaled and offset value of the mv component. + const int32_t mv_q4 = mv_q3 << 1; + + /* TODO(jkoleszar): make fixed point, or as a second multiply? */ + return mv_q4 * num / den + offset_q4; } -void vp9_build_inter_predictors4b(MACROBLOCKD *xd, BLOCKD *d, int pitch) { - uint8_t *ptr_base; - uint8_t *ptr; - uint8_t *pred_ptr = d->predictor; - int_mv mv; - - ptr_base = *(d->base_pre); - mv.as_int = d->bmi.as_mv[0].as_int; - ptr = ptr_base + d->pre + (mv.as_mv.row >> 3) * d->pre_stride + - (mv.as_mv.col >> 3); - - xd->subpix.predict[!!(mv.as_mv.col & 7)][!!(mv.as_mv.row & 7)][0]( - ptr, d->pre_stride, pred_ptr, pitch, - xd->subpix.filter_x[(mv.as_mv.col & 7) << 1], xd->subpix.x_step_q4, - xd->subpix.filter_y[(mv.as_mv.row & 7) << 1], xd->subpix.y_step_q4, - 8, 8); +static int32_t scale_motion_vector_component_q4(int mv_q4, + int num, + int den, + int offset_q4) { + // returns the scaled and offset value of the mv component. + + /* TODO(jkoleszar): make fixed point, or as a second multiply? */ + return mv_q4 * num / den + offset_q4; } -/* - * Similar to build_inter_predictors_4b(), but instead of storing the - * results in d->predictor, we average the contents of d->predictor (which - * come from an earlier call to build_inter_predictors_4b()) with the - * predictor of the second reference frame / motion vector. +static int_mv32 scale_motion_vector_q3_to_q4( + const int_mv *src_mv, + const struct scale_factors *scale) { + // returns mv * scale + offset + int_mv32 result; + + result.as_mv.row = scale_motion_vector_component_q3(src_mv->as_mv.row, + scale->y_num, + scale->y_den, + scale->y_offset_q4); + result.as_mv.col = scale_motion_vector_component_q3(src_mv->as_mv.col, + scale->x_num, + scale->x_den, + scale->x_offset_q4); + return result; +} + +void vp9_build_inter_predictor(const uint8_t *src, int src_stride, + uint8_t *dst, int dst_stride, + const int_mv *mv_q3, + const struct scale_factors *scale, + int w, int h, int do_avg, + const struct subpix_fn_table *subpix) { + int_mv32 mv; + + mv = scale_motion_vector_q3_to_q4(mv_q3, scale); + src = src + (mv.as_mv.row >> 4) * src_stride + (mv.as_mv.col >> 4); + + scale->predict[!!(mv.as_mv.col & 15)][!!(mv.as_mv.row & 15)][do_avg]( + src, src_stride, dst, dst_stride, + subpix->filter_x[mv.as_mv.col & 15], scale->x_step_q4, + subpix->filter_y[mv.as_mv.row & 15], scale->y_step_q4, + w, h); +} + +/* Like vp9_build_inter_predictor, but takes the full-pel part of the + * mv separately, and the fractional part as a q4. */ -void vp9_build_2nd_inter_predictors4b(MACROBLOCKD *xd, - BLOCKD *d, int pitch) { - uint8_t *ptr_base; - uint8_t *ptr; - uint8_t *pred_ptr = d->predictor; - int_mv mv; - - ptr_base = *(d->base_second_pre); - mv.as_int = d->bmi.as_mv[1].as_int; - ptr = ptr_base + d->pre + (mv.as_mv.row >> 3) * d->pre_stride + - (mv.as_mv.col >> 3); - - xd->subpix.predict[!!(mv.as_mv.col & 7)][!!(mv.as_mv.row & 7)][1]( - ptr, d->pre_stride, pred_ptr, pitch, - xd->subpix.filter_x[(mv.as_mv.col & 7) << 1], xd->subpix.x_step_q4, - xd->subpix.filter_y[(mv.as_mv.row & 7) << 1], xd->subpix.y_step_q4, - 8, 8); +void vp9_build_inter_predictor_q4(const uint8_t *src, int src_stride, + uint8_t *dst, int dst_stride, + const int_mv *fullpel_mv_q3, + const int_mv *frac_mv_q4, + const struct scale_factors *scale, + int w, int h, int do_avg, + const struct subpix_fn_table *subpix) { + const int mv_row_q4 = ((fullpel_mv_q3->as_mv.row >> 3) << 4) + + (frac_mv_q4->as_mv.row & 0xf); + const int mv_col_q4 = ((fullpel_mv_q3->as_mv.col >> 3) << 4) + + (frac_mv_q4->as_mv.col & 0xf); + const int scaled_mv_row_q4 = + scale_motion_vector_component_q4(mv_row_q4, scale->y_num, scale->y_den, + scale->y_offset_q4); + const int scaled_mv_col_q4 = + scale_motion_vector_component_q4(mv_col_q4, scale->x_num, scale->x_den, + scale->x_offset_q4); + const int subpel_x = scaled_mv_col_q4 & 15; + const int subpel_y = scaled_mv_row_q4 & 15; + + src = src + (scaled_mv_row_q4 >> 4) * src_stride + (scaled_mv_col_q4 >> 4); + scale->predict[!!subpel_x][!!subpel_y][do_avg]( + src, src_stride, dst, dst_stride, + subpix->filter_x[subpel_x], scale->x_step_q4, + subpix->filter_y[subpel_y], scale->y_step_q4, + w, h); } -static void build_inter_predictors2b(MACROBLOCKD *xd, BLOCKD *d, int pitch) { - uint8_t *ptr_base; - uint8_t *ptr; - uint8_t *pred_ptr = d->predictor; - int_mv mv; - - ptr_base = *(d->base_pre); - mv.as_int = d->bmi.as_mv[0].as_int; - ptr = ptr_base + d->pre + (mv.as_mv.row >> 3) * d->pre_stride + - (mv.as_mv.col >> 3); - - xd->subpix.predict[!!(mv.as_mv.col & 7)][!!(mv.as_mv.row & 7)][0]( - ptr, d->pre_stride, pred_ptr, pitch, - xd->subpix.filter_x[(mv.as_mv.col & 7) << 1], xd->subpix.x_step_q4, - xd->subpix.filter_y[(mv.as_mv.row & 7) << 1], xd->subpix.y_step_q4, - 8, 4); +static void build_2x1_inter_predictor(const BLOCKD *d0, const BLOCKD *d1, + struct scale_factors *scale, + int block_size, int stride, int which_mv, + const struct subpix_fn_table *subpix, + int row, int col) { + assert(d1->predictor - d0->predictor == block_size); + assert(d1->pre == d0->pre + block_size); + + set_scaled_offsets(&scale[which_mv], 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, + d0->predictor, stride, + &d0->bmi.as_mv[which_mv], + &scale[which_mv], + 2 * block_size, block_size, which_mv, + 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, + d0->predictor, stride, + &d0->bmi.as_mv[which_mv], + &scale[which_mv], + block_size, block_size, which_mv, + subpix); + + set_scaled_offsets(&scale[which_mv], row, col + block_size); + + vp9_build_inter_predictor(*base_pre1 + d1->pre, + d1->pre_stride, + d1->predictor, stride, + &d1->bmi.as_mv[which_mv], + &scale[which_mv], + block_size, block_size, which_mv, + subpix); + } } /*encoder only*/ -void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd) { +void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd, + int mb_row, + int mb_col) { int i, j; BLOCKD *blockd = xd->block; @@ -329,19 +439,17 @@ void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd) { } for (i = 16; i < 24; i += 2) { + const int use_second_ref = xd->mode_info_context->mbmi.second_ref_frame > 0; + const int x = 4 * (i & 1); + const int y = ((i - 16) >> 1) * 4; + + int which_mv; BLOCKD *d0 = &blockd[i]; BLOCKD *d1 = &blockd[i + 1]; - if (d0->bmi.as_mv[0].as_int == d1->bmi.as_mv[0].as_int) - build_inter_predictors2b(xd, d0, 8); - else { - vp9_build_inter_predictors_b(d0, 8, &xd->subpix); - vp9_build_inter_predictors_b(d1, 8, &xd->subpix); - } - - if (xd->mode_info_context->mbmi.second_ref_frame > 0) { - vp9_build_2nd_inter_predictors_b(d0, 8, &xd->subpix); - vp9_build_2nd_inter_predictors_b(d1, 8, &xd->subpix); + for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { + build_2x1_inter_predictor(d0, d1, xd->scale_factor_uv, 4, 8, which_mv, + &xd->subpix, mb_row * 8 + y, mb_col * 8 + x); } } } @@ -383,91 +491,100 @@ static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) { } /*encoder only*/ -void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd, - uint8_t *dst_y, - int dst_ystride, - int clamp_mvs) { - uint8_t *ptr_base = xd->pre.y_buffer; - uint8_t *ptr; - int pre_stride = xd->block[0].pre_stride; - int_mv ymv; - - ymv.as_int = xd->mode_info_context->mbmi.mv[0].as_int; - - if (clamp_mvs) - clamp_mv_to_umv_border(&ymv.as_mv, xd); - - ptr = ptr_base + (ymv.as_mv.row >> 3) * pre_stride + (ymv.as_mv.col >> 3); - - xd->subpix.predict[!!(ymv.as_mv.col & 7)][!!(ymv.as_mv.row & 7)][0]( - ptr, pre_stride, dst_y, dst_ystride, - xd->subpix.filter_x[(ymv.as_mv.col & 7) << 1], xd->subpix.x_step_q4, - xd->subpix.filter_y[(ymv.as_mv.row & 7) << 1], xd->subpix.y_step_q4, - 16, 16); -} - -void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride) { - int offset; - uint8_t *uptr, *vptr; - int pre_stride = xd->block[0].pre_stride; - int_mv _o16x16mv; - int_mv _16x16mv; - - _16x16mv.as_int = xd->mode_info_context->mbmi.mv[0].as_int; - - if (xd->mode_info_context->mbmi.need_to_clamp_mvs) - clamp_mv_to_umv_border(&_16x16mv.as_mv, xd); - - _o16x16mv = _16x16mv; - /* calc uv motion vectors */ - if (_16x16mv.as_mv.row < 0) - _16x16mv.as_mv.row -= 1; - else - _16x16mv.as_mv.row += 1; - - if (_16x16mv.as_mv.col < 0) - _16x16mv.as_mv.col -= 1; - else - _16x16mv.as_mv.col += 1; - - _16x16mv.as_mv.row /= 2; - _16x16mv.as_mv.col /= 2; - - _16x16mv.as_mv.row &= xd->fullpixel_mask; - _16x16mv.as_mv.col &= xd->fullpixel_mask; - - pre_stride >>= 1; - offset = (_16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3); - uptr = xd->pre.u_buffer + offset; - vptr = xd->pre.v_buffer + offset; - - xd->subpix.predict[!!(_o16x16mv.as_mv.col & 15)] - [!!(_o16x16mv.as_mv.row & 15)][0]( - uptr, pre_stride, dst_u, dst_uvstride, - xd->subpix.filter_x[_o16x16mv.as_mv.col & 15], xd->subpix.x_step_q4, - xd->subpix.filter_y[_o16x16mv.as_mv.row & 15], xd->subpix.y_step_q4, - 8, 8); - - xd->subpix.predict[!!(_o16x16mv.as_mv.col & 15)] - [!!(_o16x16mv.as_mv.row & 15)][0]( - vptr, pre_stride, dst_v, dst_uvstride, - xd->subpix.filter_x[_o16x16mv.as_mv.col & 15], xd->subpix.x_step_q4, - xd->subpix.filter_y[_o16x16mv.as_mv.row & 15], xd->subpix.y_step_q4, - 8, 8); +void vp9_build_inter16x16_predictors_mby(MACROBLOCKD *xd, + uint8_t *dst_y, + int dst_ystride, + 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; + int_mv ymv; + int pre_stride; + + ymv.as_int = xd->mode_info_context->mbmi.mv[which_mv].as_int; + base_pre = which_mv ? xd->second_pre.y_buffer + : xd->pre.y_buffer; + pre_stride = which_mv ? xd->second_pre.y_stride + : xd->pre.y_stride; + if (clamp_mvs) + clamp_mv_to_umv_border(&ymv.as_mv, xd); + + set_scaled_offsets(&xd->scale_factor[which_mv], mb_row * 16, mb_col * 16); + + vp9_build_inter_predictor(base_pre, pre_stride, + dst_y, dst_ystride, + &ymv, &xd->scale_factor[which_mv], + 16, 16, which_mv, &xd->subpix); + } } - -void vp9_build_1st_inter16x16_predictors_mb(MACROBLOCKD *xd, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, int dst_uvstride) { - vp9_build_1st_inter16x16_predictors_mby(xd, dst_y, dst_ystride, - xd->mode_info_context->mbmi.need_to_clamp_mvs); - vp9_build_1st_inter16x16_predictors_mbuv(xd, dst_u, dst_v, dst_uvstride); +void vp9_build_inter16x16_predictors_mbuv(MACROBLOCKD *xd, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_uvstride, + 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->second_pre.y_stride + : xd->pre.y_stride; + int_mv _o16x16mv; + int_mv _16x16mv; + + _16x16mv.as_int = xd->mode_info_context->mbmi.mv[which_mv].as_int; + + if (clamp_mvs) + clamp_mv_to_umv_border(&_16x16mv.as_mv, xd); + + _o16x16mv = _16x16mv; + /* calc uv motion vectors */ + if (_16x16mv.as_mv.row < 0) + _16x16mv.as_mv.row -= 1; + else + _16x16mv.as_mv.row += 1; + + if (_16x16mv.as_mv.col < 0) + _16x16mv.as_mv.col -= 1; + else + _16x16mv.as_mv.col += 1; + + _16x16mv.as_mv.row /= 2; + _16x16mv.as_mv.col /= 2; + + _16x16mv.as_mv.row &= xd->fullpixel_mask; + _16x16mv.as_mv.col &= xd->fullpixel_mask; + + pre_stride >>= 1; + uptr = (which_mv ? xd->second_pre.u_buffer : xd->pre.u_buffer); + vptr = (which_mv ? xd->second_pre.v_buffer : xd->pre.v_buffer); + + set_scaled_offsets(&xd->scale_factor_uv[which_mv], + mb_row * 16, mb_col * 16); + + vp9_build_inter_predictor_q4(uptr, pre_stride, + dst_u, dst_uvstride, + &_16x16mv, &_o16x16mv, + &xd->scale_factor_uv[which_mv], + 8, 8, which_mv, &xd->subpix); + + vp9_build_inter_predictor_q4(vptr, pre_stride, + dst_v, dst_uvstride, + &_16x16mv, &_o16x16mv, + &xd->scale_factor_uv[which_mv], + 8, 8, which_mv, &xd->subpix); + } } void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x, @@ -475,7 +592,9 @@ void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x, uint8_t *dst_u, uint8_t *dst_v, int dst_ystride, - int dst_uvstride) { + int dst_uvstride, + int mb_row, + int mb_col) { uint8_t *y1 = x->pre.y_buffer, *u1 = x->pre.u_buffer, *v1 = x->pre.v_buffer; uint8_t *y2 = x->second_pre.y_buffer, *u2 = x->second_pre.u_buffer, *v2 = x->second_pre.v_buffer; @@ -488,32 +607,43 @@ void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x, for (n = 0; n < 4; n++) { const int x_idx = n & 1, y_idx = n >> 1; + int scaled_uv_offset; x->mb_to_top_edge = edge[0] - ((y_idx * 16) << 3); x->mb_to_bottom_edge = edge[1] + (((1 - y_idx) * 16) << 3); x->mb_to_left_edge = edge[2] - ((x_idx * 16) << 3); x->mb_to_right_edge = edge[3] + (((1 - x_idx) * 16) << 3); - x->pre.y_buffer = y1 + y_idx * 16 * x->pre.y_stride + x_idx * 16; - x->pre.u_buffer = u1 + y_idx * 8 * x->pre.uv_stride + x_idx * 8; - x->pre.v_buffer = v1 + y_idx * 8 * x->pre.uv_stride + x_idx * 8; + x->pre.y_buffer = y1 + scaled_buffer_offset(x_idx * 16, + y_idx * 16, + x->pre.y_stride, + &x->scale_factor[0]); + scaled_uv_offset = scaled_buffer_offset(x_idx * 8, + y_idx * 8, + x->pre.uv_stride, + &x->scale_factor_uv[0]); + x->pre.u_buffer = u1 + scaled_uv_offset; + x->pre.v_buffer = v1 + scaled_uv_offset; - vp9_build_1st_inter16x16_predictors_mb(x, - dst_y + y_idx * 16 * dst_ystride + x_idx * 16, - dst_u + y_idx * 8 * dst_uvstride + x_idx * 8, - dst_v + y_idx * 8 * dst_uvstride + x_idx * 8, - dst_ystride, dst_uvstride); if (x->mode_info_context->mbmi.second_ref_frame > 0) { - x->second_pre.y_buffer = y2 + y_idx * 16 * x->pre.y_stride + x_idx * 16; - x->second_pre.u_buffer = u2 + y_idx * 8 * x->pre.uv_stride + x_idx * 8; - x->second_pre.v_buffer = v2 + y_idx * 8 * x->pre.uv_stride + x_idx * 8; + x->second_pre.y_buffer = y2 + + scaled_buffer_offset(x_idx * 16, + y_idx * 16, + x->second_pre.y_stride, + &x->scale_factor[1]); + scaled_uv_offset = scaled_buffer_offset(x_idx * 8, + y_idx * 8, + x->second_pre.uv_stride, + &x->scale_factor_uv[1]); + x->second_pre.u_buffer = u2 + scaled_uv_offset; + x->second_pre.v_buffer = v2 + scaled_uv_offset; + } - vp9_build_2nd_inter16x16_predictors_mb(x, + vp9_build_inter16x16_predictors_mb(x, dst_y + y_idx * 16 * dst_ystride + x_idx * 16, dst_u + y_idx * 8 * dst_uvstride + x_idx * 8, dst_v + y_idx * 8 * dst_uvstride + x_idx * 8, - dst_ystride, dst_uvstride); - } + dst_ystride, dst_uvstride, mb_row + y_idx, mb_col + x_idx); } x->mb_to_top_edge = edge[0]; @@ -544,7 +674,9 @@ void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x, uint8_t *dst_u, uint8_t *dst_v, int dst_ystride, - int dst_uvstride) { + int dst_uvstride, + int mb_row, + int mb_col) { uint8_t *y1 = x->pre.y_buffer, *u1 = x->pre.u_buffer, *v1 = x->pre.v_buffer; uint8_t *y2 = x->second_pre.y_buffer, *u2 = x->second_pre.u_buffer, *v2 = x->second_pre.v_buffer; @@ -557,27 +689,43 @@ void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x, for (n = 0; n < 4; n++) { const int x_idx = n & 1, y_idx = n >> 1; + int scaled_uv_offset; x->mb_to_top_edge = edge[0] - ((y_idx * 32) << 3); x->mb_to_bottom_edge = edge[1] + (((1 - y_idx) * 32) << 3); x->mb_to_left_edge = edge[2] - ((x_idx * 32) << 3); x->mb_to_right_edge = edge[3] + (((1 - x_idx) * 32) << 3); - x->pre.y_buffer = y1 + y_idx * 32 * x->pre.y_stride + x_idx * 32; - x->pre.u_buffer = u1 + y_idx * 16 * x->pre.uv_stride + x_idx * 16; - x->pre.v_buffer = v1 + y_idx * 16 * x->pre.uv_stride + x_idx * 16; + x->pre.y_buffer = y1 + scaled_buffer_offset(x_idx * 32, + y_idx * 32, + x->pre.y_stride, + &x->scale_factor[0]); + scaled_uv_offset = scaled_buffer_offset(x_idx * 16, + y_idx * 16, + x->pre.uv_stride, + &x->scale_factor_uv[0]); + x->pre.u_buffer = u1 + scaled_uv_offset; + x->pre.v_buffer = v1 + scaled_uv_offset; if (x->mode_info_context->mbmi.second_ref_frame > 0) { - x->second_pre.y_buffer = y2 + y_idx * 32 * x->pre.y_stride + x_idx * 32; - x->second_pre.u_buffer = u2 + y_idx * 16 * x->pre.uv_stride + x_idx * 16; - x->second_pre.v_buffer = v2 + y_idx * 16 * x->pre.uv_stride + x_idx * 16; + x->second_pre.y_buffer = y2 + + scaled_buffer_offset(x_idx * 32, + y_idx * 32, + x->second_pre.y_stride, + &x->scale_factor[1]); + scaled_uv_offset = scaled_buffer_offset(x_idx * 16, + y_idx * 16, + x->second_pre.uv_stride, + &x->scale_factor_uv[1]); + x->second_pre.u_buffer = u2 + scaled_uv_offset; + x->second_pre.v_buffer = v2 + scaled_uv_offset; } vp9_build_inter32x32_predictors_sb(x, dst_y + y_idx * 32 * dst_ystride + x_idx * 32, dst_u + y_idx * 16 * dst_uvstride + x_idx * 16, dst_v + y_idx * 16 * dst_uvstride + x_idx * 16, - dst_ystride, dst_uvstride); + dst_ystride, dst_uvstride, mb_row + y_idx * 2, mb_col + x_idx * 2); } x->mb_to_top_edge = edge[0]; @@ -603,171 +751,48 @@ void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x, #endif } -/* - * The following functions should be called after an initial - * call to vp9_build_1st_inter16x16_predictors_mb() or _mby()/_mbuv(). - * It will run a second filter on a (different) ref - * frame and average the result with the output of the - * first filter. The second reference frame is stored - * in x->second_pre (the reference frame index is in - * x->mode_info_context->mbmi.second_ref_frame). The second - * motion vector is x->mode_info_context->mbmi.second_mv. - * - * This allows blending prediction from two reference frames - * which sometimes leads to better prediction than from a - * single reference framer. - */ -void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd, - uint8_t *dst_y, - int dst_ystride) { - uint8_t *ptr; - - int_mv _16x16mv; - int mv_row; - int mv_col; - - uint8_t *ptr_base = xd->second_pre.y_buffer; - int pre_stride = xd->block[0].pre_stride; - - _16x16mv.as_int = xd->mode_info_context->mbmi.mv[1].as_int; - - if (xd->mode_info_context->mbmi.need_to_clamp_secondmv) - clamp_mv_to_umv_border(&_16x16mv.as_mv, xd); - - mv_row = _16x16mv.as_mv.row; - mv_col = _16x16mv.as_mv.col; - - ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3); - - xd->subpix.predict[!!(mv_col & 7)][!!(mv_row & 7)][1]( - ptr, pre_stride, dst_y, dst_ystride, - xd->subpix.filter_x[(mv_col & 7) << 1], xd->subpix.x_step_q4, - xd->subpix.filter_y[(mv_row & 7) << 1], xd->subpix.y_step_q4, - 16, 16); -} - -void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride) { - int offset; - uint8_t *uptr, *vptr; - - int_mv _16x16mv; - int mv_row; - int mv_col; - int omv_row, omv_col; - - int pre_stride = xd->block[0].pre_stride; - - _16x16mv.as_int = xd->mode_info_context->mbmi.mv[1].as_int; - - if (xd->mode_info_context->mbmi.need_to_clamp_secondmv) - clamp_mv_to_umv_border(&_16x16mv.as_mv, xd); - - mv_row = _16x16mv.as_mv.row; - mv_col = _16x16mv.as_mv.col; - - /* calc uv motion vectors */ - omv_row = mv_row; - omv_col = mv_col; - mv_row = (mv_row + (mv_row > 0)) >> 1; - mv_col = (mv_col + (mv_col > 0)) >> 1; - - mv_row &= xd->fullpixel_mask; - mv_col &= xd->fullpixel_mask; - - pre_stride >>= 1; - offset = (mv_row >> 3) * pre_stride + (mv_col >> 3); - uptr = xd->second_pre.u_buffer + offset; - vptr = xd->second_pre.v_buffer + offset; - - xd->subpix.predict[!!(omv_col & 15)][!!(omv_row & 15)][1]( - uptr, pre_stride, dst_u, dst_uvstride, - xd->subpix.filter_x[omv_col & 15], xd->subpix.x_step_q4, - xd->subpix.filter_y[omv_row & 15], xd->subpix.y_step_q4, - 8, 8); - - xd->subpix.predict[!!(omv_col & 15)][!!(omv_row & 15)][1]( - vptr, pre_stride, dst_v, dst_uvstride, - xd->subpix.filter_x[omv_col & 15], xd->subpix.x_step_q4, - xd->subpix.filter_y[omv_row & 15], xd->subpix.y_step_q4, - 8, 8); -} - -void vp9_build_2nd_inter16x16_predictors_mb(MACROBLOCKD *xd, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, - int dst_uvstride) { - vp9_build_2nd_inter16x16_predictors_mby(xd, dst_y, dst_ystride); - vp9_build_2nd_inter16x16_predictors_mbuv(xd, dst_u, dst_v, dst_uvstride); -} - -static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) { +static void build_inter4x4_predictors_mb(MACROBLOCKD *xd, + int mb_row, int mb_col) { int i; MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi; BLOCKD *blockd = xd->block; + int which_mv = 0; + const int use_second_ref = mbmi->second_ref_frame > 0; if (xd->mode_info_context->mbmi.partitioning != PARTITIONING_4X4) { - blockd[ 0].bmi = xd->mode_info_context->bmi[ 0]; - blockd[ 2].bmi = xd->mode_info_context->bmi[ 2]; - blockd[ 8].bmi = xd->mode_info_context->bmi[ 8]; - blockd[10].bmi = xd->mode_info_context->bmi[10]; - - if (mbmi->need_to_clamp_mvs) { - clamp_mv_to_umv_border(&blockd[ 0].bmi.as_mv[0].as_mv, xd); - clamp_mv_to_umv_border(&blockd[ 2].bmi.as_mv[0].as_mv, xd); - clamp_mv_to_umv_border(&blockd[ 8].bmi.as_mv[0].as_mv, xd); - clamp_mv_to_umv_border(&blockd[10].bmi.as_mv[0].as_mv, xd); - if (mbmi->second_ref_frame > 0) { - clamp_mv_to_umv_border(&blockd[ 0].bmi.as_mv[1].as_mv, xd); - clamp_mv_to_umv_border(&blockd[ 2].bmi.as_mv[1].as_mv, xd); - clamp_mv_to_umv_border(&blockd[ 8].bmi.as_mv[1].as_mv, xd); - clamp_mv_to_umv_border(&blockd[10].bmi.as_mv[1].as_mv, xd); - } - } + 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]; - vp9_build_inter_predictors4b(xd, &blockd[ 0], 16); - vp9_build_inter_predictors4b(xd, &blockd[ 2], 16); - vp9_build_inter_predictors4b(xd, &blockd[ 8], 16); - vp9_build_inter_predictors4b(xd, &blockd[10], 16); + for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { + 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 (mbmi->second_ref_frame > 0) { - vp9_build_2nd_inter_predictors4b(xd, &blockd[ 0], 16); - vp9_build_2nd_inter_predictors4b(xd, &blockd[ 2], 16); - vp9_build_2nd_inter_predictors4b(xd, &blockd[ 8], 16); - vp9_build_2nd_inter_predictors4b(xd, &blockd[10], 16); + build_2x1_inter_predictor(d0, d1, xd->scale_factor, 8, 16, + which_mv, &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 (mbmi->need_to_clamp_mvs) { - clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv[0].as_mv, xd); - clamp_mv_to_umv_border(&blockd[i + 1].bmi.as_mv[0].as_mv, xd); - if (mbmi->second_ref_frame > 0) { - clamp_mv_to_umv_border(&blockd[i + 0].bmi.as_mv[1].as_mv, xd); - clamp_mv_to_umv_border(&blockd[i + 1].bmi.as_mv[1].as_mv, xd); - } - } - - if (d0->bmi.as_mv[0].as_int == d1->bmi.as_mv[0].as_int) - build_inter_predictors2b(xd, d0, 16); - else { - vp9_build_inter_predictors_b(d0, 16, &xd->subpix); - vp9_build_inter_predictors_b(d1, 16, &xd->subpix); - } - - if (mbmi->second_ref_frame > 0) { - vp9_build_2nd_inter_predictors_b(d0, 16, &xd->subpix); - vp9_build_2nd_inter_predictors_b(d1, 16, &xd->subpix); + for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { + build_2x1_inter_predictor(d0, d1, xd->scale_factor, 4, 16, + which_mv, &xd->subpix, + mb_row * 16 + y, mb_col * 16 + x); } } } @@ -775,17 +800,13 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *xd) { for (i = 16; i < 24; i += 2) { BLOCKD *d0 = &blockd[i]; BLOCKD *d1 = &blockd[i + 1]; + const int x = 4 * (i & 1); + const int y = ((i - 16) >> 1) * 4; - if (d0->bmi.as_mv[0].as_int == d1->bmi.as_mv[0].as_int) - build_inter_predictors2b(xd, d0, 8); - else { - vp9_build_inter_predictors_b(d0, 8, &xd->subpix); - vp9_build_inter_predictors_b(d1, 8, &xd->subpix); - } - - if (mbmi->second_ref_frame > 0) { - vp9_build_2nd_inter_predictors_b(d0, 8, &xd->subpix); - vp9_build_2nd_inter_predictors_b(d1, 8, &xd->subpix); + for (which_mv = 0; which_mv < 1 + use_second_ref; ++which_mv) { + build_2x1_inter_predictor(d0, d1, xd->scale_factor_uv, 4, 8, + which_mv, &xd->subpix, + mb_row * 8 + y, mb_col * 8 + x); } } } @@ -882,22 +903,31 @@ void build_4x4uvmvs(MACROBLOCKD *xd) { } } -void vp9_build_inter_predictors_mb(MACROBLOCKD *xd) { +void vp9_build_inter16x16_predictors_mb(MACROBLOCKD *xd, + uint8_t *dst_y, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_ystride, + int dst_uvstride, + int mb_row, + int mb_col) { + vp9_build_inter16x16_predictors_mby(xd, dst_y, dst_ystride, mb_row, mb_col); + vp9_build_inter16x16_predictors_mbuv(xd, dst_u, dst_v, dst_uvstride, + mb_row, mb_col); +} + + +void vp9_build_inter_predictors_mb(MACROBLOCKD *xd, + int mb_row, + int mb_col) { if (xd->mode_info_context->mbmi.mode != SPLITMV) { - vp9_build_1st_inter16x16_predictors_mb(xd, xd->predictor, - &xd->predictor[256], - &xd->predictor[320], 16, 8); - - if (xd->mode_info_context->mbmi.second_ref_frame > 0) { - /* 256 = offset of U plane in Y+U+V buffer; - * 320 = offset of V plane in Y+U+V buffer. - * (256=16x16, 320=16x16+8x8). */ - vp9_build_2nd_inter16x16_predictors_mb(xd, xd->predictor, - &xd->predictor[256], - &xd->predictor[320], 16, 8); - } + vp9_build_inter16x16_predictors_mb(xd, xd->predictor, + &xd->predictor[256], + &xd->predictor[320], 16, 8, + mb_row, mb_col); + #if CONFIG_COMP_INTERINTRA_PRED - else if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME) { + if (xd->mode_info_context->mbmi.second_ref_frame == INTRA_FRAME) { vp9_build_interintra_16x16_predictors_mb(xd, xd->predictor, &xd->predictor[256], &xd->predictor[320], 16, 8); @@ -905,6 +935,6 @@ void vp9_build_inter_predictors_mb(MACROBLOCKD *xd) { #endif } else { build_4x4uvmvs(xd); - build_inter4x4_predictors_mb(xd); + build_inter4x4_predictors_mb(xd, mb_row, mb_col); } } diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h index 903bd2e86..831ce2a73 100644 --- a/vp9/common/vp9_reconinter.h +++ b/vp9/common/vp9_reconinter.h @@ -16,71 +16,126 @@ struct subpix_fn_table; -extern void vp9_build_1st_inter16x16_predictors_mby(MACROBLOCKD *xd, - uint8_t *dst_y, - int dst_ystride, - int clamp_mvs); - -extern void vp9_build_1st_inter16x16_predictors_mbuv(MACROBLOCKD *xd, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride); - -extern void vp9_build_1st_inter16x16_predictors_mb(MACROBLOCKD *xd, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, - int dst_uvstride); - -extern void vp9_build_2nd_inter16x16_predictors_mby(MACROBLOCKD *xd, - uint8_t *dst_y, - int dst_ystride); - -extern void vp9_build_2nd_inter16x16_predictors_mbuv(MACROBLOCKD *xd, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_uvstride); - -extern void vp9_build_2nd_inter16x16_predictors_mb(MACROBLOCKD *xd, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, - int dst_uvstride); - -extern void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, - int dst_uvstride); - -extern void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x, - uint8_t *dst_y, - uint8_t *dst_u, - uint8_t *dst_v, - int dst_ystride, - int dst_uvstride); - -extern void vp9_build_inter_predictors_mb(MACROBLOCKD *xd); - -extern void vp9_build_inter_predictors_b(BLOCKD *d, int pitch, - struct subpix_fn_table *sppf); - -extern void vp9_build_2nd_inter_predictors_b(BLOCKD *d, int pitch, - struct subpix_fn_table *sppf); - -extern void vp9_build_inter_predictors4b(MACROBLOCKD *xd, BLOCKD *d, - int pitch); - -extern void vp9_build_2nd_inter_predictors4b(MACROBLOCKD *xd, - BLOCKD *d, int pitch); - -extern void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd); - -extern void vp9_setup_interp_filters(MACROBLOCKD *xd, - INTERPOLATIONFILTERTYPE filter, - VP9_COMMON *cm); +void vp9_build_inter16x16_predictors_mby(MACROBLOCKD *xd, + uint8_t *dst_y, + int dst_ystride, + int mb_row, + int mb_col); + +void vp9_build_inter16x16_predictors_mbuv(MACROBLOCKD *xd, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_uvstride, + int mb_row, + int mb_col); + +void vp9_build_inter16x16_predictors_mb(MACROBLOCKD *xd, + uint8_t *dst_y, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_ystride, + int dst_uvstride, + int mb_row, + int mb_col); + +void vp9_build_inter32x32_predictors_sb(MACROBLOCKD *x, + uint8_t *dst_y, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_ystride, + int dst_uvstride, + int mb_row, + int mb_col); + +void vp9_build_inter64x64_predictors_sb(MACROBLOCKD *x, + uint8_t *dst_y, + uint8_t *dst_u, + uint8_t *dst_v, + int dst_ystride, + int dst_uvstride, + int mb_row, + int mb_col); + +void vp9_build_inter_predictors_mb(MACROBLOCKD *xd, + int mb_row, + int mb_col); + +void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd, + int mb_row, + int mb_col); + +void vp9_setup_interp_filters(MACROBLOCKD *xd, + INTERPOLATIONFILTERTYPE filter, + VP9_COMMON *cm); + +void vp9_setup_scale_factors_for_frame(struct scale_factors *scale, + YV12_BUFFER_CONFIG *other, + int this_w, int this_h); + +void vp9_build_inter_predictor(const uint8_t *src, int src_stride, + uint8_t *dst, int dst_stride, + const int_mv *mv_q3, + const struct scale_factors *scale, + int w, int h, int do_avg, + const struct subpix_fn_table *subpix); + +void vp9_build_inter_predictor_q4(const uint8_t *src, int src_stride, + uint8_t *dst, int dst_stride, + const int_mv *fullpel_mv_q3, + const int_mv *frac_mv_q4, + const struct scale_factors *scale, + int w, int h, int do_avg, + const struct subpix_fn_table *subpix); + +static int scale_value_x(int val, const struct scale_factors *scale) { + return val * scale->x_num / scale->x_den; +} + +static int scale_value_y(int val, const struct scale_factors *scale) { + return val * scale->y_num / scale->y_den; +} + +static int scaled_buffer_offset(int x_offset, + int y_offset, + int stride, + const struct scale_factors *scale) { + return scale_value_y(y_offset, scale) * stride + + scale_value_x(x_offset, scale); +} + +static void setup_pred_block(YV12_BUFFER_CONFIG *dst, + const YV12_BUFFER_CONFIG *src, + int mb_row, int mb_col, + const struct scale_factors *scale, + const struct scale_factors *scale_uv) { + const int recon_y_stride = src->y_stride; + const int recon_uv_stride = src->uv_stride; + int recon_yoffset; + int recon_uvoffset; + + if (scale) { + recon_yoffset = scaled_buffer_offset(16 * mb_col, 16 * mb_row, + recon_y_stride, scale); + recon_uvoffset = scaled_buffer_offset(8 * mb_col, 8 * mb_row, + recon_uv_stride, scale_uv); + } else { + recon_yoffset = 16 * mb_row * recon_y_stride + 16 * mb_col; + recon_uvoffset = 8 * mb_row * recon_uv_stride + 8 * mb_col; + } + *dst = *src; + dst->y_buffer += recon_yoffset; + dst->u_buffer += recon_uvoffset; + dst->v_buffer += recon_uvoffset; +} + +static void set_scale_factors(MACROBLOCKD *xd, + int ref0, int ref1, + struct scale_factors scale_factor[MAX_REF_FRAMES]) { + + xd->scale_factor[0] = scale_factor[ref0 >= 0 ? ref0 : 0]; + xd->scale_factor[1] = scale_factor[ref1 >= 0 ? ref1 : 0]; + xd->scale_factor_uv[0] = xd->scale_factor[0]; + xd->scale_factor_uv[1] = xd->scale_factor[1]; +} #endif // VP9_COMMON_VP9_RECONINTER_H_ diff --git a/vp9/common/vp9_reconintra.h b/vp9/common/vp9_reconintra.h index 88584ad3b..3031fb699 100644 --- a/vp9/common/vp9_reconintra.h +++ b/vp9/common/vp9_reconintra.h @@ -14,37 +14,43 @@ #include "vpx/vpx_integer.h" #include "vp9/common/vp9_blockd.h" -extern void vp9_recon_intra_mbuv(MACROBLOCKD *xd); -extern B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr, - int stride, int n); -extern B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x); +void vp9_recon_intra_mbuv(MACROBLOCKD *xd); + +B_PREDICTION_MODE vp9_find_dominant_direction(uint8_t *ptr, + int stride, int n); + +B_PREDICTION_MODE vp9_find_bpred_context(BLOCKD *x); + #if CONFIG_COMP_INTERINTRA_PRED -extern void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd, - uint8_t *ypred, - uint8_t *upred, - uint8_t *vpred, - int ystride, - int uvstride); -extern void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd, - uint8_t *ypred, - int ystride); -extern void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd, - uint8_t *upred, - uint8_t *vpred, - int uvstride); +void vp9_build_interintra_16x16_predictors_mb(MACROBLOCKD *xd, + uint8_t *ypred, + uint8_t *upred, + uint8_t *vpred, + int ystride, + int uvstride); + +void vp9_build_interintra_16x16_predictors_mby(MACROBLOCKD *xd, + uint8_t *ypred, + int ystride); + +void vp9_build_interintra_16x16_predictors_mbuv(MACROBLOCKD *xd, + uint8_t *upred, + uint8_t *vpred, + int uvstride); #endif // CONFIG_COMP_INTERINTRA_PRED -extern void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd, - uint8_t *ypred, - uint8_t *upred, - uint8_t *vpred, - int ystride, - int uvstride); -extern void vp9_build_interintra_64x64_predictors_sb(MACROBLOCKD *xd, - uint8_t *ypred, - uint8_t *upred, - uint8_t *vpred, - int ystride, - int uvstride); +void vp9_build_interintra_32x32_predictors_sb(MACROBLOCKD *xd, + uint8_t *ypred, + uint8_t *upred, + uint8_t *vpred, + int ystride, + int uvstride); + +void vp9_build_interintra_64x64_predictors_sb(MACROBLOCKD *xd, + uint8_t *ypred, + uint8_t *upred, + uint8_t *vpred, + int ystride, + int uvstride); #endif // VP9_COMMON_VP9_RECONINTRA_H_ diff --git a/vp9/common/vp9_rtcd.c b/vp9/common/vp9_rtcd.c index 277d5b217..72613ae07 100644 --- a/vp9/common/vp9_rtcd.c +++ b/vp9/common/vp9_rtcd.c @@ -12,10 +12,9 @@ #include "vp9_rtcd.h" #include "vpx_ports/vpx_once.h" -extern void vpx_scale_rtcd(void); +void vpx_scale_rtcd(void); -void vp9_rtcd() -{ +void vp9_rtcd() { vpx_scale_rtcd(); once(setup_rtcd_internal); } diff --git a/vp9/common/vp9_setupintrarecon.h b/vp9/common/vp9_setupintrarecon.h index 457265528..e389f3c91 100644 --- a/vp9/common/vp9_setupintrarecon.h +++ b/vp9/common/vp9_setupintrarecon.h @@ -13,6 +13,6 @@ #include "vpx_scale/yv12config.h" -extern void vp9_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); +void vp9_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); #endif // VP9_COMMON_VP9_SETUPINTRARECON_H_ |