| Index: source/libvpx/vp9/vp9_cx_iface.c
|
| ===================================================================
|
| --- source/libvpx/vp9/vp9_cx_iface.c (revision 240950)
|
| +++ source/libvpx/vp9/vp9_cx_iface.c (working copy)
|
| @@ -38,6 +38,7 @@
|
| unsigned int rc_max_intra_bitrate_pct;
|
| unsigned int lossless;
|
| unsigned int frame_parallel_decoding_mode;
|
| + unsigned int aq_mode;
|
| };
|
|
|
| struct extraconfig_map {
|
| @@ -66,6 +67,7 @@
|
| 0, /* rc_max_intra_bitrate_pct */
|
| 0, /* lossless */
|
| 0, /* frame_parallel_decoding_mode */
|
| + 0, /* aq_mode */
|
| }
|
| }
|
| };
|
| @@ -75,14 +77,14 @@
|
| vpx_codec_enc_cfg_t cfg;
|
| struct vp9_extracfg vp8_cfg;
|
| VP9_CONFIG oxcf;
|
| - VP9_PTR cpi;
|
| + VP9_PTR cpi;
|
| unsigned char *cx_data;
|
| - unsigned int cx_data_sz;
|
| + size_t cx_data_sz;
|
| unsigned char *pending_cx_data;
|
| - unsigned int pending_cx_data_sz;
|
| + size_t pending_cx_data_sz;
|
| int pending_frame_count;
|
| - uint32_t pending_frame_sizes[8];
|
| - uint32_t pending_frame_magnitude;
|
| + size_t pending_frame_sizes[8];
|
| + size_t pending_frame_magnitude;
|
| vpx_image_t preview_img;
|
| vp8_postproc_cfg_t preview_ppcfg;
|
| vpx_codec_pkt_list_decl(64) pkt_list;
|
| @@ -98,7 +100,7 @@
|
| case VP8_ALTR_FRAME:
|
| return VP9_ALT_FLAG;
|
| }
|
| - assert(!"Invalid Reference Frame");
|
| + assert(0 && "Invalid Reference Frame");
|
| return VP9_LAST_FLAG;
|
| }
|
|
|
| @@ -157,6 +159,7 @@
|
| RANGE_CHECK_HI(cfg, rc_max_quantizer, 0);
|
| RANGE_CHECK_HI(cfg, rc_min_quantizer, 0);
|
| }
|
| + RANGE_CHECK(vp8_cfg, aq_mode, 0, AQ_MODES_COUNT - 1);
|
|
|
| RANGE_CHECK_HI(cfg, g_threads, 64);
|
| RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS);
|
| @@ -195,6 +198,10 @@
|
| RANGE_CHECK(vp8_cfg, arnr_type, 1, 3);
|
| RANGE_CHECK(vp8_cfg, cq_level, 0, 63);
|
|
|
| + // TODO(yaowu): remove this when ssim tuning is implemented for vp9
|
| + if (vp8_cfg->tuning == VP8_TUNE_SSIM)
|
| + ERROR("Option --tune=ssim is not currently supported in VP9.");
|
| +
|
| if (cfg->g_pass == VPX_RC_LAST_PASS) {
|
| size_t packet_sz = sizeof(FIRSTPASS_STATS);
|
| int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz);
|
| @@ -335,6 +342,8 @@
|
| oxcf->error_resilient_mode = cfg.g_error_resilient;
|
| oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode;
|
|
|
| + oxcf->aq_mode = vp8_cfg.aq_mode;
|
| +
|
| oxcf->ss_number_layers = cfg.ss_number_layers;
|
| /*
|
| printf("Current VP9 Settings: \n");
|
| @@ -442,11 +451,10 @@
|
| 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);
|
| + MAP(VP9E_SET_AQ_MODE, xcfg.aq_mode);
|
| }
|
|
|
| res = validate_config(ctx, &ctx->cfg, &xcfg);
|
| @@ -700,7 +708,7 @@
|
| unsigned int lib_flags;
|
| YV12_BUFFER_CONFIG sd;
|
| int64_t dst_time_stamp, dst_end_time_stamp;
|
| - unsigned long size, cx_data_sz;
|
| + size_t size, cx_data_sz;
|
| unsigned char *cx_data;
|
|
|
| /* Set up internal flags */
|
| @@ -1009,66 +1017,40 @@
|
| }
|
| }
|
|
|
| -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 *);
|
| +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 (data) {
|
| - int res;
|
| - res = vp9_set_size_literal(ctx->cpi, 0, *data);
|
| -
|
| - if (!res) {
|
| - return VPX_CODEC_OK;
|
| - } else {
|
| - return VPX_CODEC_INVALID_PARAM;
|
| - }
|
| - } else {
|
| + if (data == NULL) {
|
| 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 *);
|
| + params = *(vpx_svc_parameters_t *)data;
|
|
|
| - if (data) {
|
| - int res;
|
| - res = 0;
|
| + 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;
|
|
|
| - res = vp9_switch_layer(ctx->cpi, *data);
|
| -
|
| - 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;
|
| }
|
|
|
| @@ -1096,16 +1078,13 @@
|
| {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},
|
| + {VP9E_SET_AQ_MODE, 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},
|
| };
|
|
|
|
|