From 663916cea7b30c157e4df2de541dd196e07e07f6 Mon Sep 17 00:00:00 2001 From: Ivan Maltz Date: Fri, 11 Oct 2013 18:03:00 -0700 Subject: SVC improvements These changes were originally made in the Stratacaster team-review repository commit e114bffcd82ad74c3696ec58e13c0ac895d6c82d Author: Charles 'Buck' Krasic Date: Mon Oct 14 16:52:13 2013 -0700 Make dummy frame handling a bit more explicit, fixing bug with single layer encodes. Squashed commit of the following: commit 1ebbfd976c0fadb02bf1ea562a2d0e3f0206daad Merge: ac468dd 54e88b7 Author: Ivan Maltz Date: Fri Oct 11 17:29:58 2013 -0700 Move SVC code from vp9_spatial_scalable_encoder to libvpx module accessible from ffmpeg commit 54e88b78b160becc9569fc3c6cb6b0a8c95dc357 Author: Ivan Maltz Date: Tue Oct 8 09:08:40 2013 -0700 common svc encoding code for sample app and ffmpeg added svc_encodeframe.c, svc_context.h, svc_test.cc vp9_spatial_scalable_encoder uses vpx_svc_encode commit 5616ec8e2e3d3e8d277333d8a9242f6c70151162 Merge: 4528014 e29137d Author: Ivan Maltz Date: Tue Oct 8 08:47:58 2013 -0700 Merge branch 'master' into stratacaster commit 45280148450b1f3d61e390df8aadedf85cd5bce1 Merge: bb2b675 1ab60f7 Author: Sujeevan Rajayogam Date: Fri Oct 4 10:22:31 2013 -0700 Merge branch 'master' into stratacaster commit bb2b675e595dc9bfc8551e963edf56800c3aea61 Author: Sujeevan Rajayogam Date: Wed Oct 2 12:37:26 2013 -0700 Track individual frame sizes and psnrs instead of averages. commit c6d303b714795c81e7ceb4173967115c9f8ff5b7 Merge: fa87df9 3583087 Author: Sujeevan Rajayogam Date: Fri Sep 27 10:05:35 2013 -0700 Merge branch 'master' into stratacaster commit fa87df94fba923d9f7aeb8ae20c6e15f777e00b5 Merge: bf22d71 3c465af Author: Sujeevan Rajayogam Date: Thu Sep 26 16:10:31 2013 -0700 Merge branch 'master' into stratacaster commit bf22d7144895a82e0c348ac177c8a261b9e2b88e Author: Sujeevan Rajayogam Date: Thu Sep 26 11:10:34 2013 -0700 Parameterized quantizer, 16th scalefactors, more logging, enabled single layer encodes to generate baseline. commit ceffd7e6025b765f9886b5ea0f324248aa37e327 Author: Sujeevan Rajayogam Date: Thu Sep 19 10:04:49 2013 -0700 - Include new mode for 3 layer I frame with 5 total layers. - Refactor svc api. Change-Id: Ie4d775e21e006fa597d884c59488dc999478e9b5 --- vp9/common/vp9_onyx.h | 2 -- vp9/encoder/vp9_onyx_if.c | 28 ----------------- vp9/vp9_cx_iface.c | 80 ++++++++++++++--------------------------------- 3 files changed, 24 insertions(+), 86 deletions(-) (limited to 'vp9') diff --git a/vp9/common/vp9_onyx.h b/vp9/common/vp9_onyx.h index acb4724e5..452dd6b89 100644 --- a/vp9/common/vp9_onyx.h +++ b/vp9/common/vp9_onyx.h @@ -221,8 +221,6 @@ extern "C" int vp9_set_size_literal(VP9_PTR comp, unsigned int width, unsigned int height); - int vp9_switch_layer(VP9_PTR comp, int layer); - void vp9_set_svc(VP9_PTR comp, int use_svc); int vp9_get_quantizer(VP9_PTR c); diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index f6b2a2876..b52a101a5 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -4226,37 +4226,9 @@ int vp9_set_size_literal(VP9_PTR comp, unsigned int width, return 0; } -int vp9_switch_layer(VP9_PTR comp, int layer) { - VP9_COMP *cpi = (VP9_COMP *)comp; - - if (cpi->use_svc) { - cpi->current_layer = layer; - - // Use buffer i for layer i LST - cpi->lst_fb_idx = layer; - - // Use buffer i-1 for layer i Alt (Inter-layer prediction) - if (layer != 0) cpi->alt_fb_idx = layer - 1; - - // Use the rest for Golden - if (layer < 2 * cpi->number_spatial_layers - NUM_REF_FRAMES) - cpi->gld_fb_idx = cpi->lst_fb_idx; - else - cpi->gld_fb_idx = 2 * cpi->number_spatial_layers - 1 - layer; - - printf("Switching to layer %d:\n", layer); - printf("Using references: LST/GLD/ALT [%d|%d|%d]\n", cpi->lst_fb_idx, - cpi->gld_fb_idx, cpi->alt_fb_idx); - } else { - printf("Switching layer not supported. Enable SVC first \n"); - } - return 0; -} - void vp9_set_svc(VP9_PTR comp, int use_svc) { VP9_COMP *cpi = (VP9_COMP *)comp; cpi->use_svc = use_svc; - if (cpi->use_svc) printf("Enabled SVC encoder \n"); return; } diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index fb380e1db..b744ec6e6 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -442,8 +442,6 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, MAP(VP8E_SET_ARNR_TYPE, xcfg.arnr_type); MAP(VP8E_SET_TUNING, xcfg.tuning); MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level); - MAP(VP9E_SET_MAX_Q, ctx->cfg.rc_max_quantizer); - MAP(VP9E_SET_MIN_Q, ctx->cfg.rc_min_quantizer); MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct); MAP(VP9E_SET_LOSSLESS, xcfg.lossless); MAP(VP9E_SET_FRAME_PARALLEL_DECODING, xcfg.frame_parallel_decoding_mode); @@ -1029,66 +1027,40 @@ static vpx_codec_err_t vp9e_set_scalemode(vpx_codec_alg_priv_t *ctx, } } -static vpx_codec_err_t vp9e_set_width(vpx_codec_alg_priv_t *ctx, int ctr_id, - va_list args) { - unsigned int *data = va_arg(args, unsigned int *); - if (data) { - int res; - res = vp9_set_size_literal(ctx->cpi, *data, 0); - if (!res) { - return VPX_CODEC_OK; - } else { - return VPX_CODEC_INVALID_PARAM; - } - } else { - return VPX_CODEC_INVALID_PARAM; - } +static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id, + va_list args) { + int data = va_arg(args, int); + vp9_set_svc(ctx->cpi, data); + return VPX_CODEC_OK; } -static vpx_codec_err_t vp9e_set_height(vpx_codec_alg_priv_t *ctx, - int ctr_id, - va_list args) { - unsigned int *data = va_arg(args, unsigned int *); - - if (data) { - int res; - res = vp9_set_size_literal(ctx->cpi, 0, *data); +static vpx_codec_err_t vp9e_set_svc_parameters(vpx_codec_alg_priv_t *ctx, + int ctr_id, va_list args) { + vpx_svc_parameters_t *data = va_arg(args, vpx_svc_parameters_t *); + VP9_COMP *cpi = (VP9_COMP *)ctx->cpi; + vpx_svc_parameters_t params; - if (!res) { - return VPX_CODEC_OK; - } else { - return VPX_CODEC_INVALID_PARAM; - } - } else { + if (!data) { return VPX_CODEC_INVALID_PARAM; } -} - -static vpx_codec_err_t vp9e_set_layer(vpx_codec_alg_priv_t *ctx, - int ctr_id, - va_list args) { - unsigned int *data = va_arg(args, unsigned int *); - if (data) { - int res; - res = 0; + params = *(vpx_svc_parameters_t *)data; - res = vp9_switch_layer(ctx->cpi, *data); + cpi->current_layer = params.layer; + cpi->lst_fb_idx = params.lst_fb_idx; + cpi->gld_fb_idx = params.gld_fb_idx; + cpi->alt_fb_idx = params.alt_fb_idx; - if (!res) { - return VPX_CODEC_OK; - } else { - return VPX_CODEC_INVALID_PARAM; - } - } else { + if (vp9_set_size_literal(ctx->cpi, params.width, params.height) != 0) { return VPX_CODEC_INVALID_PARAM; } -} -static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id, - va_list args) { - int data = va_arg(args, int); - vp9_set_svc(ctx->cpi, data); + ctx->cfg.rc_max_quantizer = params.max_quantizer; + ctx->cfg.rc_min_quantizer = params.min_quantizer; + + set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg); + vp9_change_config(ctx->cpi, &ctx->oxcf); + return VPX_CODEC_OK; } @@ -1116,16 +1088,12 @@ static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = { {VP8E_SET_ARNR_TYPE, set_param}, {VP8E_SET_TUNING, set_param}, {VP8E_SET_CQ_LEVEL, set_param}, - {VP9E_SET_MAX_Q, set_param}, - {VP9E_SET_MIN_Q, set_param}, {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param}, {VP9E_SET_LOSSLESS, set_param}, {VP9E_SET_FRAME_PARALLEL_DECODING, set_param}, {VP9_GET_REFERENCE, get_reference}, - {VP9E_SET_WIDTH, vp9e_set_width}, - {VP9E_SET_HEIGHT, vp9e_set_height}, - {VP9E_SET_LAYER, vp9e_set_layer}, {VP9E_SET_SVC, vp9e_set_svc}, + {VP9E_SET_SVC_PARAMETERS, vp9e_set_svc_parameters}, { -1, NULL}, }; -- cgit v1.2.3