Merge "Adding get_ref_frame_buffer() function."
This commit is contained in:
Коммит
7b496783c2
|
@ -1090,12 +1090,11 @@ static void write_frame_size(VP9_COMP *cpi,
|
|||
static void write_frame_size_with_refs(VP9_COMP *cpi,
|
||||
struct vp9_write_bit_buffer *wb) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
int refs[REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int i, found = 0;
|
||||
int found = 0;
|
||||
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->ref_frame_map[refs[i]]];
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
||||
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, ref_frame);
|
||||
found = cm->width == cfg->y_crop_width &&
|
||||
cm->height == cfg->y_crop_height;
|
||||
|
||||
|
@ -1159,8 +1158,6 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
|||
|
||||
write_frame_size(cpi, wb);
|
||||
} else {
|
||||
const int refs[REFS_PER_FRAME] = {cpi->lst_fb_idx, cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
if (!cm->show_frame)
|
||||
vp9_wb_write_bit(wb, cm->intra_only);
|
||||
|
||||
|
@ -1173,11 +1170,12 @@ static void write_uncompressed_header(VP9_COMP *cpi,
|
|||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
|
||||
write_frame_size(cpi, wb);
|
||||
} else {
|
||||
int i;
|
||||
MV_REFERENCE_FRAME ref_frame;
|
||||
vp9_wb_write_literal(wb, get_refresh_mask(cpi), REF_FRAMES);
|
||||
for (i = 0; i < REFS_PER_FRAME; ++i) {
|
||||
vp9_wb_write_literal(wb, refs[i], REF_FRAMES_LOG2);
|
||||
vp9_wb_write_bit(wb, cm->ref_frame_sign_bias[LAST_FRAME + i]);
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
|
||||
vp9_wb_write_literal(wb, get_ref_frame_idx(cpi, ref_frame),
|
||||
REF_FRAMES_LOG2);
|
||||
vp9_wb_write_bit(wb, cm->ref_frame_sign_bias[ref_frame]);
|
||||
}
|
||||
|
||||
write_frame_size_with_refs(cpi, wb);
|
||||
|
|
|
@ -1994,8 +1994,7 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
|
|||
vp9_setup_src_planes(x, cpi->Source, 0, 0);
|
||||
|
||||
// TODO(jkoleszar): are these initializations required?
|
||||
setup_pre_planes(xd, 0, &cm->yv12_fb[cm->ref_frame_map[cpi->lst_fb_idx]],
|
||||
0, 0, NULL);
|
||||
setup_pre_planes(xd, 0, get_ref_frame_buffer(cpi, LAST_FRAME), 0, 0, NULL);
|
||||
setup_dst_planes(xd, get_frame_new_buffer(cm), 0, 0);
|
||||
|
||||
setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
|
||||
|
@ -2584,8 +2583,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
|
|||
int ref;
|
||||
const int is_compound = has_second_ref(mbmi);
|
||||
for (ref = 0; ref < 1 + is_compound; ++ref) {
|
||||
YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->ref_frame_map[
|
||||
get_ref_frame_idx(cpi, mbmi->ref_frame[ref])]];
|
||||
YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi,
|
||||
mbmi->ref_frame[ref]);
|
||||
setup_pre_planes(xd, ref, cfg, mi_row, mi_col, &xd->block_refs[ref]->sf);
|
||||
}
|
||||
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, MAX(bsize, BLOCK_8X8));
|
||||
|
|
|
@ -492,10 +492,8 @@ void vp9_first_pass(VP9_COMP *cpi) {
|
|||
int i;
|
||||
|
||||
int recon_yoffset, recon_uvoffset;
|
||||
const int lst_yv12_idx = cm->ref_frame_map[cpi->lst_fb_idx];
|
||||
const int gld_yv12_idx = cm->ref_frame_map[cpi->gld_fb_idx];
|
||||
YV12_BUFFER_CONFIG *const lst_yv12 = &cm->yv12_fb[lst_yv12_idx];
|
||||
YV12_BUFFER_CONFIG *const gld_yv12 = &cm->yv12_fb[gld_yv12_idx];
|
||||
YV12_BUFFER_CONFIG *const lst_yv12 = get_ref_frame_buffer(cpi, LAST_FRAME);
|
||||
YV12_BUFFER_CONFIG *const gld_yv12 = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
|
||||
YV12_BUFFER_CONFIG *const new_yv12 = get_frame_new_buffer(cm);
|
||||
const int recon_y_stride = lst_yv12->y_stride;
|
||||
const int recon_uv_stride = lst_yv12->uv_stride;
|
||||
|
|
|
@ -392,8 +392,7 @@ static void separate_arf_mbs(VP9_COMP *cpi) {
|
|||
void vp9_update_mbgraph_stats(VP9_COMP *cpi) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
int i, n_frames = vp9_lookahead_depth(cpi->lookahead);
|
||||
YV12_BUFFER_CONFIG *golden_ref =
|
||||
&cm->yv12_fb[cm->ref_frame_map[cpi->gld_fb_idx]];
|
||||
YV12_BUFFER_CONFIG *golden_ref = get_ref_frame_buffer(cpi, GOLDEN_FRAME);
|
||||
|
||||
// we need to look ahead beyond where the ARF transitions into
|
||||
// being a GF - so exit if we don't look ahead beyond that
|
||||
|
|
|
@ -663,6 +663,12 @@ static int get_scale_ref_frame_idx(VP9_COMP *cpi,
|
|||
}
|
||||
}
|
||||
|
||||
static YV12_BUFFER_CONFIG *get_ref_frame_buffer(VP9_COMP *cpi,
|
||||
MV_REFERENCE_FRAME ref_frame) {
|
||||
VP9_COMMON *const cm = &cpi->common;
|
||||
return &cm->yv12_fb[cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)]];
|
||||
}
|
||||
|
||||
void vp9_encode_frame(VP9_COMP *cpi);
|
||||
|
||||
void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size);
|
||||
|
|
|
@ -3115,10 +3115,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
int_mv single_newmv[MAX_REF_FRAMES] = { { 0 } };
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
int idx_list[4] = {0,
|
||||
cpi->lst_fb_idx,
|
||||
cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int64_t best_rd = best_rd_so_far;
|
||||
int64_t best_tx_rd[TX_MODES];
|
||||
int64_t best_tx_diff[TX_MODES];
|
||||
|
@ -3169,8 +3165,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
|
||||
x->pred_mv_sad[ref_frame] = INT_MAX;
|
||||
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
|
||||
setup_buffer_inter(cpi, x, tile, idx_list[ref_frame], ref_frame,
|
||||
block_size, mi_row, mi_col,
|
||||
setup_buffer_inter(cpi, x, tile, get_ref_frame_idx(cpi, ref_frame),
|
||||
ref_frame, block_size, mi_row, mi_col,
|
||||
frame_mv[NEARESTMV], frame_mv[NEARMV], yv12_mb);
|
||||
}
|
||||
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
|
||||
|
@ -3739,10 +3735,6 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
struct buf_2d yv12_mb[4][MAX_MB_PLANE];
|
||||
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
|
||||
VP9_ALT_FLAG };
|
||||
int idx_list[4] = {0,
|
||||
cpi->lst_fb_idx,
|
||||
cpi->gld_fb_idx,
|
||||
cpi->alt_fb_idx};
|
||||
int64_t best_rd = best_rd_so_far;
|
||||
int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise
|
||||
int64_t best_tx_rd[TX_MODES];
|
||||
|
@ -3792,8 +3784,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
|
|||
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ref_frame++) {
|
||||
if (cpi->ref_frame_flags & flag_list[ref_frame]) {
|
||||
setup_buffer_inter(cpi, x, tile, idx_list[ref_frame], ref_frame,
|
||||
block_size, mi_row, mi_col,
|
||||
setup_buffer_inter(cpi, x, tile, get_ref_frame_idx(cpi, ref_frame),
|
||||
ref_frame, block_size, mi_row, mi_col,
|
||||
frame_mv[NEARESTMV], frame_mv[NEARMV],
|
||||
yv12_mb);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче