Index: source/libvpx/vp9/encoder/vp9_ratectrl.h |
diff --git a/source/libvpx/vp9/encoder/vp9_ratectrl.h b/source/libvpx/vp9/encoder/vp9_ratectrl.h |
index cf709274db361d50fac633afc0894b59fb5c0882..705796a8de67936a8eb788039e1212b67823588b 100644 |
--- a/source/libvpx/vp9/encoder/vp9_ratectrl.h |
+++ b/source/libvpx/vp9/encoder/vp9_ratectrl.h |
@@ -33,6 +33,27 @@ typedef enum { |
RATE_FACTOR_LEVELS = 5 |
} RATE_FACTOR_LEVEL; |
+// Internal frame scaling level. |
+typedef enum { |
+ UNSCALED = 0, // Frame is unscaled. |
+ SCALE_STEP1 = 1, // First-level down-scaling. |
+ FRAME_SCALE_STEPS |
+} FRAME_SCALE_LEVEL; |
+ |
+// Frame dimensions multiplier wrt the native frame size, in 1/16ths, |
+// specified for the scale-up case. |
+// e.g. 24 => 16/24 = 2/3 of native size. The restriction to 1/16th is |
+// intended to match the capabilities of the normative scaling filters, |
+// giving precedence to the up-scaling accuracy. |
+static const int frame_scale_factor[FRAME_SCALE_STEPS] = {16, 24}; |
+ |
+// Multiplier of the target rate to be used as threshold for triggering scaling. |
+static const double rate_thresh_mult[FRAME_SCALE_STEPS] = {1.0, 2.0}; |
+ |
+// Scale dependent Rate Correction Factor multipliers. Compensates for the |
+// greater number of bits per pixel generated in down-scaled frames. |
+static const double rcf_mult[FRAME_SCALE_STEPS] = {1.0, 2.0}; |
+ |
typedef struct { |
// Rate targetting variables |
int base_frame_target; // A baseline frame target before adjustment |
@@ -55,6 +76,7 @@ typedef struct { |
int max_gf_interval; |
int static_scene_max_gf_interval; |
int baseline_gf_interval; |
+ int constrained_gf_group; |
int frames_to_key; |
int frames_since_key; |
int this_key_frame_forced; |
@@ -99,6 +121,7 @@ typedef struct { |
int64_t starting_buffer_level; |
int64_t optimal_buffer_level; |
int64_t maximum_buffer_size; |
+ |
// rate control history for last frame(1) and the frame before(2). |
// -1: undershot |
// 1: overshoot |
@@ -107,6 +130,13 @@ typedef struct { |
int rc_2_frame; |
int q_1_frame; |
int q_2_frame; |
+ |
+ // Auto frame-scaling variables. |
+ FRAME_SCALE_LEVEL frame_size_selector; |
+ FRAME_SCALE_LEVEL next_frame_size_selector; |
+ int frame_width[FRAME_SCALE_STEPS]; |
+ int frame_height[FRAME_SCALE_STEPS]; |
+ int rf_level_maxq[RATE_FACTOR_LEVELS]; |
} RATE_CONTROL; |
struct VP9_COMP; |
@@ -159,7 +189,7 @@ void vp9_rc_postencode_update_drop_frame(struct VP9_COMP *cpi); |
// Updates rate correction factors |
// Changes only the rate correction factors in the rate control structure. |
-void vp9_rc_update_rate_correction_factors(struct VP9_COMP *cpi, int damp_var); |
+void vp9_rc_update_rate_correction_factors(struct VP9_COMP *cpi); |
// Decide if we should drop this frame: For 1-pass CBR. |
// Changes only the decimation count in the rate control structure |
@@ -204,6 +234,8 @@ int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type, |
int qindex, double rate_target_ratio, |
vpx_bit_depth_t bit_depth); |
+int vp9_frame_type_qdelta(const struct VP9_COMP *cpi, int rf_level, int q); |
+ |
void vp9_rc_update_framerate(struct VP9_COMP *cpi); |
void vp9_rc_set_gf_max_interval(const struct VP9_COMP *const cpi, |