forge
Explore
Log in

Don't you dare go Hollow

wip(av1): superres stage-3 gate flags + chroma crop rounding fix

Browse files at this commit

e9f1fa85c2fda7f0e94ad5bfa42288e5c350f28dAhmet Kaan GümüşParent: c28ee95
Gate a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact:
- add the restrictive aomenc flag set (charter's list) to get past the
  pre-existing "AV1 tile: partition type this encoder never writes"
  capability gap, plus --superres-kf-denominator=12 (the missing piece:
  --superres-denominator only controls non-key frames; with
  --kf-max-dist=0 every frame is a key frame and AOM_SUPERRES_FIXED
  reads superres_kf_scale_denominator for those, which defaults to 8/
  no-scale -- header.use_superres was parsing false).
- decode.rs: both decode_key_frame_tile_with_cdfs and
  decode_inter_frame_tile_with_cdfs cropped chroma to fw/2 (floor) when
  fw != the mi-aligned decode width; the real AV1 chroma-plane width
  formula is ROUND_POWER_OF_TWO(fw, ss_x) i.e. div_ceil for 4:2:0. Odd
  downscaled superres widths (43 here) exposed it as a length-mismatch
  panic in superres.rs; fixed both sites (general decoder bug, not
  superres-specific, swept repo-wide -- only these two call it).

Gate still fails: 5/4096 luma pixels off by 1 near the right edge
(columns 59-62 of 64) after the flag+crop fixes. Not bounds/kernel --
superres.rs's pinned upscale_row/upscale_plane already matched libaom
bit-exact via the C harness for symmetric in8->out12/16 cases. Likely
candidate: our edge-replication padding in upscale_row synthesizes the
right border from the already-cropped fw-wide row, while libaom's
av1_extend_plane may extend from real reconstructed pixels still
present in the mi-aligned buffer beyond fw before any crop -- untested
theory, not confirmed this round. Next: thread the pre-crop plane
width/margin into upscale_picture instead of cropping to fw first.
crates/ec-av1/src/decode.rsmodified+4 -4
@@ -4990,8 +4990,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
4990 width: fw,4990 width: fw,
4991 height: fh,4991 height: fh,
4992 y: crop(&y, fw, fh),4992 y: crop(&y, fw, fh),
4993- u: crop(&u, fw / 2, fh / 2),4993+ u: crop(&u, fw.div_ceil(2), fh.div_ceil(2)),
4994- v: crop(&v, fw / 2, fh / 2),4994+ v: crop(&v, fw.div_ceil(2), fh.div_ceil(2)),
4995 },4995 },
4996 cdfs,4996 cdfs,
4997 ))4997 ))
@@ -10501,8 +10501,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
10501 width: fw,10501 width: fw,
10502 height: fh,10502 height: fh,
10503 y: crop(&y, fw, fh),10503 y: crop(&y, fw, fh),
10504- u: crop(&u, fw / 2, fh / 2),10504+ u: crop(&u, fw.div_ceil(2), fh.div_ceil(2)),
10505- v: crop(&v, fw / 2, fh / 2),10505+ v: crop(&v, fw.div_ceil(2), fh.div_ceil(2)),
10506 },10506 },
10507 cdfs,10507 cdfs,
10508 motion_field,10508 motion_field,
crates/ec-av1/src/stream.rsmodified+17 -0
@@ -3868,6 +3868,23 @@ mod tests {
3868 "--row-mt=0",3868 "--row-mt=0",
3869 "--superres-mode=1",3869 "--superres-mode=1",
3870 "--superres-denominator=12",3870 "--superres-denominator=12",
3871+ "--superres-kf-denominator=12",
3872+ "--enable-rect-partitions=0",
3873+ "--enable-ab-partitions=0",
3874+ "--enable-1to4-partitions=0",
3875+ "--enable-filter-intra=0",
3876+ "--enable-smooth-intra=0",
3877+ "--enable-paeth-intra=0",
3878+ "--enable-directional-intra=0",
3879+ "--enable-angle-delta=0",
3880+ "--enable-tx-size-search=0",
3881+ "--enable-cdef=0",
3882+ "--enable-restoration=0",
3883+ "--max-partition-size=32",
3884+ "--min-partition-size=32",
3885+ "--enable-palette=0",
3886+ "--enable-intrabc=0",
3887+ "--enable-cfl-intra=0",
3871 "--obu",3888 "--obu",
3872 "-o",3889 "-o",
3873 "-",3890 "-",