diff options
author | Paul Wilkins <paulwilkins@google.com> | 2018-09-06 14:23:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-09-06 14:23:54 +0000 |
commit | bb582b50fcf20e923f260fb1e952f0f7e1d5ebb2 (patch) | |
tree | 5fb62b383f05f26a486b986a797f5ea22e7cedb9 /vp9/encoder | |
parent | 4c06c02ad51479843f3cb650d270eb41f582a679 (diff) | |
parent | ce29b592822563a4e691d8793bdf5d4f87b27926 (diff) | |
download | libvpx-bb582b50fcf20e923f260fb1e952f0f7e1d5ebb2.tar libvpx-bb582b50fcf20e923f260fb1e952f0f7e1d5ebb2.tar.gz libvpx-bb582b50fcf20e923f260fb1e952f0f7e1d5ebb2.tar.bz2 libvpx-bb582b50fcf20e923f260fb1e952f0f7e1d5ebb2.zip |
Merge "Revert "Revert "Prevent double application of min rate in two pass."""
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 25 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.h | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index c0eafdebd..cc798e9f1 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -47,8 +47,6 @@ #define MIN_BPB_FACTOR 0.005 #define MAX_BPB_FACTOR 50 -#define FRAME_OVERHEAD_BITS 200 - #if CONFIG_VP9_HIGHBITDEPTH #define ASSIGN_MINQ_TABLE(bit_depth, name) \ do { \ @@ -212,18 +210,23 @@ int vp9_estimate_bits_at_q(FRAME_TYPE frame_type, int q, int mbs, int vp9_rc_clamp_pframe_target_size(const VP9_COMP *const cpi, int target) { const RATE_CONTROL *rc = &cpi->rc; const VP9EncoderConfig *oxcf = &cpi->oxcf; - const int min_frame_target = - VPXMAX(rc->min_frame_bandwidth, rc->avg_frame_bandwidth >> 5); - if (target < min_frame_target) target = min_frame_target; - if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) { - // If there is an active ARF at this location use the minimum - // bits on this frame even if it is a constructed arf. - // The active maximum quantizer insures that an appropriate - // number of bits will be spent if needed for constructed ARFs. - target = min_frame_target; + + if (cpi->oxcf.pass != 2) { + const int min_frame_target = + VPXMAX(rc->min_frame_bandwidth, rc->avg_frame_bandwidth >> 5); + if (target < min_frame_target) target = min_frame_target; + if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) { + // If there is an active ARF at this location use the minimum + // bits on this frame even if it is a constructed arf. + // The active maximum quantizer insures that an appropriate + // number of bits will be spent if needed for constructed ARFs. + target = min_frame_target; + } } + // Clip the frame target to the maximum allowed value. if (target > rc->max_frame_bandwidth) target = rc->max_frame_bandwidth; + if (oxcf->rc_max_inter_bitrate_pct) { const int max_rate = rc->avg_frame_bandwidth * oxcf->rc_max_inter_bitrate_pct / 100; diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h index 87b1ec33e..cf37117f9 100644 --- a/vp9/encoder/vp9_ratectrl.h +++ b/vp9/encoder/vp9_ratectrl.h @@ -32,6 +32,8 @@ extern "C" { #define FIXED_GF_INTERVAL 8 // Used in some testing modes only #define ONEHALFONLY_RESIZE 0 +#define FRAME_OVERHEAD_BITS 200 + // Threshold used to define a KF group as static (e.g. a slide show). // Essentially this means that no frame in the group has more than 1% of MBs // that are not marked as coded with 0,0 motion in the first pass. |