Commit b2c34d55 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Using enums instead of integers.

Change-Id: Ic0d74ab3a4c0c854fbcf59d9df5212c218bc68f9
parent 29beeff1
...@@ -97,7 +97,7 @@ void vp9_init_quantizer(VP9_COMP *cpi); ...@@ -97,7 +97,7 @@ void vp9_init_quantizer(VP9_COMP *cpi);
static const double in_frame_q_adj_ratio[MAX_SEGMENTS] = 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}; {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) { switch (mode) {
case NORMAL: case NORMAL:
*hr = 1; *hr = 1;
...@@ -1410,6 +1410,10 @@ void vp9_change_config(struct VP9_COMP *cpi, VP9_CONFIG *oxcf) { ...@@ -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); cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
break; break;
case MODE_BESTQUALITY:
cpi->pass = 0;
break;
case MODE_FIRSTPASS: case MODE_FIRSTPASS:
cpi->pass = 1; cpi->pass = 1;
break; break;
......
...@@ -442,8 +442,6 @@ typedef struct { ...@@ -442,8 +442,6 @@ typedef struct {
int avg_frame_size; int avg_frame_size;
} LAYER_CONTEXT; } LAYER_CONTEXT;
#define MAX_SEGMENTS 8
typedef enum { typedef enum {
NORMAL = 0, NORMAL = 0,
FOURFIVE = 1, FOURFIVE = 1,
...@@ -522,7 +520,7 @@ typedef struct { ...@@ -522,7 +520,7 @@ typedef struct {
// were generated in the first encoding pass to create the compressed // were generated in the first encoding pass to create the compressed
// output using the highest possible quality, and taking a // output using the highest possible quality, and taking a
// longer amount of time to encode.. ( speed setting ignored ) // longer amount of time to encode.. ( speed setting ignored )
int mode; MODE mode;
// Key Framing Operations // Key Framing Operations
int auto_key; // autodetect cut scenes and set the keyframes int auto_key; // autodetect cut scenes and set the keyframes
...@@ -533,7 +531,7 @@ typedef struct { ...@@ -533,7 +531,7 @@ typedef struct {
// ---------------------------------------------------------------- // ----------------------------------------------------------------
// DATARATE CONTROL OPTIONS // DATARATE CONTROL OPTIONS
int end_usage; // vbr or cbr END_USAGE end_usage; // vbr or cbr
// buffer targeting aggressiveness // buffer targeting aggressiveness
int under_shoot_pct; int under_shoot_pct;
......
...@@ -577,33 +577,27 @@ static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) { ...@@ -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, static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
unsigned long duration, unsigned long duration,
unsigned long deadline) { unsigned long deadline) {
unsigned int new_qc; // 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) { if (deadline) {
uint64_t duration_us; // Convert duration parameter from stream timebase to microseconds
const uint64_t duration_us = (uint64_t)duration * 1000000 *
/* Convert duration parameter from stream timebase to microseconds */ (uint64_t)ctx->cfg.g_timebase.num /
duration_us = (uint64_t)duration * 1000000 (uint64_t)ctx->cfg.g_timebase.den;
* (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.
/* If the deadline is more that the duration this frame is to be shown, new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
* 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) if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
new_qc = MODE_FIRSTPASS; new_qc = MODE_FIRSTPASS;
else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS) else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
new_qc = (new_qc == MODE_BESTQUALITY) new_qc = (new_qc == MODE_BESTQUALITY) ? MODE_SECONDPASS_BEST
? MODE_SECONDPASS_BEST : MODE_SECONDPASS;
: MODE_SECONDPASS;
if (ctx->oxcf.mode != new_qc) { if (ctx->oxcf.mode != new_qc) {
ctx->oxcf.mode = new_qc; ctx->oxcf.mode = new_qc;
......
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