Correct the r4 chroma-granularity assumption for 8x8 leaves
Browse files at this commitb91e4ecf7a2ec70e9d36330272eccbe02cad3cb9Parent: dc6d790- fix
- correct the r4 chroma-granularity assumption for 8x8 leaves
2 changed files +17 -9
crates/ec-av1/src/cdf_state.rsmodified+9 -4
| @@ -42,10 +42,15 @@ pub(crate) enum TxbSet { | |||
| 42 | Luma8, | 42 | Luma8, |
| 43 | /// The 8x8 transform of a chroma plane of a 16x16 block. | 43 | /// The 8x8 transform of a chroma plane of a 16x16 block. |
| 44 | Chroma8, | 44 | Chroma8, |
| 45 | - /// The 4x4 transform of a chroma plane of an 8x8 leaf (lane-av1-rect): | 45 | + /// The 4x4 transform of a chroma plane of an 8x8 leaf (lane-av1-rect). |
| 46 | - /// per `get_tx_size` for chroma, this stays 8x8 at the *parent* 16x16's | 46 | + /// r5 correction: libaom's `is_chroma_reference` (`av1_common_int.h`) is |
| 47 | - /// granularity today (see `Chroma8`), so this variant is currently unused | 47 | + /// unconditionally true for `bsize >= BLOCK_8X8`, so chroma *does* follow |
| 48 | - /// but shipped for when a chroma-follows-luma split is wired. | 48 | + /// luma all the way down to 8x8 — it is coded once per 8x8 leaf, not once |
| 49 | + /// per parent 16x16 (that "stays at the parent's Chroma8 granularity" | ||
| 50 | + /// framing this doc carried through r4 was never checked against a real | ||
| 51 | + /// decoder and is wrong; only `BLOCK_4X4`/`4X8`/`8X4`, one mi-unit wide or | ||
| 52 | + /// high, get the "last sub-block only" chroma-merge treatment). A real | ||
| 53 | + /// writer for the straddling-16x16 case must use this variant per leaf. | ||
| 49 | Chroma4, | 54 | Chroma4, |
| 50 | /// The 16x16 transform of a chroma plane of a 32x32 block. | 55 | /// The 16x16 transform of a chroma plane of a 32x32 block. |
| 51 | Chroma16, | 56 | Chroma16, |
crates/ec-av1/src/encode.rsmodified+8 -5
| @@ -1058,11 +1058,14 @@ fn code_square( | |||
| 1058 | let (luma_set, chroma_set) = if side == BLOCK { | 1058 | let (luma_set, chroma_set) = if side == BLOCK { |
| 1059 | (TxbSet::Luma32, TxbSet::Chroma16) | 1059 | (TxbSet::Luma32, TxbSet::Chroma16) |
| 1060 | } else if side == 8 { | 1060 | } else if side == 8 { |
| 1061 | - // An 8x8 leaf under a straddling 16x16 (lane-av1-rect): chroma of an | 1061 | + // An 8x8 leaf under a straddling 16x16 (lane-av1-rect). r5 correction: |
| 1062 | - // 8x8 luma leaf still codes at its parent 16x16's granularity (see | 1062 | + // `TxbSet::Chroma4`'s doc now has the checked spec fact -- chroma is |
| 1063 | - // `TxbSet::Chroma4`'s doc comment), so the chroma set stays Chroma8 | 1063 | + // `is_chroma_reference` at every BLOCK_8X8, so it is coded per leaf at |
| 1064 | - // even though luma has split down to 8x8. | 1064 | + // 4x4, not once at the parent's 8x8. No caller passes `side == 8` yet |
| 1065 | - (TxbSet::Luma8, TxbSet::Chroma8) | 1065 | + // (this branch is still unreached), so leaving `Chroma8` here would |
| 1066 | + // silently wire the wrong table the moment one does; `Chroma4` is | ||
| 1067 | + // what a real caller needs. | ||
| 1068 | + (TxbSet::Luma8, TxbSet::Chroma4) | ||
| 1066 | } else { | 1069 | } else { |
| 1067 | (TxbSet::Luma16, TxbSet::Chroma8) | 1070 | (TxbSet::Luma16, TxbSet::Chroma8) |
| 1068 | }; | 1071 | }; |