GIRC.dev

Deriving the transform from what the decoder already has.

The mechanism is a substitution. Where a conventional codec spends bits to say which transform it used, GIRC has the decoder work it out, and the encoder only has to correct it when the guess is wrong.

A research format, on purpose

GIRC's bitstream is its own research format, not VVC-conformant. That is deliberate: the mechanism has to be measured with everything else held constant, and a conformant bitstream would force the comparison to inherit every other design decision of the standard.

"GIRC"        4 bytes magic
version       u16, little endian
flags         u16, little endian  bit 0: inferred signalling
width         u32, little endian
height        u32, little endian
qp            u8
payload len   u32, little endian
payload       range-coded words

The flags field records the signalling mode, so a stream is self-describing: the two modes have different syntax, and a decoder that guessed wrong would desynchronise. What is conformant is the signalling the mechanism removes: the explicit mode writes the same bins the reference implementation writes for mts_idx, checked against VVenC's own output over 187,834 transform units.

One bin for the answer, two for the correction

The explicit mode codes the transform type with a truncated binary code: the plain DCT-II costs one bin and the other four cost two to four.

The inferred mode codes one bin saying whether the decoder's prediction was right. When it was wrong, two further bins select between the four modes the prediction ruled out.

That second part is what makes the design worth having. The naive form spends a bin on the correction and then the full type again, which is three bins against the explicit mode's two. Coding the correction relative to the prediction brings it back to two, so an override never costs more than the signalling it replaces.

The two syntaxes, and what each costs crates/girc-core/src/bitstream.rs, ITU-T H.266 clause 7.3.9
plain DCT-II 1 1 bin DST-VII / DST-VII 1 0 2 bins DCT-VIII / DST-VII 1 0 0 3 bins DST-VII / DCT-VIII 1 0 0 0 4 bins DCT-VIII / DCT-VIII 1 0 0 0 4 bins 1 bin: was the prediction right? and if not, 2 bins select between the four the prediction ruled out an override never costs more than the signalling it replaces the naive form spent a bin on the correction and then the full type again the inferred mode codes the correction relative to the prediction the explicit mode is the standard's own mts_idx
What the signalling costs per block, against the explicit syntax it replaces research/benchmark/report-v9-joint.json · results, models/girc-predictor.json
2.09 bins the explicit mode, the standard's own mts_idx syntax the baseline 2.00 bins the constant predictor, always the plain DCT-II no training, no model 1.85 bins the shipped learned model the mechanism as shipped 1.00 bins the oracle, which cannot be built the ceiling the correction is coded relative to the prediction, so a wrong answer costs three bins rather than two 760,320 blocks, the benchmark's own count

Read from the decoder's own reconstruction

The decoder reads a 16-sample square window ending at the block's top-left corner. Every sample in it has already been reconstructed, so reading it costs nothing in signalling.

Feature Count What it measures
orientation histogram 8 The gradient orientation field, over the full circle
gradient energy 1 The total magnitude, log-scaled
dominance 1 The strongest bin's share of the total
isotropy 1 The entropy of the histogram
reference coverage 1 How much of the immediate reference is present
horizontal, vertical energy 2 The per-axis gradient magnitude, log-scaled
axis correlation 1 Whether the two axes agree: an edge or a corner
quantization parameter 1 Which transform wins depends on it
intra mode 10 One-hot; decoded before the transform mode
neighbour modes 20 One-hot per neighbour, over the five modes: left, above, above-left, above-right

The gradient is taken with central differences over a genuine two-dimensional window. Restricting it to the two reference lines — the top row and the left column — throws away the diagonal information that distinguishes the transforms, and leaves four of the eight orientation bins permanently empty.

The neighbour context is free: the decoder already knows every already-coded neighbour's transform mode, because it decoded them. The intra mode is the strongest single signal and it is available on both sides, because the mode is decoded before the transform type.

One model over five modes, fitted on the encoder's own choices

The predictor models the joint mode: one multinomial logistic regression over the five modes. An earlier version modelled the two axes separately and composed them, because each axis on its own was well above the majority class — about 53.9% against 50.1% — and the composed mode came out below it, at 48.8%. The five modes are not a product space, so composing two independent per-axis models cannot recover the joint distribution, and the measurement showed it losing. One model over the five modes is both simpler and better.

The regression is a weight vector and a bias per mode, and the prediction is the highest logit. It is a pure function of its weights and the feature vector, so the encoder and the decoder always agree.

The model is trained on the encoder's own decisions. The collection pass runs the encoder and records, for every block, the geometry features and the transform the rate-distortion search actually chose. The training set is therefore the encoder's behaviour and not a proxy for it.

The pipeline also reports the predictability ceiling: a gradient-boosted tree fitted over the same features gives an upper bound on what any model over them can achieve, so a report can state what the features can support rather than only what the shipped model achieves.

What the encoder actually chose: the plain DCT-II, and four modes that split the rest models/girc-predictor.json · class_distribution
50.1% DCT-II 14.2% DST-VII DST-VII 12.3% DCT-VIII DST-VII 12.4% DST-VII DCT-VIII 10.9% DCT-VIII DCT-VIII 570,240 blocks, the encoder's own rate-distortion choices the majority class is 50.10% the four other modes are 49.90%
The predictability ceiling, and where the shipped model sits under it models/girc-predictor.json · training.predictability_ceiling
50.10% majority class: always the plain DCT-II 50.10 of every 100 blocks 50.17% the shipped model, over the joint mode 50.17 of every 100 blocks 50.65% the gradient-boosted ceiling, same features 50.65 of every 100 blocks the gap between the first and the last is what any predictor over these features can earn

The one free parameter, and why it is necessary

The mechanism's free parameter is the margin: the amount of rate-distortion cost the encoder is willing to give up to avoid signalling the transform type. When the predicted transform is within the margin of the search's own choice, the encoder takes the predicted one and spends nothing.

The margin is the honest form of the mechanism. Without it the encoder takes the strictly optimal transform and overrides whenever the prediction differs, and the inferred mode is reliably larger than the explicit one, because the signalling it removes is smaller than the distortion it costs. The margin is what lets the two balance.

The margin applies only to the inferred mode. The explicit mode stays a clean rate-distortion optimum, so the comparison between them is not confounded by the explicit baseline being deliberately handicapped.

How often the prediction is wrong, and how the margin buys it back research/benchmark/report-v9-joint.json · margin_sweep
31% 36% 41% 46% 46.4% 0 44.6% 25 42.6% 50 37.9% 100 30.6% 200 the margin is what turns a wrong prediction into a free one margin, in rate-distortion cost units the intra blocks' mismatch is higher than the inter blocks'

One variable, so the rate difference is attributable

The two modes share the intra prediction, the quantization, the transform arithmetic, the residual coding and the entropy coder. They differ in one place: how the transform type reaches the decoder. A difference in the measured rate is therefore attributable to the signalling mechanism alone.

The transform arithmetic is the real thing. The integer transforms are bit-exact against Fraunhofer HHI's VVenC 1.14.0, checked by a test that drives the reference implementation's own kernels and compares the results bit for bit across all twelve transform and size combinations.

The measurement apparatus: one variable, everything else held constant crates/girc-bench/src/main.rs
twelve CIF sequences four quantization parameters ten frames each the explicit mode the same search, the same quantizer the inferred mode the same search, plus a margin the only difference how the transform mode reaches the decoder every other stage is shared by both the anchors are coded the same way, on the same frames, with the same PSNR code the benchmark decodes what it encodes, and refuses a result if the two pictures differ
The chroma planes

GIRC codes 4:2:0 content. No chroma transform type is signalled — H.266 codes one for the luma plane only — so the mechanism is a luma mechanism, exactly where the standard signals a transform type at all. That is why the benchmark reports two rate axes: the luma rate, which is the mechanism's own effect, and the whole-frame rate, which is what a deployment would save.