Merge "Bugfix in vp8dx_set_reference"

This commit is contained in:
John Koleszar 2011-06-01 13:57:23 -07:00 коммит произвёл Code Review
Родитель 5610970fe9 69ba6bd142
Коммит 4101b5c5ed
1 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -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
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)
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;
} }