Unverified Commit c27a5694 authored by Yushin Cho's avatar Yushin Cho Committed by GitHub

Fix top-down partition rdo split don't have ref pixels (#762)

parent 23535876
......@@ -2027,7 +2027,8 @@ fn encode_partition_topdown(seq: &Sequence, fi: &FrameInvariants, fs: &mut Frame
partition = PartitionType::PARTITION_SPLIT;
} else if bsize > fi.min_partition_size {
// Blocks of sizes within the supported range are subjected to a partitioning decision
rdo_output = rdo_partition_decision(seq, fi, fs, cw, bsize, bo, &rdo_output, pmvs);
rdo_output = rdo_partition_decision(seq, fi, fs, cw,
w_pre_cdef, w_post_cdef, bsize, bo, &rdo_output, pmvs);
partition = rdo_output.part_type;
} else {
// Blocks of sizes below the supported range are encoded directly
......@@ -812,7 +812,8 @@ pub fn rdo_tx_type_decision(
// RDO-based single level partitioning decision
pub fn rdo_partition_decision(
seq: &Sequence, fi: &FrameInvariants, fs: &mut FrameState,
cw: &mut ContextWriter, bsize: BlockSize, bo: &BlockOffset,
cw: &mut ContextWriter, w_pre_cdef: &mut dyn Writer, w_post_cdef: &mut dyn Writer,
bsize: BlockSize, bo: &BlockOffset,
cached_block: &RDOOutput, pmvs: &[[Option<MotionVector>; REF_FRAMES]; 5]
) -> RDOOutput {
let max_rd = std::f64::MAX;
......@@ -875,16 +876,49 @@ pub fn rdo_partition_decision(
let cw_checkpoint = cw.checkpoint();
let w_pre_checkpoint = w_pre_cdef.checkpoint();
let w_post_checkpoint = w_post_cdef.checkpoint();
.map(|(&offset, pmv_idx)| {
let mode_decision =
rdo_mode_decision(seq, fi, fs, cw, subsize, &offset,
&pmvs[pmv_idx], true)
let (mode_luma, mode_chroma) = (mode_decision.pred_mode_luma, mode_decision.pred_mode_chroma);
let bo = offset;
let cfl = mode_decision.pred_cfl_params;
let ref_frames = mode_decision.ref_frames;
let mvs = mode_decision.mvs;
let skip = mode_decision.skip;
let mut cdef_coded = cw.bc.cdef_coded;
let (tx_size, tx_type) = (mode_decision.tx_size, mode_decision.tx_type);
cw.bc.set_tx_size(bo, tx_size);
let mut mv_stack = Vec::new();
let is_compound = ref_frames[1] != NONE_FRAME;
let mode_context = cw.find_mvrefs(bo, ref_frames, &mut mv_stack, subsize, false, fi, is_compound);
cdef_coded = encode_block_a(seq, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
subsize, bo, skip);
encode_block_b(seq, fi, fs, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
mode_luma, mode_chroma, ref_frames, mvs, subsize, bo, skip, seq.bit_depth, cfl,
tx_size, tx_type, mode_context, &mv_stack, false);
_ => {
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