summaryrefslogtreecommitdiff
path: root/vp8/decoder/onyxd_if.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-05-26 11:44:18 -0400
committerJohn Koleszar <jkoleszar@google.com>2011-05-26 11:44:36 -0400
commit9dccdc1f0884426d5c7340129660787b64812dbe (patch)
tree6fe02110f5b5e74bc1543911ad9d28fb9b86d0cc /vp8/decoder/onyxd_if.c
parentf7044d4058fe22e81179727d87a7a425026538ee (diff)
parent117fcb207e2e655cd334b6a8522af7d713b1fcee (diff)
downloadlibvpx-9dccdc1f0884426d5c7340129660787b64812dbe.tar
libvpx-9dccdc1f0884426d5c7340129660787b64812dbe.tar.gz
libvpx-9dccdc1f0884426d5c7340129660787b64812dbe.tar.bz2
libvpx-9dccdc1f0884426d5c7340129660787b64812dbe.zip
Merge remote branch 'internal/upstream-experimental' into HEAD
Conflicts: vp8/encoder/encodeframe.c vp8/encoder/ethreading.c Change-Id: I4becf6f101756923de6b98ca6a2132c3605c6ea5
Diffstat (limited to 'vp8/decoder/onyxd_if.c')
-rw-r--r--vp8/decoder/onyxd_if.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index 5c8e09521..3233265c2 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -39,6 +39,8 @@
extern void vp8_init_loop_filter(VP8_COMMON *cm);
extern void vp8cx_init_de_quantizer(VP8D_COMP *pbi);
+static int get_free_fb (VP8_COMMON *cm);
+static void ref_cnt_fb (int *buf, int *idx, int new_idx);
void vp8dx_initialize()
@@ -158,18 +160,24 @@ int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C
{
VP8D_COMP *pbi = (VP8D_COMP *) ptr;
VP8_COMMON *cm = &pbi->common;
- int ref_fb_idx;
+ int *ref_fb_ptr = NULL;
+ int free_fb;
if (ref_frame_flag == VP8_LAST_FLAG)
- ref_fb_idx = cm->lst_fb_idx;
+ *ref_fb_ptr = cm->lst_fb_idx;
else if (ref_frame_flag == VP8_GOLD_FLAG)
- ref_fb_idx = cm->gld_fb_idx;
+ *ref_fb_ptr = cm->gld_fb_idx;
else if (ref_frame_flag == VP8_ALT_FLAG)
- ref_fb_idx = cm->alt_fb_idx;
+ *ref_fb_ptr = cm->alt_fb_idx;
else
return -1;
- vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[ref_fb_idx]);
+ /* Find an empty frame buffer. */
+ free_fb = get_free_fb(cm);
+
+ /* Manage the reference counters and copy image. */
+ ref_cnt_fb (cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb);
+ vp8_yv12_copy_frame_ptr(sd, &cm->yv12_fb[*ref_fb_ptr]);
return 0;
}