Commit d8c34a25 authored by Paul Wilkins's avatar Paul Wilkins Committed by Gerrit Code Review
Browse files

Merge "Prevent double application of min rate in two pass."

parents 401e6d48 416b7051
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
#define MIN_BPB_FACTOR 0.005 #define MIN_BPB_FACTOR 0.005
#define MAX_BPB_FACTOR 50 #define MAX_BPB_FACTOR 50
#define FRAME_OVERHEAD_BITS 200
#if CONFIG_VP9_HIGHBITDEPTH #if CONFIG_VP9_HIGHBITDEPTH
#define ASSIGN_MINQ_TABLE(bit_depth, name) \ #define ASSIGN_MINQ_TABLE(bit_depth, name) \
do { \ do { \
...@@ -212,18 +210,23 @@ int vp9_estimate_bits_at_q(FRAME_TYPE frame_type, int q, int mbs, ...@@ -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) { int vp9_rc_clamp_pframe_target_size(const VP9_COMP *const cpi, int target) {
const RATE_CONTROL *rc = &cpi->rc; const RATE_CONTROL *rc = &cpi->rc;
const VP9EncoderConfig *oxcf = &cpi->oxcf; const VP9EncoderConfig *oxcf = &cpi->oxcf;
const int min_frame_target =
VPXMAX(rc->min_frame_bandwidth, rc->avg_frame_bandwidth >> 5); if (cpi->oxcf.pass != 2) {
if (target < min_frame_target) target = min_frame_target; const int min_frame_target =
if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) { VPXMAX(rc->min_frame_bandwidth, rc->avg_frame_bandwidth >> 5);
// If there is an active ARF at this location use the minimum if (target < min_frame_target) target = min_frame_target;
// bits on this frame even if it is a constructed arf. if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) {
// The active maximum quantizer insures that an appropriate // If there is an active ARF at this location use the minimum
// number of bits will be spent if needed for constructed ARFs. // bits on this frame even if it is a constructed arf.
target = min_frame_target; // 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. // Clip the frame target to the maximum allowed value.
if (target > rc->max_frame_bandwidth) target = rc->max_frame_bandwidth; if (target > rc->max_frame_bandwidth) target = rc->max_frame_bandwidth;
if (oxcf->rc_max_inter_bitrate_pct) { if (oxcf->rc_max_inter_bitrate_pct) {
const int max_rate = const int max_rate =
rc->avg_frame_bandwidth * oxcf->rc_max_inter_bitrate_pct / 100; rc->avg_frame_bandwidth * oxcf->rc_max_inter_bitrate_pct / 100;
......
...@@ -35,6 +35,8 @@ extern "C" { ...@@ -35,6 +35,8 @@ extern "C" {
#define FIXED_GF_INTERVAL 8 // Used in some testing modes only #define FIXED_GF_INTERVAL 8 // Used in some testing modes only
#define ONEHALFONLY_RESIZE 0 #define ONEHALFONLY_RESIZE 0
#define FRAME_OVERHEAD_BITS 200
typedef enum { typedef enum {
INTER_NORMAL = 0, INTER_NORMAL = 0,
INTER_HIGH = 1, INTER_HIGH = 1,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment