Commit 6bfa0aa8 authored by fbossen's avatar fbossen Committed by GitHub

Add support for compound mode (#663)

* Enable coding of compound mode

* Modify inter prediction function to support compound mode

* Call motion estimation function early and store results for use by compound mode

* Add compound as an RDO candidate

* Increase frame coding structure pyramid size

* Make ME search range dependent on frame distance
parent e06321d1
......@@ -179,7 +179,7 @@ impl Context {
let reorder = false;
let multiref = reorder || self.fi.config.speed <= 2;
let pyramid_depth = if reorder { 1 } else { 0 };
let pyramid_depth = if reorder { 2 } else { 0 };
let group_src_len = 1 << pyramid_depth;
let group_len = group_src_len + if reorder { pyramid_depth } else { 0 };
let segment_len = 1 + (key_frame_interval - 1 + group_src_len - 1) / group_src_len * group_len;
......@@ -264,7 +264,13 @@ impl Context {
} as u8) & 7;
}
self.fi.reference_mode = if multiref && reorder && idx_in_group != 0 {
ReferenceMode::SELECT
} else {
ReferenceMode::SINGLE
};
self.fi.number = segment_idx * key_frame_interval + self.fi.order_hint as u64;
self.fi.me_range_scale = (group_src_len >> lvl) as u8;
}
true
......
This diff is collapsed.
This diff is collapsed.
......@@ -899,7 +899,7 @@ pub static default_refmv_cdf: [[u16; cdf_size!(2)]; REFMV_MODE_CONTEXTS] = [
pub static default_drl_cdf: [[u16; cdf_size!(2)]; DRL_MODE_CONTEXTS] =
[cdf!(13104), cdf!(24560), cdf!(18945)];
pub static default_inter_compound_mode_cdf: [[u16;
pub static default_compound_mode_cdf: [[u16;
cdf_size!(INTER_COMPOUND_MODES)];
INTER_MODE_CONTEXTS] = [
cdf!(7760, 13823, 15808, 17641, 19156, 20666, 26891),
......@@ -1125,7 +1125,7 @@ pub static default_obmc_cdf: [[u16; cdf_size!(2)];
pub static default_intra_inter_cdf: [[u16; cdf_size!(2)];
INTRA_INTER_CONTEXTS] = [cdf!(806), cdf!(16662), cdf!(20186), cdf!(26538)];
pub static default_comp_inter_cdf: [[u16; cdf_size!(2)]; COMP_INTER_CONTEXTS] =
pub static default_comp_mode_cdf: [[u16; cdf_size!(2)]; COMP_INTER_CONTEXTS] =
[cdf!(26828), cdf!(24035), cdf!(12031), cdf!(10640), cdf!(2901)];
pub static default_comp_ref_type_cdf: [[u16; cdf_size!(2)];
......
......@@ -45,7 +45,7 @@ pub fn motion_estimation(
x: (bo.x as isize) << BLOCK_TO_PLANE_SHIFT,
y: (bo.y as isize) << BLOCK_TO_PLANE_SHIFT
};
let range = 32 as isize;
let range = 32 * fi.me_range_scale as isize;
let blk_w = bsize.width();
let blk_h = bsize.height();
let border_w = 128 + blk_w as isize * 8;
......@@ -113,7 +113,8 @@ pub fn motion_estimation(
&mut tmp_plane.mut_slice(&PlaneOffset { x: 0, y: 0 });
mode.predict_inter(
fi, 0, &po, tmp_slice, blk_w, blk_h, ref_frame, &cand_mv, 8,
fi, 0, &po, tmp_slice, blk_w, blk_h, &[ref_frame, NONE_FRAME],
&[cand_mv, MotionVector{ row: 0, col: 0 }], 8,
);
}
......
This diff is collapsed.
......@@ -50,6 +50,14 @@ pub static RAV1E_INTER_MODES_MINIMAL: &'static [PredictionMode] = &[
PredictionMode::NEWMV
];
pub static RAV1E_INTER_COMPOUND_MODES: &'static [PredictionMode] = &[
PredictionMode::GLOBAL_GLOBALMV,
PredictionMode::NEAREST_NEARESTMV,
PredictionMode::NEW_NEWMV,
PredictionMode::NEAREST_NEWMV,
PredictionMode::NEW_NEARESTMV
];
// Weights are quadratic from '1' to '1 / block_size', scaled by 2^sm_weight_log2_scale.
const sm_weight_log2_scale: u8 = 8;
......
This diff is collapsed.
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