| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 } | 738 } |
| 739 | 739 |
| 740 static void txfm_rd_in_plane(MACROBLOCK *x, | 740 static void txfm_rd_in_plane(MACROBLOCK *x, |
| 741 int *rate, int64_t *distortion, | 741 int *rate, int64_t *distortion, |
| 742 int *skippable, int64_t *sse, | 742 int *skippable, int64_t *sse, |
| 743 int64_t ref_best_rd, int plane, | 743 int64_t ref_best_rd, int plane, |
| 744 BLOCK_SIZE bsize, TX_SIZE tx_size, | 744 BLOCK_SIZE bsize, TX_SIZE tx_size, |
| 745 int use_fast_coef_casting) { | 745 int use_fast_coef_casting) { |
| 746 MACROBLOCKD *const xd = &x->e_mbd; | 746 MACROBLOCKD *const xd = &x->e_mbd; |
| 747 const struct macroblockd_plane *const pd = &xd->plane[plane]; | 747 const struct macroblockd_plane *const pd = &xd->plane[plane]; |
| 748 struct rdcost_block_args args = { 0 }; | 748 struct rdcost_block_args args; |
| 749 vp9_zero(args); |
| 749 args.x = x; | 750 args.x = x; |
| 750 args.best_rd = ref_best_rd; | 751 args.best_rd = ref_best_rd; |
| 751 args.use_fast_coef_costing = use_fast_coef_casting; | 752 args.use_fast_coef_costing = use_fast_coef_casting; |
| 752 | 753 |
| 753 if (plane == 0) | 754 if (plane == 0) |
| 754 xd->mi[0]->mbmi.tx_size = tx_size; | 755 xd->mi[0]->mbmi.tx_size = tx_size; |
| 755 | 756 |
| 756 vp9_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); | 757 vp9_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); |
| 757 | 758 |
| 758 args.so = get_scan(xd, tx_size, pd->plane_type, 0); | 759 args.so = get_scan(xd, tx_size, pd->plane_type, 0); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 BLOCK_SIZE bs) { | 800 BLOCK_SIZE bs) { |
| 800 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; | 801 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; |
| 801 VP9_COMMON *const cm = &cpi->common; | 802 VP9_COMMON *const cm = &cpi->common; |
| 802 MACROBLOCKD *const xd = &x->e_mbd; | 803 MACROBLOCKD *const xd = &x->e_mbd; |
| 803 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 804 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 804 vp9_prob skip_prob = vp9_get_skip_prob(cm, xd); | 805 vp9_prob skip_prob = vp9_get_skip_prob(cm, xd); |
| 805 int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX}, | 806 int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX}, |
| 806 {INT64_MAX, INT64_MAX}, | 807 {INT64_MAX, INT64_MAX}, |
| 807 {INT64_MAX, INT64_MAX}, | 808 {INT64_MAX, INT64_MAX}, |
| 808 {INT64_MAX, INT64_MAX}}; | 809 {INT64_MAX, INT64_MAX}}; |
| 809 int n, m; | 810 TX_SIZE n, m; |
| 810 int s0, s1; | 811 int s0, s1; |
| 811 const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode]; | 812 const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode]; |
| 812 int64_t best_rd = INT64_MAX; | 813 int64_t best_rd = INT64_MAX; |
| 813 TX_SIZE best_tx = TX_4X4; | 814 TX_SIZE best_tx = TX_4X4; |
| 814 | 815 |
| 815 const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs); | 816 const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs); |
| 816 assert(skip_prob > 0); | 817 assert(skip_prob > 0); |
| 817 s0 = vp9_cost_bit(skip_prob, 0); | 818 s0 = vp9_cost_bit(skip_prob, 0); |
| 818 s1 = vp9_cost_bit(skip_prob, 1); | 819 s1 = vp9_cost_bit(skip_prob, 1); |
| 819 | 820 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 BLOCK_SIZE bs) { | 883 BLOCK_SIZE bs) { |
| 883 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; | 884 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; |
| 884 VP9_COMMON *const cm = &cpi->common; | 885 VP9_COMMON *const cm = &cpi->common; |
| 885 MACROBLOCKD *const xd = &x->e_mbd; | 886 MACROBLOCKD *const xd = &x->e_mbd; |
| 886 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 887 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 887 vp9_prob skip_prob = vp9_get_skip_prob(cm, xd); | 888 vp9_prob skip_prob = vp9_get_skip_prob(cm, xd); |
| 888 int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX}, | 889 int64_t rd[TX_SIZES][2] = {{INT64_MAX, INT64_MAX}, |
| 889 {INT64_MAX, INT64_MAX}, | 890 {INT64_MAX, INT64_MAX}, |
| 890 {INT64_MAX, INT64_MAX}, | 891 {INT64_MAX, INT64_MAX}, |
| 891 {INT64_MAX, INT64_MAX}}; | 892 {INT64_MAX, INT64_MAX}}; |
| 892 int n, m; | 893 TX_SIZE n, m; |
| 893 int s0, s1; | 894 int s0, s1; |
| 894 double scale_rd[TX_SIZES] = {1.73, 1.44, 1.20, 1.00}; | 895 double scale_rd[TX_SIZES] = {1.73, 1.44, 1.20, 1.00}; |
| 895 const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode]; | 896 const TX_SIZE max_mode_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode]; |
| 896 int64_t best_rd = INT64_MAX; | 897 int64_t best_rd = INT64_MAX; |
| 897 TX_SIZE best_tx = TX_4X4; | 898 TX_SIZE best_tx = TX_4X4; |
| 898 | 899 |
| 899 const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs); | 900 const vp9_prob *tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc.tx_probs); |
| 900 assert(skip_prob > 0); | 901 assert(skip_prob > 0); |
| 901 s0 = vp9_cost_bit(skip_prob, 0); | 902 s0 = vp9_cost_bit(skip_prob, 0); |
| 902 s1 = vp9_cost_bit(skip_prob, 1); | 903 s1 = vp9_cost_bit(skip_prob, 1); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 int64_t d[TX_SIZES], sse[TX_SIZES]; | 955 int64_t d[TX_SIZES], sse[TX_SIZES]; |
| 955 MACROBLOCKD *xd = &x->e_mbd; | 956 MACROBLOCKD *xd = &x->e_mbd; |
| 956 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 957 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 957 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; | 958 const TX_SIZE max_tx_size = max_txsize_lookup[bs]; |
| 958 TX_SIZE tx_size; | 959 TX_SIZE tx_size; |
| 959 | 960 |
| 960 assert(bs == mbmi->sb_type); | 961 assert(bs == mbmi->sb_type); |
| 961 | 962 |
| 962 vp9_subtract_plane(x, bs, 0); | 963 vp9_subtract_plane(x, bs, 0); |
| 963 | 964 |
| 964 if (cpi->sf.tx_size_search_method == USE_LARGESTALL) { | 965 if (cpi->sf.tx_size_search_method == USE_LARGESTALL || xd->lossless) { |
| 965 vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t)); | 966 vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t)); |
| 966 choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse, | 967 choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse, |
| 967 ref_best_rd, bs); | 968 ref_best_rd, bs); |
| 968 if (psse) | 969 if (psse) |
| 969 *psse = sse[mbmi->tx_size]; | 970 *psse = sse[mbmi->tx_size]; |
| 970 return; | 971 return; |
| 971 } | 972 } |
| 972 | 973 |
| 973 if (cpi->sf.tx_size_search_method == USE_LARGESTINTRA_MODELINTER) { | 974 if (cpi->sf.tx_size_search_method == USE_LARGESTINTRA_MODELINTER) { |
| 974 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) | 975 for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 992 static void intra_super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, | 993 static void intra_super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, |
| 993 int64_t *distortion, int *skip, | 994 int64_t *distortion, int *skip, |
| 994 int64_t *psse, BLOCK_SIZE bs, | 995 int64_t *psse, BLOCK_SIZE bs, |
| 995 int64_t txfm_cache[TX_MODES], | 996 int64_t txfm_cache[TX_MODES], |
| 996 int64_t ref_best_rd) { | 997 int64_t ref_best_rd) { |
| 997 int64_t sse[TX_SIZES]; | 998 int64_t sse[TX_SIZES]; |
| 998 MACROBLOCKD *xd = &x->e_mbd; | 999 MACROBLOCKD *xd = &x->e_mbd; |
| 999 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; | 1000 MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; |
| 1000 | 1001 |
| 1001 assert(bs == mbmi->sb_type); | 1002 assert(bs == mbmi->sb_type); |
| 1002 if (cpi->sf.tx_size_search_method != USE_FULL_RD) { | 1003 if (cpi->sf.tx_size_search_method != USE_FULL_RD || xd->lossless) { |
| 1003 vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t)); | 1004 vpx_memset(txfm_cache, 0, TX_MODES * sizeof(int64_t)); |
| 1004 choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse, | 1005 choose_largest_txfm_size(cpi, x, rate, distortion, skip, sse, |
| 1005 ref_best_rd, bs); | 1006 ref_best_rd, bs); |
| 1006 } else { | 1007 } else { |
| 1007 int r[TX_SIZES][2], s[TX_SIZES]; | 1008 int r[TX_SIZES][2], s[TX_SIZES]; |
| 1008 int64_t d[TX_SIZES]; | 1009 int64_t d[TX_SIZES]; |
| 1009 TX_SIZE tx_size; | 1010 TX_SIZE tx_size; |
| 1010 for (tx_size = TX_4X4; tx_size <= max_txsize_lookup[bs]; ++tx_size) | 1011 for (tx_size = TX_4X4; tx_size <= max_txsize_lookup[bs]; ++tx_size) |
| 1011 txfm_rd_in_plane(x, &r[tx_size][0], &d[tx_size], | 1012 txfm_rd_in_plane(x, &r[tx_size][0], &d[tx_size], |
| 1012 &s[tx_size], &sse[tx_size], | 1013 &s[tx_size], &sse[tx_size], |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2305 cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; | 2306 cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; |
| 2306 } | 2307 } |
| 2307 | 2308 |
| 2308 static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, | 2309 static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, |
| 2309 BLOCK_SIZE bsize, | 2310 BLOCK_SIZE bsize, |
| 2310 int mi_row, int mi_col, | 2311 int mi_row, int mi_col, |
| 2311 int_mv *tmp_mv, int *rate_mv) { | 2312 int_mv *tmp_mv, int *rate_mv) { |
| 2312 MACROBLOCKD *xd = &x->e_mbd; | 2313 MACROBLOCKD *xd = &x->e_mbd; |
| 2313 const VP9_COMMON *cm = &cpi->common; | 2314 const VP9_COMMON *cm = &cpi->common; |
| 2314 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; | 2315 MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; |
| 2315 struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}}; | 2316 struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; |
| 2316 int bestsme = INT_MAX; | 2317 int bestsme = INT_MAX; |
| 2317 int step_param; | 2318 int step_param; |
| 2318 int sadpb = x->sadperbit16; | 2319 int sadpb = x->sadperbit16; |
| 2319 MV mvp_full; | 2320 MV mvp_full; |
| 2320 int ref = mbmi->ref_frame[0]; | 2321 int ref = mbmi->ref_frame[0]; |
| 2321 MV ref_mv = mbmi->ref_mvs[ref][0].as_mv; | 2322 MV ref_mv = mbmi->ref_mvs[ref][0].as_mv; |
| 2322 | 2323 |
| 2323 int tmp_col_min = x->mv_col_min; | 2324 int tmp_col_min = x->mv_col_min; |
| 2324 int tmp_col_max = x->mv_col_max; | 2325 int tmp_col_max = x->mv_col_max; |
| 2325 int tmp_row_min = x->mv_row_min; | 2326 int tmp_row_min = x->mv_row_min; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 // Use mv result from single mode as mvp. | 2508 // Use mv result from single mode as mvp. |
| 2508 tmp_mv = frame_mv[refs[id]].as_mv; | 2509 tmp_mv = frame_mv[refs[id]].as_mv; |
| 2509 | 2510 |
| 2510 tmp_mv.col >>= 3; | 2511 tmp_mv.col >>= 3; |
| 2511 tmp_mv.row >>= 3; | 2512 tmp_mv.row >>= 3; |
| 2512 | 2513 |
| 2513 // Small-range full-pixel motion search | 2514 // Small-range full-pixel motion search |
| 2514 bestsme = vp9_refining_search_8p_c(x, &tmp_mv, sadpb, | 2515 bestsme = vp9_refining_search_8p_c(x, &tmp_mv, sadpb, |
| 2515 search_range, | 2516 search_range, |
| 2516 &cpi->fn_ptr[bsize], | 2517 &cpi->fn_ptr[bsize], |
| 2517 &ref_mv[id].as_mv, second_pred, | 2518 &ref_mv[id].as_mv, second_pred); |
| 2518 pw, ph); | |
| 2519 if (bestsme < INT_MAX) | 2519 if (bestsme < INT_MAX) |
| 2520 bestsme = vp9_get_mvpred_av_var(x, &tmp_mv, &ref_mv[id].as_mv, | 2520 bestsme = vp9_get_mvpred_av_var(x, &tmp_mv, &ref_mv[id].as_mv, |
| 2521 second_pred, &cpi->fn_ptr[bsize], 1); | 2521 second_pred, &cpi->fn_ptr[bsize], 1); |
| 2522 | 2522 |
| 2523 x->mv_col_min = tmp_col_min; | 2523 x->mv_col_min = tmp_col_min; |
| 2524 x->mv_col_max = tmp_col_max; | 2524 x->mv_col_max = tmp_col_max; |
| 2525 x->mv_row_min = tmp_row_min; | 2525 x->mv_row_min = tmp_row_min; |
| 2526 x->mv_row_max = tmp_row_max; | 2526 x->mv_row_max = tmp_row_max; |
| 2527 | 2527 |
| 2528 if (bestsme < INT_MAX) { | 2528 if (bestsme < INT_MAX) { |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } }; | 3062 int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } }; |
| 3063 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, | 3063 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, |
| 3064 VP9_ALT_FLAG }; | 3064 VP9_ALT_FLAG }; |
| 3065 int64_t best_rd = best_rd_so_far; | 3065 int64_t best_rd = best_rd_so_far; |
| 3066 int64_t best_tx_rd[TX_MODES]; | 3066 int64_t best_tx_rd[TX_MODES]; |
| 3067 int64_t best_tx_diff[TX_MODES]; | 3067 int64_t best_tx_diff[TX_MODES]; |
| 3068 int64_t best_pred_diff[REFERENCE_MODES]; | 3068 int64_t best_pred_diff[REFERENCE_MODES]; |
| 3069 int64_t best_pred_rd[REFERENCE_MODES]; | 3069 int64_t best_pred_rd[REFERENCE_MODES]; |
| 3070 int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; | 3070 int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; |
| 3071 int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; | 3071 int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; |
| 3072 MB_MODE_INFO best_mbmode = { 0 }; | 3072 MB_MODE_INFO best_mbmode; |
| 3073 int mode_index, best_mode_index = -1; | 3073 int mode_index, best_mode_index = -1; |
| 3074 unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; | 3074 unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; |
| 3075 vp9_prob comp_mode_p; | 3075 vp9_prob comp_mode_p; |
| 3076 int64_t best_intra_rd = INT64_MAX; | 3076 int64_t best_intra_rd = INT64_MAX; |
| 3077 int64_t best_inter_rd = INT64_MAX; | 3077 int64_t best_inter_rd = INT64_MAX; |
| 3078 PREDICTION_MODE best_intra_mode = DC_PRED; | 3078 PREDICTION_MODE best_intra_mode = DC_PRED; |
| 3079 MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME; | 3079 MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME; |
| 3080 INTERP_FILTER tmp_best_filter = SWITCHABLE; | 3080 INTERP_FILTER tmp_best_filter = SWITCHABLE; |
| 3081 int rate_uv_intra[TX_SIZES], rate_uv_tokenonly[TX_SIZES]; | 3081 int rate_uv_intra[TX_SIZES], rate_uv_tokenonly[TX_SIZES]; |
| 3082 int64_t dist_uv[TX_SIZES]; | 3082 int64_t dist_uv[TX_SIZES]; |
| 3083 int skip_uv[TX_SIZES]; | 3083 int skip_uv[TX_SIZES]; |
| 3084 PREDICTION_MODE mode_uv[TX_SIZES]; | 3084 PREDICTION_MODE mode_uv[TX_SIZES]; |
| 3085 int64_t mode_distortions[MB_MODE_COUNT] = {-1}; | 3085 int64_t mode_distortions[MB_MODE_COUNT] = {-1}; |
| 3086 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); | 3086 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); |
| 3087 const int bws = num_8x8_blocks_wide_lookup[bsize] / 2; | 3087 const int bws = num_8x8_blocks_wide_lookup[bsize] / 2; |
| 3088 const int bhs = num_8x8_blocks_high_lookup[bsize] / 2; | 3088 const int bhs = num_8x8_blocks_high_lookup[bsize] / 2; |
| 3089 int best_skip2 = 0; | 3089 int best_skip2 = 0; |
| 3090 int mode_skip_mask = 0; | 3090 int mode_skip_mask = 0; |
| 3091 int mode_skip_start = cpi->sf.mode_skip_start + 1; | 3091 int mode_skip_start = cpi->sf.mode_skip_start + 1; |
| 3092 const int *const rd_threshes = rd_opt->threshes[segment_id][bsize]; | 3092 const int *const rd_threshes = rd_opt->threshes[segment_id][bsize]; |
| 3093 const int *const rd_thresh_freq_fact = rd_opt->thresh_freq_fact[bsize]; | 3093 const int *const rd_thresh_freq_fact = rd_opt->thresh_freq_fact[bsize]; |
| 3094 const int mode_search_skip_flags = cpi->sf.mode_search_skip_flags; | 3094 const int mode_search_skip_flags = cpi->sf.mode_search_skip_flags; |
| 3095 const int intra_y_mode_mask = | 3095 const int intra_y_mode_mask = |
| 3096 cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]]; | 3096 cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]]; |
| 3097 int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize]; | 3097 int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize]; |
| 3098 | 3098 vp9_zero(best_mbmode); |
| 3099 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; | 3099 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; |
| 3100 | 3100 |
| 3101 estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp, | 3101 estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp, |
| 3102 &comp_mode_p); | 3102 &comp_mode_p); |
| 3103 | 3103 |
| 3104 for (i = 0; i < REFERENCE_MODES; ++i) | 3104 for (i = 0; i < REFERENCE_MODES; ++i) |
| 3105 best_pred_rd[i] = INT64_MAX; | 3105 best_pred_rd[i] = INT64_MAX; |
| 3106 for (i = 0; i < TX_MODES; i++) | 3106 for (i = 0; i < TX_MODES; i++) |
| 3107 best_tx_rd[i] = INT64_MAX; | 3107 best_tx_rd[i] = INT64_MAX; |
| 3108 for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) | 3108 for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3671 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; | 3671 struct buf_2d yv12_mb[4][MAX_MB_PLANE]; |
| 3672 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, | 3672 static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, |
| 3673 VP9_ALT_FLAG }; | 3673 VP9_ALT_FLAG }; |
| 3674 int64_t best_rd = best_rd_so_far; | 3674 int64_t best_rd = best_rd_so_far; |
| 3675 int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise | 3675 int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise |
| 3676 static const int64_t best_tx_diff[TX_MODES] = { 0 }; | 3676 static const int64_t best_tx_diff[TX_MODES] = { 0 }; |
| 3677 int64_t best_pred_diff[REFERENCE_MODES]; | 3677 int64_t best_pred_diff[REFERENCE_MODES]; |
| 3678 int64_t best_pred_rd[REFERENCE_MODES]; | 3678 int64_t best_pred_rd[REFERENCE_MODES]; |
| 3679 int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; | 3679 int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; |
| 3680 int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; | 3680 int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; |
| 3681 MB_MODE_INFO best_mbmode = { 0 }; | 3681 MB_MODE_INFO best_mbmode; |
| 3682 int ref_index, best_ref_index = 0; | 3682 int ref_index, best_ref_index = 0; |
| 3683 unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; | 3683 unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; |
| 3684 vp9_prob comp_mode_p; | 3684 vp9_prob comp_mode_p; |
| 3685 int64_t best_inter_rd = INT64_MAX; | 3685 int64_t best_inter_rd = INT64_MAX; |
| 3686 MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME; | 3686 MV_REFERENCE_FRAME best_inter_ref_frame = LAST_FRAME; |
| 3687 INTERP_FILTER tmp_best_filter = SWITCHABLE; | 3687 INTERP_FILTER tmp_best_filter = SWITCHABLE; |
| 3688 int rate_uv_intra, rate_uv_tokenonly; | 3688 int rate_uv_intra, rate_uv_tokenonly; |
| 3689 int64_t dist_uv; | 3689 int64_t dist_uv; |
| 3690 int skip_uv; | 3690 int skip_uv; |
| 3691 PREDICTION_MODE mode_uv = DC_PRED; | 3691 PREDICTION_MODE mode_uv = DC_PRED; |
| 3692 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); | 3692 int intra_cost_penalty = 20 * vp9_dc_quant(cm->base_qindex, cm->y_dc_delta_q); |
| 3693 int_mv seg_mvs[4][MAX_REF_FRAMES]; | 3693 int_mv seg_mvs[4][MAX_REF_FRAMES]; |
| 3694 b_mode_info best_bmodes[4]; | 3694 b_mode_info best_bmodes[4]; |
| 3695 int best_skip2 = 0; | 3695 int best_skip2 = 0; |
| 3696 int ref_frame_mask = 0; | 3696 int ref_frame_mask = 0; |
| 3697 int mode_skip_mask = 0; | 3697 int mode_skip_mask = 0; |
| 3698 | 3698 |
| 3699 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; | 3699 x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH; |
| 3700 vpx_memset(x->zcoeff_blk[TX_4X4], 0, 4); | 3700 vpx_memset(x->zcoeff_blk[TX_4X4], 0, 4); |
| 3701 vp9_zero(best_mbmode); |
| 3701 | 3702 |
| 3702 for (i = 0; i < 4; i++) { | 3703 for (i = 0; i < 4; i++) { |
| 3703 int j; | 3704 int j; |
| 3704 for (j = 0; j < MAX_REF_FRAMES; j++) | 3705 for (j = 0; j < MAX_REF_FRAMES; j++) |
| 3705 seg_mvs[i][j].as_int = INVALID_MV; | 3706 seg_mvs[i][j].as_int = INVALID_MV; |
| 3706 } | 3707 } |
| 3707 | 3708 |
| 3708 estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp, | 3709 estimate_ref_frame_costs(cm, xd, segment_id, ref_costs_single, ref_costs_comp, |
| 3709 &comp_mode_p); | 3710 &comp_mode_p); |
| 3710 | 3711 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4391 rd->thresh_mult_sub8x8[THR_GOLD] = INT_MAX; | 4392 rd->thresh_mult_sub8x8[THR_GOLD] = INT_MAX; |
| 4392 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) | 4393 if (!(cpi->ref_frame_flags & VP9_ALT_FLAG)) |
| 4393 rd->thresh_mult_sub8x8[THR_ALTR] = INT_MAX; | 4394 rd->thresh_mult_sub8x8[THR_ALTR] = INT_MAX; |
| 4394 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != | 4395 if ((cpi->ref_frame_flags & (VP9_LAST_FLAG | VP9_ALT_FLAG)) != |
| 4395 (VP9_LAST_FLAG | VP9_ALT_FLAG)) | 4396 (VP9_LAST_FLAG | VP9_ALT_FLAG)) |
| 4396 rd->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX; | 4397 rd->thresh_mult_sub8x8[THR_COMP_LA] = INT_MAX; |
| 4397 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != | 4398 if ((cpi->ref_frame_flags & (VP9_GOLD_FLAG | VP9_ALT_FLAG)) != |
| 4398 (VP9_GOLD_FLAG | VP9_ALT_FLAG)) | 4399 (VP9_GOLD_FLAG | VP9_ALT_FLAG)) |
| 4399 rd->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX; | 4400 rd->thresh_mult_sub8x8[THR_COMP_GA] = INT_MAX; |
| 4400 } | 4401 } |
| OLD | NEW |