Commit ac0a380e authored by Thomas Daede's avatar Thomas Daede Committed by Yaowu Xu

Make deadline mode not depend on frame duration.

Backwards compatible with old API.

cherry-picked #02ae3dd3 from aom/master.

Change-Id: I65aa43f84bb9491e8cca73fe444094c2622b0187
parent f56859f1
......@@ -819,25 +819,15 @@ static aom_codec_err_t encoder_destroy(aom_codec_alg_priv_t *ctx) {
}
static void pick_quickcompress_mode(aom_codec_alg_priv_t *ctx,
unsigned long duration,
unsigned long deadline) {
MODE new_mode = BEST;
switch (ctx->cfg.g_pass) {
case AOM_RC_ONE_PASS:
if (deadline > 0) {
const aom_codec_enc_cfg_t *const cfg = &ctx->cfg;
// Convert duration parameter from stream timebase to microseconds.
const uint64_t duration_us = (uint64_t)duration * 1000000 *
(uint64_t)cfg->g_timebase.num /
(uint64_t)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_mode = (deadline > duration_us) ? GOOD : REALTIME;
} else {
new_mode = BEST;
switch (deadline) {
case AOM_DL_BEST_QUALITY: new_mode = BEST; break;
case AOM_DL_REALTIME: new_mode = REALTIME; break;
default: new_mode = GOOD; break;
}
break;
case AOM_RC_FIRST_PASS: break;
......@@ -981,7 +971,7 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
}
}
pick_quickcompress_mode(ctx, duration, deadline);
pick_quickcompress_mode(ctx, deadline);
aom_codec_pkt_list_init(&ctx->pkt_list);
// Handle Flags
......
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