shithub: libvpx

Download patch

ref: 8363349b8484f6be9f0cf860e2ae57d3acf838a6
parent: 61da0870b9637b6ea7ceceb49235404662660fb5
parent: 9ed616a56cc32399d992ca0a3553cec9c3f5e041
author: Frank Galligan <fgalligan@google.com>
date: Wed Dec 4 14:26:40 EST 2013

Merge "Fix the initial references to frame buffers."

--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -238,8 +238,10 @@
 }
 
 static void ref_cnt_fb(int *buf, int *idx, int new_idx) {
-  if (buf[*idx] > 0)
-    buf[*idx]--;
+  const int ref_index = *idx;
+
+  if (ref_index > 0 && buf[ref_index] > 0)
+    buf[ref_index]--;
 
   *idx = new_idx;
 
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -687,12 +687,6 @@
 
   if (cm->width != width || cm->height != height) {
     // Change in frame size.
-    if (cm->width == 0 || cm->height == 0) {
-      // Assign new frame buffer on first call.
-      cm->new_fb_idx = NUM_YV12_BUFFERS - 1;
-      cm->fb_idx_ref_cnt[cm->new_fb_idx] = 1;
-    }
-
     // TODO(agrange) Don't test width/height, check overall size.
     if (width > cm->width || height > cm->height) {
       // Rescale frame buffers only if they're not big enough already.
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -125,6 +125,9 @@
 
   vp9_zero(*pbi);
 
+  // Initialize the references to not point to any frame buffers.
+  memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
+
   if (setjmp(cm->error.jmp)) {
     cm->error.setjmp = 0;
     vp9_remove_decompressor(pbi);