forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-av1dec' (r6): real-stream probes — interior 8x8 splits, TX_64X64 fix

Browse files at this commit

2354a755517195ae18a25c5fbb85c6919f6bfa8dAhmet Kaan GümüşParent: 24df967761f32c
Real libaom streams drove two fixes: interior 16x16 splits decode via the
leaf8 machinery, and the TX_64X64 zero-pad path dequantizes at the true
transform size. Gap ladder for remaining real-world features recorded.
crates/ec-av1/src/decode.rsmodified+76 -28
@@ -237,9 +237,9 @@ fn read_coeffs(
237 if let Some(tx_type) = coding.tx_type.as_deref_mut() {237 if let Some(tx_type) = coding.tx_type.as_deref_mut() {
238 let t = dec.symbol(tx_type);238 let t = dec.symbol(tx_type);
239 if t != 1 {239 if t != 1 {
240- return Err(unsupported(240+ return Err(unsupported(format!(
241- "a transform type other than DCT_DCT (round 2: inter/other intra tx sets)",241+ "a transform type other than DCT_DCT (round 2: inter/other intra tx sets), symbol {t}"
242- ));242+ )));
243 }243 }
244 }244 }
245 245
@@ -655,16 +655,20 @@ fn read_plane(
655 let levels = if tx_side == side {655 let levels = if tx_side == side {
656 grid656 grid
657 } else {657 } else {
658- let mut full = vec![0i32; tx_side * tx_side];658+ // `grid` is `tx_side x tx_side` (the coded corner); `dequant_and_inverse`
659- for row in 0..side {659+ // wants the true `side x side` transform, with dqDenom (spec 7.12.3)
660- full[row * tx_side..][..side].copy_from_slice(&grid[row * side..][..side]);660+ // keyed by that true size, not the coded corner's -- so the corner
661+ // goes into the top-left of a `side`-sized grid, not the reverse.
662+ let mut full = vec![0i32; side * side];
663+ for row in 0..tx_side {
664+ full[row * side..][..tx_side].copy_from_slice(&grid[row * tx_side..][..tx_side]);
661 }665 }
662 full666 full
663 };667 };
664- let residual = dequant_and_inverse(&levels, tx_side, 8, i32::from(base_q_idx));668+ let residual = dequant_and_inverse(&levels, side, 8, i32::from(base_q_idx));
665- plane.reconstruct(x, y, tx_side, predict_mode, reach, &residual);669+ plane.reconstruct(x, y, side, predict_mode, reach, &residual);
666 Ok(if tx_side == side {670 Ok(if tx_side == side {
667- residual_grid_placeholder(&levels, tx_side)671+ residual_grid_placeholder(&levels, side)
668 } else {672 } else {
669 levels673 levels
670 })674 })
@@ -1075,28 +1079,72 @@ pub fn decode_key_frame_tile(
1075 let ctx16 = neighbours.partition_ctx(at16, SUB);1079 let ctx16 = neighbours.partition_ctx(at16, SUB);
1076 if has_cols16 && has_rows16 {1080 if has_cols16 && has_rows16 {
1077 let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]);1081 let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]);
1078- if part16 != PARTITION_NONE {1082+ if part16 == PARTITION_NONE {
1083+ decode_block(
1084+ &mut dec,
1085+ &mut cdfs,
1086+ &mut neighbours,
1087+ at16,
1088+ SUB,
1089+ TxbSet::Luma16,
1090+ TxbSet::Chroma8,
1091+ TX16,
1092+ TX8,
1093+ (&scan16, &scan8),
1094+ true,
1095+ &mut y,
1096+ &mut u,
1097+ &mut v,
1098+ base_q_idx,
1099+ )?;
1100+ continue;
1101+ }
1102+ if part16 != PARTITION_SPLIT {
1079 return Err(unsupported(1103 return Err(unsupported(
1080- "a partition below 16x16 (this encoder never writes one)",1104+ "a partition below 16x16 other than a clean split (this encoder never writes one)",
1081 ));1105 ));
1082 }1106 }
1083- decode_block(1107+ // A real (non-straddle) SPLIT of a
1084- &mut dec,1108+ // whole 16x16 into four 8x8 leaves --
1085- &mut cdfs,1109+ // the same recursion the straddle
1086- &mut neighbours,1110+ // path below already runs when the
1087- at16,1111+ // true frame edge forces it, just
1088- SUB,1112+ // over all four positions instead of
1089- TxbSet::Luma16,1113+ // the one or two the edge leaves.
1090- TxbSet::Chroma8,1114+ let (mi_row0, mi_col0) =
1091- TX16,1115+ (sr as u32 * SUB_MI, sc as u32 * SUB_MI);
1092- TX8,1116+ let mut prev_leaf: Option<((usize, usize), usize)> = None;
1093- (&scan16, &scan8),1117+ for i in 0..4 {
1094- true,1118+ let (mr, mc) =
1095- &mut y,1119+ (mi_row0 + (i / 2) * 2, mi_col0 + (i % 2) * 2);
1096- &mut u,1120+ let leaf_mi = (mr as usize, mc as usize);
1097- &mut v,1121+ let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8);
1098- base_q_idx,1122+ let part8 =
1099- )?;1123+ dec.symbol(&mut cdfs.partition_w8[leaf_ctx]);
1124+ if part8 != PARTITION_NONE {
1125+ return Err(unsupported(
1126+ "a partition below 8x8 (this encoder never writes one)",
1127+ ));
1128+ }
1129+ let leaf_mode = decode_leaf8(
1130+ &mut dec,
1131+ &mut cdfs,
1132+ &mut neighbours,
1133+ at16,
1134+ leaf_mi,
1135+ (&scan8, &scan4),
1136+ prev_leaf,
1137+ &mut y,
1138+ &mut u,
1139+ &mut v,
1140+ base_q_idx,
1141+ )?;
1142+ prev_leaf = Some((leaf_mi, leaf_mode));
1143+ }
1144+ if let Some((_, mode)) = prev_leaf {
1145+ neighbours.above_mode[sc] = mode;
1146+ neighbours.left_mode[sr] = mode;
1147+ }
1100 continue;1148 continue;
1101 }1149 }
1102 // The true edge falls inside this 16x161150 // The true edge falls inside this 16x16