Commit 8a8b662e authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Removing ctrl_id parameter from vpx_codec_control_fn_t.

Change-Id: I2b61c8c17ded1074dea92b4f6ad9be84d128b52a
parent 26a76dc3
...@@ -472,70 +472,128 @@ static vpx_codec_err_t vp8e_set_config(vpx_codec_alg_priv_t *ctx, ...@@ -472,70 +472,128 @@ static vpx_codec_err_t vp8e_set_config(vpx_codec_alg_priv_t *ctx,
return res; return res;
} }
int vp8_reverse_trans(int); int vp8_reverse_trans(int);
static vpx_codec_err_t get_quantizer(vpx_codec_alg_priv_t *ctx, va_list args)
{
int *const arg = va_arg(args, int *);
if (arg == NULL)
return VPX_CODEC_INVALID_PARAM;
*arg = vp8_get_quantizer(ctx->cpi);
return VPX_CODEC_OK;
}
static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t get_quantizer64(vpx_codec_alg_priv_t *ctx, va_list args)
int ctrl_id,
va_list args)
{ {
void *arg = va_arg(args, void *); int *const arg = va_arg(args, int *);
if (arg == NULL)
return VPX_CODEC_INVALID_PARAM;
*arg = vp8_reverse_trans(vp8_get_quantizer(ctx->cpi));
return VPX_CODEC_OK;
}
#define MAP(id, var) case id: *(RECAST(id, arg)) = var; break static vpx_codec_err_t update_extracfg(vpx_codec_alg_priv_t *ctx,
const struct vp8_extracfg *extra_cfg)
{
const vpx_codec_err_t res = validate_config(ctx, &ctx->cfg, extra_cfg, 0);
if (res == VPX_CODEC_OK) {
ctx->vp8_cfg = *extra_cfg;
set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL);
vp8_change_config(ctx->cpi, &ctx->oxcf);
}
return res;
}
if (!arg) static vpx_codec_err_t set_cpu_used(vpx_codec_alg_priv_t *ctx, va_list args)
return VPX_CODEC_INVALID_PARAM; {
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.cpu_used = CAST(VP8E_SET_CPUUSED, args);
return update_extracfg(ctx, &extra_cfg);
}
switch (ctrl_id) static vpx_codec_err_t set_enable_auto_alt_ref(vpx_codec_alg_priv_t *ctx,
{ va_list args)
MAP(VP8E_GET_LAST_QUANTIZER, vp8_get_quantizer(ctx->cpi)); {
MAP(VP8E_GET_LAST_QUANTIZER_64, vp8_reverse_trans(vp8_get_quantizer(ctx->cpi))); struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
} extra_cfg.enable_auto_alt_ref = CAST(VP8E_SET_ENABLEAUTOALTREF, args);
return update_extracfg(ctx, &extra_cfg);
}
return VPX_CODEC_OK; static vpx_codec_err_t set_noise_sensitivity(vpx_codec_alg_priv_t *ctx,
#undef MAP va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.noise_sensitivity = CAST(VP8E_SET_NOISE_SENSITIVITY, args);
return update_extracfg(ctx, &extra_cfg);
} }
static vpx_codec_err_t set_sharpness(vpx_codec_alg_priv_t *ctx, va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.Sharpness = CAST(VP8E_SET_SHARPNESS, args);
return update_extracfg(ctx, &extra_cfg);
}
static vpx_codec_err_t set_static_thresh(vpx_codec_alg_priv_t *ctx,
va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.static_thresh = CAST(VP8E_SET_STATIC_THRESHOLD, args);
return update_extracfg(ctx, &extra_cfg);
}
static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t set_token_partitions(vpx_codec_alg_priv_t *ctx,
int ctrl_id, va_list args)
va_list args)
{ {
vpx_codec_err_t res = VPX_CODEC_OK; struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
struct vp8_extracfg xcfg = ctx->vp8_cfg; extra_cfg.token_partitions = CAST(VP8E_SET_TOKEN_PARTITIONS, args);
return update_extracfg(ctx, &extra_cfg);
}
#define MAP(id, var) case id: var = CAST(id, args); break; static vpx_codec_err_t set_arnr_max_frames(vpx_codec_alg_priv_t *ctx,
va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.arnr_max_frames = CAST(VP8E_SET_ARNR_MAXFRAMES, args);
return update_extracfg(ctx, &extra_cfg);
}
switch (ctrl_id) static vpx_codec_err_t set_arnr_strength(vpx_codec_alg_priv_t *ctx,
{ va_list args)
MAP(VP8E_SET_CPUUSED, xcfg.cpu_used); {
MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref); struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity); extra_cfg.arnr_strength = CAST(VP8E_SET_ARNR_STRENGTH, args);
MAP(VP8E_SET_SHARPNESS, xcfg.Sharpness); return update_extracfg(ctx, &extra_cfg);
MAP(VP8E_SET_STATIC_THRESHOLD, xcfg.static_thresh); }
MAP(VP8E_SET_TOKEN_PARTITIONS, xcfg.token_partitions);
MAP(VP8E_SET_ARNR_MAXFRAMES, xcfg.arnr_max_frames);
MAP(VP8E_SET_ARNR_STRENGTH , xcfg.arnr_strength);
MAP(VP8E_SET_ARNR_TYPE , xcfg.arnr_type);
MAP(VP8E_SET_TUNING, xcfg.tuning);
MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level);
MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
} static vpx_codec_err_t set_arnr_type(vpx_codec_alg_priv_t *ctx, va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.arnr_type = CAST(VP8E_SET_ARNR_TYPE, args);
return update_extracfg(ctx, &extra_cfg);
}
res = validate_config(ctx, &ctx->cfg, &xcfg, 0); static vpx_codec_err_t set_tuning(vpx_codec_alg_priv_t *ctx, va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.tuning = CAST(VP8E_SET_TUNING, args);
return update_extracfg(ctx, &extra_cfg);
}
if (!res) static vpx_codec_err_t set_cq_level(vpx_codec_alg_priv_t *ctx, va_list args)
{ {
ctx->vp8_cfg = xcfg; struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL); extra_cfg.cq_level = CAST(VP8E_SET_CQ_LEVEL, args);
vp8_change_config(ctx->cpi, &ctx->oxcf); return update_extracfg(ctx, &extra_cfg);
} }
return res; static vpx_codec_err_t set_rc_max_intra_bitrate_pct(vpx_codec_alg_priv_t *ctx,
#undef MAP va_list args)
{
struct vp8_extracfg extra_cfg = ctx->vp8_cfg;
extra_cfg.rc_max_intra_bitrate_pct =
CAST(VP8E_SET_MAX_INTRA_BITRATE_PCT, args);
return update_extracfg(ctx, &extra_cfg);
} }
static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg, static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
...@@ -976,8 +1034,7 @@ static const vpx_codec_cx_pkt_t *vp8e_get_cxdata(vpx_codec_alg_priv_t *ctx, ...@@ -976,8 +1034,7 @@ static const vpx_codec_cx_pkt_t *vp8e_get_cxdata(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
...@@ -996,8 +1053,7 @@ static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx, ...@@ -996,8 +1053,7 @@ static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
...@@ -1016,12 +1072,10 @@ static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx, ...@@ -1016,12 +1072,10 @@ static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *); vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
(void)ctr_id;
if (data) if (data)
{ {
...@@ -1032,7 +1086,6 @@ static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx, ...@@ -1032,7 +1086,6 @@ static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_INVALID_PARAM; return VPX_CODEC_INVALID_PARAM;
#else #else
(void)ctx; (void)ctx;
(void)ctr_id;
(void)args; (void)args;
return VPX_CODEC_INCAPABLE; return VPX_CODEC_INCAPABLE;
#endif #endif
...@@ -1090,8 +1143,7 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx) ...@@ -1090,8 +1143,7 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
} }
static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
int update = va_arg(args, int); int update = va_arg(args, int);
vp8_update_entropy(ctx->cpi, update); vp8_update_entropy(ctx->cpi, update);
...@@ -1100,8 +1152,7 @@ static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx, ...@@ -1100,8 +1152,7 @@ static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
int update = va_arg(args, int); int update = va_arg(args, int);
vp8_update_reference(ctx->cpi, update); vp8_update_reference(ctx->cpi, update);
...@@ -1109,8 +1160,7 @@ static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx, ...@@ -1109,8 +1160,7 @@ static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
int reference_flag = va_arg(args, int); int reference_flag = va_arg(args, int);
vp8_use_as_reference(ctx->cpi, reference_flag); vp8_use_as_reference(ctx->cpi, reference_flag);
...@@ -1118,7 +1168,6 @@ static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx, ...@@ -1118,7 +1168,6 @@ static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx,
int ctr_id,
va_list args) va_list args)
{ {
vpx_roi_map_t *data = va_arg(args, vpx_roi_map_t *); vpx_roi_map_t *data = va_arg(args, vpx_roi_map_t *);
...@@ -1138,8 +1187,7 @@ static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx, ...@@ -1138,8 +1187,7 @@ static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx,
static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_active_map_t *data = va_arg(args, vpx_active_map_t *); vpx_active_map_t *data = va_arg(args, vpx_active_map_t *);
...@@ -1158,8 +1206,7 @@ static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx, ...@@ -1158,8 +1206,7 @@ static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8e_set_scalemode(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8e_set_scalemode(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *); vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *);
...@@ -1197,20 +1244,20 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] = ...@@ -1197,20 +1244,20 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] =
{VP8E_SET_ROI_MAP, vp8e_set_roi_map}, {VP8E_SET_ROI_MAP, vp8e_set_roi_map},
{VP8E_SET_ACTIVEMAP, vp8e_set_activemap}, {VP8E_SET_ACTIVEMAP, vp8e_set_activemap},
{VP8E_SET_SCALEMODE, vp8e_set_scalemode}, {VP8E_SET_SCALEMODE, vp8e_set_scalemode},
{VP8E_SET_CPUUSED, set_param}, {VP8E_SET_CPUUSED, set_cpu_used},
{VP8E_SET_NOISE_SENSITIVITY, set_param}, {VP8E_SET_NOISE_SENSITIVITY, set_noise_sensitivity},
{VP8E_SET_ENABLEAUTOALTREF, set_param}, {VP8E_SET_ENABLEAUTOALTREF, set_enable_auto_alt_ref},
{VP8E_SET_SHARPNESS, set_param}, {VP8E_SET_SHARPNESS, set_sharpness},
{VP8E_SET_STATIC_THRESHOLD, set_param}, {VP8E_SET_STATIC_THRESHOLD, set_static_thresh},
{VP8E_SET_TOKEN_PARTITIONS, set_param}, {VP8E_SET_TOKEN_PARTITIONS, set_token_partitions},
{VP8E_GET_LAST_QUANTIZER, get_param}, {VP8E_GET_LAST_QUANTIZER, get_quantizer},
{VP8E_GET_LAST_QUANTIZER_64, get_param}, {VP8E_GET_LAST_QUANTIZER_64, get_quantizer64},
{VP8E_SET_ARNR_MAXFRAMES, set_param}, {VP8E_SET_ARNR_MAXFRAMES, set_arnr_max_frames},
{VP8E_SET_ARNR_STRENGTH , set_param}, {VP8E_SET_ARNR_STRENGTH , set_arnr_strength},
{VP8E_SET_ARNR_TYPE , set_param}, {VP8E_SET_ARNR_TYPE , set_arnr_type},
{VP8E_SET_TUNING, set_param}, {VP8E_SET_TUNING, set_tuning},
{VP8E_SET_CQ_LEVEL, set_param}, {VP8E_SET_CQ_LEVEL, set_cq_level},
{VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param}, {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_rc_max_intra_bitrate_pct},
{ -1, NULL}, { -1, NULL},
}; };
......
...@@ -576,8 +576,7 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, ...@@ -576,8 +576,7 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
...@@ -598,8 +597,7 @@ static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx, ...@@ -598,8 +597,7 @@ static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx,
int ctr_id, va_list args)
va_list args)
{ {
vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
...@@ -620,7 +618,6 @@ static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx, ...@@ -620,7 +618,6 @@ static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx,
int ctr_id,
va_list args) va_list args)
{ {
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
...@@ -640,31 +637,56 @@ static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx, ...@@ -640,31 +637,56 @@ static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx,
#endif #endif
} }
static vpx_codec_err_t vp8_set_dbg_options(vpx_codec_alg_priv_t *ctx,
int ctrl_id, static vpx_codec_err_t vp8_set_dbg_color_ref_frame(vpx_codec_alg_priv_t *ctx,
va_list args) va_list args) {
{
#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
int data = va_arg(args, int); ctx->dbg_color_ref_frame_flag = va_arg(args, int);
return VPX_CODEC_OK;
#else
(void)ctx;
(void)args;
return VPX_CODEC_INCAPABLE;
#endif
}
#define MAP(id, var) case id: var = data; break; static vpx_codec_err_t vp8_set_dbg_color_mb_modes(vpx_codec_alg_priv_t *ctx,
va_list args) {
#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
ctx->dbg_color_mb_modes_flag = va_arg(args, int);
return VPX_CODEC_OK;
#else
(void)ctx;
(void)args;
return VPX_CODEC_INCAPABLE;
#endif
}
switch (ctrl_id) static vpx_codec_err_t vp8_set_dbg_color_b_modes(vpx_codec_alg_priv_t *ctx,
{ va_list args) {
MAP (VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag); #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
MAP (VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag); ctx->dbg_color_b_modes_flag = va_arg(args, int);
MAP (VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag); return VPX_CODEC_OK;
MAP (VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag); #else
} (void)ctx;
(void)args;
return VPX_CODEC_INCAPABLE;
#endif
}
return VPX_CODEC_OK; static vpx_codec_err_t vp8_set_dbg_display_mv(vpx_codec_alg_priv_t *ctx,
va_list args) {
#if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC
ctx->dbg_display_mv_flag = va_arg(args, int);
return VPX_CODEC_OK;
#else #else
return VPX_CODEC_INCAPABLE; (void)ctx;
(void)args;
return VPX_CODEC_INCAPABLE;
#endif #endif
} }
static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
int ctrl_id,
va_list args) va_list args)
{ {
int *update_info = va_arg(args, int *); int *update_info = va_arg(args, int *);
...@@ -685,7 +707,6 @@ static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, ...@@ -685,7 +707,6 @@ static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
extern int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame ); extern int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame );
static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx,
int ctrl_id,
va_list args) va_list args)
{ {
int *ref_info = va_arg(args, int *); int *ref_info = va_arg(args, int *);
...@@ -706,7 +727,6 @@ static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, ...@@ -706,7 +727,6 @@ static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
int ctrl_id,
va_list args) va_list args)
{ {
...@@ -725,7 +745,6 @@ static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, ...@@ -725,7 +745,6 @@ static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
} }
static vpx_codec_err_t vp8_set_decryptor(vpx_codec_alg_priv_t *ctx, static vpx_codec_err_t vp8_set_decryptor(vpx_codec_alg_priv_t *ctx,
int ctrl_id,
va_list args) va_list args)
{ {
vpx_decrypt_init *init = va_arg(args, vpx_decrypt_init *); vpx_decrypt_init *init = va_arg(args, vpx_decrypt_init *);
...@@ -748,10 +767,10 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = ...@@ -748,10 +767,10 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
{VP8_SET_REFERENCE, vp8_set_reference}, {VP8_SET_REFERENCE, vp8_set_reference},
{VP8_COPY_REFERENCE, vp8_get_reference}, {VP8_COPY_REFERENCE, vp8_get_reference},
{VP8_SET_POSTPROC, vp8_set_postproc}, {VP8_SET_POSTPROC, vp8_set_postproc},
{VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_options}, {VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_color_ref_frame},
{VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_options}, {VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_color_mb_modes},
{VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_options}, {VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_color_b_modes},
{VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_options}, {VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_display_mv},
{VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates}, {VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates},
{VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted}, {VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted},
{VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame}, {VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame},
......
...@@ -462,64 +462,154 @@ static vpx_codec_err_t encoder_set_config(vpx_codec_alg_priv_t *ctx, ...@@ -462,64 +462,154 @@ static vpx_codec_err_t encoder_set_config(vpx_codec_alg_priv_t *ctx,
return res; return res;
} }
static vpx_codec_err_t ctrl_get_param(vpx_codec_alg_priv_t *ctx, int ctrl_id, static vpx_codec_err_t ctrl_get_quantizer(vpx_codec_alg_priv_t *ctx,
va_list args) { va_list args) {
void *const arg = va_arg(args, void *); int *const arg = va_arg(args, int *);
if (arg == NULL)
#define MAP(id, var) case id: *(RECAST(id, arg)) = var; break return VPX_CODEC_INVALID_PARAM;
*arg = vp9_get_quantizer(ctx->cpi);
return VPX_CODEC_OK;
}
static vpx_codec_err_t ctrl_get_quantizer64(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const arg = va_arg(args, int *);
if (arg == NULL) if (arg == NULL)
return VPX_CODEC_INVALID_PARAM; return VPX_CODEC_INVALID_PARAM;
*arg = vp9_qindex_to_quantizer(vp9_get_quantizer(ctx->cpi));
return VPX_CODEC_OK;
}
switch (ctrl_id) { static vpx_codec_err_t update_extra_cfg(vpx_codec_alg_priv_t *ctx,
MAP(VP8E_GET_LAST_QUANTIZER, vp9_get_quantizer(ctx->cpi)); const struct vp9_extracfg *extra_cfg) {
MAP(VP8E_GET_LAST_QUANTIZER_64, const vpx_codec_err_t res = validate_config(ctx, &ctx->cfg, extra_cfg);
vp9_qindex_to_quantizer(vp9_get_quantizer(ctx->cpi))); if (res == VPX_CODEC_OK) {
ctx->extra_cfg = *extra_cfg;
set_encoder_config(&ctx->oxcf, &ctx->cfg, &ctx->extra_cfg);
vp9_change_config(ctx->cpi, &ctx->oxcf);
} }
return res;
}
return VPX_CODEC_OK; static vpx_codec_err_t ctrl_set_cpuused(vpx_codec_alg_priv_t *ctx,
#undef MAP va_list args) {
struct vp9_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.cpu_used = CAST(VP8E_SET_CPUUSED, args);
return update_extra_cfg(ctx, &extra_cfg);
} }
static vpx_codec_err_t ctrl_set_enable_auto_alt_ref(vpx_codec_alg_priv_t *ctx,
va_list args) {
struct vp9_extracfg extra_cfg = ctx->extra_cfg;
extra_cfg.enable_auto_alt_ref = CAST(VP8E_SET_ENABLEAUTOALTREF, args);
return update_extra_cfg(ctx, &extra_cfg);
}
static vpx_codec_err_t ctrl_set_param(vpx_codec_alg_priv_t *ctx, int ctrl_id, static vpx_codec_err_t ctrl_set_noise_sensitivity(vpx_codec_alg_priv_t *ctx,
va_list args) { va_list args) {
vpx_codec_err_t res = VPX_CODEC_OK;
struct vp9_extracfg extra_cfg = ctx->extra_cfg; struct vp9_extracfg extra_cfg = ctx->extra_cfg;