Commit 297dfd86 authored by Peter Boström's avatar Peter Boström
Browse files

Add decoder getters for the last quantizer.

To be used for frame stats output of vpxdec.

Change-Id: I0739a01bd3635c4b3fedd58f3e27363ce8fb1b1e
parent baa4a290
......@@ -52,6 +52,7 @@ vpx_codec_err_t vp8dx_get_reference(struct VP8D_COMP *comp,
vpx_codec_err_t vp8dx_set_reference(struct VP8D_COMP *comp,
enum vpx_ref_frame_type ref_frame_flag,
YV12_BUFFER_CONFIG *sd);
int vp8dx_get_quantizer(const struct VP8D_COMP *c);
#ifdef __cplusplus
}
......
......@@ -471,3 +471,7 @@ int vp8_remove_decoder_instances(struct frame_buffers *fb) {
remove_decompressor(pbi);
return VPX_CODEC_OK;
}
int vp8dx_get_quantizer(const VP8D_COMP *cpi) {
return cpi->common.base_qindex;
}
......@@ -535,6 +535,14 @@ static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx,
}
}
static vpx_codec_err_t vp8_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 = vp8dx_get_quantizer(ctx->yv12_frame_buffers.pbi[0]);
return VPX_CODEC_OK;
}
static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx,
va_list args) {
#if CONFIG_POSTPROC
......@@ -627,6 +635,7 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = {
{ VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates },
{ VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted },
{ VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame },
{ VPXD_GET_LAST_QUANTIZER, vp8_get_quantizer },
{ VPXD_SET_DECRYPTOR, vp8_set_decryptor },
{ -1, NULL },
};
......
......@@ -832,6 +832,15 @@ static vpx_codec_err_t ctrl_set_postproc(vpx_codec_alg_priv_t *ctx,
#endif
}
static vpx_codec_err_t ctrl_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 =
((FrameWorkerData *)ctx->frame_workers[0].data1)->pbi->common.base_qindex;
return VPX_CODEC_OK;
}
static vpx_codec_err_t ctrl_get_last_ref_updates(vpx_codec_alg_priv_t *ctx,
va_list args) {
int *const update_info = va_arg(args, int *);
......@@ -1027,6 +1036,7 @@ static vpx_codec_ctrl_fn_map_t decoder_ctrl_maps[] = {
{ VP9_DECODE_SVC_SPATIAL_LAYER, ctrl_set_spatial_layer_svc },
// Getters
{ VPXD_GET_LAST_QUANTIZER, ctrl_get_quantizer },
{ VP8D_GET_LAST_REF_UPDATES, ctrl_get_last_ref_updates },
{ VP8D_GET_FRAME_CORRUPTED, ctrl_get_frame_corrupted },
{ VP9_GET_REFERENCE, ctrl_get_reference },
......
......@@ -116,6 +116,14 @@ enum vp8_dec_control_id {
*/
VP9_DECODE_SVC_SPATIAL_LAYER,
/*!\brief Codec control function to get last decoded frame quantizer.
*
* Return value uses internal quantizer scale defined by the codec.
*
* Supported in codecs: VP8, VP9
*/
VPXD_GET_LAST_QUANTIZER,
VP8_DECODER_CTRL_ID_MAX
};
......@@ -155,6 +163,8 @@ VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
#define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED
VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
#define VPX_CTRL_VP8D_GET_LAST_REF_USED
VPX_CTRL_USE_TYPE(VPXD_GET_LAST_QUANTIZER, int *)
#define VPX_CTRL_VPXD_GET_LAST_QUANTIZER
VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
#define VPX_CTRL_VPXD_SET_DECRYPTOR
VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment