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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 MACROBLOCKD *const xd = &x->e_mbd; | 2019 MACROBLOCKD *const xd = &x->e_mbd; |
2020 MODE_INFO *const mi = xd->mi[0].src_mi; | 2020 MODE_INFO *const mi = xd->mi[0].src_mi; |
2021 int_mv *const candidates = mi->mbmi.ref_mvs[ref_frame]; | 2021 int_mv *const candidates = mi->mbmi.ref_mvs[ref_frame]; |
2022 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; | 2022 const struct scale_factors *const sf = &cm->frame_refs[ref_frame - 1].sf; |
2023 | 2023 |
2024 // TODO(jkoleszar): Is the UV buffer ever used here? If so, need to make this | 2024 // TODO(jkoleszar): Is the UV buffer ever used here? If so, need to make this |
2025 // use the UV scaling factors. | 2025 // use the UV scaling factors. |
2026 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf, sf); | 2026 vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, sf, sf); |
2027 | 2027 |
2028 // Gets an initial list of candidate vectors from neighbours and orders them | 2028 // Gets an initial list of candidate vectors from neighbours and orders them |
2029 vp9_find_mv_refs(cm, xd, tile, mi, ref_frame, candidates, mi_row, mi_col, | 2029 vp9_find_mv_refs(cm, xd, tile, mi, ref_frame, candidates, mi_row, mi_col); |
2030 NULL, NULL); | |
2031 | 2030 |
2032 // Candidate refinement carried out at encoder and decoder | 2031 // Candidate refinement carried out at encoder and decoder |
2033 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, | 2032 vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, |
2034 &frame_nearest_mv[ref_frame], | 2033 &frame_nearest_mv[ref_frame], |
2035 &frame_near_mv[ref_frame]); | 2034 &frame_near_mv[ref_frame]); |
2036 | 2035 |
2037 // Further refinement that is encode side only to test the top few candidates | 2036 // Further refinement that is encode side only to test the top few candidates |
2038 // in full and choose the best as the centre point for subsequent searches. | 2037 // in full and choose the best as the centre point for subsequent searches. |
2039 // The current implementation doesn't support scaling. | 2038 // The current implementation doesn't support scaling. |
2040 if (!vp9_is_scaled(sf) && block_size >= BLOCK_8X8) | 2039 if (!vp9_is_scaled(sf) && block_size >= BLOCK_8X8) |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 case ALTREF_FRAME: | 3040 case ALTREF_FRAME: |
3042 ref_frame_skip_mask[0] |= ALT_REF_MODE_MASK; | 3041 ref_frame_skip_mask[0] |= ALT_REF_MODE_MASK; |
3043 break; | 3042 break; |
3044 case NONE: | 3043 case NONE: |
3045 case MAX_REF_FRAMES: | 3044 case MAX_REF_FRAMES: |
3046 assert(0 && "Invalid Reference frame"); | 3045 assert(0 && "Invalid Reference frame"); |
3047 break; | 3046 break; |
3048 } | 3047 } |
3049 } | 3048 } |
3050 | 3049 |
3051 if ((ref_frame_skip_mask[0] & (1 << ref_frame)) && | 3050 if (ref_frame_skip_mask[0] & (1 << ref_frame) && |
3052 (ref_frame_skip_mask[1] & (1 << MAX(0, second_ref_frame)))) | 3051 ref_frame_skip_mask[1] & (1 << MAX(0, second_ref_frame))) |
3053 continue; | 3052 continue; |
3054 | 3053 |
3055 if (mode_skip_mask[ref_frame] & (1 << this_mode)) | 3054 if (mode_skip_mask[ref_frame] & (1 << this_mode)) |
3056 continue; | 3055 continue; |
3057 | 3056 |
3058 // Test best rd so far against threshold for trying this mode. | 3057 // Test best rd so far against threshold for trying this mode. |
3059 if (best_mode_skippable && sf->schedule_mode_search) | 3058 if (best_mode_skippable && sf->schedule_mode_search) |
3060 mode_threshold[mode_index] <<= 1; | 3059 mode_threshold[mode_index] <<= 1; |
3061 | 3060 |
3062 if (best_rd < mode_threshold[mode_index]) | 3061 if (best_rd < mode_threshold[mode_index]) |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3744 ref_frame_skip_mask[0] |= (1 << GOLDEN_FRAME) | (1 << LAST_FRAME); | 3743 ref_frame_skip_mask[0] |= (1 << GOLDEN_FRAME) | (1 << LAST_FRAME); |
3745 break; | 3744 break; |
3746 case NONE: | 3745 case NONE: |
3747 case MAX_REF_FRAMES: | 3746 case MAX_REF_FRAMES: |
3748 assert(0 && "Invalid Reference frame"); | 3747 assert(0 && "Invalid Reference frame"); |
3749 break; | 3748 break; |
3750 } | 3749 } |
3751 } | 3750 } |
3752 } | 3751 } |
3753 | 3752 |
3754 if ((ref_frame_skip_mask[0] & (1 << ref_frame)) && | 3753 if (ref_frame_skip_mask[0] & (1 << ref_frame) && |
3755 (ref_frame_skip_mask[1] & (1 << MAX(0, second_ref_frame)))) | 3754 ref_frame_skip_mask[1] & (1 << MAX(0, second_ref_frame))) |
3756 continue; | 3755 continue; |
3757 | 3756 |
3758 // Test best rd so far against threshold for trying this mode. | 3757 // Test best rd so far against threshold for trying this mode. |
3759 if (rd_less_than_thresh(best_rd, | 3758 if (rd_less_than_thresh(best_rd, |
3760 rd_opt->threshes[segment_id][bsize][ref_index], | 3759 rd_opt->threshes[segment_id][bsize][ref_index], |
3761 tile_data->thresh_freq_fact[bsize][ref_index])) | 3760 tile_data->thresh_freq_fact[bsize][ref_index])) |
3762 continue; | 3761 continue; |
3763 | 3762 |
3764 comp_pred = second_ref_frame > INTRA_FRAME; | 3763 comp_pred = second_ref_frame > INTRA_FRAME; |
3765 if (comp_pred) { | 3764 if (comp_pred) { |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4226 if (cm->interp_filter == SWITCHABLE) | 4225 if (cm->interp_filter == SWITCHABLE) |
4227 assert(best_filter_diff[SWITCHABLE_FILTERS] == 0); | 4226 assert(best_filter_diff[SWITCHABLE_FILTERS] == 0); |
4228 } else { | 4227 } else { |
4229 vp9_zero(best_filter_diff); | 4228 vp9_zero(best_filter_diff); |
4230 } | 4229 } |
4231 | 4230 |
4232 store_coding_context(x, ctx, best_ref_index, | 4231 store_coding_context(x, ctx, best_ref_index, |
4233 best_pred_diff, best_tx_diff, best_filter_diff, 0); | 4232 best_pred_diff, best_tx_diff, best_filter_diff, 0); |
4234 } | 4233 } |
4235 | 4234 |
OLD | NEW |