summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_onyx_if.c6
-rw-r--r--vp9/encoder/vp9_onyx_int.h6
-rw-r--r--vp9/vp9_cx_iface.c34
3 files changed, 21 insertions, 25 deletions
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 57d2c78ab..ebc0f7dc1 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -97,7 +97,7 @@ void vp9_init_quantizer(VP9_COMP *cpi);
static const double in_frame_q_adj_ratio[MAX_SEGMENTS] =
{1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
-static INLINE void Scale2Ratio(int mode, int *hr, int *hs) {
+static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) {
switch (mode) {
case NORMAL:
*hr = 1;
@@ -1410,6 +1410,10 @@ void vp9_change_config(struct VP9_COMP *cpi, VP9_CONFIG *oxcf) {
cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
break;
+ case MODE_BESTQUALITY:
+ cpi->pass = 0;
+ break;
+
case MODE_FIRSTPASS:
cpi->pass = 1;
break;
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index 1540d6e26..e2525234a 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -442,8 +442,6 @@ typedef struct {
int avg_frame_size;
} LAYER_CONTEXT;
-#define MAX_SEGMENTS 8
-
typedef enum {
NORMAL = 0,
FOURFIVE = 1,
@@ -522,7 +520,7 @@ typedef struct {
// were generated in the first encoding pass to create the compressed
// output using the highest possible quality, and taking a
// longer amount of time to encode.. ( speed setting ignored )
- int mode;
+ MODE mode;
// Key Framing Operations
int auto_key; // autodetect cut scenes and set the keyframes
@@ -533,7 +531,7 @@ typedef struct {
// ----------------------------------------------------------------
// DATARATE CONTROL OPTIONS
- int end_usage; // vbr or cbr
+ END_USAGE end_usage; // vbr or cbr
// buffer targeting aggressiveness
int under_shoot_pct;
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index 895fa1629..220fed9bd 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -577,33 +577,27 @@ static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) {
}
static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
- unsigned long duration,
- unsigned long deadline) {
- unsigned int new_qc;
-
- /* Use best quality mode if no deadline is given. */
- new_qc = MODE_BESTQUALITY;
+ unsigned long duration,
+ unsigned long deadline) {
+ // Use best quality mode if no deadline is given.
+ MODE new_qc = MODE_BESTQUALITY;
if (deadline) {
- uint64_t duration_us;
-
- /* Convert duration parameter from stream timebase to microseconds */
- duration_us = (uint64_t)duration * 1000000
- * (uint64_t)ctx->cfg.g_timebase.num
- / (uint64_t)ctx->cfg.g_timebase.den;
-
- /* If the deadline is more that the duration this frame is to be shown,
- * use good quality mode. Otherwise use realtime mode.
- */
- new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
+ // Convert duration parameter from stream timebase to microseconds
+ const uint64_t duration_us = (uint64_t)duration * 1000000 *
+ (uint64_t)ctx->cfg.g_timebase.num /
+ (uint64_t)ctx->cfg.g_timebase.den;
+
+ // If the deadline is more that the duration this frame is to be shown,
+ // use good quality mode. Otherwise use realtime mode.
+ new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
}
if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
new_qc = MODE_FIRSTPASS;
else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
- new_qc = (new_qc == MODE_BESTQUALITY)
- ? MODE_SECONDPASS_BEST
- : MODE_SECONDPASS;
+ new_qc = (new_qc == MODE_BESTQUALITY) ? MODE_SECONDPASS_BEST
+ : MODE_SECONDPASS;
if (ctx->oxcf.mode != new_qc) {
ctx->oxcf.mode = new_qc;