int cur_tile_mi_row_start, cur_tile_mi_row_end;
} VP9_COMMON;
+// ref == 0 => LAST_FRAME
+// ref == 1 => GOLDEN_FRAME
+// ref == 2 => ALTREF_FRAME
+static YV12_BUFFER_CONFIG *get_frame_ref_buffer(VP9_COMMON *cm, int ref) {
+ return &cm->yv12_fb[cm->active_ref_idx[ref]];
+}
+
static int get_free_fb(VP9_COMMON *cm) {
int i;
for (i = 0; i < NUM_YV12_BUFFERS; i++)
int idx, int mi_row, int mi_col) {
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
const int ref = mbmi->ref_frame[idx] - LAST_FRAME;
- const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]];
+ const YV12_BUFFER_CONFIG *cfg = get_frame_ref_buffer(cm, ref);
const struct scale_factors_common *sfc = &cm->active_ref_scale_comm[ref];
if (!vp9_is_valid_scale(sfc))
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
int found = 0, i;
for (i = 0; i < ALLOWED_REFS_PER_FRAME; ++i) {
if (vp9_rb_read_bit(rb)) {
- YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[i]];
+ YV12_BUFFER_CONFIG *const cfg = get_frame_ref_buffer(cm, i);
width = cfg->y_crop_width;
height = cfg->y_crop_height;
found = 1;
YV12_BUFFER_CONFIG *sd) {
VP9D_COMP *pbi = (VP9D_COMP *) ptr;
VP9_COMMON *cm = &pbi->common;
- int ref_fb_idx;
/* TODO(jkoleszar): The decoder doesn't have any real knowledge of what the
* encoder is using the frame buffers for. This is just a stub to keep the
* later commit that adds VP9-specific controls for this functionality.
*/
if (ref_frame_flag == VP9_LAST_FLAG) {
- ref_fb_idx = cm->ref_frame_map[0];
+ YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->ref_frame_map[0]];
+ if (!equal_dimensions(cfg, sd))
+ vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
+ "Incorrect buffer dimensions");
+ else
+ vp8_yv12_copy_frame(cfg, sd);
} else {
vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
"Invalid reference frame");
- return cm->error.error_code;
- }
-
- if (!equal_dimensions(&cm->yv12_fb[ref_fb_idx], sd)) {
- vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
- "Incorrect buffer dimensions");
- } else {
- vp8_yv12_copy_frame(&cm->yv12_fb[ref_fb_idx], sd);
}
return cm->error.error_code;
* thing to do here.
*/
if (cm->active_ref_idx[0] != INT_MAX)
- cm->yv12_fb[cm->active_ref_idx[0]].corrupted = 1;
+ get_frame_ref_buffer(cm, 0)->corrupted = 1;
}
cm->new_fb_idx = get_free_fb(cm);
* thing to do here.
*/
if (cm->active_ref_idx[0] != INT_MAX)
- cm->yv12_fb[cm->active_ref_idx[0]].corrupted = 1;
+ get_frame_ref_buffer(cm, 0)->corrupted = 1;
if (cm->fb_idx_ref_cnt[cm->new_fb_idx] > 0)
cm->fb_idx_ref_cnt[cm->new_fb_idx]--;