forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on ea60760987fae286ca761c1fcc56dc892ddd0177

2026-09-08

feat(av1): two knobs for the ARF temporal filter -- window width and a mid-ARF strengthAhmet Kaan Gümüş · ea60760
feat(av1): two knobs for the ARF temporal filter -- window width and a mid-ARF strength

The filter's neighbour count was a literal 2 and it ran on the top ARF
only. Both are now speed-table entries with env overrides
(EC_AV1_ARF_TF_WIN, EC_AV1_ARF_TF_MID), defaults unchanged (2 / off), so
the sweep arms are env-only.
fix(av1): the ARF temporal filter stops at the rate loop's quantizer floorAhmet Kaan Gümüş · cbb5336
fix(av1): the ARF temporal filter stops at the rate loop's quantizer floor

speed::ARF_TF_QMIN = 16: below that qindex the anchor's source is coded
unfiltered, which is libaom's own rule for arnr and is what
bitrate_target_lands_within_5_percent_over_48_frames named -- its 2 Mbps
pyramid arm codes IDENTICAL 22358-byte anchors to its 1536 kbps arm, i.e.
base_q_idx + arf_q_offset has clamped to 1 and the loop cannot spend the
target, so that arm sits at -4.8% of target with the filter off entirely
(measured) and a cheaper anchor pushed it to -5.1%, outside the test's bound.
The threshold restores the control's own -4.8% and leaves both BD gates
untouched: the finest ladder point codes its top ARF at qindex 28, and both
byte pins are unchanged by it.

Suite green: 342 + 201 + 42 passed, 0 failed.
docs(av1): lane-palw gate tableAhmet Kaan Gümüş · efa6308Browse files
feat(av1): the top ARF is coded from a temporally filtered sourceAhmet Kaan Gümüş · 7b95799
feat(av1): the top ARF is coded from a temporally filtered source

The 48-picture film B census names the top ARF as the overspent level (55%
of the stream, 6992 B a frame against rav1e's 3872 at a FINER quantizer) and
splits its per-frame gap 61% residual / 28% mode+partition / 9% mv. The new
arf_pred_census instrument then separates the two candidate causes of that
residual: the anchor's lag is worth 7.1% of its prediction SAD (film B 1.199
per pixel at lag 8 vs 1.114 at lag 4) while a motion-compensated average of
the group's own display neighbours removes 11.7% of it -- the residual is
mostly source grain, which no search at any lag can predict.

speed::ARF_TF now defaults to 3.0: the top ARF's source is filtered against
its two buffered display neighbours with weight exp(-mse/strength). Long-GOP
gate, BD vs libaom / rav1e: film A +23.5/-8.0 -> +22.7/-7.9, film B
+85.3/+6.7 -> +79.0/+2.7. Strength is sharply single-peaked (8, 15, 30 all
lose); EC_AV1_ARF_TF=0 restores the old streams.

Pins re-taken -- the hidden frames' pixels move by construction:
8269 -> 8218 at q=150 and 33044 -> 33017 at q=60.
fix(av1): write a cut palette block's colour-index map over its on-screen part onlyAhmet Kaan Gümüş · 254b908
fix(av1): write a cut palette block's colour-index map over its on-screen part only

A palette block straddling the frame's right/bottom mi edge codes its map
over spec 5.11.50's onscreenWidth x onscreenHeight corner and the decoder
replicates it outward. The writer walked the full block grid, so every
conformant decoder read the map short and desynced the rest of the tile;
our own trial decode agreed with itself because the encoder-side FrameCtx
carried no mi dims and the reader mirrored the writer there.

Both frame encoders now publish the header's mi dims on that ctx, the
palette search folds its searched map to the on-screen corner (so the
priced, reconstructed and written map are one map), and the writer codes
that corner only. The reader's mirror-the-writer branch is gone.

Witness: encoder::tests::a_palette_block_cut_by_the_frame_edge_decodes_
exactly_through_ffmpeg -- our encoder at 384x152, 12 cut maps written,
every plane of every frame equal to ffmpeg's decode.
instrument(av1): price the top ARF's prediction and a source temporal filterAhmet Kaan Gümüş · 56d80b6
instrument(av1): price the top ARF's prediction and a source temporal filter

The 48-picture film B census says the top ARF carries 55% of the stream at
6992 B a frame against rav1e's 3872 at a FINER quantizer (118 vs 104), and
61% of that per-frame gap is residual, not syntax. `arf_pred_census`
(--ignored) prices the two candidate causes without an encoder change: the
anchor's lag is worth only 7% of its prediction SAD (film B 1.199 per pixel
at lag 8 against 1.114 at lag 4), while a motion-compensated average of the
display neighbours removes 11.7% of it (film A 5.9%) at 50.1 dB from the
source it replaces.

`encode::arf_temporal_filter` builds that filter and `speed::ARF_TF`
(`EC_AV1_ARF_TF=<strength>`) arms it on the top ARF only; the default is 0,
so no shipped stream moves. The census example also reports per-plane PSNR
now.
fix(av1): the on-screen palette clamp only applies where the frame's mi dims are knownAhmet Kaan Gümüş · d84ad00
fix(av1): the on-screen palette clamp only applies where the frame's mi dims are known

The encoder's own in-process reconstruct runs on a FrameCtx that never saw
set_segmentation, so its mi dims are zero and every colour-index map read
clamped to 1x1 -- 16 round-trip gates refused with a bogus reference-slot
error. Its writer half is unclamped as well, so that path mirrors itself.
feat(av1): the top ARF codes its delta_q at 1.5x the preset's strengthAhmet Kaan Gümüş · 29220f1
feat(av1): the top ARF codes its delta_q at 1.5x the preset's strength

lane-arfq: `speed::DQ_LEVEL_K = [1.5, 1.0, 1.0]` -- at preset 0 the mini-GOP's
own hidden ALTREF now maps the tpl ratio onto its superblock quantizers at
0.375 where the mid level and the leaves keep 0.25.

Long-GOP gate (48 pictures, BD vs libaom / rav1e), control reproduced first:
  film A +24.0/-7.6 -> +23.5/-8.0, film B +85.8/+7.1 -> +85.3/+6.7
i.e. both films down on both columns. 12-frame gate: bars 1080p -3.1/-18.7 ->
-3.2/-18.8, bars 2160p +9.1/-13.3 -> +9.2/-13.3, film A +20.3/-5.0 ->
+20.3/-4.9, film B +24.6/-2.0 -> +24.7/-1.8, screen +14.6/-33.2 unchanged
(a screen frame codes no delta syntax at all).

0.5 buys film A twice as much (+23.0/-8.2) and turns film B back up
(+86.0/+7.3) while costing the 12-frame film B row 0.4; the strength sweep and
the per-level census are in lanes/arfq.report.md.

Byte pins re-taken with a five-line comment: 8252 -> 8269 at q=150 and
33053 -> 33044 at q=60; green at default and at EC_AV1_SPEED=6.
test(av1): a witness that builds an SVT-AV1 screen stream whose palette map is cut by the frame edgeAhmet Kaan Gümüş · 7fc807b
test(av1): a witness that builds an SVT-AV1 screen stream whose palette map is cut by the frame edge

docs(av1): lane-svtinter report
fix(av1): the palette colour-index map is read over the block's on-screen part onlyAhmet Kaan Gümüş · 2461f80
fix(av1): the palette colour-index map is read over the block's on-screen part only

A palette block cut by the frame's bottom or right mi edge codes its
colour-index map over spec 5.11.50's onscreenWidth x onscreenHeight
corner and replicates it outward; this decoder read the full block grid,
consuming symbols libaom never wrote and desyncing the rest of the tile
(the symptom was either a wrong bottom-edge superblock row or a
'Golomb tail longer than this decoder reads' refusal further down).
docs(av1): lane-svt1 gate resultsAhmet Kaan Gümüş · d09fdffBrowse files
test(av1): NEWMV census prints the hp symbol count; lane-hpmv reportAhmet Kaan Gümüş · 057f20b
test(av1): NEWMV census prints the hp symbol count; lane-hpmv report

The eighth-pel capability is refuted as a default on both films: film B
12 frames control +24.6/-2.0 vs +25.0/-1.8 (qindex<96), +25.1/-1.8
(qindex<128, libaom's own rule), +26.6/-0.3 (always on) -- monotone worse
in how much high precision is armed. It fires (53% of the hp bits coded
are zero, i.e. vectors the control cannot name) and costs 1.2-1.5 more mv
bits per coded NEWMV than it earns. Film A flat (+20.3/-5.0 -> +20.3/-4.9).
Ships default off (HP_MV_QTHRESH = 0); no default stream moved, so no byte
pin moved.
fix(av1): a skipped palette block with a split transform predicted DC off its edgesAhmet Kaan Gümüş · 1edcdab
fix(av1): a skipped palette block with a split transform predicted DC off its edges

A square intra block that is SKIPPED predicts its whole side x side luma in
one call; the palette (and intrabc) prediction override was armed only when
the transform covered the whole block, so a 16x16 palette block with
tx_depth == 1 and skip == 1 fell back to edge prediction. Right symbols --
the whole mode ladder diffs clean against an instrumented aomdec -- wrong
pixels: 812 luma samples in the key frame of an SVT-AV1 preset-8 screen
stream, carried by the V_PRED blocks under it to 10122 over 12 frames.

Sibling paths (decode_leaf8, decode_rect_split, the intra-in-inter walk)
already arm on both arms; this was the one site left.

Gate rides the kept stream via EC_AV1_SVT1_STREAM (SKIP when unset), asserts
the fixed arm fires, and adds EC_AV1_DEBUG_SKIP_LR beside the deblock/CDEF
debug rungs for the stage bisect.
feat(av1): a per-pyramid-level strength for the objective delta_qAhmet Kaan Gümüş · 657e043
feat(av1): a per-pyramid-level strength for the objective delta_q

lane-arfq: the objective per-superblock delta_q shipped one frame-type-blind
strength (`speed::DQ_TPL_K`). The top ARF feeds a whole mini-GOP where a leaf
feeds nothing, so the level is now a parameter: `encode::DqLevel`
(top ARF / mid ARF / leaf) rides on `PyramidFrame`, the caller sets it from
the offset it codes the frame at, and `speed::DQ_LEVEL_K` multiplies the
preset's strength per level. `EC_AV1_DQ_K=<top>:<mid>:<leaf>` sweeps it.

Three levels, not four: the KEY frame codes no delta_q syntax at all (the
lever lives in `encode_inter_frame`), so a strength cannot reach it -- the
key's allocation stays `Pyramid::key_q_offset`'s job.

The default table is flat, so every stream is byte-identical
(`the_encoders_own_streams_are_byte_identical_to_their_pins` green,
unchanged pins). The census line now names the level it prices.

Self-check: encode::tests::the_per_level_delta_q_strength_indexes_the_levels_it_names
feat(av1): code allow_high_precision_mv frames -- header bit, mv_hp symbols, pricer, eighth-pel search stageAhmet Kaan Gümüş · c5d3832
feat(av1): code allow_high_precision_mv frames -- header bit, mv_hp symbols, pricer, eighth-pel search stage

The writer refused any odd eighth-pel mv residual, so the finest vector
this encoder could commit to was a quarter pel. It can now code a frame
with allow_high_precision_mv: the header bit follows libaom's own rule
(qindex below a threshold), tile::write_mv_component codes the
mv_hp/mv_class0_hp symbol, encode::mv_component_bits prices it,
round_to_valid_mv stops rounding, and motion::search runs a fourth
refinement stage at 1/8 pel in such a frame. Default stays off
(HP_MV_QTHRESH = 0) until the BD sweep decides the policy.

Witness: a_high_precision_frame_codes_eighth_pel_motion_vectors_both_decoders_read
-- 0 hp symbols off, 6 on (5 of them eighth-pel vectors the off arm
cannot name), both arms sample-exact through ffmpeg and decode_stream.
feat(av1): preset 0 codes a per-superblock delta_q from libaom's objective tpl mapping at strength 0.25Ahmet Kaan Gümüş · 7680c47
feat(av1): preset 0 codes a per-superblock delta_q from libaom's objective tpl mapping at strength 0.25

Long-GOP (48 pictures) BD vs libaom/rav1e: film A +25.2/-7.2 -> +24.4/-7.5,
film B +86.7/+7.3 -> +86.0/+7.3; the 12-frame gate reads flat and the screen
capture stays byte-identical (no delta syntax on a screen frame). Byte pins
re-taken.
perf(av1): the motion search charges its rate term at half the block lambda and iterates each subpel stageAhmet Kaan Gümüş · 215871e
perf(av1): the motion search charges its rate term at half the block lambda and iterates each subpel stage

The search compares SAD while the lambda it is handed is an SSE-domain RD
weight, so a coded vector was over-priced inside the search itself; and one
round per subpel stage cannot reach a winner two half-pels from the integer
centre. MV_SEARCH_LAMBDA 0.5 and MV_SUBPEL_ITERS 4, both swept.

Native BD gate, ours vs libaom / vs rav1e:
12-frame  film A +21.0/-4.8 -> +20.6/-5.1, film B +24.9/-1.9 -> +24.8/-2.1,
          screen +14.5/-33.2 -> +14.6/-33.2
long-GOP  film A +25.2/-7.2 -> +24.7/-7.5, film B +86.7/+7.3 -> +86.8/+7.4

Encoder wall +5-7%. Pins re-taken (inter vectors move).
test(av1): a 128-superblock witness for the clamped drl predictorAhmet Kaan Gümüş · d93d5b5
test(av1): a 128-superblock witness for the clamped drl predictor

lavfi mandelbrot 1280x768, 12 frames, EC_AV1_SB128 forced on: the writer
clamps 7 drl indices whose predictor moves, and every frame of the stream
decodes sample-exact against the encoder's own reconstruction. Red before
the writer took its base MV from the index it signals (frame 3 luma differs),
green after. The counter is the gate on the fixture itself.
fix(av1): the inter writer's MV predictor comes from the drl index it SIGNALSAhmet Kaan Gümüş · d5a4212
fix(av1): the inter writer's MV predictor comes from the drl index it SIGNALS

A search-chosen ref_mv_idx past the write-time stack's last entry was coded
as the clamped index the drl loop can carry while the residual was priced
against stack.pred_mv, so the decoder derived a different motion vector with
the entropy stream still in sync. The drift only surfaced frames later as a
drl symbol desync, which the encoder's own trial decode then reported as a
missing reference slot.

write_drl_idx returns the index it signals and both single-reference arms
plus the two compound drl arms take their base MV from it.

Adds the writer/reader symbol trace the desync was bisected with
(EC_AV1_SYMTRACE=<dir>, EC_AV1_SYMTRACE_AT=<i|from:to>) and the mv-stack
note beside it.
instrument(av1): a NEWMV census plus mv-rate weights for the block decision and the searchAhmet Kaan Gümüş · f00abe4
instrument(av1): a NEWMV census plus mv-rate weights for the block decision and the search

EC_AV1_NEWMV_CENSUS=1 prints, per block side, how often a LAST NEWMV is
searched, offered to RD, and wins, the RD margin either way, the searched
vector's distance from NEARESTMV, and the mv syntax bits it spends, plus the
two pre-RD margins' skip shares and the search's own bound witness (how often
the winner was walked to at the log stage's widest step).

EC_AV1_MV_LAMBDA weights the mv rate term of the block decision only and
EC_AV1_MV_SEARCH_LAMBDA the search's own; both default 1.0, byte-identical.
feat(av1): libaom's objective per-SB delta_q mapping behind EC_AV1_DQ_TPL, plus an EC_AV1_DQ_CENSUS instrumentAhmet Kaan Gümüş · 4cfdb9d
feat(av1): libaom's objective per-SB delta_q mapping behind EC_AV1_DQ_TPL, plus an EC_AV1_DQ_CENSUS instrument

The tpl map now hands out its raw per-cell dependence ratio beside the
lambda factors; deltaq_libaom inverts dc_q through beta = r0/rk the way
av1_get_q_for_deltaq_objective does and clamps to +-(delta_q_res*9-1).
Default behaviour is unchanged (both flags off).
docs(av1): lane-cen3 -- film B at matched rate, ours vs libaom vs rav1e, per level and per syntax familyAhmet Kaan Gümüş · 1cb5cf6
docs(av1): lane-cen3 -- film B at matched rate, ours vs libaom vs rav1e, per level and per syntax family

At the 48-frame film B window and matched bytes (ours 71601 B/45.444 dB,
libaom cpu-used 6 crf 34 70345 B/46.539, rav1e speed 6 q110 75452 B/45.751)
the whole 1.10 dB deficit is inter: our key is the cheapest of the three and
0.29 dB above libaom's. At equal size we spend 9.2 kB MORE on mode syntax and
6.9 kB LESS on residual than libaom. Our per-block mode cost equals libaom's
to two decimals (3.26 bits), so the mode gap is block COUNT: 38754 coded
blocks against 16178, and at the leaf level 85.5% of ours are already at the
64x64 maximum. Second: +5633 B of inter coefficients against -1545 B of mv,
with NEWMV coded on 18-33% of our blocks against libaom's 54-76% on the same
motion field. Long-GOP against rav1e names the top-ARF level as the overspent
one (+68% bytes for -0.22 dB) and the key as the under-quality one (-0.61 dB).

Instrument: EC_CENSUS_TABLES sets how many CDF tables syntax_census names per
row (default 8, unchanged when unset) -- the default hid the mode family's own
split. No encoder behaviour changed; pins unmoved.
docs(av1): lane-split report -- the split lambda swept, control wins, census shippedAhmet Kaan Gümüş · d8a0bf9
docs(av1): lane-split report -- the split lambda swept, control wins, census shipped

Also extracts split_census_base and enumerates its whole domain in a test.