Skip to content

Skip IST/STX cascade for intra-luma zero-quant primary#5103

Merged
leolzhao merged 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:tx_speedup_submission
Jul 16, 2026
Merged

Skip IST/STX cascade for intra-luma zero-quant primary#5103
leolzhao merged 1 commit into
AOMediaCodec:av2-encfrom
yeqing-wu:tx_speedup_submission

Conversation

@yeqing-wu

Copy link
Copy Markdown
Contributor

Extend the intra-luma IST/STX pre-skip and post-trellis gates to cover eob == 0 in addition to the existing eob == 1 (DC-only) case. The eob == 0 branch kills candidates only when stx > 0, so a non-DCT primary with stx == 0 that quantizes to all-zero can still win via skip coding.

Add a pre-quant L-infinity gate that predicts primary FP-quant eob = 0 directly from the post-primary coefficients (max |coeff| below the FP quantizer kill threshold min(dq0, dq1) >> (4 + log_scale)). When fired, av2_quant + av2_optimize_b + cost_coeffs are skipped and the same eob_found / DCT_DCT propagation as the post-quant gate is applied. Scoped to intra Y, stx == 0, non-DC-only, IST-enabled, non-QM blocks.

Gated behind a new tx_sf.prune_intra_ist_stx_by_zero_eob flag, off by default and enabled at speed >= 1. Encoding at speed 0 is unchanged from the baseline.

STATS_CHANGED

Anchor: commit dd84ac9
Speed 1 (cpu-used=1): FG16 CTC (33 frames, RA)

  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         |  0.06 | -0.20 | -0.34 |  0.02 |   98 |  100 |
  | A2         |  0.09 | -0.18 | -0.12 |  0.07 |   97 |  100 |
  | A3         |  0.05 |  0.58 |  0.48 |  0.07 |   96 |   99 |
  | A4         |  0.09 |  0.22 | -3.02 | -0.01 |   97 |   99 |
  | A5         | -0.12 | -2.35 |  2.22 | -0.12 |   97 |  101 |
  | B1         |  0.14 | -0.94 | -0.28 |  0.09 |   97 |  101 |
  | B2         | -0.48 | -0.71 |  0.30 | -0.46 |   97 |   97 |
  | Avg w/o B2 |  0.07 | -0.32 | -0.24 |  0.04 |   97 |  100 |
  +------------+-------+-------+-------+-------+------+------+

@yeqing-wu

Copy link
Copy Markdown
Contributor Author

Hello all,

Could you please review this PR?

Thanks
Yeqing

@yeqing-wu yeqing-wu force-pushed the tx_speedup_submission branch from 77ddaec to 883693a Compare July 14, 2026 16:57
Comment thread av2/encoder/tx_search.c Outdated
Comment thread av2/encoder/tx_search.c Outdated
Extend the intra-luma IST/STX pre-skip and post-trellis gates to cover
eob == 0 in addition to the existing eob == 1 (DC-only) case. The
eob == 0 branch kills candidates only when stx > 0, so a non-DCT
primary with stx == 0 that quantizes to all-zero can still win via
skip coding.

Add a pre-quant L-infinity gate that predicts primary FP-quant eob = 0
directly from the post-primary coefficients (max |coeff| below the
FP quantizer kill threshold min(dq0, dq1) >> (4 + log_scale)). When
fired, av2_quant + av2_optimize_b + cost_coeffs are skipped and the
same eob_found / DCT_DCT propagation as the post-quant gate is applied.
Scoped to intra Y, stx == 0, non-DC-only, IST-enabled, non-QM blocks.

Gated behind a new tx_sf.prune_intra_ist_stx_by_zero_eob flag, off by
default and enabled at speed >= 1. Encoding at speed 0 is unchanged
from the baseline.

STATS_CHANGED

Anchor: commit dd84ac9
Speed 1 (cpu-used=1): FG16 CTC (33 frames, RA)

```
  +------------+-------+-------+-------+-------+------+------+
  | Class      |     Y |    Cb |    Cr |  wAvg | Enc% | Dec% |
  +------------+-------+-------+-------+-------+------+------+
  | A1         |  0.06 | -0.20 | -0.34 |  0.02 |   98 |  100 |
  | A2         |  0.09 | -0.18 | -0.12 |  0.07 |   97 |  100 |
  | A3         |  0.05 |  0.58 |  0.48 |  0.07 |   96 |   99 |
  | A4         |  0.09 |  0.22 | -3.02 | -0.01 |   97 |   99 |
  | A5         | -0.12 | -2.35 |  2.22 | -0.12 |   97 |  101 |
  | B1         |  0.14 | -0.94 | -0.28 |  0.09 |   97 |  101 |
  | B2         | -0.48 | -0.71 |  0.30 | -0.46 |   97 |   97 |
  | Avg w/o B2 |  0.07 | -0.32 | -0.24 |  0.04 |   97 |  100 |
  +------------+-------+-------+-------+-------+------+------+
```
@yeqing-wu yeqing-wu force-pushed the tx_speedup_submission branch from 883693a to deb476d Compare July 16, 2026 17:28
@leolzhao leolzhao merged commit 6e71b0c into AOMediaCodec:av2-enc Jul 16, 2026
109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants