diff options
author | Minghai Shang <minghai@google.com> | 2014-08-18 14:51:04 -0700 |
---|---|---|
committer | Minghai Shang <minghai@google.com> | 2014-08-25 10:02:45 -0700 |
commit | d4a407c051a1aa85214e7b96c1ad1e0ba41c6e9e (patch) | |
tree | 8eac216cfbe8fdfd39a3bcf00ae5fabcf7b164e6 /vpx | |
parent | e1b5d24837ab0a786eab7897c663f22a30813b42 (diff) | |
download | libvpx-d4a407c051a1aa85214e7b96c1ad1e0ba41c6e9e.tar libvpx-d4a407c051a1aa85214e7b96c1ad1e0ba41c6e9e.tar.gz libvpx-d4a407c051a1aa85214e7b96c1ad1e0ba41c6e9e.tar.bz2 libvpx-d4a407c051a1aa85214e7b96c1ad1e0ba41c6e9e.zip |
[spatial svc]Multiple frame context feature
We can use one frame context for each layer so that we don't have
to reset the probs every frame. But we can't use prev_mi since we
may drop enhancement layers. So we have to generate a non vp9
compatible bitstream and modify it in the player.
1. We need to code all frames as invisible frame to let prev_mi
not to be used. But in the bitstream we need to code the
show_frame flag to 1 so that the publisher will know it's
supposed to be a visible frame.
2. In the player we need to change the show_frame flag to 0 for
all frames. Then add an one byte frame into the super frame
to tell the decoder which layer we want to show.
Change-Id: I75b7304cf31f0ab952f043e33c034495e88f01f3
Diffstat (limited to 'vpx')
-rw-r--r-- | vpx/src/svc_encodeframe.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/vpx/src/svc_encodeframe.c b/vpx/src/svc_encodeframe.c index 7828615b2..45b0dca5c 100644 --- a/vpx/src/svc_encodeframe.c +++ b/vpx/src/svc_encodeframe.c @@ -86,6 +86,7 @@ typedef struct SvcInternal { int layers; int layer; int is_keyframe; + int use_multiple_frame_contexts; FrameData *frame_list; FrameData *frame_temp; @@ -366,6 +367,7 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) { char *option_name; char *option_value; char *input_ptr; + SvcInternal *const si = get_svc_internal(svc_ctx); vpx_codec_err_t res = VPX_CODEC_OK; if (options == NULL) return VPX_CODEC_OK; @@ -393,6 +395,8 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) { } else if (strcmp("auto-alt-refs", option_name) == 0) { res = parse_auto_alt_ref(svc_ctx, option_value); if (res != VPX_CODEC_OK) break; + } else if (strcmp("multi-frame-contexts", option_name) == 0) { + si->use_multiple_frame_contexts = atoi(option_value); } else { svc_log(svc_ctx, SVC_LOG_ERROR, "invalid option: %s\n", option_name); res = VPX_CODEC_INVALID_PARAM; @@ -401,6 +405,10 @@ static vpx_codec_err_t parse_options(SvcContext *svc_ctx, const char *options) { option_name = strtok_r(NULL, "=", &input_ptr); } free(input_string); + + if (si->use_multiple_frame_contexts && svc_ctx->spatial_layers > 3) + res = VPX_CODEC_INVALID_PARAM; + return res; } @@ -534,7 +542,8 @@ vpx_codec_err_t vpx_svc_init(SvcContext *svc_ctx, vpx_codec_ctx_t *codec_ctx, enc_cfg->rc_buf_initial_sz = 500; enc_cfg->rc_buf_optimal_sz = 600; enc_cfg->rc_buf_sz = 1000; - enc_cfg->g_error_resilient = 1; + if (enc_cfg->g_error_resilient == 0 && si->use_multiple_frame_contexts == 0) + enc_cfg->g_error_resilient = 1; // Initialize codec res = vpx_codec_enc_init(codec_ctx, iface, enc_cfg, VPX_CODEC_USE_PSNR); |