From 16efbd9e766f38e84f0b3663d19e06c9a64f4d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 5 Sep 2026 01:14:05 +0300 Subject: [PATCH] chore(av1): clear the ec-av1 compiler warnings (300 -> 0 on the release lib) No arithmetic, control flow or public signature changes; the four perf6 decode hashes are byte-identical. - gate-counter accessors and other test-only items carry `#[allow(dead_code)]` with the reason on the line (they are read from the `#[cfg(test)]` gates, which the plain lib build cannot see); - `///` blocks sitting on `thread_local!`/macro invocations become `//` (rustc never attached them to anything); - `cdf.rs` tables and the `InterpFilterKind` variants get a one-line doc; - unused locals/params prefixed `_` where the value is genuinely unused; dead initializers dropped where the compiler proves every read is preceded by an assignment; - `decode_key_frame_tile` import is now `#[cfg(test)]` (its only user). Left standing on purpose, as findings rather than hidden warnings: `stream.rs` census counters `other` and `rect_residual_refusals` are incremented and never read back by their gates. --- crates/ec-av1/src/cdf.rs | 86 ++++++++++++ crates/ec-av1/src/decode.rs | 218 ++++++++++++++++++++++++++---- crates/ec-av1/src/encode.rs | 32 ++--- crates/ec-av1/src/film_grain.rs | 3 +- crates/ec-av1/src/intra.rs | 63 +++++---- crates/ec-av1/src/mc.rs | 4 + crates/ec-av1/src/motion_field.rs | 1 + crates/ec-av1/src/mvstack.rs | 14 +- crates/ec-av1/src/restoration.rs | 31 +++-- crates/ec-av1/src/stream.rs | 56 ++++---- crates/ec-av1/src/transform.rs | 2 + crates/ec-av1/src/wedge.rs | 4 + 12 files changed, 396 insertions(+), 118 deletions(-) diff --git a/crates/ec-av1/src/cdf.rs b/crates/ec-av1/src/cdf.rs index 5191fe6d..4f9d64ae 100644 --- a/crates/ec-av1/src/cdf.rs +++ b/crates/ec-av1/src/cdf.rs @@ -19,6 +19,7 @@ pub const PARTITION_W128: [[u16; 9]; 4] = [ [711, 966, 1172, 32448, 32538, 32617, 32664, 32768, 0], ]; +/// Default CDF table `PARTITION_W64` (AV1 spec 9.4 initial probabilities). pub const PARTITION_W64: [[u16; 11]; 4] = [ [ 20137, 21547, 23078, 29566, 29837, 30261, 30524, 30892, 31724, 32768, 0, @@ -63,6 +64,7 @@ pub const TXFM_PARTITION: [[u16; 3]; 21] = [ [16088, 32768, 0], ]; +/// Default CDF table `SKIP` (AV1 spec 9.4 initial probabilities). pub const SKIP: [[u16; 3]; 3] = [[31671, 32768, 0], [16515, 32768, 0], [4576, 32768, 0]]; /// `Default_Intra_Frame_Y_Mode_Cdf` (spec 9.4): the thirteen luma intra @@ -698,6 +700,7 @@ pub const SEGMENT_ID: [[u16; 9]; 3] = [ /// `seg_id_predicted`, indexed by `AboveSegPredContext + LeftSegPredContext`. pub const SEGMENT_PRED: [[u16; 3]; 3] = [[16384, 32768, 0]; 3]; +/// Default CDF table `DELTA_Q` (AV1 spec 9.4 initial probabilities). pub const DELTA_Q: [u16; 5] = [28160, 32120, 32677, 32768, 0]; /// `default_delta_lf_cdf` -- see [`DELTA_Q`]'s doc. pub const DELTA_LF: [u16; 5] = DELTA_Q; @@ -3186,8 +3189,11 @@ pub const TXB_SKIP_CHROMA_32_Q3: [[u16; 3]; 3] = /// 128x128 block's four TX_32X32 chroma units -- the offset-7 rows above are /// every other case (lane-sb128b r3). pub const TXB_SKIP_CHROMA_32_BIG_Q0: [[u16; 3]; 3] = [[146, 32768, 0], [5132, 32768, 0], [31657, 32768, 0]]; +/// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q1` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_CHROMA_32_BIG_Q1: [[u16; 3]; 3] = [[641, 32768, 0], [22265, 32768, 0], [31452, 32768, 0]]; +/// Default CDF table `TXB_SKIP_CHROMA_32_BIG` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_CHROMA_32_BIG: [[u16; 3]; 3] = [[3082, 32768, 0], [20982, 32768, 0], [29443, 32768, 0]]; +/// Default CDF table `TXB_SKIP_CHROMA_32_BIG_Q3` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_CHROMA_32_BIG_Q3: [[u16; 3]; 3] = [[1806, 32768, 0], [14645, 32768, 0], [25336, 32768, 0]]; /// EOB_EXTRA_LUMA_16, q-context 3: the same table as [`EOB_EXTRA_LUMA_16`], for `base_q_idx` 121..=255. pub const EOB_EXTRA_LUMA_16_Q3: [[u16; 3]; 9] = [ @@ -3886,8 +3892,11 @@ pub const EOB_PT_64_LUMA_Q3: [u16; 8] = [6307, 7541, 12060, 16358, 22553, 27865, /// (`av1_default_eob_multi64_cdfs[q][0][1]`), for an 8x8 luma TU whose /// `tx_type` resolves `V_DCT`/`H_DCT`. pub const EOB_PT_64_LUMA_CLASS1_Q0: [u16; 8] = [335, 730, 1459, 5494, 8755, 12997, 32768, 0]; +/// Default CDF table `EOB_PT_64_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_LUMA_CLASS1_Q1: [u16; 8] = [401, 605, 1029, 2563, 5845, 12626, 32768, 0]; +/// Default CDF table `EOB_PT_64_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_LUMA_CLASS1: [u16; 8] = [497, 810, 1315, 3000, 7004, 15641, 32768, 0]; +/// Default CDF table `EOB_PT_64_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_LUMA_CLASS1_Q3: [u16; 8] = [1289, 2320, 3971, 7926, 14153, 24291, 32768, 0]; /// EOB_PT_16_CHROMA_Q0, q-context 0: the same table as [`EOB_PT_16_CHROMA`], for `base_q_idx` 0..=20. @@ -4683,6 +4692,7 @@ pub const TXB_SKIP_LUMA_8_Q0_CTX: [[u16; 3]; 7] = [ [26308, 32768, 0], [32537, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_8_Q1_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_8_Q1_CTX: [[u16; 3]; 7] = [ [31782, 32768, 0], [1836, 32768, 0], @@ -4692,6 +4702,7 @@ pub const TXB_SKIP_LUMA_8_Q1_CTX: [[u16; 3]; 7] = [ [27518, 32768, 0], [32399, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_8_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_8_CTX: [[u16; 3]; 7] = [ [31957, 32768, 0], [3230, 32768, 0], @@ -4701,6 +4712,7 @@ pub const TXB_SKIP_LUMA_8_CTX: [[u16; 3]; 7] = [ [26536, 32768, 0], [31986, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_8_Q3_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_8_Q3_CTX: [[u16; 3]; 7] = [ [31903, 32768, 0], [2044, 32768, 0], @@ -4710,6 +4722,7 @@ pub const TXB_SKIP_LUMA_8_Q3_CTX: [[u16; 3]; 7] = [ [24168, 32768, 0], [31037, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_16_Q0_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_16_Q0_CTX: [[u16; 3]; 7] = [ [29957, 32768, 0], [5391, 32768, 0], @@ -4719,6 +4732,7 @@ pub const TXB_SKIP_LUMA_16_Q0_CTX: [[u16; 3]; 7] = [ [25822, 32768, 0], [32197, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_16_Q1_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_16_Q1_CTX: [[u16; 3]; 7] = [ [31901, 32768, 0], [10311, 32768, 0], @@ -4728,6 +4742,7 @@ pub const TXB_SKIP_LUMA_16_Q1_CTX: [[u16; 3]; 7] = [ [27914, 32768, 0], [32296, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_16_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_16_CTX: [[u16; 3]; 7] = [ [32363, 32768, 0], [10692, 32768, 0], @@ -4737,6 +4752,7 @@ pub const TXB_SKIP_LUMA_16_CTX: [[u16; 3]; 7] = [ [28312, 32768, 0], [32169, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_16_Q3_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_16_Q3_CTX: [[u16; 3]; 7] = [ [32510, 32768, 0], [8430, 32768, 0], @@ -4746,6 +4762,7 @@ pub const TXB_SKIP_LUMA_16_Q3_CTX: [[u16; 3]; 7] = [ [28789, 32768, 0], [32139, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_32_Q0_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_32_Q0_CTX: [[u16; 3]; 7] = [ [17920, 32768, 0], [1818, 32768, 0], @@ -4755,6 +4772,7 @@ pub const TXB_SKIP_LUMA_32_Q0_CTX: [[u16; 3]; 7] = [ [31554, 32768, 0], [32624, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_32_Q1_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_32_Q1_CTX: [[u16; 3]; 7] = [ [26726, 32768, 0], [1045, 32768, 0], @@ -4764,6 +4782,7 @@ pub const TXB_SKIP_LUMA_32_Q1_CTX: [[u16; 3]; 7] = [ [25970, 32768, 0], [31938, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_32_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_32_CTX: [[u16; 3]; 7] = [ [30669, 32768, 0], [3832, 32768, 0], @@ -4773,6 +4792,7 @@ pub const TXB_SKIP_LUMA_32_CTX: [[u16; 3]; 7] = [ [23313, 32768, 0], [31330, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_32_Q3_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_32_Q3_CTX: [[u16; 3]; 7] = [ [31671, 32768, 0], [2056, 32768, 0], @@ -4782,6 +4802,7 @@ pub const TXB_SKIP_LUMA_32_Q3_CTX: [[u16; 3]; 7] = [ [24715, 32768, 0], [31484, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_64_Q0_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_64_Q0_CTX: [[u16; 3]; 7] = [ [6308, 32768, 0], [117, 32768, 0], @@ -4791,6 +4812,7 @@ pub const TXB_SKIP_LUMA_64_Q0_CTX: [[u16; 3]; 7] = [ [10923, 32768, 0], [30247, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_64_Q1_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_64_Q1_CTX: [[u16; 3]; 7] = [ [26584, 32768, 0], [188, 32768, 0], @@ -4800,6 +4822,7 @@ pub const TXB_SKIP_LUMA_64_Q1_CTX: [[u16; 3]; 7] = [ [30583, 32768, 0], [32608, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_64_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_64_CTX: [[u16; 3]; 7] = [ [28573, 32768, 0], [3183, 32768, 0], @@ -4809,6 +4832,7 @@ pub const TXB_SKIP_LUMA_64_CTX: [[u16; 3]; 7] = [ [27832, 32768, 0], [32387, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_64_Q3_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_64_Q3_CTX: [[u16; 3]; 7] = [ [31539, 32768, 0], [8433, 32768, 0], @@ -4838,6 +4862,7 @@ pub const TXB_SKIP_LUMA_4_Q0_CTX: [[u16; 3]; 7] = [ [27473, 32768, 0], [32487, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_4_Q1_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_4_Q1_CTX: [[u16; 3]; 7] = [ [30371, 32768, 0], [7570, 32768, 0], @@ -4847,6 +4872,7 @@ pub const TXB_SKIP_LUMA_4_Q1_CTX: [[u16; 3]; 7] = [ [27067, 32768, 0], [32013, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_4_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_4_CTX: [[u16; 3]; 7] = [ [29614, 32768, 0], [9068, 32768, 0], @@ -4856,6 +4882,7 @@ pub const TXB_SKIP_LUMA_4_CTX: [[u16; 3]; 7] = [ [24619, 32768, 0], [30642, 32768, 0], ]; +/// Default CDF table `TXB_SKIP_LUMA_4_Q3_CTX` (AV1 spec 9.4 initial probabilities). pub const TXB_SKIP_LUMA_4_Q3_CTX: [[u16; 3]; 7] = [ [26887, 32768, 0], [6729, 32768, 0], @@ -4869,8 +4896,11 @@ pub const TXB_SKIP_LUMA_4_Q3_CTX: [[u16; 3]; 7] = [ /// The end-of-block group of a 4x4 luma transform (`av1_default_eob_multi16_cdfs`, /// `PLANE_TYPES` idx0 luma). pub const EOB_PT_16_LUMA_Q0: [u16; 6] = [840, 1039, 1980, 4895, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_Q1: [u16; 6] = [2125, 2551, 5165, 8946, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA: [u16; 6] = [4016, 4897, 8881, 14968, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_Q3: [u16; 6] = [6708, 8958, 14746, 22133, 32768, 0]; /// The `TX_CLASS_HORIZ`/`TX_CLASS_VERT` (non-2D-scan) sibling of @@ -4903,12 +4933,17 @@ pub const EOB_PT_32_LUMA_CLASS1: [u16; 7] = [574, 821, 1836, 5089, 13128, 32768, /// [`EOB_PT_32_LUMA_CLASS1_Q0`]'s q-context 3 sibling. pub const EOB_PT_32_LUMA_CLASS1_Q3: [u16; 7] = [1156, 1702, 3675, 9274, 20539, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_CLASS1_Q0: [u16; 6] = [370, 671, 1883, 4471, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_CLASS1_Q1: [u16; 6] = [513, 765, 1859, 6339, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_CLASS1: [u16; 6] = [716, 1105, 2646, 10056, 32768, 0]; +/// Default CDF table `EOB_PT_16_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_LUMA_CLASS1_Q3: [u16; 6] = [1222, 2074, 4783, 15410, 32768, 0]; // EOB_EXTRA_LUMA_4 +/// Default CDF table `EOB_EXTRA_LUMA_4_Q0` (AV1 spec 9.4 initial probabilities). pub const EOB_EXTRA_LUMA_4_Q0: [[u16; 3]; 9] = [ [16961, 32768, 0], [17223, 32768, 0], @@ -4921,6 +4956,7 @@ pub const EOB_EXTRA_LUMA_4_Q0: [[u16; 3]; 9] = [ [16384, 32768, 0], ]; +/// Default CDF table `EOB_EXTRA_LUMA_4_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_EXTRA_LUMA_4_Q1: [[u16; 3]; 9] = [ [17471, 32768, 0], [20223, 32768, 0], @@ -4933,6 +4969,7 @@ pub const EOB_EXTRA_LUMA_4_Q1: [[u16; 3]; 9] = [ [16384, 32768, 0], ]; +/// Default CDF table `EOB_EXTRA_LUMA_4` (AV1 spec 9.4 initial probabilities). pub const EOB_EXTRA_LUMA_4: [[u16; 3]; 9] = [ [18983, 32768, 0], [20512, 32768, 0], @@ -4945,6 +4982,7 @@ pub const EOB_EXTRA_LUMA_4: [[u16; 3]; 9] = [ [16384, 32768, 0], ]; +/// Default CDF table `EOB_EXTRA_LUMA_4_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_EXTRA_LUMA_4_Q3: [[u16; 3]; 9] = [ [20177, 32768, 0], [20789, 32768, 0], @@ -4958,6 +4996,7 @@ pub const EOB_EXTRA_LUMA_4_Q3: [[u16; 3]; 9] = [ ]; // COEFF_BASE_LUMA_4 +/// Default CDF table `COEFF_BASE_LUMA_4_Q0` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_LUMA_4_Q0: [[u16; 5]; 42] = [ [4034, 8930, 12727, 32768, 0], [18082, 29741, 31877, 32768, 0], @@ -5003,6 +5042,7 @@ pub const COEFF_BASE_LUMA_4_Q0: [[u16; 5]; 42] = [ [8192, 16384, 24576, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_LUMA_4_Q1` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_LUMA_4_Q1: [[u16; 5]; 42] = [ [6041, 11854, 15927, 32768, 0], [20326, 30905, 32251, 32768, 0], @@ -5048,6 +5088,7 @@ pub const COEFF_BASE_LUMA_4_Q1: [[u16; 5]; 42] = [ [8192, 16384, 24576, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_LUMA_4` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_LUMA_4: [[u16; 5]; 42] = [ [8896, 16227, 20630, 32768, 0], [23629, 31782, 32527, 32768, 0], @@ -5093,6 +5134,7 @@ pub const COEFF_BASE_LUMA_4: [[u16; 5]; 42] = [ [8192, 16384, 24576, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_LUMA_4_Q3` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_LUMA_4_Q3: [[u16; 5]; 42] = [ [7062, 16472, 22319, 32768, 0], [24538, 32261, 32674, 32768, 0], @@ -5139,6 +5181,7 @@ pub const COEFF_BASE_LUMA_4_Q3: [[u16; 5]; 42] = [ ]; // COEFF_BASE_EOB_LUMA_4 +/// Default CDF table `COEFF_BASE_EOB_LUMA_4_Q0` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_EOB_LUMA_4_Q0: [[u16; 4]; 4] = [ [17837, 29055, 32768, 0], [29600, 31446, 32768, 0], @@ -5146,6 +5189,7 @@ pub const COEFF_BASE_EOB_LUMA_4_Q0: [[u16; 4]; 4] = [ [24926, 28948, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_EOB_LUMA_4_Q1` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_EOB_LUMA_4_Q1: [[u16; 4]; 4] = [ [17560, 29888, 32768, 0], [29671, 31549, 32768, 0], @@ -5153,6 +5197,7 @@ pub const COEFF_BASE_EOB_LUMA_4_Q1: [[u16; 4]; 4] = [ [27286, 30006, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_EOB_LUMA_4` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_EOB_LUMA_4: [[u16; 4]; 4] = [ [20092, 30774, 32768, 0], [30695, 32020, 32768, 0], @@ -5160,6 +5205,7 @@ pub const COEFF_BASE_EOB_LUMA_4: [[u16; 4]; 4] = [ [28666, 30870, 32768, 0], ]; +/// Default CDF table `COEFF_BASE_EOB_LUMA_4_Q3` (AV1 spec 9.4 initial probabilities). pub const COEFF_BASE_EOB_LUMA_4_Q3: [[u16; 4]; 4] = [ [22497, 31198, 32768, 0], [31715, 32495, 32768, 0], @@ -5168,6 +5214,7 @@ pub const COEFF_BASE_EOB_LUMA_4_Q3: [[u16; 4]; 4] = [ ]; // COEFF_BR_LUMA_4 +/// Default CDF table `COEFF_BR_LUMA_4_Q0` (AV1 spec 9.4 initial probabilities). pub const COEFF_BR_LUMA_4_Q0: [[u16; 5]; 21] = [ [14298, 20718, 24174, 32768, 0], [12536, 19601, 23789, 32768, 0], @@ -5192,6 +5239,7 @@ pub const COEFF_BR_LUMA_4_Q0: [[u16; 5]; 21] = [ [3034, 5860, 8462, 32768, 0], ]; +/// Default CDF table `COEFF_BR_LUMA_4_Q1` (AV1 spec 9.4 initial probabilities). pub const COEFF_BR_LUMA_4_Q1: [[u16; 5]; 21] = [ [14995, 21341, 24749, 32768, 0], [13158, 20289, 24601, 32768, 0], @@ -5216,6 +5264,7 @@ pub const COEFF_BR_LUMA_4_Q1: [[u16; 5]; 21] = [ [3793, 7278, 10447, 32768, 0], ]; +/// Default CDF table `COEFF_BR_LUMA_4` (AV1 spec 9.4 initial probabilities). pub const COEFF_BR_LUMA_4: [[u16; 5]; 21] = [ [16138, 22223, 25509, 32768, 0], [15347, 22430, 26332, 32768, 0], @@ -5240,6 +5289,7 @@ pub const COEFF_BR_LUMA_4: [[u16; 5]; 21] = [ [5413, 10335, 14498, 32768, 0], ]; +/// Default CDF table `COEFF_BR_LUMA_4_Q3` (AV1 spec 9.4 initial probabilities). pub const COEFF_BR_LUMA_4_Q3: [[u16; 5]; 21] = [ [18315, 24289, 27551, 32768, 0], [16854, 24068, 27835, 32768, 0], @@ -5295,79 +5345,115 @@ pub const INTRA_TX_TYPE_SET1_4: [[u16; 8]; 13] = [ /// `DCTONLY`) hold no 1D type. pub const EOB_PT_256_LUMA_CLASS1_Q0: [u16; 10] = [998, 1850, 2998, 5604, 17341, 19888, 22899, 25583, 32768, 0]; +/// Default CDF table `EOB_PT_256_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_LUMA_CLASS1_Q1: [u16; 10] = [399, 1019, 1749, 3038, 10444, 15546, 22739, 27294, 32768, 0]; +/// Default CDF table `EOB_PT_256_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_LUMA_CLASS1: [u16; 10] = [1084, 2358, 3488, 5122, 11483, 18103, 26023, 29799, 32768, 0]; +/// Default CDF table `EOB_PT_256_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_LUMA_CLASS1_Q3: [u16; 10] = [2453, 4474, 6307, 8777, 16474, 22975, 29000, 31547, 32768, 0]; +/// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_CHROMA_CLASS1_Q0: [u16; 10] = [2203, 4130, 7435, 10739, 20652, 23681, 25609, 27261, 32768, 0]; +/// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_CHROMA_CLASS1_Q1: [u16; 10] = [1674, 3252, 5734, 10159, 22397, 23802, 24821, 30940, 32768, 0]; +/// Default CDF table `EOB_PT_256_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_CHROMA_CLASS1: [u16; 10] = [6571, 9610, 15516, 21826, 29092, 30829, 31842, 32708, 32768, 0]; +/// Default CDF table `EOB_PT_256_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_256_CHROMA_CLASS1_Q3: [u16; 10] = [9998, 17661, 25178, 28097, 31308, 32038, 32403, 32695, 32768, 0]; +/// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_CHROMA_CLASS1_Q0: [u16; 8] = [1563, 2700, 4876, 10911, 14706, 22480, 32768, 0]; +/// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_CHROMA_CLASS1_Q1: [u16; 8] = [1923, 3127, 5867, 9703, 14277, 27100, 32768, 0]; +/// Default CDF table `EOB_PT_64_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_CHROMA_CLASS1: [u16; 8] = [4034, 6290, 10235, 14982, 21214, 28491, 32768, 0]; +/// Default CDF table `EOB_PT_64_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_64_CHROMA_CLASS1_Q3: [u16; 8] = [8726, 12378, 19409, 26450, 30038, 32462, 32768, 0]; +/// Default CDF table `EOB_PT_16_CHROMA_CLASS1_Q0` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_CHROMA_CLASS1_Q0: [u16; 6] = [1904, 3354, 7763, 14647, 32768, 0]; +/// Default CDF table `EOB_PT_16_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_CHROMA_CLASS1_Q1: [u16; 6] = [2497, 4096, 8866, 16993, 32768, 0]; +/// Default CDF table `EOB_PT_16_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_CHROMA_CLASS1: [u16; 6] = [3192, 5032, 10297, 19755, 32768, 0]; +/// Default CDF table `EOB_PT_16_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_16_CHROMA_CLASS1_Q3: [u16; 6] = [7297, 10767, 19273, 28194, 32768, 0]; /// `EOB_PT_128_LUMA`'s class-1 sibling (`av1_default_eob_multi128_cdfs[q][0][1]`), /// read by a 16x8/8x16 luma transform whose inherited `tx_type` is 1D /// (`TxbSet::LumaRect16x8`) -- machine-extracted, scripts/extract-eob-class1.py. pub const EOB_PT_128_LUMA_CLASS1_Q0: [u16; 9] = [371, 699, 1254, 4830, 9479, 12562, 17497, 32768, 0]; +/// Default CDF table `EOB_PT_128_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_LUMA_CLASS1_Q1: [u16; 9] = [217, 352, 618, 2303, 5261, 9969, 17472, 32768, 0]; +/// Default CDF table `EOB_PT_128_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_LUMA_CLASS1: [u16; 9] = [354, 558, 944, 2760, 7287, 14037, 21779, 32768, 0]; +/// Default CDF table `EOB_PT_128_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_LUMA_CLASS1_Q3: [u16; 9] = [886, 1731, 3271, 8469, 15569, 22126, 28383, 32768, 0]; /// `EOB_PT_32_CHROMA`'s class-1 sibling (`av1_default_eob_multi32_cdfs[q][1][1]`), /// read by an 8x4/4x8 chroma transform under a 1D luma `tx_type` /// (`TxbSet::ChromaRect8x4`) -- machine-extracted, scripts/extract-eob-class1.py. pub const EOB_PT_32_CHROMA_CLASS1_Q0: [u16; 7] = [1786, 3179, 6902, 11357, 19054, 32768, 0]; +/// Default CDF table `EOB_PT_32_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_32_CHROMA_CLASS1_Q1: [u16; 7] = [2578, 4124, 8181, 13670, 24234, 32768, 0]; +/// Default CDF table `EOB_PT_32_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_32_CHROMA_CLASS1: [u16; 7] = [3542, 5502, 10415, 16760, 25644, 32768, 0]; +/// Default CDF table `EOB_PT_32_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_32_CHROMA_CLASS1_Q3: [u16; 7] = [7699, 10897, 20891, 26926, 31628, 32768, 0]; /// `EOB_PT_128_CHROMA`'s class-1 sibling (`av1_default_eob_multi128_cdfs[q][1][1]`). pub const EOB_PT_128_CHROMA_CLASS1_Q0: [u16; 9] = [2054, 3472, 5869, 14232, 18242, 20590, 26752, 32768, 0]; +/// Default CDF table `EOB_PT_128_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_CHROMA_CLASS1_Q1: [u16; 9] = [2310, 4160, 7471, 14997, 17931, 20768, 30240, 32768, 0]; +/// Default CDF table `EOB_PT_128_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_CHROMA_CLASS1: [u16; 9] = [6275, 9889, 14769, 23164, 27988, 30493, 32272, 32768, 0]; +/// Default CDF table `EOB_PT_128_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_128_CHROMA_CLASS1_Q3: [u16; 9] = [9165, 13282, 21150, 30286, 31894, 32571, 32712, 32768, 0]; /// `EOB_PT_512_LUMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][0][1]`). pub const EOB_PT_512_LUMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_LUMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_LUMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_LUMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; /// `EOB_PT_512_CHROMA`'s class-1 sibling (`av1_default_eob_multi512_cdfs[q][1][1]`). pub const EOB_PT_512_CHROMA_CLASS1_Q0: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_CHROMA_CLASS1_Q1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_CHROMA_CLASS1: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; +/// Default CDF table `EOB_PT_512_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_512_CHROMA_CLASS1_Q3: [u16; 11] = [3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, 0]; /// `EOB_PT_1024_LUMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][0][1]`). pub const EOB_PT_1024_LUMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_LUMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_LUMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_LUMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_LUMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_LUMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_LUMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; /// `EOB_PT_1024_CHROMA`'s class-1 sibling (`av1_default_eob_multi1024_cdfs[q][1][1]`). pub const EOB_PT_1024_CHROMA_CLASS1_Q0: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_CHROMA_CLASS1_Q1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_CHROMA_CLASS1_Q1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_CHROMA_CLASS1` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_CHROMA_CLASS1: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; +/// Default CDF table `EOB_PT_1024_CHROMA_CLASS1_Q3` (AV1 spec 9.4 initial probabilities). pub const EOB_PT_1024_CHROMA_CLASS1_Q3: [u16; 12] = [2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, 0]; diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 5f33e5db..0dc98a3c 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -243,9 +243,9 @@ pub(crate) fn sb_mi_cur(fctx: &crate::decode::FrameCtx) -> u32 { if sb128(fctx) { SB_MI * 2 } else { SB_MI } } -/// How many real 128-level partition symbols this decoder has read, and how -/// many superblocks resolved to `PARTITION_SPLIT` (coded or forced) -- the -/// gate's proof a `--sb-size=128` stream exercised the 128 partition root. +// How many real 128-level partition symbols this decoder has read, and how +// many superblocks resolved to `PARTITION_SPLIT` (coded or forced) -- the +// gate's proof a `--sb-size=128` stream exercised the 128 partition root. thread_local! { static PART128_SYMBOLS: std::cell::Cell = const { std::cell::Cell::new(0) }; static PART128_SPLIT_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; @@ -255,16 +255,19 @@ thread_local! { /// Current value of `PART128_GATHERED_SYMBOLS`: 128 roots that read the /// half-out-of-frame gathered split_or_horz/split_or_vert symbol (spec /// 5.11.4), which this decoder used to read and throw away. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn part128_gathered_symbols() -> usize { PART128_GATHERED_SYMBOLS.with(|c| c.get()) } /// Current value of [`PART128_SYMBOLS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn part128_symbols() -> usize { PART128_SYMBOLS.with(|c| c.get()) } /// Current value of [`PART128_SPLIT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn part128_split_hits() -> usize { PART128_SPLIT_HITS.with(|c| c.get()) } @@ -293,6 +296,7 @@ thread_local! { } /// Current value of [`FILTER_INTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_hits() -> usize { FILTER_INTRA_HITS.with(|c| c.get()) } @@ -307,6 +311,7 @@ thread_local! { } /// Current value of [`INTRA_IN_INTER_FILTER_INTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter_filter_intra_hits() -> usize { INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.get()) } @@ -323,11 +328,13 @@ thread_local! { } /// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_Y_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter_angle_delta_y_hits() -> usize { INTRA_IN_INTER_ANGLE_DELTA_Y_HITS.with(|c| c.get()) } /// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_UV_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter_angle_delta_uv_hits() -> usize { INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.get()) } @@ -348,12 +355,14 @@ thread_local! { /// Nonzero luma angle deltas coded by an intra 8x8 leaf inside an inter frame /// (lane-leaf8tx r1) -- counted only in [`decode_inter_block8`]'s intra arm. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter8_angle_delta_y_hits() -> usize { INTRA_IN_INTER8_ANGLE_DELTA_Y_HITS.with(|c| c.get()) } /// `(directional, smooth/paeth, CfL)` chroma modes coded by an intra 8x8 leaf /// inside an inter frame -- see [`INTRA_IN_INTER8_UV_DIR_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter8_uv_hits() -> (usize, usize, usize) { ( INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.get()), @@ -442,6 +451,7 @@ thread_local! { } /// Current value of [`WARP_PLANE_SUPPRESS_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn warp_plane_suppress_hits() -> usize { WARP_PLANE_SUPPRESS_HITS.with(|c| c.get()) } @@ -460,6 +470,7 @@ fn warp_plane_allowed(w: usize, h: usize) -> bool { } /// Current value of [`CDEF_IDX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn cdef_idx_hits() -> usize { CDEF_IDX_HITS.with(|c| c.get()) } @@ -476,16 +487,19 @@ thread_local! { } /// Current value of [`INTRA_IN_INTER_TXCTX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter_txctx_hits() -> usize { INTRA_IN_INTER_TXCTX_HITS.with(|c| c.get()) } /// Current value of [`NON_CHROMA_REF_CTX_SKIP_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn non_chroma_ref_ctx_skip_hits() -> usize { NON_CHROMA_REF_CTX_SKIP_HITS.with(|c| c.get()) } /// Current value of [`EDGE_FILTER_MI_FIX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn edge_filter_mi_fix_hits() -> usize { EDGE_FILTER_MI_FIX_HITS.with(|c| c.get()) } @@ -512,6 +526,7 @@ thread_local! { } /// Current value of [`DELTA_Q_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn delta_q_hits() -> usize { DELTA_Q_HITS.with(|c| c.get()) } @@ -581,6 +596,7 @@ thread_local! { } /// Current value of [`DELTA_LF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn delta_lf_hits() -> usize { DELTA_LF_HITS.with(|c| c.get()) } @@ -720,21 +736,25 @@ pub(crate) fn take_segment_ids(fctx: &crate::decode::FrameCtx) -> Vec { } /// How many `segment_id` symbols have been read (never reset per frame). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn segment_id_hits() -> usize { SEG_ID_HITS.with(|c| c.get()) } /// How many distinct segment ids any decoded block has carried. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn segment_ids_seen() -> usize { SEG_IDS_SEEN.with(|c| c.get().count_ones() as usize) } /// How many `seg_id_predicted` symbols have been read (temporal update). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn segment_pred_hits() -> usize { SEG_PRED_HITS.with(|c| c.get()) } /// Resets the segmentation hit counters (gate setup). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_segment_hits() { SEG_ID_HITS.with(|c| c.set(0)); SEG_IDS_SEEN.with(|c| c.set(0)); @@ -1006,6 +1026,7 @@ thread_local! { } /// Current value of [`SMOOTH_LUMA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn smooth_luma_hits() -> usize { SMOOTH_LUMA_HITS.with(|c| c.get()) } @@ -1022,6 +1043,7 @@ thread_local! { } /// Current value of [`SPLIT_TU_REACH_FIX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn split_tu_reach_fix_hits() -> usize { SPLIT_TU_REACH_FIX_HITS.with(|c| c.get()) } @@ -1063,6 +1085,7 @@ thread_local! { } /// Current value of [`SMOOTH_UV_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn smooth_uv_hits() -> usize { SMOOTH_UV_HITS.with(|c| c.get()) } @@ -1077,6 +1100,7 @@ thread_local! { const { std::cell::Cell::new(0) }; } /// Current value of [`TILE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tile_hits() -> usize { TILE_HITS.with(|c| c.get()) } @@ -1096,6 +1120,7 @@ static PREFILT_PICTURE_IDX: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); /// Current value of [`DEBLOCK_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn deblock_hits() -> usize { DEBLOCK_HITS.with(|c| c.get()) } @@ -1111,6 +1136,7 @@ thread_local! { } /// Current value of [`UNI_COMP_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn uni_comp_hits() -> usize { UNI_COMP_HITS.with(|c| c.get()) } @@ -1125,6 +1151,7 @@ thread_local! { } /// Current value of [`DIFFWTD_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn diffwtd_hits() -> usize { DIFFWTD_HITS.with(|c| c.get()) } @@ -1140,6 +1167,7 @@ thread_local! { } /// Current value of [`DIFFWTD_INFERRED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn diffwtd_inferred_hits() -> usize { DIFFWTD_INFERRED_HITS.with(|c| c.get()) } @@ -1156,6 +1184,7 @@ thread_local! { } /// Current value of [`FWD_KF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn fwd_kf_hits() -> usize { FWD_KF_HITS.with(|c| c.get()) } @@ -1189,11 +1218,13 @@ thread_local! { } /// Current value of [`SQ_CHROMA_TX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sq_chroma_tx_hits() -> usize { SQ_CHROMA_TX_HITS.with(|c| c.get()) } /// Current value of [`TX_DEPTH_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tx_depth_hits() -> usize { TX_DEPTH_HITS.with(|c| c.get()) } @@ -1237,21 +1268,25 @@ thread_local! { } /// Current value of [`TXFM_SPLIT_READS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn txfm_split_reads() -> usize { TXFM_SPLIT_READS.with(|c| c.get()) } /// Current value of [`TXFM_SPLIT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn txfm_split_hits() -> usize { TXFM_SPLIT_HITS.with(|c| c.get()) } /// Current value of [`INTER_LEAF16_HORZ_HITS`] (lane-inter4 r3). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_leaf16_horz_hits() -> usize { INTER_LEAF16_HORZ_HITS.with(|c| c.get()) } /// Current value of [`INTER_LEAF16_VERT_HITS`] (lane-inter4 r3). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_leaf16_vert_hits() -> usize { INTER_LEAF16_VERT_HITS.with(|c| c.get()) } @@ -1328,6 +1363,7 @@ thread_local! { } /// Current value of [`VERT_B_INTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn vert_b_intra_hits() -> usize { VERT_B_INTRA_HITS.with(|c| c.get()) } @@ -1342,7 +1378,7 @@ thread_local! { static AB16_HITS: std::cell::Cell<[usize; 4]> = const { std::cell::Cell::new([0; 4]) }; } -/// [`AB16_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 16x16). +// [`AB16_HITS`] per arm (HORZ_A, HORZ_B, VERT_A, VERT_B at 16x16). thread_local! { /// 4x4 transform units decoded inside an 8x8 square of a /// `PARTITION_VERT_A`/`_B` -- the exact call that panicked before @@ -1351,10 +1387,12 @@ thread_local! { static VERT_AB_TX4_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn vert_ab_tx4_hits() -> usize { VERT_AB_TX4_HITS.with(std::cell::Cell::get) } +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn ab16_hits_by_arm() -> [usize; 4] { AB16_HITS.with(std::cell::Cell::get) } @@ -1379,6 +1417,7 @@ thread_local! { } /// Current value of [`HORZ_VERT_INTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn horz_vert_intra_hits() -> usize { HORZ_VERT_INTRA_HITS.with(|c| c.get()) } @@ -1394,6 +1433,7 @@ thread_local! { } /// Current value of [`EDGE_RECT_STRIP_HITS`]. +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) fn edge_rect_strip_hits() -> usize { EDGE_RECT_STRIP_HITS.with(|c| c.get()) } @@ -1447,11 +1487,13 @@ pub fn reset_inter_edge_strip_hits() { } /// Current value of [`EDGE_BOTH_CUT_HITS`] (`[16, 32, 64, 128]` levels). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn edge_both_cut_hits() -> [usize; 4] { EDGE_BOTH_CUT_HITS.with(|c| c.get()) } /// Zeroes [`EDGE_BOTH_CUT_HITS`] so a gate can measure a per-attempt delta. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_edge_both_cut_hits() { EDGE_BOTH_CUT_HITS.with(|c| c.set([0; 4])); } @@ -1466,6 +1508,7 @@ thread_local! { } /// Current value of [`RECT_SPLIT_TX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_split_tx_hits() -> usize { RECT_SPLIT_TX_HITS.with(|c| c.get()) } @@ -1482,6 +1525,7 @@ thread_local! { } /// Current value of [`RECT_SPLIT_SB_INTERIOR_TU_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_split_sb_interior_tu_hits() -> usize { RECT_SPLIT_SB_INTERIOR_TU_HITS.with(|c| c.get()) } @@ -1498,6 +1542,7 @@ thread_local! { } /// Current value of [`RECT_SPLIT_CHROMA_SHAPE_HITS`] (32x8, 8x32, 8x4, 4x8). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_split_chroma_shape_hits() -> [usize; 4] { RECT_SPLIT_CHROMA_SHAPE_HITS.with(|c| c.get()) } @@ -1512,6 +1557,7 @@ thread_local! { } /// Current value of [`FILTER_INTRA_RECT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_rect_hits() -> usize { FILTER_INTRA_RECT_HITS.with(|c| c.get()) } @@ -1532,11 +1578,13 @@ thread_local! { } /// Current value of [`FILTER_INTRA_RECT4_HORZ_HITS`] (32x8 strips). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_rect4_horz_hits() -> usize { FILTER_INTRA_RECT4_HORZ_HITS.with(|c| c.get()) } /// Current value of [`FILTER_INTRA_RECT4_VERT_HITS`] (8x32 strips). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_rect4_vert_hits() -> usize { FILTER_INTRA_RECT4_VERT_HITS.with(|c| c.get()) } @@ -1551,6 +1599,7 @@ thread_local! { } /// Current value of [`RECT_COEFF_TU_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_coeff_tu_hits() -> usize { RECT_COEFF_TU_HITS.with(|c| c.get()) } @@ -1559,6 +1608,7 @@ pub(crate) fn rect_coeff_tu_hits() -> usize { /// (`V_DCT`/`H_DCT`) -- [`TX_CLASS1_HITS`]'s rect-only half, so a gate can /// pin that the 1D-class-on-a-RECT-transform path fired rather than settling /// for the square reader's own 1D types. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_class1_hits() -> usize { RECT_CLASS1_HITS.with(|c| c.get()) } @@ -1574,6 +1624,7 @@ thread_local! { } /// Current value of [`FILTER_INTRA_RECT_SUB16_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_rect_sub16_hits() -> usize { FILTER_INTRA_RECT_SUB16_HITS.with(|c| c.get()) } @@ -1587,6 +1638,7 @@ thread_local! { } /// Current value of [`FILTER_INTRA_RECT_SUB8_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn filter_intra_rect_sub8_hits() -> usize { FILTER_INTRA_RECT_SUB8_HITS.with(|c| c.get()) } @@ -1612,6 +1664,7 @@ thread_local! { } /// Current value of [`DIRECTIONAL_UV_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn directional_uv_hits() -> usize { DIRECTIONAL_UV_HITS.with(|c| c.get()) } @@ -1637,6 +1690,7 @@ thread_local! { } /// Current value of [`NON_LAST_REF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn non_last_ref_hits() -> usize { NON_LAST_REF_HITS.with(|c| c.get()) } @@ -1683,6 +1737,7 @@ thread_local! { } /// Current value of [`COMP_MODE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn comp_mode_hits() -> usize { COMP_MODE_HITS.with(|c| c.get()) } @@ -1697,6 +1752,7 @@ thread_local! { } /// Current value of [`PALETTE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_hits() -> usize { PALETTE_HITS.with(|c| c.get()) } @@ -1710,6 +1766,7 @@ thread_local! { } /// Current value of [`PALETTE_TILE_LEFT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_tile_left_hits() -> usize { PALETTE_TILE_LEFT_HITS.with(|c| c.get()) } @@ -1722,6 +1779,7 @@ thread_local! { } /// Current value of [`PALETTE_UV_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_uv_hits() -> usize { PALETTE_UV_HITS.with(|c| c.get()) } @@ -1734,6 +1792,7 @@ thread_local! { } /// Current value of [`PALETTE_RECT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_rect_hits() -> usize { PALETTE_RECT_HITS.with(|c| c.get()) } @@ -1753,6 +1812,7 @@ thread_local! { } /// Current value of [`RECT_SCREEN_CONTENT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_screen_content_hits() -> usize { RECT_SCREEN_CONTENT_HITS.with(|c| c.get()) } @@ -1774,11 +1834,13 @@ thread_local! { } /// Current value of [`RECT4_PALETTE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect4_palette_hits() -> usize { RECT4_PALETTE_HITS.with(|c| c.get()) } /// Current value of [`PALETTE_SPLIT_TX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_split_tx_hits() -> usize { PALETTE_SPLIT_TX_HITS.with(|c| c.get()) } @@ -1792,11 +1854,13 @@ thread_local! { } /// Current value of [`PALETTE_LEAF8_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_leaf8_hits() -> usize { PALETTE_LEAF8_HITS.with(|c| c.get()) } /// Zeroes [`PALETTE_LEAF8_HITS`] (per-attempt gate counting). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_palette_leaf8_hits() { PALETTE_LEAF8_HITS.with(|c| c.set(0)); } @@ -1809,11 +1873,13 @@ thread_local! { } /// Current value of [`PALETTE_SB_STRIP_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn palette_sb_strip_hits() -> usize { PALETTE_SB_STRIP_HITS.with(|c| c.get()) } /// Zeroes [`PALETTE_SB_STRIP_HITS`] (per-attempt gate counting). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_palette_sb_strip_hits() { PALETTE_SB_STRIP_HITS.with(|c| c.set(0)); } @@ -1877,6 +1943,7 @@ thread_local! { } /// Current value of [`INTRA_IN_INTER_SPLIT_TX_HITS`], indexed 8/16/32/64. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_in_inter_split_tx_hits() -> [usize; 4] { INTRA_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get) } @@ -1975,6 +2042,7 @@ pub(crate) fn rect_intrabc_reads() -> usize { } /// Zeroes [`RECT_INTRABC_READS`] (gate tests call this before a decode). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_rect_intrabc_reads() { RECT_INTRABC_READS.with(|c| c.set(0)); } @@ -1991,16 +2059,19 @@ pub(crate) fn leaf8_intrabc_hits() -> usize { } /// Zeroes [`LEAF8_INTRABC_HITS`] (gate tests call this before a decode). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_leaf8_intrabc_hits() { LEAF8_INTRABC_HITS.with(|c| c.set(0)); } /// Current value of [`INTRABC_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intrabc_hits() -> usize { INTRABC_HITS.with(|c| c.get()) } /// Zeroes [`INTRABC_HITS`] (gate tests call this before a decode). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_intrabc_hits() { INTRABC_HITS.with(|c| c.set(0)); } @@ -2013,11 +2084,13 @@ thread_local! { } /// Current value of [`INTRABC_VARTX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intrabc_vartx_hits() -> usize { INTRABC_VARTX_HITS.with(|c| c.get()) } /// Zeroes [`INTRABC_VARTX_HITS`] (gate tests call this before a decode). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_intrabc_vartx_hits() { INTRABC_VARTX_HITS.with(|c| c.set(0)); } @@ -2061,6 +2134,7 @@ thread_local! { } /// Current value of [`SKIP_MODE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn skip_mode_hits() -> usize { SKIP_MODE_HITS.with(|c| c.get()) } @@ -2092,7 +2166,7 @@ pub fn fimv_alphabet_hits() -> usize { } // lane-fimv r1: how many frame headers this decoder has decoded with -/// `force_integer_mv == 1` (bumped by `stream.rs` per frame). Lets a gate +// `force_integer_mv == 1` (bumped by `stream.rs` per frame). Lets a gate // prove the encoder really produced the header state under test rather than // assume it. thread_local! { @@ -2111,6 +2185,7 @@ pub fn note_force_integer_mv_frame() { } /// Current value of [`OBMC_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn obmc_hits() -> usize { OBMC_HITS.with(|c| c.get()) } @@ -2126,6 +2201,7 @@ thread_local! { } /// Current value of [`OBMC_FILTER_BAND_READS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn obmc_filter_band_reads() -> usize { OBMC_FILTER_BAND_READS.with(|c| c.get()) } @@ -2149,6 +2225,7 @@ thread_local! { /// Current value of [`MIXED_SCALE_COMPOUND_HITS`]: compound blocks with one /// scaled and one unscaled tap. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn mixed_scale_compound_hits() -> usize { MIXED_SCALE_COMPOUND_HITS.with(|c| c.get()) } @@ -2157,11 +2234,13 @@ pub(crate) fn mixed_scale_compound_hits() -> usize { /// read the 3-symbol `motion_mode_cdf` but read the 2-symbol `obmc_cdf` /// instead because their reference is scaled (libaom `motion_mode_allowed`, /// `blockd.h:1484`). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn scaled_warp_suppressed_hits() -> usize { SCALED_WARP_SUPPRESSED_HITS.with(|c| c.get()) } /// Current value of [`SCALED_COMPOUND_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn scaled_compound_hits() -> usize { SCALED_COMPOUND_HITS.with(|c| c.get()) } @@ -2172,16 +2251,19 @@ pub fn scaled_warp_fallback_hits() -> usize { } /// Current value of [`SCALED_OBMC_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn scaled_obmc_hits() -> usize { SCALED_OBMC_HITS.with(|c| c.get()) } /// Current value of [`SCALED_INTERINTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn scaled_interintra_hits() -> usize { SCALED_INTERINTRA_HITS.with(|c| c.get()) } /// Current value of [`SCALED_BLOCK8_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn scaled_block8_hits() -> usize { SCALED_BLOCK8_HITS.with(|c| c.get()) } @@ -2211,11 +2293,13 @@ thread_local! { } /// Current value of [`DUAL_FILTER_DIFF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn dual_filter_diff_hits() -> usize { DUAL_FILTER_DIFF_HITS.with(|c| c.get()) } /// Current value of [`COMPOUND8_FILTER_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn compound8_filter_hits() -> usize { COMPOUND8_FILTER_HITS.with(|c| c.get()) } @@ -2232,6 +2316,7 @@ thread_local! { } /// Current value of [`WARP_SELECTED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn warp_selected_hits() -> usize { WARP_SELECTED_HITS.with(|c| c.get()) } @@ -2247,6 +2332,7 @@ thread_local! { } /// Current value of [`COMPOUND_WARP_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn compound_warp_hits() -> usize { COMPOUND_WARP_HITS.with(|c| c.get()) } @@ -2261,6 +2347,7 @@ thread_local! { } /// Current value of [`COMPOUND_WARP_HITS_8`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn compound_warp_hits_8() -> usize { COMPOUND_WARP_HITS_8.with(|c| c.get()) } @@ -2276,6 +2363,7 @@ thread_local! { } /// Current value of [`AFFINE_GM_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn affine_gm_hits() -> usize { AFFINE_GM_HITS.with(|c| c.get()) } @@ -2321,11 +2409,13 @@ thread_local! { } /// Current value of [`GLOBALMV_HITS_8`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn globalmv_hits_8() -> usize { GLOBALMV_HITS_8.with(|c| c.get()) } /// Current value of [`WARP_HITS_8`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn warp_hits_8() -> usize { WARP_HITS_8.with(|c| c.get()) } @@ -2339,6 +2429,7 @@ thread_local! { } /// Current value of [`INTERINTRA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn interintra_hits() -> usize { INTERINTRA_HITS.with(|c| c.get()) } @@ -2368,6 +2459,7 @@ thread_local! { } /// Current value of [`MASKED_COMPOUND_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn masked_compound_hits() -> usize { MASKED_COMPOUND_HITS.with(|c| c.get()) } @@ -2383,6 +2475,7 @@ thread_local! { } /// Current value of [`RECT_MASKED_COMPOUND_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_masked_compound_hits() -> usize { RECT_MASKED_COMPOUND_HITS.with(|c| c.get()) } @@ -2397,6 +2490,7 @@ thread_local! { } /// Current value of [`WEDGE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn wedge_hits() -> usize { WEDGE_HITS.with(|c| c.get()) } @@ -2411,6 +2505,7 @@ thread_local! { } /// Current value of [`WII_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn wii_hits() -> usize { WII_HITS.with(|c| c.get()) } @@ -2425,6 +2520,7 @@ thread_local! { } /// Current value of [`NOCFL_UV_MODE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn nocfl_uv_mode_hits() -> usize { NOCFL_UV_MODE_HITS.with(|c| c.get()) } @@ -2495,11 +2591,13 @@ thread_local! { } /// Current value of [`OBMC_EDGE_SPAN_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn obmc_edge_span_hits() -> usize { OBMC_EDGE_SPAN_HITS.with(|c| c.get()) } /// Current value of [`OBMC_HITS_8`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn obmc_hits_8() -> usize { OBMC_HITS_8.with(|c| c.get()) } @@ -2517,6 +2615,7 @@ thread_local! { } /// Current value of [`EXTENDED_PARTITION_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn extended_partition_hits() -> usize { EXTENDED_PARTITION_HITS.with(|c| c.get()) } @@ -2531,6 +2630,7 @@ thread_local! { } /// Current value of [`RECT_PARTITION_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_partition_hits() -> usize { RECT_PARTITION_HITS.with(|c| c.get()) } @@ -2580,6 +2680,7 @@ thread_local! { } /// Current value of [`INTER_SB_NONE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_sb_none_hits() -> usize { INTER_SB_NONE_HITS.with(|c| c.get()) } @@ -2594,6 +2695,7 @@ thread_local! { } /// Current value of [`INTER_SUB16_SPLIT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_sub16_split_hits() -> usize { INTER_SUB16_SPLIT_HITS.with(|c| c.get()) } @@ -2634,6 +2736,7 @@ thread_local! { } /// Current value of [`RECT_COEFF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_coeff_hits() -> usize { RECT_COEFF_HITS.with(|c| c.get()) } @@ -2647,6 +2750,7 @@ thread_local! { } /// Current value of [`RECT_LEAF_COEFF_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_leaf_coeff_hits() -> usize { RECT_LEAF_COEFF_HITS.with(|c| c.get()) } @@ -2663,6 +2767,7 @@ thread_local! { /// Current value of [`INTRA_RECT_IN_INTER_HITS`] for one shape class /// (0 = 64x32/32x64, 1 = 32x16/16x32, 2 = 16x8/8x16). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_rect_strip_in_inter_hits(class: usize) -> usize { INTRA_RECT_IN_INTER_HITS.with(|c| c.get()[class]) } @@ -2703,16 +2808,19 @@ thread_local! { } /// Current value of [`INTRA_RECT_IN_INTER_SCREEN_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_rect_in_inter_screen_hits() -> usize { INTRA_RECT_IN_INTER_SCREEN_HITS.with(std::cell::Cell::get) } /// Resets [`INTRA_RECT_IN_INTER_SCREEN_HITS`] before a decode. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_intra_rect_in_inter_screen_hits() { INTRA_RECT_IN_INTER_SCREEN_HITS.with(|c| c.set(0)); } /// Current value of [`INTRA_RECT_IN_INTER_SPLIT_TX_HITS`], indexed by tx depth. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_rect_in_inter_split_tx_hits() -> [usize; 3] { INTRA_RECT_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get) } @@ -2726,6 +2834,7 @@ thread_local! { } /// Current value of [`INTRA_RECT_IN_INTER_TXCTX_OVERRIDE_HITS`]. +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) fn intra_rect_in_inter_txctx_override_hits() -> usize { INTRA_RECT_IN_INTER_TXCTX_OVERRIDE_HITS.with(std::cell::Cell::get) } @@ -2763,6 +2872,7 @@ thread_local! { } /// Current value of [`MODE_MI_OVERRIDE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn mode_mi_override_hits() -> usize { MODE_MI_OVERRIDE_HITS.with(|c| c.get()) } @@ -2781,6 +2891,7 @@ thread_local! { } /// Current value of [`MODE_TILE_EDGE_COARSE_LEAKS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn mode_tile_edge_coarse_leaks() -> usize { MODE_TILE_EDGE_COARSE_LEAKS.with(|c| c.get()) } @@ -2795,6 +2906,7 @@ thread_local! { } /// Current value of [`UV_MODE_MI_OVERRIDE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn uv_mode_mi_override_hits() -> usize { UV_MODE_MI_OVERRIDE_HITS.with(|c| c.get()) } @@ -2825,6 +2937,7 @@ thread_local! { } /// Current value of [`INTER_NEIGHBOUR_NOT_SMOOTH_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_neighbour_not_smooth_hits() -> usize { INTER_NEIGHBOUR_NOT_SMOOTH_HITS.with(|c| c.get()) } @@ -2842,6 +2955,7 @@ thread_local! { } /// Current value of [`UV_TILE_EDGE_SUPPRESSED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn uv_tile_edge_suppressed_hits() -> usize { UV_TILE_EDGE_SUPPRESSED_HITS.with(|c| c.get()) } @@ -2855,11 +2969,13 @@ thread_local! { } /// Current value of [`CFL_BLOCK_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn cfl_block_hits() -> usize { CFL_BLOCK_HITS.with(|c| c.get()) } /// Current value of [`UV_ANGLE_DELTA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn uv_angle_delta_hits() -> usize { UV_ANGLE_DELTA_HITS.with(|c| c.get()) } @@ -2873,7 +2989,7 @@ thread_local! { const { std::cell::Cell::new(0) }; } -/// Current value of [`SB_RECT_HITS`]. +// Current value of [`SB_RECT_HITS`]. // lane-hgkf r1: the frame-edge partition bit, one level each. Slot 0 = a // 64-level gathered edge bit read as HORZ/VERT, 1 = the same bit read as // SPLIT, 2/3 = the 32-level pair. A gate asserting slot 0 or 2 proves the @@ -2884,11 +3000,13 @@ thread_local! { } /// Current value of [`EDGE_PART_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn edge_part_hits() -> [usize; 4] { EDGE_PART_HITS.with(|c| c.get()) } /// Reset [`EDGE_PART_HITS`] (a gate counts one stream at a time). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn reset_edge_part_hits() { EDGE_PART_HITS.with(|c| c.set([0; 4])); } @@ -2901,6 +3019,7 @@ fn bump_edge_part(slot: usize) { }); } +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sb_rect_hits() -> usize { SB_RECT_HITS.with(|c| c.get()) } @@ -2924,6 +3043,7 @@ thread_local! { } /// Current value of [`EDGE32_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn edge32_hits() -> [usize; 8] { EDGE32_HITS.with(|c| c.get()) } @@ -2954,6 +3074,7 @@ thread_local! { } /// Current value of [`SB_AB_HITS`], summed over the four arms. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sb_ab_hits() -> usize { SB_AB_HITS.with(|c| c.get().iter().sum()) } @@ -2962,6 +3083,7 @@ pub(crate) fn sb_ab_hits() -> usize { /// `_VERT_A`, `_VERT_B` order -- what the gate hard-asserts arm by arm, so a /// run where aomenc's RD only ever picked (say) `HORZ_A` cannot pass off as /// proof of all four. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sb_ab_hits_by_arm() -> [usize; 4] { SB_AB_HITS.with(std::cell::Cell::get) } @@ -2977,11 +3099,13 @@ thread_local! { } /// Current value of `SB_RECT4_HORZ_HITS` (64x16 strips decoded). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sb_rect4_horz_hits() -> usize { SB_RECT4_HORZ_HITS.with(|c| c.get()) } /// Current value of `SB_RECT4_VERT_HITS` (16x64 strips decoded). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sb_rect4_vert_hits() -> usize { SB_RECT4_VERT_HITS.with(|c| c.get()) } @@ -3005,9 +3129,9 @@ thread_local! { static INTER_SB_VERT4_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } -/// How many 32x32-level 1:4 strips actually read coefficients (non-skip): -/// a gate that only counted strips would pass on an all-skip stream, which -/// exercises none of the new scan/context tables. +// How many 32x32-level 1:4 strips actually read coefficients (non-skip): +// a gate that only counted strips would pass on an all-skip stream, which +// exercises none of the new scan/context tables. thread_local! { static RECT4_COEFF_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } @@ -3024,6 +3148,7 @@ thread_local! { } /// Current values of `RECT4_SPLIT_DEPTH1_HITS` / `RECT4_SPLIT_DEPTH2_HITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect4_split_depth_hits() -> (usize, usize) { ( RECT4_SPLIT_DEPTH1_HITS.with(|c| c.get()), @@ -3032,6 +3157,7 @@ pub(crate) fn rect4_split_depth_hits() -> (usize, usize) { } /// Current value of `SUB16_SPLIT_HITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sub16_split_hits() -> usize { SUB16_SPLIT_HITS.with(|c| c.get()) } @@ -3044,6 +3170,7 @@ thread_local! { } /// Current value of `RECT64_SPLIT_TXFM_PUBLISH_HITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect64_split_txfm_publish_hits() -> usize { RECT64_SPLIT_TXFM_PUBLISH_HITS.with(|c| c.get()) } @@ -3273,6 +3400,7 @@ thread_local! { } /// Current value of [`RECT64_QIDX_DRIFT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect64_qidx_drift_hits() -> usize { RECT64_QIDX_DRIFT_HITS.with(|c| c.get()) } @@ -3287,6 +3415,7 @@ thread_local! { } /// Current value of [`PARTAB_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn partab_hits() -> usize { PARTAB_HITS.with(|c| c.get()) } @@ -3307,18 +3436,22 @@ thread_local! { } /// Current value of [`INTRA_HORZ_A_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_horz_a_hits() -> usize { INTRA_HORZ_A_HITS.with(|c| c.get()) } /// Current value of [`INTRA_HORZ_B_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_horz_b_hits() -> usize { INTRA_HORZ_B_HITS.with(|c| c.get()) } /// Current value of [`INTRA_VERT_A_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_vert_a_hits() -> usize { INTRA_VERT_A_HITS.with(|c| c.get()) } /// Current value of [`INTRA_VERT_B_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_vert_b_hits() -> usize { INTRA_VERT_B_HITS.with(|c| c.get()) } @@ -3335,6 +3468,7 @@ thread_local! { } /// Current value of [`COMPOUND_MODE_HITS`]. +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) fn compound_mode_hits() -> usize { COMPOUND_MODE_HITS.with(|c| c.get()) } @@ -3352,12 +3486,14 @@ pub(crate) fn compound_mode_hits() -> usize { /// [`crate::motion_field::setup_motion_field`] yet, so this will read `0` /// against any real stream today. See the module doc on /// `crate::motion_field` and this crate's ledger for the remaining wiring. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tmv_hits() -> usize { crate::mvstack::tmv_hits() } /// Current value of [`crate::mc::inter_pred_hits`] -- inter predictions /// produced on this thread, the 10-bit inter gate's firing proof. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter_pred_hits() -> usize { crate::mc::inter_pred_hits() } @@ -3465,6 +3601,7 @@ pub(crate) fn build_motion_field( /// Current value of the counter for `ref_frame` (`LAST2_FRAME`..=`ALTREF_FRAME`; /// panics on `LAST_FRAME`/`INTRA_FRAME`/`NONE`, which have no counter here). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn ref_hits(ref_frame: i8) -> usize { let c = match ref_frame { LAST2_FRAME => &LAST2_HITS, @@ -3499,11 +3636,13 @@ pub(crate) fn set_enable_edge_filter(value: bool, fctx: &crate::decode::FrameCtx } /// Current value of [`ANGLE_DELTA_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn angle_delta_hits() -> usize { ANGLE_DELTA_HITS.with(|c| c.get()) } /// Current value of [`TX_CLASS1_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tx_class1_hits() -> usize { TX_CLASS1_HITS.with(|c| c.get()) } @@ -3592,6 +3731,7 @@ pub fn cdef_mixed_skip_units() -> usize { } /// Current value of `CDEF_SKIPPED_UNITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn cdef_skipped_units() -> usize { CDEF_SKIPPED_UNITS.with(|c| c.get()) } @@ -3603,16 +3743,19 @@ pub fn cdef_unwritten_skip_units() -> usize { } /// Current value of `INTER8_SKIP_BAND_HITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn inter8_skip_band_hits() -> usize { INTER8_SKIP_BAND_HITS.with(|c| c.get()) } /// Current value of `CDEF_STRADDLE_UNITS`. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn cdef_straddle_units() -> usize { CDEF_STRADDLE_UNITS.with(|c| c.get()) } /// Current value of [`SUB8_SPLIT_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sub8_split_hits() -> usize { SUB8_SPLIT_HITS.with(|c| c.get()) } @@ -3669,26 +3812,31 @@ thread_local! { } /// Current value of [`RECT8_SPLIT_TX_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect8_split_tx_hits() -> usize { RECT8_SPLIT_TX_HITS.with(|c| c.get()) } /// Current value of [`RECT_STRIP_PRED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_strip_pred_hits() -> usize { RECT_STRIP_PRED_HITS.with(|c| c.get()) } /// Current value of [`RECT_STRIP_REACH_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn rect_strip_reach_hits() -> usize { RECT_STRIP_REACH_HITS.with(|c| c.get()) } /// Current value of [`TX4X8_CODED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tx4x8_coded_hits() -> usize { TX4X8_CODED_HITS.with(|c| c.get()) } /// Current value of [`TX8X4_CODED_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tx8x4_coded_hits() -> usize { TX8X4_CODED_HITS.with(|c| c.get()) } @@ -3705,6 +3853,7 @@ thread_local! { } /// Current value of [`CHROMA_EOB_CLASS1_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn chroma_eob_class1_hits() -> usize { CHROMA_EOB_CLASS1_HITS.with(|c| c.get()) } @@ -4680,7 +4829,7 @@ fn read_coeffs_rect( let pos = scan[scan_idx] as usize; let (row, col) = (pos / w, pos % w); // libaom's column-major `coeff_idx`, for ladder comparison. - let apos = col * h + row; + let _apos = col * h + row; let level = if scan_idx == eob - 1 { let ctx = eob_coeff_ctx(scan_idx, w * h); let v = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1; @@ -5014,6 +5163,7 @@ struct Neighbours { tile_col0_mi: usize, } +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates impl Neighbours { /// `cols`/`rows` are in [`SUB`] units; `mi_cols`/`mi_rows` are the frame's /// true (unpadded) size in 4x4 mode-info units. @@ -5603,6 +5753,7 @@ impl Neighbours { /// "no neighbour"). `ref_frame` is `-1` for an intra block, else the /// `1..=7` reference it coded (lane-av1refs's `single_ref_p*_ctx` needs /// the real value, not just `is_inter`). + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn record_inter( &mut self, at: (usize, usize), @@ -5622,6 +5773,7 @@ impl Neighbours { /// left-context span (its own height) differ, unlike every caller before /// this round (class neighbour-votes-all-its-fields). #[allow(clippy::too_many_arguments)] + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn record_inter_rect( &mut self, at: (usize, usize), @@ -5721,6 +5873,7 @@ impl Neighbours { /// this is the one caller that actually knows it) -- so the next block's /// [`NeighbourRef`](crate::mvstack::NeighbourRef) sees a real compound /// neighbour instead of `record_inter`'s single-ref default. + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn record_compound_ctx( &mut self, at: (usize, usize), @@ -5735,6 +5888,7 @@ impl Neighbours { /// [`Self::record_compound_ctx`] with independent above/left extents, /// mirroring [`Self::record_inter_rect`] (lane-partitions r1). #[allow(clippy::too_many_arguments)] + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn record_compound_ctx_rect( &mut self, at: (usize, usize), @@ -9810,9 +9964,9 @@ fn decode_rect4_16( let (r, c) = at16; let (mi_row0, mi_col0) = (r * (SUB / MI), c * (SUB / MI)); let (bw, bh) = if horz { (16, 4) } else { (4, 16) }; - let (mi_w, mi_h) = (bw / MI, bh / MI); - let scan: &[u16] = if horz { &SCAN_16X4 } else { &SCAN_4X16 }; - let chroma_scan: &[u16] = if horz { &SCAN_8X4 } else { &SCAN_4X8 }; + let (_mi_w, _mi_h) = (bw / MI, bh / MI); + let _scan: &[u16] = if horz { &SCAN_16X4 } else { &SCAN_4X16 }; + let _chroma_scan: &[u16] = if horz { &SCAN_8X4 } else { &SCAN_4X8 }; let mut prev: Option<((usize, usize), usize)> = None; let mut last_mode = DC_PRED; let mut last_uv_mode = DC_PRED; @@ -11345,6 +11499,7 @@ fn cfl_scaled(alpha_q3: i32, ac_q3: i32) -> i32 { /// deblock/CDEF stages run, so the frame being dumped here is `idx - 1` -- /// without this every frame overwrote `.f0` and a per-frame bisection silently /// compared the LAST decoded frame (ledger, class stale-output-faked-measurement). +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live fn stage_dump_idx() -> usize { PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst).saturating_sub(1) } @@ -13347,7 +13502,6 @@ fn decode_leaf8( // 8x8 `mode` and reading its own fresh context off the earlier // units in this same leaf (the same per-TU pattern `decode_block`'s // multi-TU branch runs at bigger blocks). - luma_grid = vec![0i32; 64]; for tu_row in 0..2 { for tu_col in 0..2 { let tu_mi = (leaf_mi.0 + tu_row, leaf_mi.1 + tu_col); @@ -14243,6 +14397,7 @@ fn cdef_msb(x: i32) -> i32 { /// Spec 7.15.3's `constrain`: how much of a neighbour's difference from the /// centre sample a filter tap is allowed to contribute. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn cdef_constrain(diff: i32, threshold: i32, damping: i32) -> i32 { if threshold == 0 { return 0; @@ -15016,6 +15171,7 @@ fn read_tx_size( /// transform and whether this unit already sits below it, times three, plus /// the two neighbour terms (whether the transform last written above/left of /// this unit is narrower/shorter than the unit itself). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn txfm_partition_ctx(above_px: u8, left_px: u8, blk_max_px: usize, tx_px: usize) -> usize { txfm_partition_ctx_rect(above_px, left_px, blk_max_px, tx_px, tx_px) } @@ -15048,6 +15204,7 @@ fn txfm_partition_ctx_rect( /// `txfm_partition_update` (libaom `av1_common_int.h`): once a var-tx unit /// resolves, every mi cell its *parent* unit (`txb_px`) spans records the /// resolved transform's own size. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn txfm_partition_update( n: &mut Neighbours, at_mi: (usize, usize), @@ -16453,6 +16610,7 @@ fn deblock_thresholds(level: i32, sharpness: u8) -> (i32, i32, i32) { (2 * (level + 2) + lim, lim, level >> 4) } +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn sclamp(v: i32, fctx: &crate::decode::FrameCtx) -> i32 { // libaom's `signed_char_clamp_high`: the clamp range scales with // `128 << (bit_depth - 8)` alongside the centering constant below. @@ -17651,6 +17809,7 @@ fn apply_loop_restoration( /// 16x16, a directional mode's angle delta other than zero, chroma-from-luma), /// or when the tile payload runs out of the symbols this decode expects (a /// genuinely foreign stream). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn decode_key_frame_tile( data: &[u8], mi_cols: u32, @@ -17708,6 +17867,7 @@ pub(crate) fn decode_key_frame_tile( /// (see [`LAST_FRAME_WIDE_MARGIN`]) -- `stream.rs`'s superres path /// reads this immediately after the call, before any other frame /// decode can overwrite it. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn take_last_frame_wide_margin(fctx: &crate::decode::FrameCtx) -> Option { fctx.last_frame_wide_margin.with(|m| m.borrow_mut().take()) } @@ -17764,13 +17924,12 @@ fn sb_visit_order(r0: u32, r1: u32, c0: u32, c1: u32, sb128: bool) -> Vec<(u32, out } -/// lane-sb128 r2: the 128x128 superblock root, shared by the key-frame and -/// the inter tile loop. Its loop-restoration units are read once for the whole -/// 128x128 (spec 5.11.57 is called with the superblock's own size), then one -/// partition symbol off the `BLOCK_128X128` CDF (8 symbols, no HORZ_4/VERT_4) -/// decides the root -- only SPLIT recurses into the four 64x64 quadrants this -/// decoder codes, the other seven arms refuse by name. -#[allow(clippy::too_many_arguments)] +// lane-sb128 r2: the 128x128 superblock root, shared by the key-frame and +// the inter tile loop. Its loop-restoration units are read once for the whole +// 128x128 (spec 5.11.57 is called with the superblock's own size), then one +// partition symbol off the `BLOCK_128X128` CDF (8 symbols, no HORZ_4/VERT_4) +// decides the root -- only SPLIT recurses into the four 64x64 quadrants this +// decoder codes, the other seven arms refuse by name. thread_local! { /// How many 128x128 superblock roots resolved to `PARTITION_NONE` -- one /// whole 128x128 block (lane-sb128b r1's gate counter). @@ -17795,16 +17954,19 @@ pub(crate) fn part128_ab_hits() -> [usize; 4] { } /// [`PART128_NONE_HITS`], for a gate's own before/after delta. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn part128_none_hits() -> usize { PART128_NONE_HITS.with(std::cell::Cell::get) } /// [`PART128_HORZ_HITS`], for a gate's own before/after delta. +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) fn part128_horz_hits() -> usize { PART128_HORZ_HITS.with(std::cell::Cell::get) } /// [`PART128_VERT_HITS`], for a gate's own before/after delta. +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) fn part128_vert_hits() -> usize { PART128_VERT_HITS.with(std::cell::Cell::get) } @@ -17827,6 +17989,7 @@ thread_local! { } /// [`CHROMA_SPLIT_TX_HITS`], for a gate's own before/after delta. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn chroma_split_tx_hits() -> usize { CHROMA_SPLIT_TX_HITS.with(std::cell::Cell::get) } @@ -20422,7 +20585,7 @@ fn read_inter_plane( x: usize, y: usize, side: usize, - base_q_idx: u8, + _base_q_idx: u8, prediction: &[u16], // lane-chromau: this block's own luma transform's *actual coded* // `tx_type` -- `av1_get_tx_type` (libaom `blockd.h`): an inter block's @@ -22123,7 +22286,7 @@ fn decode_inter_block( // 5.11.17), `Some` only when this block's var-tx tree resolved to more // than one luma transform -- read back by the residual loop, the // coefficient-context write-back and the loop-filter grid fill below. - let mut vartx_leaves: Option> = None; + let vartx_leaves: Option>; // lane-t900 r22: this block's own palette state, stamped into the // mi-granular neighbour bands at the tail below for EVERY block -- // libaom's `MB_MODE_INFO.palette_size` is 0 on an inter block, and @@ -22810,7 +22973,7 @@ fn decode_inter_block( ); } let mut pred_y = vec![0u16; side * side]; - let mut diffwtd_mask_y = Vec::new(); + let mut diffwtd_mask_y; // lane-wedge r3: `mask_y` is the DIFFWTD buffer just computed OR // the wedge codebook lookup (comp_group_idx==1's two mutually // exclusive branches) -- same [`mc::blend_masked_compound`] call @@ -25668,7 +25831,7 @@ fn decode_inter_sub8_split4( neighbours.left_ref[rmi], neighbours.left_ref1[rmi], ); - let (sref_y, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?; + let (sref_y, _sref_u, _sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?; // lane-t900 r28: refusal lifted -- this sub-block's own reference may // be scaled (superres); spec 7.11.3.3's walk is per reference, and // each of the group's pieces (luma and its 2x2 chroma) carries its @@ -27226,7 +27389,7 @@ fn decode_inter_block8( // the one split a `BLOCK_8X8` can take (`read_block_tx_size` below) -- // read back by the luma residual read and the tail's neighbour/loop-filter // bookkeeping. Always `false` outside a `TxMode::Select` inter frame. - let mut split8 = false; + let split8; const SIDE: usize = 8; const CHROMA_SIDE: usize = 4; @@ -27710,7 +27873,7 @@ fn decode_inter_block8( ); } let mut pred_y = vec![0u16; SIDE * SIDE]; - let mut diffwtd_mask_y = Vec::new(); + let mut diffwtd_mask_y; let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { diffwtd_mask_y = vec![0u8; SIDE * SIDE]; DIFFWTD_HITS.with(|c| c.set(c.get() + 1)); @@ -29142,6 +29305,7 @@ fn decode_inter_block8( /// or when `reference` is not this frame's own true size, or when the tile /// codes a 16x16 leaf whose own true edge cuts through it (round 2, same /// refusal [`crate::tile`]'s writer gives its encoder). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn decode_inter_frame_tile( data: &[u8], mi_cols: u32, diff --git a/crates/ec-av1/src/encode.rs b/crates/ec-av1/src/encode.rs index d30ab733..1898fdbf 100644 --- a/crates/ec-av1/src/encode.rs +++ b/crates/ec-av1/src/encode.rs @@ -1859,9 +1859,9 @@ fn prune_top_k() -> Option { } } -/// A per-thread override [`prune_top_k`] checks first, so one test can sweep -/// `top_k` in-process without mutating the environment (forbidden here -- -/// `#![forbid(unsafe_code)]` -- and racy across parallel tests besides). +// A per-thread override [`prune_top_k`] checks first, so one test can sweep +// `top_k` in-process without mutating the environment (forbidden here -- +// `#![forbid(unsafe_code)]` -- and racy across parallel tests besides). #[cfg(test)] thread_local! { static TEST_TOP_K_OVERRIDE: std::cell::Cell>> = @@ -1898,8 +1898,8 @@ fn prune_top_k_inter() -> Option { } } -/// A per-thread override [`prune_top_k_inter`] checks first, same reason as -/// [`TEST_TOP_K_OVERRIDE`]. +// A per-thread override [`prune_top_k_inter`] checks first, same reason as +// [`TEST_TOP_K_OVERRIDE`]. #[cfg(test)] thread_local! { static TEST_TOP_K_OVERRIDE_INTER: std::cell::Cell>> = @@ -1920,14 +1920,14 @@ fn set_test_top_k_override_inter(value: Option) { /// pruning them costs less quality here. const INTER_PRUNE_TOP_K: Option = Some(3); -/// Per-thread nanosecond counters `stage_timing_breakdown_inter` (and -/// [`crate::mc::predict`], through [`stage_add`]) accumulate into, so an -/// inter frame's cost can be attributed to a bucket without changing what -/// the search actually does. Index: 0 = whole-call time inside -/// [`motion::search`] (includes bucket 1's time, run from inside it), 1 = -/// [`crate::mc::predict`] (every call, from the motion search's own -/// candidates and from a committed inter block's final prediction alike), -/// 2 = `forward_and_quantize` + `dequant_and_inverse`, 3 = `coeff_bits`. +// Per-thread nanosecond counters `stage_timing_breakdown_inter` (and +// [`crate::mc::predict`], through [`stage_add`]) accumulate into, so an +// inter frame's cost can be attributed to a bucket without changing what +// the search actually does. Index: 0 = whole-call time inside +// [`motion::search`] (includes bucket 1's time, run from inside it), 1 = +// [`crate::mc::predict`] (every call, from the motion search's own +// candidates and from a committed inter block's final prediction alike), +// 2 = `forward_and_quantize` + `dequant_and_inverse`, 3 = `coeff_bits`. #[cfg(test)] thread_local! { static STAGE_NS: [std::cell::Cell; 4] = [ @@ -3512,7 +3512,7 @@ mod tests { x: usize, y: usize, width: usize, - height: usize, fctx: &crate::decode::FrameCtx, + height: usize, _fctx: &crate::decode::FrameCtx, ) -> (bool, bool) { let (bw_log2, bh_log2) = ((bw / 4).ilog2() as usize, (bh / 4).ilog2() as usize); let (_bw_unit, bh_unit) = (bw / 4, bh / 4); @@ -3992,7 +3992,7 @@ mod tests { // col_off==0 (whole-transform) path, with MAX_MIB_SIZE_LOG2 = 5 (a // 128px reference grid) pinned as libaom pins it, independent of the // 64px superblock this crate actually codes. - fn libaom_top_right(side: usize, x: usize, y: usize, width: usize, height: usize) -> bool { + fn libaom_top_right(side: usize, x: usize, y: usize, width: usize, _height: usize) -> bool { if y == 0 || x + side >= width { return false; } @@ -4017,7 +4017,7 @@ mod tests { (table[index / 8] >> (index % 8)) & 1 != 0 } - fn libaom_bottom_left(side: usize, x: usize, y: usize, height: usize, fctx: &crate::decode::FrameCtx) -> bool { + fn libaom_bottom_left(side: usize, x: usize, y: usize, height: usize, _fctx: &crate::decode::FrameCtx) -> bool { if x == 0 || y + side >= height { return false; } diff --git a/crates/ec-av1/src/film_grain.rs b/crates/ec-av1/src/film_grain.rs index 8bfba7b2..bdc2c53a 100644 --- a/crates/ec-av1/src/film_grain.rs +++ b/crates/ec-av1/src/film_grain.rs @@ -800,7 +800,7 @@ fn copy_area( width: i32, height: i32, fctx: &crate::decode::FrameCtx, ) { - let (grain_min, grain_max) = grain_range(fctx); + let (_grain_min, _grain_max) = grain_range(fctx); for h in 0..height { for w in 0..width { let v = at(src, src_stride, src_row0 + h, src_col0 + w); @@ -816,6 +816,7 @@ thread_local! { } /// Current value of [`GRAIN_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn grain_hits() -> usize { GRAIN_HITS.with(|c| c.get()) } diff --git a/crates/ec-av1/src/intra.rs b/crates/ec-av1/src/intra.rs index c759208c..e7da29a7 100644 --- a/crates/ec-av1/src/intra.rs +++ b/crates/ec-av1/src/intra.rs @@ -206,35 +206,35 @@ impl Edges { } } -/// Predicts one `bw`-wide, `bh`-tall block into `dst`, row-major and -/// `bw * bh` long; `bw == bh` for a square block, the only shape every -/// caller outside this lane's own tests passes. -/// -/// `above` is the reconstructed row above the block and `left` its -/// reconstructed left column, each at least `bw`/`bh` samples long -/// respectively, and `corner` the sample diagonally above-left; `None` where -/// the block sits against an edge of the frame. A directional mode reads out -/// to `bw + bh`: pass the samples above-right and below-left where the -/// decoder has them decoded, and the edge is extended by repetition where it -/// does not, which is what the decoder's own clamp to `aboveLimit` and -/// `leftLimit` comes to. -/// -/// `angle_delta` (spec `AngleDeltaY`/`AngleDeltaUV`, `-MAX_ANGLE_DELTA` to -/// `MAX_ANGLE_DELTA`) steers every one of `V_PRED`, `H_PRED` and the six -/// diagonal modes off their base angle by `ANGLE_STEP` degrees per unit (spec -/// 7.11.2.1's `pAngle = Mode_To_Angle[mode] + angleDelta * ANGLE_STEP`); -/// ignored (must be `0`) for the seven modes that carry no angle at all. -/// -/// `enable_edge_filter` is the sequence header's `enable_intra_edge_filter` -/// (spec 7.11.2.4's own gate on the whole filter/upsample step); `smooth_neighbor` -/// is `get_intra_edge_filter_type` (spec 7.11.2.9, libaom `reconintra.c`) -- -/// whether the block above or to the left predicted with one of the three -/// smooth modes, which steers [`intra_edge_filter_strength`]'s threshold -/// table. Ignored outside the directional modes. -/// -/// # Panics -/// Panics on a mode this module does not predict, or when `dst` is not -/// `bw * bh` long. +// Predicts one `bw`-wide, `bh`-tall block into `dst`, row-major and +// `bw * bh` long; `bw == bh` for a square block, the only shape every +// caller outside this lane's own tests passes. +// +// `above` is the reconstructed row above the block and `left` its +// reconstructed left column, each at least `bw`/`bh` samples long +// respectively, and `corner` the sample diagonally above-left; `None` where +// the block sits against an edge of the frame. A directional mode reads out +// to `bw + bh`: pass the samples above-right and below-left where the +// decoder has them decoded, and the edge is extended by repetition where it +// does not, which is what the decoder's own clamp to `aboveLimit` and +// `leftLimit` comes to. +// +// `angle_delta` (spec `AngleDeltaY`/`AngleDeltaUV`, `-MAX_ANGLE_DELTA` to +// `MAX_ANGLE_DELTA`) steers every one of `V_PRED`, `H_PRED` and the six +// diagonal modes off their base angle by `ANGLE_STEP` degrees per unit (spec +// 7.11.2.1's `pAngle = Mode_To_Angle[mode] + angleDelta * ANGLE_STEP`); +// ignored (must be `0`) for the seven modes that carry no angle at all. +// +// `enable_edge_filter` is the sequence header's `enable_intra_edge_filter` +// (spec 7.11.2.4's own gate on the whole filter/upsample step); `smooth_neighbor` +// is `get_intra_edge_filter_type` (spec 7.11.2.9, libaom `reconintra.c`) -- +// whether the block above or to the left predicted with one of the three +// smooth modes, which steers [`intra_edge_filter_strength`]'s threshold +// table. Ignored outside the directional modes. +// +// # Panics +// Panics on a mode this module does not predict, or when `dst` is not +// `bw * bh` long. // lane-hbdgates r1: per-tool firing counters for the 10-bit gates. Each tool // the coverage table tracks needs its OWN counter -- `smooth_uv_hits` lumps // SMOOTH..=PAETH together, so a paeth-only stream would have "proved" smooth @@ -246,17 +246,20 @@ thread_local! { } /// How many blocks were predicted with SMOOTH/SMOOTH_V/SMOOTH_H on this thread. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn smooth_pred_hits() -> usize { SMOOTH_PRED_HITS.with(|c| c.get()) } /// How many blocks were predicted with PAETH_PRED on this thread. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn paeth_pred_hits() -> usize { PAETH_PRED_HITS.with(|c| c.get()) } /// How many directional edges [`filter_intra_edge`] actually smoothed /// (strength != 0) on this thread -- the `--enable-intra-edge-filter` proof. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn intra_edge_filter_hits() -> usize { EDGE_FILTER_HITS.with(|c| c.get()) } @@ -994,7 +997,7 @@ mod tests { let fctx = &crate::decode::FrameCtx::new(); // xorshift64*: a seeded stream, so a failure names one (shape, mode, // seed) triple that reproduces. - let mut rng = |state: &mut u64| { + let rng = |state: &mut u64| { *state ^= *state << 13; *state ^= *state >> 7; *state ^= *state << 17; diff --git a/crates/ec-av1/src/mc.rs b/crates/ec-av1/src/mc.rs index b9168834..12ec3a63 100644 --- a/crates/ec-av1/src/mc.rs +++ b/crates/ec-av1/src/mc.rs @@ -173,9 +173,13 @@ const SUBPEL_FILTERS_BILINEAR: [[i32; 8]; 16] = [ /// this type only ever names the resolved kernel, never `Switchable` itself. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum InterpFilterKind { + /// The `Regular` interpolation kernel. Regular, + /// The `Smooth` interpolation kernel. Smooth, + /// The `Sharp` interpolation kernel. Sharp, + /// The `Bilinear` interpolation kernel. Bilinear, } diff --git a/crates/ec-av1/src/motion_field.rs b/crates/ec-av1/src/motion_field.rs index d83bc3dd..1b166cd0 100644 --- a/crates/ec-av1/src/motion_field.rs +++ b/crates/ec-av1/src/motion_field.rs @@ -317,6 +317,7 @@ thread_local! { /// Reads the counter above (gate /// `a_real_aomenc_inter_sequence_with_forward_keyframes_and_temporal_mvs_decodes_pixel_exact`). +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub fn refstamp_intra_frames() -> (usize, usize) { ( REFSTAMP_INTRA_FRAMES.with(std::cell::Cell::get), diff --git a/crates/ec-av1/src/mvstack.rs b/crates/ec-av1/src/mvstack.rs index e8662730..50d6f925 100644 --- a/crates/ec-av1/src/mvstack.rs +++ b/crates/ec-av1/src/mvstack.rs @@ -88,6 +88,7 @@ static TMV_HITS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize /// The number of query blocks that received at least one temporal MV /// candidate so far, across every [`find_mv_stack_with_sign_bias`] call in /// this process. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tmv_hits() -> usize { TMV_HITS.load(std::sync::atomic::Ordering::Relaxed) } @@ -108,16 +109,19 @@ static TILE_REACH_CLIPS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); /// [`COMP_GM_FILL_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn comp_gm_fill_hits() -> usize { COMP_GM_FILL_HITS.load(std::sync::atomic::Ordering::Relaxed) } /// [`STACK_FULL_DROPS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn stack_full_drops() -> usize { STACK_FULL_DROPS.load(std::sync::atomic::Ordering::Relaxed) } /// [`TILE_REACH_CLIPS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn tile_reach_clips() -> usize { TILE_REACH_CLIPS.load(std::sync::atomic::Ordering::Relaxed) } @@ -799,11 +803,11 @@ fn scan_corner( /// frame. const MV_BORDER: i32 = 16 << 3; -/// Clamps one candidate MV to the range spec 7.10.2.14 (libaom's -/// `clamp_mv_ref`) allows for a `bw4`-by-`bh4` block at `(mi_row, mi_col)` in -/// a `mi_cols`-by-`mi_rows` frame: the distance from the block's own edge to -/// the matching frame edge, plus the block's own span and [`MV_BORDER`] of -/// slack, in every direction. +// Clamps one candidate MV to the range spec 7.10.2.14 (libaom's +// `clamp_mv_ref`) allows for a `bw4`-by-`bh4` block at `(mi_row, mi_col)` in +// a `mi_cols`-by-`mi_rows` frame: the distance from the block's own edge to +// the matching frame edge, plus the block's own span and [`MV_BORDER`] of +// slack, in every direction. // lane-t900 r11: stack entries whose clamp window is narrowed by a NEGATIVE // `mb_to_right_edge`/`mb_to_bottom_edge` -- i.e. blocks overhanging the frame's // right/bottom edge whose predictor the frame-edge clamp actually moves. Zero diff --git a/crates/ec-av1/src/restoration.rs b/crates/ec-av1/src/restoration.rs index 1d4fb6da..91e87ec7 100644 --- a/crates/ec-av1/src/restoration.rs +++ b/crates/ec-av1/src/restoration.rs @@ -79,7 +79,9 @@ fn decode_signed_subexp_with_ref_msac(dec: &mut SymbolDecoder, low: i32, high: i decode_unsigned_subexp_with_ref_msac(dec, n, k, r) as i32 + low } +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live const WIENER_HALFWIN: usize = 3; +#[allow(dead_code)] // gate counter accessor with no reader yet; the counter itself is live pub(crate) const WIENER_WIN: usize = 7; const WIENER_TAP_MINV: [i32; 3] = [-5, -23, -17]; const WIENER_TAP_MAXV: [i32; 3] = [10, 8, 46]; @@ -363,49 +365,54 @@ pub(crate) fn read_lr( } } -/// r3 gate self-pin: how many units decoded a real (non-`None`) filter, by -/// kind -- proves a real `--enable-restoration=1` aomenc stream actually -/// exercises `read_lr_unit`'s Wiener/SGR/switchable arms, not just that the -/// symbol-count/refusal-string wiring compiles. Never reset -- summed across -/// a gate's whole attempt loop, matching `MASKED_COMPOUND_HITS`/`WEDGE_HITS` -/// (decode.rs) which this mirrors. +// r3 gate self-pin: how many units decoded a real (non-`None`) filter, by +// kind -- proves a real `--enable-restoration=1` aomenc stream actually +// exercises `read_lr_unit`'s Wiener/SGR/switchable arms, not just that the +// symbol-count/refusal-string wiring compiles. Never reset -- summed across +// a gate's whole attempt loop, matching `MASKED_COMPOUND_HITS`/`WEDGE_HITS` +// (decode.rs) which this mirrors. thread_local! { static WIENER_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; static SGRPROJ_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; static SWITCHABLE_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } -/// lane-reelckf2 r1: how many *stripes* a real filter ran on with the frame's -/// own top row as their above boundary (`stripe_v_start == 0`, the 56-row -/// first stripe of `RESTORATION_UNIT_OFFSET == 8`), and how many ran on a -/// short LAST stripe (`stripe_v_end == plane_h` with a partial height). Those -/// are the two stripe shapes whose boundary substitution differs from every -/// interior stripe, and no gate size before this one had either. +// lane-reelckf2 r1: how many *stripes* a real filter ran on with the frame's +// own top row as their above boundary (`stripe_v_start == 0`, the 56-row +// first stripe of `RESTORATION_UNIT_OFFSET == 8`), and how many ran on a +// short LAST stripe (`stripe_v_end == plane_h` with a partial height). Those +// are the two stripe shapes whose boundary substitution differs from every +// interior stripe, and no gate size before this one had either. thread_local! { static LR_STRIPE0_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; static LR_LAST_STRIPE_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; } /// Current value of [`LR_STRIPE0_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn lr_stripe0_hits() -> usize { LR_STRIPE0_HITS.with(|c| c.get()) } /// Current value of [`LR_LAST_STRIPE_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn lr_last_stripe_hits() -> usize { LR_LAST_STRIPE_HITS.with(|c| c.get()) } /// Current value of [`WIENER_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn wiener_hits() -> usize { WIENER_HITS.with(|c| c.get()) } /// Current value of [`SGRPROJ_HITS`]. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn sgrproj_hits() -> usize { SGRPROJ_HITS.with(|c| c.get()) } /// Current value of [`SWITCHABLE_HITS`] -- bumped once per unit whose frame /// `restoration_type` is `Switchable`, regardless of which `RestoreType` /// (`None`/Wiener/Sgrproj) that unit's own symbol resolved to. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub(crate) fn switchable_hits() -> usize { SWITCHABLE_HITS.with(|c| c.get()) } diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 2ade4c0e..63693f48 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -24,9 +24,11 @@ use ec_core::{Error, Result}; use crate::cdf_state::Cdfs; use crate::decode; use crate::decode::{ - decode_inter_frame_tile_with_cdfs, decode_key_frame_tile, decode_key_frame_tile_with_cdfs, + decode_inter_frame_tile_with_cdfs, decode_key_frame_tile_with_cdfs, q_ctx_of, }; +#[cfg(test)] +use crate::decode::decode_key_frame_tile; use crate::encode::Picture; /// lane-midcut r1: `EC_AV1_NO_GRAIN=1` skips film grain synthesis at output, so a @@ -36,13 +38,13 @@ fn no_grain() -> bool { std::env::var_os("EC_AV1_NO_GRAIN").is_some() } -/// lane-hidden r1: where `EC_AV1_FINAL_DUMP`'s per-frame dump goes for the -/// current thread, overriding the environment variable. Every ffmpeg/aomdec -/// pixel gate in this repo compares SHOWN frames only (class -/// gate-blind-to-hidden-frames), so the hidden alt-ref frames a real aomenc -/// stream carries were never compared at all; the gate that does compare -/// them needs a dump path that cannot race a sibling test's decode on -/// another thread, which a process-global env var cannot give. +// lane-hidden r1: where `EC_AV1_FINAL_DUMP`'s per-frame dump goes for the +// current thread, overriding the environment variable. Every ffmpeg/aomdec +// pixel gate in this repo compares SHOWN frames only (class +// gate-blind-to-hidden-frames), so the hidden alt-ref frames a real aomenc +// stream carries were never compared at all; the gate that does compare +// them needs a dump path that cannot race a sibling test's decode on +// another thread, which a process-global env var cannot give. thread_local! { static FINAL_DUMP_PREFIX: std::cell::RefCell> = const { std::cell::RefCell::new(None) }; @@ -200,6 +202,7 @@ pub fn obmc_pair_filter_hits() -> usize { crate::decode::obmc_pair_filter_hits() } +/// Gate counters for the 4x32/32x4 rectangular strips: `(horz, vert, coeff)` hits. pub fn rect4_32_counters() -> (usize, usize, usize) { ( crate::decode::rect4_32_horz_hits(), @@ -26910,14 +26913,13 @@ mod tests { } fn edge32_gate(name: &str, flat_band: bool) { - let NAME = name; let _gate_lock = lock_gate_counters(); if !have_ffmpeg() { - eprintln!("SKIP {NAME}: no ffmpeg"); + eprintln!("SKIP {name}: no ffmpeg"); return; } if !have_aomenc() { - eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); return; } // (width, height, frames, ten_bit, tile_columns_log2) @@ -27029,7 +27031,7 @@ mod tests { .expect("ffmpeg failed to run"); assert!( y4m.status.success(), - "{NAME}: ffmpeg fixture: {}", + "{name}: ffmpeg fixture: {}", String::from_utf8_lossy(&y4m.stderr) ); let cq_arg = format!("--cq-level={cq}"); @@ -27085,7 +27087,7 @@ mod tests { let out = child.wait_with_output().expect("aomenc failed to run"); assert!( out.status.success(), - "{NAME}: aomenc refused the fixture: {}", + "{name}: aomenc refused the fixture: {}", String::from_utf8_lossy(&out.stderr) ); let stream = out.stdout; @@ -27093,7 +27095,7 @@ mod tests { assert_eq!( parsed_bit_depth(&stream), 10, - "{NAME}: aomenc did not write a 10-bit sequence header" + "{name}: aomenc did not write a 10-bit sequence header" ); } let tag = format!( @@ -27106,7 +27108,7 @@ mod tests { // desync surfaces as a panic deep in mc.rs with no arm in the // message, and r8 spent a run bisecting arms by hand. if std::env::var_os("EC_GATE_VERBOSE").is_some() { - eprintln!("{NAME}: attempting {tag}"); + eprintln!("{name}: attempting {tag}"); } let decoded = match decode_stream(&stream) { Ok(frames) => frames, @@ -27114,7 +27116,7 @@ mod tests { let msg = e.to_string(); assert!( msg.contains("unsupported"), - "{NAME} failed outright, not a named refusal ({tag}): {msg}" + "{name} failed outright, not a named refusal ({tag}): {msg}" ); refusals.push(format!("{tag}: {msg}")); continue; @@ -27131,7 +27133,7 @@ mod tests { assert_eq!( decoded.len(), reference.len(), - "{NAME}: {tag}: shown-frame count vs ffmpeg" + "{name}: {tag}: shown-frame count vs ffmpeg" ); for (i, (ours, theirs)) in decoded.iter().zip(reference.iter()).enumerate() { for (plane, a, b, w) in [ @@ -27149,10 +27151,10 @@ mod tests { *per_row.entry(k / w).or_default() += 1; } } - eprintln!("{NAME}: {tag} plane {plane} diffs per row: {per_row:?}"); + eprintln!("{name}: {tag} plane {plane} diffs per row: {per_row:?}"); } panic!( - "{NAME}: {tag} frame {i} plane {plane}: {n} pixels differ, first \ + "{name}: {tag} frame {i} plane {plane}: {n} pixels differ, first \ at row {} col {} (ours {} vs ffmpeg {}) [edge32={delta:?}]", d / w, d % w, @@ -27174,23 +27176,23 @@ mod tests { } assert!( compared > 0, - "{NAME}: every attempt hit a named refusal:\n{}", + "{name}: every attempt hit a named refusal:\n{}", refusals.join("\n") ); assert!( !straddle || compared_multi_tile > 0, - "{NAME}: every `--tile-columns=1` attempt hit a named refusal -- the \ + "{name}: every `--tile-columns=1` attempt hit a named refusal -- the \ multi-tile twins compared nothing:\n{}", refusals.join("\n") ); assert!( !straddle || straddle_units > 0, - "{NAME}: no FILTERED 8x8 CDEF unit crossed the cropped frame edge over \ + "{name}: no FILTERED 8x8 CDEF unit crossed the cropped frame edge over \ {compared} compared attempts -- the straddling arms proved nothing" ); assert!( totals[0] + totals[1] + totals[4] + totals[5] > 0, - "{NAME}: no frame-edge partition bit was read at all over \ + "{name}: no frame-edge partition bit was read at all over \ {compared} compared attempts -- the gate proved nothing" ); // lane-golomb r3: the flat-band arm's ASSERT moved one level up. Until @@ -27202,16 +27204,16 @@ mod tests { // content. Slots 6/7 are the strips actually decoded at the edge. assert!( !flat_band || totals[6] > 0, - "{NAME}: no 64x32 bottom-edge HORZ strip was decoded \ + "{name}: no 64x32 bottom-edge HORZ strip was decoded \ (edge32={totals:?}, {compared} compared attempts)" ); assert!( !flat_band || totals[7] > 0, - "{NAME}: no 32x64 right-edge VERT strip was decoded \ + "{name}: no 32x64 right-edge VERT strip was decoded \ (edge32={totals:?}, {compared} compared attempts)" ); eprintln!( - "{NAME}: {compared} pixel-exact attempts, 32-level edge bits \ + "{name}: {compared} pixel-exact attempts, 32-level edge bits \ [horz_or_vert={} split={}] bottom-HORZ={} right-VERT={}, 64-level edge bits \ [horz_or_vert={} split={}] bottom-HORZ={} right-VERT={}, \ {straddle_units} straddling CDEF units, {} named refusals", @@ -27226,7 +27228,7 @@ mod tests { refusals.len() ); for r in &refusals { - eprintln!("{NAME} refusal: {r}"); + eprintln!("{name} refusal: {r}"); } } diff --git a/crates/ec-av1/src/transform.rs b/crates/ec-av1/src/transform.rs index 8cb14750..d78c9d35 100644 --- a/crates/ec-av1/src/transform.rs +++ b/crates/ec-av1/src/transform.rs @@ -1029,6 +1029,7 @@ pub fn dequant_and_inverse(levels: &[i32], side: usize, bit_depth: u8, q_idx: i3 /// undo, and nothing else: measuring the network's response to a unit /// coefficient at every size gives the same `1 / (8 * sqrt(2))` per unit of /// `dqDenom`, which is what [`forward_transform_2d`] divides out. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn build_dct_basis(n: usize) -> Vec { let mut basis = vec![0.0f64; n * n]; let scale = (2.0 / n as f64).sqrt(); @@ -1050,6 +1051,7 @@ fn build_dct_basis(n: usize) -> Vec { /// one of the transform sizes this crate codes (4 to 64, a power of two), so /// a small fixed table indexed by `log2(n)` covers every caller without a /// hash lookup. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates fn dct_basis(n: usize) -> &'static [f64] { use std::sync::OnceLock; // log2(4)=2 .. log2(64)=6, so index by trailing_zeros() - 2. diff --git a/crates/ec-av1/src/wedge.rs b/crates/ec-av1/src/wedge.rs index 7528af8a..3c090af1 100644 --- a/crates/ec-av1/src/wedge.rs +++ b/crates/ec-av1/src/wedge.rs @@ -251,12 +251,16 @@ fn wedge_window(wedge_index: usize, neg: usize, bw: usize, bh: usize) -> (usize, /// `stride x stride` plane (`stride = max(bw, bh)`) so a rectangular mask /// indexes exactly like the square prediction buffer `decode.rs` blends /// into. Only rows `0..bh` / columns `0..bw` are meaningful. +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub struct WedgeCodebook { /// `[sign][wedge_index] -> stride*stride` bytes, row stride `stride`. masks: [[Vec; MAX_WEDGE_TYPES]; 2], + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub bw: usize, + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub bh: usize, /// `max(bw, bh)` -- the row stride of every mask returned by [`Self::mask`]. + #[allow(dead_code)] // read only from the `#[cfg(test)]` gates pub stride: usize, }