diff options
author | Jerome Jiang <jianj@google.com> | 2023-04-28 14:32:47 -0400 |
---|---|---|
committer | Jerome Jiang <jianj@google.com> | 2023-05-03 19:16:24 -0400 |
commit | de45e4b612bb576f76d35770afc62ae799e6c0fd (patch) | |
tree | 19e1399563fe257de000351c48e45e902c9e3f08 /vp9 | |
parent | 84a180fe858fd6de9c301cd884e2f1ff341781b3 (diff) | |
download | libvpx-de45e4b612bb576f76d35770afc62ae799e6c0fd.tar libvpx-de45e4b612bb576f76d35770afc62ae799e6c0fd.tar.gz libvpx-de45e4b612bb576f76d35770afc62ae799e6c0fd.tar.bz2 libvpx-de45e4b612bb576f76d35770afc62ae799e6c0fd.zip |
Add codec control to export TPL stats
new codec control: VP9E_GET_TPL_STATS with unit test
Bug: b/273736974
Change-Id: I27343bd3f6dffafc86925234537bcdb557bc4079
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/encoder/vp9_encoder.h | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_tpl_model.c | 2 | ||||
-rw-r--r-- | vp9/vp9_cx_iface.c | 18 |
3 files changed, 21 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 7c22c807b..742cf0b6d 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -505,6 +505,7 @@ typedef struct EncFrameBuf { } EncFrameBuf; // Maximum operating frame buffer size needed for a GOP using ARF reference. +// This is used to allocate the memory for TPL stats for a GOP. #define MAX_ARF_GOP_SIZE (2 * MAX_LAG_BUFFERS) #define MAX_KMEANS_GROUPS 8 diff --git a/vp9/encoder/vp9_tpl_model.c b/vp9/encoder/vp9_tpl_model.c index dbd7482b0..b62c66b6c 100644 --- a/vp9/encoder/vp9_tpl_model.c +++ b/vp9/encoder/vp9_tpl_model.c @@ -1134,6 +1134,8 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture, const int mi_height = num_8x8_blocks_high_lookup[bsize]; const int mi_width = num_8x8_blocks_wide_lookup[bsize]; + tpl_frame_stats_before_propagation->frame_width = cm->width; + tpl_frame_stats_before_propagation->frame_height = cm->height; // Setup scaling factor #if CONFIG_VP9_HIGHBITDEPTH vp9_setup_scale_factors_for_frame( diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 4c7eaed72..8bd880c7b 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1788,6 +1788,23 @@ static vpx_codec_err_t ctrl_get_svc_ref_frame_config(vpx_codec_alg_priv_t *ctx, return VPX_CODEC_OK; } +static vpx_codec_err_t ctrl_get_tpl_stats(vpx_codec_alg_priv_t *ctx, + va_list args) { + VP9_COMP *const cpi = ctx->cpi; + TplFrameStats *data = va_arg(args, TplFrameStats *); + int i; + if (data == NULL) { + return VPX_CODEC_INVALID_PARAM; + } + for (i = 0; i < MAX_ARF_GOP_SIZE; i++) { + data[i].frame_width = cpi->tpl_frame_stats[i].frame_width; + data[i].frame_height = cpi->tpl_frame_stats[i].frame_height; + data[i].block_stats_list = cpi->tpl_frame_stats[i].block_stats_list; + } + + return VPX_CODEC_OK; +} + static vpx_codec_err_t ctrl_set_svc_ref_frame_config(vpx_codec_alg_priv_t *ctx, va_list args) { VP9_COMP *const cpi = ctx->cpi; @@ -2035,6 +2052,7 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { { VP9E_GET_ACTIVEMAP, ctrl_get_active_map }, { VP9E_GET_LEVEL, ctrl_get_level }, { VP9E_GET_SVC_REF_FRAME_CONFIG, ctrl_get_svc_ref_frame_config }, + { VP9E_GET_TPL_STATS, ctrl_get_tpl_stats }, { -1, NULL }, }; |