vp8d - function to check if a reference frame is used.
authorJim Bankoski <jimbankoski@google.com>
Mon, 9 Jan 2012 17:23:34 +0000 (09:23 -0800)
committerJohn Koleszar <jkoleszar@google.com>
Tue, 10 Jan 2012 18:10:26 +0000 (10:10 -0800)
Change-Id: Id683b4d7f46ffa99145fc4b824c7232ab4182f21

vp8/common/postproc.c
vp8/vp8_dx_iface.c
vpx/vp8dx.h

index 0ef3009..2f7e668 100644 (file)
@@ -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;
index 385fecd..de27143 100644 (file)
@@ -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,
index 1d9d531..8661035 100644 (file)
@@ -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 */