diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/x86/vp9_idct_intrin_sse2.c | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_aq_360.c | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.c | 22 | ||||
-rw-r--r-- | vp9/encoder/vp9_aq_variance.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_noise_estimate.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_pickmode.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 53 | ||||
-rw-r--r-- | vp9/encoder/x86/vp9_frame_scale_ssse3.c | 12 |
9 files changed, 56 insertions, 45 deletions
diff --git a/vp9/common/x86/vp9_idct_intrin_sse2.c b/vp9/common/x86/vp9_idct_intrin_sse2.c index 8d312d03f..1c77b57ff 100644 --- a/vp9/common/x86/vp9_idct_intrin_sse2.c +++ b/vp9/common/x86/vp9_idct_intrin_sse2.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "./vp9_rtcd.h" #include "vpx_dsp/x86/inv_txfm_sse2.h" #include "vpx_dsp/x86/txfm_common_sse2.h" #include "vpx_ports/mem.h" diff --git a/vp9/encoder/vp9_aq_360.c b/vp9/encoder/vp9_aq_360.c index f8c187cc5..7d411f65d 100644 --- a/vp9/encoder/vp9_aq_360.c +++ b/vp9/encoder/vp9_aq_360.c @@ -13,6 +13,7 @@ #include "vpx_ports/mem.h" #include "vpx_ports/system_state.h" +#include "vp9/encoder/vp9_aq_360.h" #include "vp9/encoder/vp9_aq_variance.h" #include "vp9/common/vp9_seg_common.h" diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 6b651039c..3e1a0a522 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -393,13 +393,18 @@ static void cyclic_refresh_update_map(VP9_COMP *const cpi) { cr->target_num_seg_blocks = 0; if (cpi->oxcf.content != VP9E_CONTENT_SCREEN) { consec_zero_mv_thresh = 100; - if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) - consec_zero_mv_thresh = 80; } qindex_thresh = cpi->oxcf.content == VP9E_CONTENT_SCREEN ? vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST2, cm->base_qindex) : vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex); + // More aggressive settings for noisy content. + if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) { + consec_zero_mv_thresh = 80; + qindex_thresh = + VPXMAX(vp9_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST1, cm->base_qindex), + 7 * cm->base_qindex >> 3); + } do { int sum_map = 0; // Get the mi_row/mi_col corresponding to superblock index i. @@ -463,6 +468,8 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { cr->percent_refresh = 5; cr->max_qdelta_perc = 50; cr->time_for_refresh = 0; + cr->motion_thresh = 32; + cr->rate_boost_fac = 15; // Use larger delta-qp (increase rate_ratio_qdelta) for first few (~4) // periods of the refresh cycle, after a key frame. // Account for larger interval on base layer for temporal layers. @@ -472,9 +479,11 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { cr->rate_ratio_qdelta = 3.0; } else { cr->rate_ratio_qdelta = 2.0; - if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) - // Reduce the delta-qp if the estimated source noise is above threshold. - cr->rate_ratio_qdelta = 1.5; + if (cpi->noise_estimate.enabled && cpi->noise_estimate.level >= kMedium) { + // Reduce the delta-qp if the estimated source noise is above threshold. + cr->rate_ratio_qdelta = 1.7; + cr->rate_boost_fac = 13; + } } // Adjust some parameters for low resolutions at low bitrates. if (cm->width <= 352 && @@ -482,9 +491,6 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { rc->avg_frame_bandwidth < 3400) { cr->motion_thresh = 4; cr->rate_boost_fac = 10; - } else { - cr->motion_thresh = 32; - cr->rate_boost_fac = 15; } if (cpi->svc.spatial_layer_id > 0) { cr->motion_thresh = 4; diff --git a/vp9/encoder/vp9_aq_variance.c b/vp9/encoder/vp9_aq_variance.c index d8f7d0721..59ef5faa6 100644 --- a/vp9/encoder/vp9_aq_variance.c +++ b/vp9/encoder/vp9_aq_variance.c @@ -167,7 +167,7 @@ static unsigned int block_variance(VP9_COMP *cpi, MACROBLOCK *x, vp9_64_zeros, 0, bw, bh, &sse, &avg); #endif // CONFIG_VP9_HIGHBITDEPTH var = sse - (((int64_t)avg * avg) / (bw * bh)); - return (256 * var) / (bw * bh); + return (unsigned int)(((uint64_t)256 * var) / (bw * bh)); } else { #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -185,7 +185,7 @@ static unsigned int block_variance(VP9_COMP *cpi, MACROBLOCK *x, x->plane[0].src.stride, vp9_64_zeros, 0, &sse); #endif // CONFIG_VP9_HIGHBITDEPTH - return (256 * var) >> num_pels_log2_lookup[bs]; + return (unsigned int)(((uint64_t)256 * var) >> num_pels_log2_lookup[bs]); } } diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index b6d66db72..d53bddb1c 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -59,7 +59,7 @@ typedef struct vp9_token_state { int error; int next; int16_t token; - int16_t qc; + tran_low_t qc; } vp9_token_state; static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] ={ {10, 6}, {8, 7}, }; diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c index c3351afe0..4b43b3879 100644 --- a/vp9/encoder/vp9_noise_estimate.c +++ b/vp9/encoder/vp9_noise_estimate.c @@ -39,7 +39,7 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne, ne->num_frames_estimate = 20; } -int enable_noise_estimation(VP9_COMP *const cpi) { +static int enable_noise_estimation(VP9_COMP *const cpi) { // Enable noise estimation if denoising is on. #if CONFIG_VP9_TEMPORAL_DENOISING if (cpi->oxcf.noise_sensitivity > 0) @@ -101,7 +101,7 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) { const VP9_COMMON *const cm = &cpi->common; NOISE_ESTIMATE *const ne = &cpi->noise_estimate; // Estimate of noise level every frame_period frames. - int frame_period = 10; + int frame_period = 8; int thresh_consec_zeromv = 6; unsigned int thresh_sum_diff = 100; unsigned int thresh_sum_spatial = (200 * 200) << 8; diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index fd515987b..98fc603cb 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -1105,7 +1105,7 @@ static const REF_MODE ref_mode_set_svc[RT_INTER_MODES] = { {GOLDEN_FRAME, NEWMV} }; -int set_intra_cost_penalty(const VP9_COMP *const cpi, BLOCK_SIZE bsize) { +static int set_intra_cost_penalty(const VP9_COMP *const cpi, BLOCK_SIZE bsize) { const VP9_COMMON *const cm = &cpi->common; // Reduce the intra cost penalty for small blocks (<=16x16). int reduction_fac = diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 0675d4a00..b2d748e46 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -1512,6 +1512,22 @@ static int calc_iframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) { return vp9_rc_clamp_iframe_target_size(cpi, target); } +static void adjust_gf_key_frame(VP9_COMP *cpi) { + RATE_CONTROL *const rc = &cpi->rc; + rc->constrained_gf_group = 0; + // Reset gf interval to make more equal spacing for up-coming key frame. + if ((rc->frames_to_key <= 7 * rc->baseline_gf_interval >> 2) && + (rc->frames_to_key > rc->baseline_gf_interval)) { + rc->baseline_gf_interval = rc->frames_to_key >> 1; + rc->constrained_gf_group = 1; + } else { + // Reset since frames_till_gf_update_due must be <= frames_to_key. + if (rc->baseline_gf_interval > rc->frames_to_key) { + rc->baseline_gf_interval = rc->frames_to_key; + rc->constrained_gf_group = 1; + } + } +} void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; RATE_CONTROL *const rc = &cpi->rc; @@ -1541,31 +1557,19 @@ void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) { rc->baseline_gf_interval = (rc->min_gf_interval + rc->max_gf_interval) / 2; } - // Reset the gf interval to make more equal spacing for up-coming key frame. - if ((rc->frames_to_key <= 7 * rc->baseline_gf_interval >> 2) && - (rc->frames_to_key > rc->baseline_gf_interval)) { - rc->baseline_gf_interval = rc->frames_to_key >> 1; - } else { - // Increase gf interval at high Q and high overshoot. - if (cm->current_video_frame > 30 && - rc->avg_frame_qindex[INTER_FRAME] > (7 * rc->worst_quality) >> 3 && - rc->avg_intersize_gfint > (5 * rc->avg_frame_bandwidth) >> 1) { - rc->baseline_gf_interval = (3 * rc->baseline_gf_interval) >> 1; - } else if (cm->current_video_frame > 30 && - rc->avg_frame_low_motion < 20) { - // Decrease boost and gf interval for high motion case. - rc->gfu_boost = DEFAULT_GF_BOOST >> 1; - rc->baseline_gf_interval = VPXMIN(6, rc->baseline_gf_interval >> 1); - } + // Increase gf interval at high Q and high overshoot. + if (cm->current_video_frame > 30 && + rc->avg_frame_qindex[INTER_FRAME] > (7 * rc->worst_quality) >> 3 && + rc->avg_intersize_gfint > (5 * rc->avg_frame_bandwidth) >> 1) { + rc->baseline_gf_interval = (3 * rc->baseline_gf_interval) >> 1; + } else if (cm->current_video_frame > 30 && + rc->avg_frame_low_motion < 20) { + // Decrease boost and gf interval for high motion case. + rc->gfu_boost = DEFAULT_GF_BOOST >> 1; + rc->baseline_gf_interval = VPXMIN(6, rc->baseline_gf_interval >> 1); } + adjust_gf_key_frame(cpi); rc->frames_till_gf_update_due = rc->baseline_gf_interval; - // NOTE: frames_till_gf_update_due must be <= frames_to_key. - if (rc->frames_till_gf_update_due > rc->frames_to_key) { - rc->frames_till_gf_update_due = rc->frames_to_key; - rc->constrained_gf_group = 1; - } else { - rc->constrained_gf_group = 0; - } cpi->refresh_golden_frame = 1; rc->source_alt_ref_pending = USE_ALTREF_FOR_ONE_PASS; rc->avg_intersize_gfint = 0; @@ -2152,9 +2156,8 @@ void vp9_avg_source_sad(VP9_COMP *cpi) { rc->gfu_boost = DEFAULT_GF_BOOST >> 1; rc->baseline_gf_interval = VPXMIN(20, VPXMAX(10, rc->baseline_gf_interval)); + adjust_gf_key_frame(cpi); rc->frames_till_gf_update_due = rc->baseline_gf_interval; - if (rc->frames_till_gf_update_due > rc->frames_to_key) - rc->frames_till_gf_update_due = rc->frames_to_key; target = calc_pframe_target_size_one_pass_vbr(cpi); vp9_rc_set_frame_target(cpi, target); rc->count_last_scene_change = 0; diff --git a/vp9/encoder/x86/vp9_frame_scale_ssse3.c b/vp9/encoder/x86/vp9_frame_scale_ssse3.c index de903fa33..38af3b13a 100644 --- a/vp9/encoder/x86/vp9_frame_scale_ssse3.c +++ b/vp9/encoder/x86/vp9_frame_scale_ssse3.c @@ -23,9 +23,9 @@ extern void vp9_scale_and_extend_frame_c(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst); -void downsample_2_to_1_ssse3(const uint8_t *src, ptrdiff_t src_stride, - uint8_t *dst, ptrdiff_t dst_stride, - int w, int h) { +static void downsample_2_to_1_ssse3(const uint8_t *src, ptrdiff_t src_stride, + uint8_t *dst, ptrdiff_t dst_stride, + int w, int h) { const __m128i mask = _mm_set1_epi16(0x00FF); const int max_width = w & ~15; int y; @@ -92,9 +92,9 @@ static void eight_tap_row_ssse3(const uint8_t *src, uint8_t *dst, int w) { } } -void upsample_1_to_2_ssse3(const uint8_t *src, ptrdiff_t src_stride, - uint8_t *dst, ptrdiff_t dst_stride, - int dst_w, int dst_h) { +static void upsample_1_to_2_ssse3(const uint8_t *src, ptrdiff_t src_stride, + uint8_t *dst, ptrdiff_t dst_stride, + int dst_w, int dst_h) { dst_w /= 2; dst_h /= 2; { |