diff options
-rw-r--r-- | md5_utils.c | 15 | ||||
-rw-r--r-- | vp10/encoder/encodemb.c | 2 | ||||
-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 | ||||
-rw-r--r-- | vpx_dsp/fwd_txfm.c | 1 | ||||
-rw-r--r-- | vpx_dsp/inv_txfm.c | 1 | ||||
-rw-r--r-- | vpx_dsp/loopfilter.c | 1 | ||||
-rw-r--r-- | vpx_dsp/quantize.c | 1 | ||||
-rw-r--r-- | vpx_dsp/vpx_dsp_common.h | 7 | ||||
-rw-r--r-- | vpx_dsp/x86/fwd_dct32x32_impl_avx2.h | 1 | ||||
-rw-r--r-- | vpx_dsp/x86/fwd_txfm_sse2.c | 1 | ||||
-rw-r--r-- | vpx_scale/generic/yv12extend.c | 2 |
19 files changed, 81 insertions, 52 deletions
diff --git a/md5_utils.c b/md5_utils.c index f4f893a2d..a9b979a41 100644 --- a/md5_utils.c +++ b/md5_utils.c @@ -150,12 +150,23 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx) { #define MD5STEP(f,w,x,y,z,in,s) \ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x) +#if defined(__clang__) && defined(__has_attribute) +#if __has_attribute(no_sanitize) +#define VPX_NO_UNSIGNED_OVERFLOW_CHECK \ + __attribute__((no_sanitize("unsigned-integer-overflow"))) +#endif +#endif + +#ifndef VPX_NO_UNSIGNED_OVERFLOW_CHECK +#define VPX_NO_UNSIGNED_OVERFLOW_CHECK +#endif + /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ -void +VPX_NO_UNSIGNED_OVERFLOW_CHECK void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) { register UWORD32 a, b, c, d; @@ -238,4 +249,6 @@ MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) { buf[3] += d; } +#undef VPX_NO_UNSIGNED_OVERFLOW_CHECK + #endif diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index 92ba4ddb4..fb11e466a 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -57,7 +57,7 @@ typedef struct vp10_token_state { int error; int next; int16_t token; - short qc; + tran_low_t qc; } vp10_token_state; // TODO(jimbankoski): experiment to find optimal RD numbers. 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; { diff --git a/vpx_dsp/fwd_txfm.c b/vpx_dsp/fwd_txfm.c index a5802e1f9..4c0d5db83 100644 --- a/vpx_dsp/fwd_txfm.c +++ b/vpx_dsp/fwd_txfm.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/fwd_txfm.h" void vpx_fdct4x4_c(const int16_t *input, tran_low_t *output, int stride) { diff --git a/vpx_dsp/inv_txfm.c b/vpx_dsp/inv_txfm.c index a0f59bf75..ff7533745 100644 --- a/vpx_dsp/inv_txfm.c +++ b/vpx_dsp/inv_txfm.c @@ -11,6 +11,7 @@ #include <math.h> #include <string.h> +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/inv_txfm.h" void vpx_iwht4x4_16_add_c(const tran_low_t *input, uint8_t *dest, int stride) { diff --git a/vpx_dsp/loopfilter.c b/vpx_dsp/loopfilter.c index 46ef64617..645a1ab95 100644 --- a/vpx_dsp/loopfilter.c +++ b/vpx_dsp/loopfilter.c @@ -11,6 +11,7 @@ #include <stdlib.h> #include "./vpx_config.h" +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/vpx_dsp_common.h" #include "vpx_ports/mem.h" diff --git a/vpx_dsp/quantize.c b/vpx_dsp/quantize.c index e4e741a90..6426cccc7 100644 --- a/vpx_dsp/quantize.c +++ b/vpx_dsp/quantize.c @@ -8,6 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/quantize.h" #include "vpx_mem/vpx_mem.h" diff --git a/vpx_dsp/vpx_dsp_common.h b/vpx_dsp/vpx_dsp_common.h index a9e180e79..a1d0a51ef 100644 --- a/vpx_dsp/vpx_dsp_common.h +++ b/vpx_dsp/vpx_dsp_common.h @@ -8,12 +8,11 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef VPX_DSP_COMMON_H_ -#define VPX_DSP_COMMON_H_ +#ifndef VPX_DSP_VPX_DSP_COMMON_H_ +#define VPX_DSP_VPX_DSP_COMMON_H_ #include "./vpx_config.h" #include "vpx/vpx_integer.h" -#include "vpx_dsp/vpx_dsp_common.h" #include "vpx_ports/mem.h" #ifdef __cplusplus @@ -67,4 +66,4 @@ static INLINE uint16_t clip_pixel_highbd(int val, int bd) { } // extern "C" #endif -#endif // VPX_DSP_COMMON_H_ +#endif // VPX_DSP_VPX_DSP_COMMON_H_ diff --git a/vpx_dsp/x86/fwd_dct32x32_impl_avx2.h b/vpx_dsp/x86/fwd_dct32x32_impl_avx2.h index 4df39dff8..951af3a62 100644 --- a/vpx_dsp/x86/fwd_dct32x32_impl_avx2.h +++ b/vpx_dsp/x86/fwd_dct32x32_impl_avx2.h @@ -10,6 +10,7 @@ #include <immintrin.h> // AVX2 +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/txfm_common.h" #define pair256_set_epi16(a, b) \ diff --git a/vpx_dsp/x86/fwd_txfm_sse2.c b/vpx_dsp/x86/fwd_txfm_sse2.c index e4deeecae..3e4f49bd9 100644 --- a/vpx_dsp/x86/fwd_txfm_sse2.c +++ b/vpx_dsp/x86/fwd_txfm_sse2.c @@ -11,6 +11,7 @@ #include <emmintrin.h> // SSE2 #include "./vpx_config.h" +#include "./vpx_dsp_rtcd.h" #include "vpx_dsp/vpx_dsp_common.h" #include "vpx_dsp/x86/fwd_txfm_sse2.h" diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c index 670144bc1..3eba563e9 100644 --- a/vpx_scale/generic/yv12extend.c +++ b/vpx_scale/generic/yv12extend.c @@ -211,7 +211,7 @@ void vpx_extend_frame_inner_borders_c(YV12_BUFFER_CONFIG *ybf) { } #if CONFIG_VP9_HIGHBITDEPTH -void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) { +static void memcpy_short_addr(uint8_t *dst8, const uint8_t *src8, int num) { uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); uint16_t *src = CONVERT_TO_SHORTPTR(src8); memcpy(dst, src, num * sizeof(uint16_t)); |