forge
Explore
Log in

Don't you dare go Hollow

The 128 superblock root codes a real residual

Browse files at this commit

1ee7fc675f0d2ed1e31798924242976364b6f8edAhmet Kaan GümüşParent: 5fd3825
  • feat
    • the 128 superblock root codes a real residual
Show full message
feat(av1): the 128 superblock root codes a real residual

The 128x128 PARTITION_NONE block is no longer skip-only. Its residual is
the four 64x64 mu chunks libaom's decode_token_recon_block walks: per
chunk one TX_64X64 luma unit (its coded 32x32 corner, DCT-only at this
size) then one TX_32X32 unit per chroma plane on the offset-10 txb_skip
rows, each publishing its own coefficient context before the next unit
reads it, with the var-tx tree's four depth-0 txfm_partition symbols in
front. The search prices that shape against the skip arm it already
committed to the planes, quantized at the qindex the root itself signals.

One defect found on the way: write_inter_block_128 recorded skip = true
in its own neighbour band whatever the block was, so the next root's skip
symbol took CDF row 1 where the reader takes row 0.

Witness (--ignored, forced arm): 420 residual 128x128 blocks, sample
exact through decode_stream and ffmpeg.
crates/ec-av1/src/encode.rsmodified+9 -5
@@ -16195,11 +16195,15 @@ mod tests {
16195 16195
16196 /// lane-b128r: the 128 root's own RESIDUAL arm -- four TX_64X64 luma16196 /// lane-b128r: the 128 root's own RESIDUAL arm -- four TX_64X64 luma
16197 /// units interleaved with a TX_32X32 chroma pair per 64x64 mu chunk. The16197 /// units interleaved with a TX_32X32 chroma pair per 64x64 mu chunk. The
16198- /// same pan the skip-only witness above uses, coded at a quantizer where16198+ /// same pan the skip-only witness above uses, with the arm FORCED
16199- /// the residual is worth its bits, so the counters below are non-zero;16199+ /// ([`force_b128_residual`]): on synthetic bars the RD picks the residual
16200- /// RED before this lane by construction (`write_inter_block_128` refused16200+ /// about once per frame, which witnesses the shape but not every context
16201- /// every non-skip 128 block, so the count was 0 and no such block16201+ /// it reads, and forcing codes all 420 roots of the clip through it. RED
16202- /// existed to decode).16202+ /// before this lane by construction (`write_inter_block_128` refused
16203+ /// every non-skip 128 block, so no such block existed to decode), and RED
16204+ /// again on the first draft of the writer, whose neighbour band recorded
16205+ /// `skip = true` for a block that carries a residual -- the next root's
16206+ /// `skip` symbol then took CDF row 1 where the reader takes row 0.
16203 ///16207 ///
16204 /// cargo test -p ec-av1 --release --lib -- --ignored \16208 /// cargo test -p ec-av1 --release --lib -- --ignored \
16205 /// a_128_root_block_with_a_real_residual --nocapture16209 /// a_128_root_block_with_a_real_residual --nocapture
crates/ec-av1/src/tile.rsmodified+1 -1
@@ -452,7 +452,7 @@ fn write_inter_block_128(
452 } else {452 } else {
453 neighbours.record(sb_at, SIDE, 0, &zero_grids);453 neighbours.record(sb_at, SIDE, 0, &zero_grids);
454 }454 }
455- neighbours.record_inter(sb_at, SIDE, true, true, block_ref(block));455+ neighbours.record_inter(sb_at, SIDE, block.skip, true, block_ref(block));
456 record_block_compound(neighbours, (mi_r, mi_c), SIDE, block);456 record_block_compound(neighbours, (mi_r, mi_c), SIDE, block);
457 SB128_NONE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);457 SB128_NONE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
458 if !block.skip {458 if !block.skip {