From 892e23a5badc2d929b7f179adc00c28820618681 Mon Sep 17 00:00:00 2001 From: Jim Bankoski Date: Mon, 9 Jan 2012 09:23:34 -0800 Subject: [PATCH] vp8d - function to check if a reference frame is used. Change-Id: Id683b4d7f46ffa99145fc4b824c7232ab4182f21 --- vp8/common/postproc.c | 19 ++++++++++++++++++- vp8/vp8_dx_iface.c | 21 +++++++++++++++++++++ vpx/vp8dx.h | 7 ++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c index 0ef300998..2f7e66819 100644 --- a/vp8/common/postproc.c +++ b/vp8/common/postproc.c @@ -673,6 +673,24 @@ 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 ( int blksize, /* Currently only values supported are 16, 8, 4 */ @@ -883,7 +901,6 @@ void vp8_multiframe_quality_enhance #else #define RTCD_VTABLE(oci) NULL #endif - int vp8_post_proc_frame(VP8_COMMON *oci, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *ppflags) { int q = oci->filter_level * 10 / 6; diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index 385fecd01..de2714317 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -700,6 +700,27 @@ 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 ); +static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, + int ctrl_id, + va_list args) +{ + int *ref_info = va_arg(args, int *); + VP8D_COMP *pbi = (VP8D_COMP *)ctx->pbi; + VP8_COMMON *oci = &pbi->common; + + 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); + + return VPX_CODEC_OK; + } + else + return VPX_CODEC_INVALID_PARAM; +} static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, int ctrl_id, diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h index 1d9d53165..86610358c 100644 --- a/vpx/vp8dx.h +++ b/vpx/vp8dx.h @@ -55,6 +55,11 @@ enum vp8_dec_control_id /** check if the indicated frame is corrupted */ VP8D_GET_FRAME_CORRUPTED, + /** control function to get info on which reference frames were used + * by the last decode + */ + VP8D_GET_LAST_REF_USED, + VP8_DECODER_CTRL_ID_MAX } ; @@ -69,7 +74,7 @@ enum vp8_dec_control_id VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *) VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *) - +VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *) /*! @} - end defgroup vp8_decoder */