Merge "Using enums instead of integers."
This commit is contained in:
commit
1f08824d6d
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user