From 8be41bba809d41f567795ade9be900d6365b1f2d Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Fri, 27 Jan 2012 10:13:20 -0800 Subject: [PATCH] Hook up VP8D_GET_LAST_REF_USED Commit 892e23a5b introduced support for the VP8D_GET_LAST_REF_USED, but missed the mapping of the control id to the underlying function, so it was unavailable to applications. In addition, the underlying function vp8_references_buffer() is moved from common/postproc.c to decoder/onyxd_if.c as postproc.c is not built in all configurations. Change-Id: I426dd254e7e6c4c061b70d729b69a6c384ebbe44 --- vp8/common/postproc.c | 17 ----------------- vp8/decoder/onyxd_if.c | 23 +++++++++++++++++++++++ vp8/vp8_dx_iface.c | 9 +++++---- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c index 15a214b4c..3ee04fb24 100644 --- a/vp8/common/postproc.c +++ b/vp8/common/postproc.c @@ -696,23 +696,6 @@ static void constrain_line (int x0, int *x1, int y0, int *y1, int width, int hei } } -int vp8_references_buffer( VP8_COMMON *oci, int ref_frame ) -{ - const MODE_INFO *mi = oci->mi; - int mb_row, mb_col; - - for (mb_row = 0; mb_row < oci->mb_rows; mb_row++) - { - for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++) - { - if( mi->mbmi.ref_frame == ref_frame) - return 1; - } - mi++; - } - return 0; - -} static void multiframe_quality_enhance_block ( diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index 80648d39f..980b9237e 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -606,3 +606,26 @@ int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd, int64_t *time_st vp8_clear_system_state(); return ret; } + + +/* This function as written isn't decoder specific, but the encoder has + * much faster ways of computing this, so it's ok for it to live in a + * decode specific file. + */ +int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame ) +{ + const MODE_INFO *mi = oci->mi; + int mb_row, mb_col; + + for (mb_row = 0; mb_row < oci->mb_rows; mb_row++) + { + for (mb_col = 0; mb_col < oci->mb_cols; mb_col++,mi++) + { + if( mi->mbmi.ref_frame == ref_frame) + return 1; + } + mi++; + } + return 0; + +} diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index de2714317..0a62d9717 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -700,7 +700,7 @@ static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, return VPX_CODEC_INVALID_PARAM; } -extern int vp8_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, int ctrl_id, va_list args) @@ -712,9 +712,9 @@ static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, if (ref_info) { *ref_info = - (vp8_references_buffer( oci, ALTREF_FRAME )?VP8_ALTR_FRAME:0) | - (vp8_references_buffer( oci, GOLDEN_FRAME )?VP8_GOLD_FRAME:0) | - (vp8_references_buffer( oci, LAST_FRAME )?VP8_LAST_FRAME:0); + (vp8dx_references_buffer( oci, ALTREF_FRAME )?VP8_ALTR_FRAME:0) | + (vp8dx_references_buffer( oci, GOLDEN_FRAME )?VP8_GOLD_FRAME:0) | + (vp8dx_references_buffer( oci, LAST_FRAME )?VP8_LAST_FRAME:0); return VPX_CODEC_OK; } @@ -752,6 +752,7 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = {VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_options}, {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}, { -1, NULL}, };