Commit 4101b5c5 authored by John Koleszar's avatar John Koleszar Committed by Code Review
Browse files

Merge "Bugfix in vp8dx_set_reference"

parents 5610970f 69ba6bd1
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "vp8/common/threading.h" #include "vp8/common/threading.h"
#include "decoderthreading.h" #include "decoderthreading.h"
#include <stdio.h> #include <stdio.h>
#include <assert.h>
#include "vp8/common/quant_common.h" #include "vp8/common/quant_common.h"
#include "vpx_scale/vpxscale.h" #include "vpx_scale/vpxscale.h"
...@@ -161,16 +162,19 @@ int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C ...@@ -161,16 +162,19 @@ int vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_C
int free_fb; int free_fb;
if (ref_frame_flag == VP8_LAST_FLAG) if (ref_frame_flag == VP8_LAST_FLAG)
*ref_fb_ptr = cm->lst_fb_idx; ref_fb_ptr = &cm->lst_fb_idx;
else if (ref_frame_flag == VP8_GOLD_FLAG) else if (ref_frame_flag == VP8_GOLD_FLAG)
*ref_fb_ptr = cm->gld_fb_idx; ref_fb_ptr = &cm->gld_fb_idx;
else if (ref_frame_flag == VP8_ALT_FLAG) else if (ref_frame_flag == VP8_ALT_FLAG)
*ref_fb_ptr = cm->alt_fb_idx; ref_fb_ptr = &cm->alt_fb_idx;
else else
return -1; return -1;
/* Find an empty frame buffer. */ /* Find an empty frame buffer. */
free_fb = get_free_fb(cm); free_fb = get_free_fb(cm);
/* Decrease fb_idx_ref_cnt since it will be increased again in
* ref_cnt_fb() below. */
cm->fb_idx_ref_cnt[free_fb]--;
/* Manage the reference counters and copy image. */ /* Manage the reference counters and copy image. */
ref_cnt_fb (cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb); ref_cnt_fb (cm->fb_idx_ref_cnt, ref_fb_ptr, free_fb);
...@@ -192,6 +196,7 @@ static int get_free_fb (VP8_COMMON *cm) ...@@ -192,6 +196,7 @@ static int get_free_fb (VP8_COMMON *cm)
if (cm->fb_idx_ref_cnt[i] == 0) if (cm->fb_idx_ref_cnt[i] == 0)
break; break;
assert(i < NUM_YV12_BUFFERS);
cm->fb_idx_ref_cnt[i] = 1; cm->fb_idx_ref_cnt[i] = 1;
return i; return i;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment