From 02ae3dd3364272c107f46b3be398f47cb8852d4f Mon Sep 17 00:00:00 2001 From: Thomas Daede <tdaede@mozilla.com> Date: Tue, 1 Mar 2016 14:29:47 -0800 Subject: [PATCH] Make deadline mode not depend on frame duration. Backwards compatible with old API. Change-Id: I65aa43f84bb9491e8cca73fe444094c2622b0187 --- av1/av1_cx_iface.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c index 4c226be21f..e5a81638b3 100644 --- a/av1/av1_cx_iface.c +++ b/av1/av1_cx_iface.c @@ -769,25 +769,21 @@ 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; @@ -932,7 +928,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 -- GitLab