Commit 06dd13cd authored by Raphaël Zumer's avatar Raphaël Zumer

Fix get_intra_edges() chroma handling

parent 336a7d6a
......@@ -1781,7 +1781,7 @@ pub fn encode_tx_block(
if mode.is_intra() {
let bit_depth = fi.sequence.bit_depth;
let edge_buf = get_intra_edges(&rec.slice(po), tx_size, bit_depth, p, fi.w_in_b, fi.h_in_b, Some(mode));
let edge_buf = get_intra_edges(&rec.slice(po), tx_size, bit_depth, &fs.input.planes[p].cfg, fi.w_in_b, fi.h_in_b, Some(mode));
mode.predict_intra(&mut rec.mut_slice(po), tx_size, bit_depth, &ac, alpha, &edge_buf);
}
......
......@@ -792,7 +792,7 @@ pub fn get_intra_edges<'a>(
dst: &'a PlaneSlice<'a>,
tx_size: TxSize,
bit_depth: usize,
p: usize,
plane_cfg: &'a PlaneConfig,
frame_w_in_b: usize,
frame_h_in_b: usize,
opt_mode: Option<PredictionMode>
......@@ -877,19 +877,21 @@ pub fn get_intra_edges<'a>(
// Needs top right
if needs_topright {
let bo = if p == 0 {
BlockOffset { x: x as usize / 4, y: y as usize / 4 }
} else {
BlockOffset { x: x as usize / 2, y: y as usize / 2 }
};
let bsize = if p == 0 {
BlockSize::from_width_and_height(tx_size.width(), tx_size.height())
} else {
BlockSize::from_width_and_height(2*tx_size.width(), 2*tx_size.height())
};
debug_assert!(plane_cfg.xdec <= 1 && plane_cfg.ydec <= 1);
let bo = BlockOffset {
x: x as usize >> (2 - plane_cfg.xdec),
y: y as usize >> (2 - plane_cfg.ydec)
};
let bsize = BlockSize::from_width_and_height(
tx_size.width() << plane_cfg.xdec,
tx_size.height() << plane_cfg.ydec
);
let num_avail = if y != 0 && has_tr(&bo, bsize) {
tx_size.height().min(
(if p == 0 { MI_SIZE } else { MI_SIZE / 2 }) * frame_w_in_b
(MI_SIZE >> plane_cfg.xdec) * frame_w_in_b // TODO: validate for 4:2:2
- x as usize
- tx_size.width()
)
......@@ -910,19 +912,21 @@ pub fn get_intra_edges<'a>(
// Needs bottom left
if needs_bottomleft {
let bo = if p == 0 {
BlockOffset { x: x as usize / 4, y: y as usize / 4 }
} else {
BlockOffset { x: x as usize / 2, y: y as usize / 2 }
};
let bsize = if p == 0 {
BlockSize::from_width_and_height(tx_size.width(), tx_size.height())
} else {
BlockSize::from_width_and_height(2*tx_size.width(), 2*tx_size.height())
};
debug_assert!(plane_cfg.xdec <= 1 && plane_cfg.ydec <= 1);
let bo = BlockOffset {
x: x as usize >> (2 - plane_cfg.xdec),
y: y as usize >> (2 - plane_cfg.ydec)
};
let bsize = BlockSize::from_width_and_height(
tx_size.width() << plane_cfg.xdec,
tx_size.height() << plane_cfg.ydec
);
let num_avail = if x != 0 && has_bl(&bo, bsize) {
tx_size.width().min(
(if p == 0 { MI_SIZE } else { MI_SIZE / 2 }) * frame_h_in_b
(MI_SIZE >> plane_cfg.xdec) * frame_h_in_b // TODO: validate for 4:2:2
- y as usize
- tx_size.height()
)
......
......@@ -624,7 +624,7 @@ pub fn rdo_mode_decision(fi: &FrameInvariants, fs: &mut FrameState,
let edge_buf = {
let rec = &mut fs.rec.planes[0];
let po = bo.plane_offset(&rec.cfg);
get_intra_edges(&rec.slice(&po), tx_size, fi.sequence.bit_depth, 0, fi.w_in_b, fi.h_in_b, None)
get_intra_edges(&rec.slice(&po), tx_size, fi.sequence.bit_depth, &fs.input.planes[0].cfg, fi.w_in_b, fi.h_in_b, None)
};
intra_mode_set
.iter()
......@@ -804,7 +804,7 @@ pub fn rdo_cfl_alpha(
&rec.slice(&po),
uv_tx_size,
bit_depth,
p,
&input.cfg,
0,
0,
Some(PredictionMode::UV_CFL_PRED)
......
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