diff options
Diffstat (limited to 'vp9/encoder/vp9_encodeframe.c')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index bf60027a5..7b6da6c39 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -2156,7 +2156,7 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) { vp9_zero(cm->counts.single_ref); vp9_zero(cm->counts.comp_ref); vp9_zero(cm->counts.tx); - vp9_zero(cm->counts.mbskip); + vp9_zero(cm->counts.skip); // Note: this memset assumes above_context[0], [1] and [2] // are allocated as part of the same buffer. @@ -2411,15 +2411,15 @@ static void reset_skip_txfm_size(VP9_COMMON *cm, TX_SIZE txfm_max) { } } -static int get_frame_type(VP9_COMP *cpi) { +static MV_REFERENCE_FRAME get_frame_type(VP9_COMP *cpi) { if (frame_is_intra_only(&cpi->common)) - return 0; + return INTRA_FRAME; else if (cpi->rc.is_src_frame_alt_ref && cpi->refresh_golden_frame) - return 3; + return ALTREF_FRAME; else if (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame) - return 1; + return LAST_FRAME; else - return 2; + return GOLDEN_FRAME; } static void select_tx_mode(VP9_COMP *cpi) { @@ -2734,7 +2734,6 @@ void vp9_encode_frame(VP9_COMP *cpi) { if (cpi->sf.RD) { int i; REFERENCE_MODE reference_mode; - INTERP_FILTER interp_filter; /* * This code does a single RD pass over the whole frame assuming * either compound, single or hybrid prediction as per whatever has @@ -2744,7 +2743,7 @@ void vp9_encode_frame(VP9_COMP *cpi) { * that for subsequent frames. * It does the same analysis for transform size selection also. */ - const int frame_type = get_frame_type(cpi); + const MV_REFERENCE_FRAME frame_type = get_frame_type(cpi); const int64_t *mode_thresh = cpi->rd_prediction_type_threshes[frame_type]; const int64_t *filter_thresh = cpi->rd_filter_threshes[frame_type]; @@ -2762,22 +2761,18 @@ void vp9_encode_frame(VP9_COMP *cpi) { else reference_mode = REFERENCE_MODE_SELECT; - /* filter type selection */ - // FIXME(rbultje) for some odd reason, we often select smooth_filter - // as default filter for ARF overlay frames. This is a REALLY BAD - // IDEA so we explicitly disable it here. - if (frame_type != 3 && - filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP] && - filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP_SHARP] && - filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[SWITCHABLE - 1]) { - interp_filter = EIGHTTAP_SMOOTH; - } else if (filter_thresh[EIGHTTAP_SHARP] > filter_thresh[EIGHTTAP] && - filter_thresh[EIGHTTAP_SHARP] > filter_thresh[SWITCHABLE - 1]) { - interp_filter = EIGHTTAP_SHARP; - } else if (filter_thresh[EIGHTTAP] > filter_thresh[SWITCHABLE - 1]) { - interp_filter = EIGHTTAP; - } else { - interp_filter = SWITCHABLE; + if (cm->interp_filter == SWITCHABLE) { + if (frame_type != ALTREF_FRAME && + filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP] && + filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[EIGHTTAP_SHARP] && + filter_thresh[EIGHTTAP_SMOOTH] > filter_thresh[SWITCHABLE - 1]) { + cm->interp_filter = EIGHTTAP_SMOOTH; + } else if (filter_thresh[EIGHTTAP_SHARP] > filter_thresh[EIGHTTAP] && + filter_thresh[EIGHTTAP_SHARP] > filter_thresh[SWITCHABLE - 1]) { + cm->interp_filter = EIGHTTAP_SHARP; + } else if (filter_thresh[EIGHTTAP] > filter_thresh[SWITCHABLE - 1]) { + cm->interp_filter = EIGHTTAP; + } } cpi->mb.e_mbd.lossless = cpi->oxcf.lossless; @@ -2785,9 +2780,8 @@ void vp9_encode_frame(VP9_COMP *cpi) { /* transform size selection (4x4, 8x8, 16x16 or select-per-mb) */ select_tx_mode(cpi); cm->reference_mode = reference_mode; - cm->interp_filter = interp_filter; - if (cpi->oxcf.mode == MODE_REALTIME) + if (cpi->sf.super_fast_rtc) encode_rtc_frame_internal(cpi); else encode_frame_internal(cpi); @@ -2868,7 +2862,12 @@ void vp9_encode_frame(VP9_COMP *cpi) { } } } else { - encode_rtc_frame_internal(cpi); + // Force the usage of the BILINEAR interp_filter. + cm->interp_filter = BILINEAR; + if (cpi->sf.super_fast_rtc) + encode_rtc_frame_internal(cpi); + else + encode_frame_internal(cpi); } } @@ -2945,7 +2944,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled, const int mi_height = num_8x8_blocks_high_lookup[bsize]; x->skip_recode = !x->select_txfm_size && mbmi->sb_type >= BLOCK_8X8 && (cpi->oxcf.aq_mode != COMPLEXITY_AQ) && - cpi->oxcf.mode != MODE_REALTIME; + !cpi->sf.super_fast_rtc; x->skip_optimize = ctx->is_coded; ctx->is_coded = 1; x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct; @@ -3001,7 +3000,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled, } else { mbmi->skip_coeff = 1; if (output_enabled) - cm->counts.mbskip[vp9_get_skip_context(xd)][1]++; + cm->counts.skip[vp9_get_skip_context(xd)][1]++; reset_skip_context(xd, MAX(bsize, BLOCK_8X8)); } |