From 1457eaab896abfad2073035469e09b26a2ea4ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 27 Aug 2026 03:23:36 +0300 Subject: [PATCH] test(av1): widen the own-size sweep; close hp-mv dead code 64x56 now round-trips clean through ffmpeg (its historical wrong-V-plane bug is closed by later MC/edge fixes) -- added alongside 854x480, 216x96, 192x120 to the existing own-size sweep, all green. Dropped MvComponentCdfs::class0_hp/hp: this encoder always sets allow_high_precision_mv=false, so the spec syntax that reads them (mv_class0_hp/mv_hp) never fires -- genuinely dead, not staged. cargo test -p ec-av1 --release: 129 passed, 0 failed, 4 ignored. --- crates/ec-av1/src/cdf_state.rs | 10 ++++------ crates/ec-av1/src/encode.rs | 10 +++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/crates/ec-av1/src/cdf_state.rs b/crates/ec-av1/src/cdf_state.rs index 818e9d91..38db70dd 100644 --- a/crates/ec-av1/src/cdf_state.rs +++ b/crates/ec-av1/src/cdf_state.rs @@ -194,14 +194,14 @@ pub(crate) struct MvComponentCdfs { pub class0_bit: [u16; 3], /// The fractional part of a small-class magnitude, by its integer bit. pub class0_fr: [[u16; 5]; 2], - /// The half-pel bit of a small-class magnitude. - pub class0_hp: [u16; 3], + // `class0_hp`/`hp` (spec's half-pel-bit CDFs) are never written: this + // encoder always sets `allow_high_precision_mv = false`, so the syntax + // that reads them (spec 5.9.32 `mv_class0_hp`/`mv_hp`) never fires -- + // dropped rather than kept dead. Add back if/when hp mode ships. /// One bit of an above-small-class magnitude, by its position. pub bit: [[u16; 3]; 10], /// The fractional part of an above-small-class magnitude. pub fr: [u16; 5], - /// The half-pel bit of an above-small-class magnitude. - pub hp: [u16; 3], /// The component's sign. pub sign: [u16; 3], } @@ -212,10 +212,8 @@ impl MvComponentCdfs { class: cdf::MV_CLASS, class0_bit: cdf::MV_CLASS0_BIT, class0_fr: cdf::MV_CLASS0_FR, - class0_hp: cdf::MV_CLASS0_HP, bit: cdf::MV_BIT, fr: cdf::MV_FR, - hp: cdf::MV_HP, sign: cdf::MV_SIGN, } } diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index f18a0060..146add28 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -2433,7 +2433,15 @@ mod tests { // 854x480 is covered separately by // `an_854x480_picture_round_trips_through_its_padding`, which its own // doc comment explains was worth keeping as its own test. - for &(width, height) in &[(1920usize, 1080usize), (640, 352), (1280, 720)] { + for &(width, height) in &[ + (1920usize, 1080usize), + (640, 352), + (1280, 720), + (64, 56), + (854, 480), + (216, 96), + (192, 120), + ] { let picture = test_card(width, height); let encoded = encode_key_frame(&picture, 100, 0.5).unwrap(); assert_eq!(