A 1:4 intra strip in an inter frame took its tx-depth CDF row from the key frame's deblock grid, not the TXFM_CONTEXT bands
Browse files at this commit27250ff85c9359bb14fd81df450e3bc40793a007Parent: c11cb86- fix
- a 1:4 intra strip in an inter frame took its tx-depth CDF row from the key frame's deblock grid, not the TXFM_CONTEXT bands
1 changed file +70 -7
- crates/ec-av1/src/decode.rs +70 -7
crates/ec-av1/src/decode.rsmodified+70 -7
| @@ -7842,8 +7842,26 @@ fn decode_block_rect( | |||
| 7842 | // pinned HORZ quadrant were wrong from their very first pixel, and why our | 7842 | // pinned HORZ quadrant were wrong from their very first pixel, and why our |
| 7843 | // range after the read equalled the oracle's range for the whole block. | 7843 | // range after the read equalled the oracle's range for the whole block. |
| 7844 | let depth = if tx_select { | 7844 | let depth = if tx_select { |
| 7845 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | 7845 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real |
| 7846 | - dec.symbol(&mut cdfs.tx_size_cat2[ctx]) | 7846 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and |
| 7847 | + // the 16x4 intra-in-inter strips already do); the key frame's | ||
| 7848 | + // deblock-grid approximation is only right where those bands were never | ||
| 7849 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | ||
| 7850 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | ||
| 7851 | + // `tx_size_cat2` row 1 where libaom reads row 2. | ||
| 7852 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | ||
| 7853 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 7854 | + } else { | ||
| 7855 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 7856 | + }; | ||
| 7857 | + let d = dec.symbol(&mut cdfs.tx_size_cat2[ctx]); | ||
| 7858 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 7859 | + eprintln!( | ||
| 7860 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=2 rng={}", | ||
| 7861 | + dec.debug_state().0 | ||
| 7862 | + ); | ||
| 7863 | + } | ||
| 7864 | + d | ||
| 7847 | } else { | 7865 | } else { |
| 7848 | 0 | 7866 | 0 |
| 7849 | }; | 7867 | }; |
| @@ -8658,8 +8676,26 @@ fn decode_block_rect4( | |||
| 8658 | uv_mode | 8676 | uv_mode |
| 8659 | }; | 8677 | }; |
| 8660 | let depth = if tx_select { | 8678 | let depth = if tx_select { |
| 8661 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | 8679 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real |
| 8662 | - dec.symbol(&mut cdfs.tx_size_cat2[ctx]) | 8680 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and |
| 8681 | + // the 16x4 intra-in-inter strips already do); the key frame's | ||
| 8682 | + // deblock-grid approximation is only right where those bands were never | ||
| 8683 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | ||
| 8684 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | ||
| 8685 | + // `tx_size_cat2` row 1 where libaom reads row 2. | ||
| 8686 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | ||
| 8687 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 8688 | + } else { | ||
| 8689 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 8690 | + }; | ||
| 8691 | + let d = dec.symbol(&mut cdfs.tx_size_cat2[ctx]); | ||
| 8692 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 8693 | + eprintln!( | ||
| 8694 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=2 rng={}", | ||
| 8695 | + dec.debug_state().0 | ||
| 8696 | + ); | ||
| 8697 | + } | ||
| 8698 | + d | ||
| 8663 | } else { | 8699 | } else { |
| 8664 | 0 | 8700 | 0 |
| 8665 | }; | 8701 | }; |
| @@ -9176,7 +9212,16 @@ fn decode_rect4_16_strip( | |||
| 9176 | } else { | 9212 | } else { |
| 9177 | tx_size_context_rect(neighbours, lmi, bw, bh) | 9213 | tx_size_context_rect(neighbours, lmi, bw, bh) |
| 9178 | }; | 9214 | }; |
| 9179 | - dec.symbol(&mut cdfs.tx_size_cat1[ctx]) | 9215 | + let d = dec.symbol(&mut cdfs.tx_size_cat1[ctx]); |
| 9216 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 9217 | + eprintln!( | ||
| 9218 | + "EC_ISTEP mi_row={} mi_col={} name=tx_depth val={d} ctx={ctx} cat=1 rng={}", | ||
| 9219 | + lmi.0, | ||
| 9220 | + lmi.1, | ||
| 9221 | + dec.debug_state().0 | ||
| 9222 | + ); | ||
| 9223 | + } | ||
| 9224 | + d | ||
| 9180 | } else { | 9225 | } else { |
| 9181 | 0 | 9226 | 0 |
| 9182 | }; | 9227 | }; |
| @@ -9653,7 +9698,18 @@ fn decode_block_rect64( | |||
| 9653 | }; | 9698 | }; |
| 9654 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); | 9699 | let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI)); |
| 9655 | let depth = if tx_select { | 9700 | let depth = if tx_select { |
| 9656 | - let ctx = tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh); | 9701 | + // lane-t900 r2: on an INTER frame `get_tx_size_context` reads the real |
| 9702 | + // `TXFM_CONTEXT` bands ([`tx_size_context_txfm_rect`], what the 2:1 and | ||
| 9703 | + // the 16x4 intra-in-inter strips already do); the key frame's | ||
| 9704 | + // deblock-grid approximation is only right where those bands were never | ||
| 9705 | + // written. Measured on the 10-bit 1920x792 128-superblock stream, | ||
| 9706 | + // decode-order frame 1: the 32x8 HORZ_4 strip at mi(48,176) read | ||
| 9707 | + // `tx_size_cat2` row 1 where libaom reads row 2. | ||
| 9708 | + let ctx = if INTRA_IN_INTER_MODE.with(std::cell::Cell::get).is_some() { | ||
| 9709 | + tx_size_context_txfm_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 9710 | + } else { | ||
| 9711 | + tx_size_context_rect(neighbours, (mi_r, mi_c), bw, bh) | ||
| 9712 | + }; | ||
| 9657 | // lane-rectsplit r1: `bsize_to_tx_size_cat` (libaom `decodemv.c`) | 9713 | // lane-rectsplit r1: `bsize_to_tx_size_cat` (libaom `decodemv.c`) |
| 9658 | // counts `sub_tx_size_map` steps from the block's own max rect | 9714 | // counts `sub_tx_size_map` steps from the block's own max rect |
| 9659 | // transform down to TX_4X4, minus one -- BLOCK_64X32's chain | 9715 | // transform down to TX_4X4, minus one -- BLOCK_64X32's chain |
| @@ -9661,7 +9717,14 @@ fn decode_block_rect64( | |||
| 9661 | // steps, so this level's category is 3 (the same one a 64x64 square | 9717 | // steps, so this level's category is 3 (the same one a 64x64 square |
| 9662 | // block uses), not the 2 a 32x16 strip uses. Reading the cat-2 CDF | 9718 | // block uses), not the 2 a 32x16 strip uses. Reading the cat-2 CDF |
| 9663 | // here was a wrong-table read of a real symbol. | 9719 | // here was a wrong-table read of a real symbol. |
| 9664 | - dec.symbol(&mut cdfs.tx_size_cat3[ctx]) | 9720 | + let d = dec.symbol(&mut cdfs.tx_size_cat3[ctx]); |
| 9721 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | ||
| 9722 | + eprintln!( | ||
| 9723 | + "EC_ISTEP mi_row={mi_r} mi_col={mi_c} name=tx_depth val={d} ctx={ctx} cat=3 rng={}", | ||
| 9724 | + dec.debug_state().0 | ||
| 9725 | + ); | ||
| 9726 | + } | ||
| 9727 | + d | ||
| 9665 | } else { | 9728 | } else { |
| 9666 | 0 | 9729 | 0 |
| 9667 | }; | 9730 | }; |