diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index c375d8bea47e6afbaf366f4190f93daf2478da0d..01e93208141f31c2942f09fb577bfc5c52eb560c 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -390,14 +390,13 @@ typedef void (*foreach_transformed_block_visitor)(int plane, int block, void *arg); static INLINE void foreach_transformed_block_in_plane( - const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane, + const MACROBLOCKD *const xd, BLOCK_SIZE_TYPE bsize, int plane, foreach_transformed_block_visitor visit, void *arg) { const struct macroblockd_plane *const pd = &xd->plane[plane]; - + const MB_MODE_INFO* mbmi = &xd->mode_info_context->mbmi; // block and transform sizes, in number of 4x4 blocks log 2 ("*_b") // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 // transform size varies per plane, look it up in a common way. - const MB_MODE_INFO* mbmi = &xd->mode_info_context->mbmi; const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->txfm_size; const BLOCK_SIZE_TYPE plane_bsize = get_plane_block_size(bsize, pd); diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 92153dd5f4b908e1ffdeffb45d4f43f3a25d64d2..51bd4477de19f364fba48e34142bf1c564b2d3b0 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -574,6 +574,7 @@ static void pick_sb_modes(VP9_COMP *cpi, int mi_row, int mi_col, MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; + // Use the lower precision, but faster, 32x32 fdct for mode selection. x->use_lp32x32fdct = 1; if (bsize < BLOCK_8X8) { @@ -1757,8 +1758,6 @@ static void rd_pick_partition(VP9_COMP *cpi, TOKENEXTRA **tp, int mi_row, } } - // Use 4 subblocks' motion estimation results to speed up current - // partition's checking. x->fast_ms = 0; x->pred_mv.as_int = 0; x->subblock_ref = 0; @@ -2178,7 +2177,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { build_activity_map(cpi); } - // re-initencode frame context. + // Re-initialize encode frame context. init_encode_frame_mb_context(cpi); vp9_zero(cpi->rd_comp_pred_diff); @@ -2414,7 +2413,7 @@ void vp9_encode_frame(VP9_COMP *cpi) { // decoder such that we allow compound where one of the 3 buffers has a // different sign bias and that buffer is then the fixed ref. However, this // requires further work in the rd loop. For now the only supported encoder - // side behaviour is where the ALT ref buffer has opposite sign bias to + // side behavior is where the ALT ref buffer has opposite sign bias to // the other two. if ((cm->ref_frame_sign_bias[ALTREF_FRAME] == cm->ref_frame_sign_bias[GOLDEN_FRAME]) @@ -2481,13 +2480,12 @@ void vp9_encode_frame(VP9_COMP *cpi) { filter_type = SWITCHABLE; } - /* transform size (4x4, 8x8, 16x16 or select-per-mb) selection */ - cpi->mb.e_mbd.lossless = 0; if (cpi->oxcf.lossless) { cpi->mb.e_mbd.lossless = 1; } + /* transform size selection (4x4, 8x8, 16x16 or select-per-mb) */ select_tx_mode(cpi); cpi->common.comp_pred_mode = pred_type; cpi->common.mcomp_filter_type = filter_type; diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index ae09309b437fc540c2dbb10f96dd12ff866c5fab..c2feabaf92722cfeb1f7bde86e97b5df8786a7d9 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1217,6 +1217,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, MB_PREDICTION_MODE mode; MB_PREDICTION_MODE mode_selected = DC_PRED; MACROBLOCKD *const xd = &x->e_mbd; + MODE_INFO *const mic = xd->mode_info_context; int this_rate, this_rate_tokenonly, s; int64_t this_distortion, this_rd; TX_SIZE best_tx = TX_4X4; @@ -1230,7 +1231,6 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, /* Y Search for intra prediction mode */ for (mode = DC_PRED; mode <= TM_PRED; mode++) { int64_t local_tx_cache[TX_MODES]; - MODE_INFO *const mic = xd->mode_info_context; const int mis = xd->mode_info_stride; if (cpi->common.frame_type == KEY_FRAME) { @@ -1240,7 +1240,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, bmode_costs = x->y_mode_costs[A][L]; } - x->e_mbd.mode_info_context->mbmi.mode = mode; + mic->mbmi.mode = mode; super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s, NULL, bsize, local_tx_cache, best_rd); @@ -1254,7 +1254,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, if (this_rd < best_rd) { mode_selected = mode; best_rd = this_rd; - best_tx = x->e_mbd.mode_info_context->mbmi.txfm_size; + best_tx = mic->mbmi.txfm_size; *rate = this_rate; *rate_tokenonly = this_rate_tokenonly; *distortion = this_distortion; @@ -1272,8 +1272,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - x->e_mbd.mode_info_context->mbmi.mode = mode_selected; - x->e_mbd.mode_info_context->mbmi.txfm_size = best_tx; + mic->mbmi.mode = mode_selected; + mic->mbmi.txfm_size = best_tx; return best_rd; } @@ -1437,7 +1437,7 @@ static int labels2mode(MACROBLOCK *x, int i, int *mvjcost, int *mvcost[2], VP9_COMP *cpi) { MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *const mic = xd->mode_info_context; - MB_MODE_INFO * mbmi = &mic->mbmi; + MB_MODE_INFO *mbmi = &mic->mbmi; int cost = 0, thismvcost = 0; int idx, idy; const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type]; diff --git a/vp9/encoder/vp9_variance_c.c b/vp9/encoder/vp9_variance_c.c index 23e77679192985febc312f7d0f446bc0ec807f7d..325925cbd58b4aa008239a1b5e6efc5a8e68cd9e 100644 --- a/vp9/encoder/vp9_variance_c.c +++ b/vp9/encoder/vp9_variance_c.c @@ -46,7 +46,7 @@ unsigned int vp9_sub_pixel_variance64x32_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; const int16_t *hfilter, *vfilter; @@ -68,7 +68,7 @@ unsigned int vp9_sub_pixel_avg_variance64x32_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -103,7 +103,7 @@ unsigned int vp9_sub_pixel_variance32x64_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; const int16_t *hfilter, *vfilter; @@ -125,7 +125,7 @@ unsigned int vp9_sub_pixel_avg_variance32x64_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 64); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -160,7 +160,7 @@ unsigned int vp9_sub_pixel_variance32x16_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; const int16_t *hfilter, *vfilter; @@ -182,7 +182,7 @@ unsigned int vp9_sub_pixel_avg_variance32x16_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 16); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -217,7 +217,7 @@ unsigned int vp9_sub_pixel_variance16x32_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; const int16_t *hfilter, *vfilter; @@ -239,7 +239,7 @@ unsigned int vp9_sub_pixel_avg_variance16x32_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 32); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -440,7 +440,7 @@ unsigned int vp9_sub_pixel_variance4x4_c(const uint8_t *src_ptr, unsigned int *sse) { uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; - uint16_t fdata3[5 * 4]; // Temp data bufffer used in filtering + uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering hfilter = VP9_BILINEAR_FILTERS_2TAP(xoffset); vfilter = VP9_BILINEAR_FILTERS_2TAP(yoffset); @@ -466,7 +466,7 @@ unsigned int vp9_sub_pixel_avg_variance4x4_c(const uint8_t *src_ptr, uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 4); // compound pred buffer - uint16_t fdata3[5 * 4]; // Temp data bufffer used in filtering + uint16_t fdata3[5 * 4]; // Temp data buffer used in filtering hfilter = VP9_BILINEAR_FILTERS_2TAP(xoffset); vfilter = VP9_BILINEAR_FILTERS_2TAP(yoffset); @@ -488,7 +488,7 @@ unsigned int vp9_sub_pixel_variance8x8_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[9 * 8]; // Temp data bufffer used in filtering + uint16_t fdata3[9 * 8]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; @@ -510,7 +510,7 @@ unsigned int vp9_sub_pixel_avg_variance8x8_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[9 * 8]; // Temp data bufffer used in filtering + uint16_t fdata3[9 * 8]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 8); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -532,7 +532,7 @@ unsigned int vp9_sub_pixel_variance16x16_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[17 * 16]; // Temp data bufffer used in filtering + uint16_t fdata3[17 * 16]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; @@ -577,7 +577,7 @@ unsigned int vp9_sub_pixel_variance64x64_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; const int16_t *hfilter, *vfilter; @@ -599,7 +599,7 @@ unsigned int vp9_sub_pixel_avg_variance64x64_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[65 * 64]; // Temp data bufffer used in filtering + uint16_t fdata3[65 * 64]; // Temp data buffer used in filtering uint8_t temp2[68 * 64]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 64 * 64); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -621,7 +621,7 @@ unsigned int vp9_sub_pixel_variance32x32_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; const int16_t *hfilter, *vfilter; @@ -643,7 +643,7 @@ unsigned int vp9_sub_pixel_avg_variance32x32_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[33 * 32]; // Temp data bufffer used in filtering + uint16_t fdata3[33 * 32]; // Temp data buffer used in filtering uint8_t temp2[36 * 32]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 32 * 32); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -785,7 +785,7 @@ unsigned int vp9_sub_pixel_variance16x8_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[16 * 9]; // Temp data bufffer used in filtering + uint16_t fdata3[16 * 9]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; @@ -807,7 +807,7 @@ unsigned int vp9_sub_pixel_avg_variance16x8_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[16 * 9]; // Temp data bufffer used in filtering + uint16_t fdata3[16 * 9]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 16 * 8); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -829,7 +829,7 @@ unsigned int vp9_sub_pixel_variance8x16_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[9 * 16]; // Temp data bufffer used in filtering + uint16_t fdata3[9 * 16]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; @@ -851,7 +851,7 @@ unsigned int vp9_sub_pixel_avg_variance8x16_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[9 * 16]; // Temp data bufffer used in filtering + uint16_t fdata3[9 * 16]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 16); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -873,7 +873,7 @@ unsigned int vp9_sub_pixel_variance8x4_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[8 * 5]; // Temp data bufffer used in filtering + uint16_t fdata3[8 * 5]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; const int16_t *hfilter, *vfilter; @@ -895,7 +895,7 @@ unsigned int vp9_sub_pixel_avg_variance8x4_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[8 * 5]; // Temp data bufffer used in filtering + uint16_t fdata3[8 * 5]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 8 * 4); // compound pred buffer const int16_t *hfilter, *vfilter; @@ -917,7 +917,7 @@ unsigned int vp9_sub_pixel_variance4x8_c(const uint8_t *src_ptr, const uint8_t *dst_ptr, int dst_pixels_per_line, unsigned int *sse) { - uint16_t fdata3[5 * 8]; // Temp data bufffer used in filtering + uint16_t fdata3[5 * 8]; // Temp data buffer used in filtering // FIXME(jingning,rbultje): this temp2 buffer probably doesn't need to be // of this big? same issue appears in all other block size settings. uint8_t temp2[20 * 16]; @@ -941,7 +941,7 @@ unsigned int vp9_sub_pixel_avg_variance4x8_c(const uint8_t *src_ptr, int dst_pixels_per_line, unsigned int *sse, const uint8_t *second_pred) { - uint16_t fdata3[5 * 8]; // Temp data bufffer used in filtering + uint16_t fdata3[5 * 8]; // Temp data buffer used in filtering uint8_t temp2[20 * 16]; DECLARE_ALIGNED_ARRAY(16, uint8_t, temp3, 4 * 8); // compound pred buffer const int16_t *hfilter, *vfilter;