diff options
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_entropymv.h | 7 | ||||
-rw-r--r-- | vp9/decoder/vp9_detokenize.c | 10 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 11 |
3 files changed, 18 insertions, 10 deletions
diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h index a8cc7e93a..e2fe37a32 100644 --- a/vp9/common/vp9_entropymv.h +++ b/vp9/common/vp9_entropymv.h @@ -27,12 +27,9 @@ void vp9_init_mv_probs(struct VP9Common *cm); void vp9_adapt_mv_probs(struct VP9Common *cm, int usehp); -// Integer pel reference mv threshold for use of high-precision 1/8 mv -#define COMPANDED_MVREF_THRESH 8 - static INLINE int use_mv_hp(const MV *ref) { - return (abs(ref->row) >> 3) < COMPANDED_MVREF_THRESH && - (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH; + const int kMvRefThresh = 64; // threshold for use of high-precision 1/8 mv + return abs(ref->row) < kMvRefThresh && abs(ref->col) < kMvRefThresh; } #define MV_UPDATE_PROB 252 diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index 7048fb1ca..a441f3add 100644 --- a/vp9/decoder/vp9_detokenize.c +++ b/vp9/decoder/vp9_detokenize.c @@ -170,7 +170,12 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type, read_coeff(r, vp9_cat1_prob, 1, &value, &count, &range); } } +#if CONFIG_VP9_HIGHBITDEPTH + // val may use 18-bits + v = (int)(((int64_t)val * dqv) >> dq_shift); +#else v = (val * dqv) >> dq_shift; +#endif } else { if (read_bool(r, p[1], &value, &count, &range)) { token_cache[scan[c]] = 3; @@ -188,9 +193,8 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type, } #if CONFIG_COEFFICIENT_RANGE_CHECKING #if CONFIG_VP9_HIGHBITDEPTH - dqcoeff[scan[c]] = - highbd_check_range(read_bool(r, 128, &value, &count, &range) ? -v : v), - xd->bd); + dqcoeff[scan[c]] = highbd_check_range( + read_bool(r, 128, &value, &count, &range) ? -v : v, xd->bd); #else dqcoeff[scan[c]] = check_range(read_bool(r, 128, &value, &count, &range) ? -v : v); diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 272dde593..2f1fe360d 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -2093,6 +2093,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { double mv_in_out_accumulator = 0.0; double abs_mv_in_out_accumulator = 0.0; double mv_ratio_accumulator_thresh; + double mv_in_out_thresh; + double abs_mv_in_out_thresh; unsigned int allow_alt_ref = is_altref_enabled(cpi); int f_boost = 0; @@ -2136,6 +2138,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // Motion breakout threshold for loop below depends on image size. mv_ratio_accumulator_thresh = (cpi->initial_height + cpi->initial_width) / 4.0; + mv_in_out_thresh = (cpi->initial_height + cpi->initial_width) / 300.0; + abs_mv_in_out_thresh = (cpi->initial_height + cpi->initial_width) / 200.0; // Set a maximum and minimum interval for the GF group. // If the image appears almost completely static we can extend beyond this. @@ -2232,8 +2236,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ((rc->frames_to_key - i) >= rc->min_gf_interval) && (!flash_detected) && ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) || - (abs_mv_in_out_accumulator > 3.0) || - (mv_in_out_accumulator < -2.0) || + (abs_mv_in_out_accumulator > abs_mv_in_out_thresh) || + (mv_in_out_accumulator < -mv_in_out_thresh) || ((boost_score - old_boost_score) < BOOST_BREAKOUT)))) { boost_score = old_boost_score; break; @@ -2265,6 +2269,9 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { rc->source_alt_ref_pending = 0; } + // Limit maximum boost based on interval length. + rc->gfu_boost = VPXMIN((int)rc->gfu_boost, i * 200); + // Set the interval until the next gf. rc->baseline_gf_interval = i - (is_key_frame || rc->source_alt_ref_pending); |