Cherry-pick lane-inter16ab (ee04373): every block of an inter frame publishes its txfm-partition band
Browse files at this commitde4295beba50a565d32b8859471615a9e65b8ba1Parent: 703bfad1 changed file +22 -0
- crates/ec-av1/src/decode.rs +22 -0
crates/ec-av1/src/decode.rsmodified+22 -0
| @@ -7316,6 +7316,16 @@ fn decode_intra_rect_in_inter( | |||
| 7316 | eprintln!("EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}"); | 7316 | eprintln!("EC_SPLITSTRIP mi_row={mi_r} mi_col={mi_c} bw={bw} bh={bh} depth={depth}"); |
| 7317 | } | 7317 | } |
| 7318 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth); | 7318 | let (tx_w, tx_h) = depth_to_tx_wh(bw, bh, depth); |
| 7319 | + // lane-inter16ab r8: libaom runs `set_txfm_ctxs(tx_size, n4_w, n4_h, | ||
| 7320 | + // skip && is_inter, xd)` (decodeframe.c `decode_block`) for EVERY block | ||
| 7321 | + // of an inter frame, intra ones included -- with the skip term 0 it | ||
| 7322 | + // memsets `above_txfm_context` to `tx_size_wide` over the block's width | ||
| 7323 | + // and `left_txfm_context` to `tx_size_high` over its height. This strip | ||
| 7324 | + // wrote neither, so the next block's var-tx `txfm_partition` context read | ||
| 7325 | + // a stale band: on a 192x128 8-bit stream the 16x8 intra strip at | ||
| 7326 | + // mi(14,0) left 8 where libaom has 16, giving ctx 13 instead of 12 at | ||
| 7327 | + // mi(16,0) and desyncing the tile at that symbol. | ||
| 7328 | + txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh)); | ||
| 7319 | let modes = RectStripModes { | 7329 | let modes = RectStripModes { |
| 7320 | skip, | 7330 | skip, |
| 7321 | mode, | 7331 | mode, |
| @@ -13162,6 +13172,9 @@ fn txfm_partition_update_rect( | |||
| 13162 | (tx_w, tx_h): (usize, usize), | 13172 | (tx_w, tx_h): (usize, usize), |
| 13163 | (txb_w, txb_h): (usize, usize), | 13173 | (txb_w, txb_h): (usize, usize), |
| 13164 | ) { | 13174 | ) { |
| 13175 | + if std::env::var_os("EC_TXUPD").is_some() { | ||
| 13176 | + eprintln!("EC_TXUPD rect mi=({},{}) tx=({tx_w},{tx_h}) txb=({txb_w},{txb_h})", mi_r, mi_c); | ||
| 13177 | + } | ||
| 13165 | for i in 0..txb_h / MI { | 13178 | for i in 0..txb_h / MI { |
| 13166 | if let Some(cell) = n.left_txfm.get_mut(mi_r + i) { | 13179 | if let Some(cell) = n.left_txfm.get_mut(mi_r + i) { |
| 13167 | *cell = tx_h as u8; | 13180 | *cell = tx_h as u8; |
| @@ -13185,6 +13198,9 @@ fn set_txfm_ctxs( | |||
| 13185 | h_mi: usize, | 13198 | h_mi: usize, |
| 13186 | skip_inter: bool, | 13199 | skip_inter: bool, |
| 13187 | ) { | 13200 | ) { |
| 13201 | + if std::env::var_os("EC_TXUPD").is_some() { | ||
| 13202 | + eprintln!("EC_TXUPD ctxs mi=({mi_r},{mi_c}) tx={tx_px} wh=({w_mi},{h_mi}) skip_inter={skip_inter}"); | ||
| 13203 | + } | ||
| 13188 | let bw = if skip_inter { w_mi * MI } else { tx_px }; | 13204 | let bw = if skip_inter { w_mi * MI } else { tx_px }; |
| 13189 | let bh = if skip_inter { h_mi * MI } else { tx_px }; | 13205 | let bh = if skip_inter { h_mi * MI } else { tx_px }; |
| 13190 | for i in 0..w_mi { | 13206 | for i in 0..w_mi { |
| @@ -22313,6 +22329,12 @@ fn decode_inter_sub8_split4( | |||
| 22313 | } | 22329 | } |
| 22314 | neighbours.record_mode_mi(rmi, cmi, 1, 1, DC_PRED); | 22330 | neighbours.record_mode_mi(rmi, cmi, 1, 1, DC_PRED); |
| 22315 | neighbours.record_inter_rect_mi(lmi, 1, 1, skip, true, ref_frame, resolved_filter, false); | 22331 | neighbours.record_inter_rect_mi(lmi, 1, 1, skip, true, ref_frame, resolved_filter, false); |
| 22332 | + // lane-inter16ab r8 (same-shape sweep of the intra-strip band gap): | ||
| 22333 | + // a BLOCK_4X4 codes no `txfm_partition` symbol, but libaom still runs | ||
| 22334 | + // `set_txfm_ctxs(TX_4X4, 1, 1, skip && is_inter, xd)` for it -- both | ||
| 22335 | + // arms give 4 -- so the sub-block must publish 4 to the next block's | ||
| 22336 | + // var-tx context instead of leaving whatever the previous block left. | ||
| 22337 | + set_txfm_ctxs(neighbours, lmi, B4, 1, 1, false); | ||
| 22316 | neighbours.fill_skip_grid_rect(lmi, 1, 1, skip); | 22338 | neighbours.fill_skip_grid_rect(lmi, 1, 1, skip); |
| 22317 | neighbours.fill_lf_grid_rect(lmi, 1, 1, B4 as u8, B4 as u8, ref_frame.max(LAST_FRAME)); | 22339 | neighbours.fill_lf_grid_rect(lmi, 1, 1, B4 as u8, B4 as u8, ref_frame.max(LAST_FRAME)); |
| 22318 | last_skip = skip; | 22340 | last_skip = skip; |