Commit ac0aeff7 authored by Raphaël Zumer's avatar Raphaël Zumer
Browse files

Rename block encode functions for clarity

parent 25018943
...@@ -1093,7 +1093,7 @@ pub fn save_block_motion<T: Pixel>( ...@@ -1093,7 +1093,7 @@ pub fn save_block_motion<T: Pixel>(
} }
} }
pub fn encode_block_a<T: Pixel>( pub fn encode_block_pre_cdef<T: Pixel>(
seq: &Sequence, ts: &TileStateMut<'_, T>, seq: &Sequence, ts: &TileStateMut<'_, T>,
cw: &mut ContextWriter, w: &mut dyn Writer, cw: &mut ContextWriter, w: &mut dyn Writer,
bsize: BlockSize, tile_bo: BlockOffset, skip: bool bsize: BlockSize, tile_bo: BlockOffset, skip: bool
...@@ -1112,7 +1112,7 @@ pub fn encode_block_a<T: Pixel>( ...@@ -1112,7 +1112,7 @@ pub fn encode_block_a<T: Pixel>(
cw.bc.cdef_coded cw.bc.cdef_coded
} }
pub fn encode_block_b<T: Pixel>( pub fn encode_block_post_cdef<T: Pixel>(
fi: &FrameInvariants<T>, ts: &mut TileStateMut<'_, T>, fi: &FrameInvariants<T>, ts: &mut TileStateMut<'_, T>,
cw: &mut ContextWriter, w: &mut dyn Writer, cw: &mut ContextWriter, w: &mut dyn Writer,
luma_mode: PredictionMode, chroma_mode: PredictionMode, luma_mode: PredictionMode, chroma_mode: PredictionMode,
...@@ -1512,9 +1512,9 @@ pub fn encode_block_with_modes<T: Pixel>( ...@@ -1512,9 +1512,9 @@ pub fn encode_block_with_modes<T: Pixel>(
let is_compound = ref_frames[1] != NONE_FRAME; let is_compound = ref_frames[1] != NONE_FRAME;
let mode_context = cw.find_mvrefs(tile_bo, ref_frames, &mut mv_stack, bsize, fi, is_compound); let mode_context = cw.find_mvrefs(tile_bo, ref_frames, &mut mv_stack, bsize, fi, is_compound);
cdef_coded = encode_block_a(&fi.sequence, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef}, cdef_coded = encode_block_pre_cdef(&fi.sequence, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
bsize, tile_bo, skip); bsize, tile_bo, skip);
encode_block_b(fi, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef}, encode_block_post_cdef(fi, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
mode_luma, mode_chroma, ref_frames, mvs, bsize, tile_bo, skip, cfl, mode_luma, mode_chroma, ref_frames, mvs, bsize, tile_bo, skip, cfl,
tx_size, tx_type, mode_context, &mv_stack, rdo_type, true); tx_size, tx_type, mode_context, &mv_stack, rdo_type, true);
} }
...@@ -1894,9 +1894,9 @@ fn encode_partition_topdown<T: Pixel, W: Writer>( ...@@ -1894,9 +1894,9 @@ fn encode_partition_topdown<T: Pixel, W: Writer>(
} }
// FIXME: every final block that has gone through the RDO decision process is encoded twice // FIXME: every final block that has gone through the RDO decision process is encoded twice
cdef_coded = encode_block_a(&fi.sequence, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef}, cdef_coded = encode_block_pre_cdef(&fi.sequence, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
bsize, tile_bo, skip); bsize, tile_bo, skip);
encode_block_b(fi, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef}, encode_block_post_cdef(fi, ts, cw, if cdef_coded {w_post_cdef} else {w_pre_cdef},
mode_luma, mode_chroma, ref_frames, mvs, bsize, tile_bo, skip, cfl, mode_luma, mode_chroma, ref_frames, mvs, bsize, tile_bo, skip, cfl,
tx_size, tx_type, mode_context, &mv_stack, RDOType::PixelDistRealRate, true); tx_size, tx_type, mode_context, &mv_stack, RDOType::PixelDistRealRate, true);
}, },
......
...@@ -16,8 +16,7 @@ use crate::lrf::*; ...@@ -16,8 +16,7 @@ use crate::lrf::*;
use crate::context::*; use crate::context::*;
use crate::ec::{OD_BITRES, Writer, WriterCounter}; use crate::ec::{OD_BITRES, Writer, WriterCounter};
use crate::header::ReferenceMode; use crate::header::ReferenceMode;
use crate::encode_block_a; use crate::{encode_block_pre_cdef, encode_block_post_cdef};
use crate::encode_block_b;
use crate::encode_block_with_modes; use crate::encode_block_with_modes;
use crate::encoder::FrameInvariants; use crate::encoder::FrameInvariants;
use crate::frame::Frame; use crate::frame::Frame;
...@@ -613,9 +612,9 @@ pub fn rdo_mode_decision<T: Pixel>( ...@@ -613,9 +612,9 @@ pub fn rdo_mode_decision<T: Pixel>(
// TODO(yushin): luma and chroma would have different decision based on chroma format // TODO(yushin): luma and chroma would have different decision based on chroma format
let need_recon_pixel = luma_mode_is_intra && tx_size.block_size() != bsize; let need_recon_pixel = luma_mode_is_intra && tx_size.block_size() != bsize;
encode_block_a(&fi.sequence, ts, cw, wr, bsize, tile_bo, skip); encode_block_pre_cdef(&fi.sequence, ts, cw, wr, bsize, tile_bo, skip);
let tx_dist = let tx_dist =
encode_block_b( encode_block_post_cdef(
fi, fi,
ts, ts,
cw, cw,
...@@ -833,8 +832,8 @@ pub fn rdo_mode_decision<T: Pixel>( ...@@ -833,8 +832,8 @@ pub fn rdo_mode_decision<T: Pixel>(
let wr: &mut dyn Writer = &mut WriterCounter::new(); let wr: &mut dyn Writer = &mut WriterCounter::new();
let tell = wr.tell_frac(); let tell = wr.tell_frac();
encode_block_a(&fi.sequence, ts, cw, wr, bsize, tile_bo, best.skip); encode_block_pre_cdef(&fi.sequence, ts, cw, wr, bsize, tile_bo, best.skip);
let _ = encode_block_b( let _ = encode_block_post_cdef(
fi, fi,
ts, ts,
cw, cw,
......
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