diff options
author | Ivan Maltz <ivanmaltz@google.com> | 2013-10-21 16:28:31 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2013-10-21 16:28:31 -0700 |
commit | a82001b1cfd688601bbda9b08b3d20e9b46b14d4 (patch) | |
tree | 49bdb1cce90f32ac875344730045f4610e06d5e9 /vp9 | |
parent | f6d870f7ae6f968bdbc342af80c8f71fa98f2ac2 (diff) | |
parent | 663916cea7b30c157e4df2de541dd196e07e07f6 (diff) | |
download | libvpx-a82001b1cfd688601bbda9b08b3d20e9b46b14d4.tar libvpx-a82001b1cfd688601bbda9b08b3d20e9b46b14d4.tar.gz libvpx-a82001b1cfd688601bbda9b08b3d20e9b46b14d4.tar.bz2 libvpx-a82001b1cfd688601bbda9b08b3d20e9b46b14d4.zip |
Merge "SVC improvements"
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/common/vp9_onyx.h | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_onyx_if.c | 28 | ||||
-rw-r--r-- | vp9/vp9_cx_iface.c | 80 |
3 files changed, 24 insertions, 86 deletions
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}, }; |