Skip to content

perf(encoder): code text with CABAC and 4x4 intra, and search motion to 128 px - #108

Closed
bjornpagen wants to merge 1 commit into
tembo:mainfrom
bjornpagen:pr/x264-tuning
Closed

bjornpagen wants to merge 1 commit into
tembo:mainfrom
bjornpagen:pr/x264-tuning

Conversation

@bjornpagen

Copy link
Copy Markdown
Contributor

With ultrafast's settings, new text was coded with CAVLC and 16x16 intra
blocks only, and the motion search reached 16 px, so a real scroll's
moves were not found and were coded as new pixels.

Now frames use CABAC and 4x4 intra blocks (keyframes too, with a finer
mode decision), and the motion search reaches 128 px. Measured on a
terminal page at 3024x1898, one thread:

  • scrolling 132 px a frame: 44.0 KB and 9.3 ms a frame before, 30.8 KB
    and 11.0 ms after (CABAC alone 21% smaller, 4x4 intra alone 14%);
  • frames that moved 96 to 128 px: 48% smaller with the wider search;
  • a keyframe: 347 KB in 14.7 ms before, 237 KB in 11.5 ms after.

Testing: the encoder benches (scroll_cost, ignored by default) take
their sizes as constants; CI.

🤖 Generated with Claude Code

…to 128 px

With ultrafast's settings, new text was coded with CAVLC and 16x16 intra
blocks only, and the motion search reached 16 px, so a real scroll's
moves were not found and were coded as new pixels.

Now frames use CABAC and 4x4 intra blocks (keyframes too, with a finer
mode decision), and the motion search reaches 128 px. Measured on a
terminal page at 3024x1898, one thread:
- scrolling 132 px a frame: 44.0 KB and 9.3 ms a frame before, 30.8 KB
  and 11.0 ms after (CABAC alone 21% smaller, 4x4 intra alone 14%);
- frames that moved 96 to 128 px: 48% smaller with the wider search;
- a keyframe: 347 KB in 14.7 ms before, 237 KB in 11.5 ms after.

Testing: the encoder benches (`scroll_cost`, ignored by default) take
their sizes as constants; CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bjornpagen bjornpagen closed this Nov 20, 2026
@bjornpagen
bjornpagen deleted the pr/x264-tuning branch November 20, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant