ref: 1f08824d6db735e4cacb0419785a789395e42b2b
parent: e3e1b493313cc9dd6808ebe78eb10b012777f003
parent: b2c34d55397c43812374e8fdf740c93406f6cb14
author: Dmitry Kovalev <dkovalev@google.com>
date: Mon Mar 10 16:50:58 EDT 2014
Merge "Using enums instead of integers."
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -97,7 +97,7 @@
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;
@@ -1408,6 +1408,10 @@
case MODE_GOODQUALITY:
cpi->pass = 0;
cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
+ break;
+
+ case MODE_BESTQUALITY:
+ cpi->pass = 0;
break;
case MODE_FIRSTPASS:
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -442,8 +442,6 @@
int avg_frame_size;
} LAYER_CONTEXT;
-#define MAX_SEGMENTS 8
-
typedef enum {
NORMAL = 0,
FOURFIVE = 1,
@@ -522,7 +520,7 @@
// 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 @@
// ----------------------------------------------------------------
// DATARATE CONTROL OPTIONS
- int end_usage; // vbr or cbr
+ END_USAGE end_usage; // vbr or cbr
// buffer targeting aggressiveness
int under_shoot_pct;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -577,33 +577,27 @@
}
static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
- unsigned long duration,
- unsigned long deadline) {
- unsigned int new_qc;
+ unsigned long duration,
+ unsigned long deadline) {
+ // Use best quality mode if no deadline is given.
+ MODE new_qc = MODE_BESTQUALITY;
- /* Use best quality mode if no deadline is given. */
- new_qc = MODE_BESTQUALITY;
-
if (deadline) {
- uint64_t duration_us;
+ // 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;
- /* 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;
+ // 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;
--
⑨