Commit 8160a26f authored by Paul Wilkins's avatar Paul Wilkins

Fix some bugs in multi-arf

Fix some bugs relating to the use of buffers
in the overlay frames.

Fix bug where a mid sequence overlay was
propagating large partition and transform sizes into
the subsequent frame because of :-
  sf->last_partitioning_redo_frequency  > 1 and
  sf->tx_size_search_method == USE_LARGESTALL

Change-Id: Ibf9ef39a5a5150f8cbdd2c9275abb0316c67873a
parent 26110225
......@@ -2268,8 +2268,15 @@ static void encode_rd_sb_row(VP9_COMP *cpi, const TileInfo *const tile,
rd_use_partition(cpi, tile, mi, tp, mi_row, mi_col, BLOCK_64X64,
&dummy_rate, &dummy_dist, 1, cpi->pc_root);
} else {
GF_GROUP * gf_grp = &cpi->twopass.gf_group;
int last_was_mid_sequence_overlay = 0;
if ((cpi->pass == 2) && (gf_grp->index)) {
if (gf_grp->update_type[gf_grp->index - 1] == OVERLAY_UPDATE)
last_was_mid_sequence_overlay = 1;
}
if ((cm->current_video_frame
% sf->last_partitioning_redo_frequency) == 0
|| last_was_mid_sequence_overlay
|| cm->prev_mi == 0
|| cm->show_frame == 0
|| cm->frame_type == KEY_FRAME
......
......@@ -2462,9 +2462,8 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
cm->show_frame = 1;
cm->intra_only = 0;
// Check to see if the frame to be encoded is an overlay
// for a previous arf frame and if so configure it as such.
if (cpi->pass == 0)
// Check to see if the frame to be encoded is an overlay for a previous
// arf frame and if so configure it as such.
is_src_altref(cpi);
}
}
......
......@@ -1340,7 +1340,7 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
twopass->gf_group.rf_level[frame_index] = GF_ARF_STD;
twopass->gf_group.bit_allocation[frame_index] = gf_arf_bits;
twopass->gf_group.arf_src_offset[frame_index] =
rc->baseline_gf_interval - 1;
(unsigned char)(rc->baseline_gf_interval - 1);
twopass->gf_group.arf_update_idx[frame_index] = 2;
twopass->gf_group.arf_ref_idx[frame_index] = 2;
++frame_index;
......@@ -1350,7 +1350,7 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
twopass->gf_group.update_type[frame_index] = ARF_UPDATE;
twopass->gf_group.rf_level[frame_index] = GF_ARF_LOW;
twopass->gf_group.arf_src_offset[frame_index] =
((rc->baseline_gf_interval - 1) >> 1);
(unsigned char)((rc->baseline_gf_interval >> 1) - 1);
twopass->gf_group.arf_update_idx[frame_index] = 3;
twopass->gf_group.arf_ref_idx[frame_index] = 2;
++frame_index;
......@@ -1385,6 +1385,9 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
twopass->gf_group.arf_update_idx[frame_index] = 2;
twopass->gf_group.arf_ref_idx[frame_index] = 2;
}
} else {
twopass->gf_group.arf_update_idx[frame_index] = 2;
twopass->gf_group.arf_ref_idx[frame_index] = 2;
}
target_frame_size = clamp(target_frame_size, 0,
......@@ -1402,6 +1405,16 @@ static void allocate_gf_group_bits(VP9_COMP *cpi, int64_t gf_group_bits,
twopass->gf_group.bit_allocation[middle_frame_idx] + mid_boost_bits;
twopass->gf_group.update_type[middle_frame_idx] = OVERLAY_UPDATE;
twopass->gf_group.bit_allocation[middle_frame_idx] = 0;
// Configure the overlay frame at the end of the sequence that will also
// be the start frame of the next group. The reason for doing this here
// is that on entry to vp9_get_compressed_data() for the overlay
// frame, but before the call to vp9_rc_get_second_pass_params() the
// data will otherwise be undefined.
twopass->gf_group.update_type[frame_index] = OVERLAY_UPDATE;
twopass->gf_group.rf_level[frame_index] = INTER_NORMAL;
twopass->gf_group.arf_update_idx[frame_index] = 2;
twopass->gf_group.arf_ref_idx[frame_index] = 2;
}
}
......
......@@ -84,16 +84,17 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
if (speed >= 2) {
if (MIN(cm->width, cm->height) >= 720) {
sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
sf->last_partitioning_redo_frequency = 3;
sf->disable_split_mask = cm->show_frame ? DISABLE_ALL_SPLIT
: DISABLE_ALL_INTER_SPLIT;
} else {
sf->disable_split_mask = LAST_AND_INTRA_SPLIT_ONLY;
sf->last_partitioning_redo_frequency = 2;
sf->lf_motion_threshold = NO_MOITION_THRESHOLD;
sf->lf_motion_threshold = NO_MOTION_THRESHOLD;
}
sf->adaptive_pred_interp_filter = 2;
sf->adaptive_pred_interp_filter = 0;
sf->reference_masking = 1;
sf->mode_search_skip_flags = FLAG_SKIP_INTRA_DIRMISMATCH |
FLAG_SKIP_INTRA_BESTINTER |
......@@ -114,7 +115,7 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
else
sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
sf->last_partitioning_redo_frequency = 3;
sf->recode_loop = ALLOW_RECODE_KFMAXBW;
sf->adaptive_rd_thresh = 3;
......@@ -198,7 +199,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
sf->comp_inter_joint_search_thresh = BLOCK_SIZES;
sf->auto_min_max_partition_size = RELAXED_NEIGHBORING_MIN_MAX;
sf->use_lastframe_partitioning = LAST_FRAME_PARTITION_LOW_MOTION;
sf->lf_motion_threshold = LOW_MOITION_THRESHOLD;
sf->lf_motion_threshold = LOW_MOTION_THRESHOLD;
sf->adjust_partitioning_from_last_frame = 1;
sf->last_partitioning_redo_frequency = 3;
sf->use_lp32x32fdct = 1;
......
......@@ -44,8 +44,8 @@ typedef enum {
} SUBPEL_SEARCH_METHODS;
typedef enum {
NO_MOITION_THRESHOLD = 0,
LOW_MOITION_THRESHOLD = 7
NO_MOTION_THRESHOLD = 0,
LOW_MOTION_THRESHOLD = 7
} MOTION_THRESHOLD;
typedef enum {
......
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