Skip to content

Move to libphf encode options (MED, FAST) and rebuild libphf.dylib - #3

Closed
libphf wants to merge 1 commit into
mainfrom
chore/libphf-encode-modes
Closed

libphf wants to merge 1 commit into
mainfrom
chore/libphf-encode-modes

Conversation

@libphf

@libphf libphf commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to libphf/phf#2, which added an options argument to phf_encode_memory():

  • server/encoder.py passes { PHF_MODE_MED, PHF_EFFORT_FAST }: the stream fixes its mode up front and encodes every frame once, without trial encodes. PHFEncoder(mode=PHF_MODE_PALETTE) is available for screen content.
  • bin/libphf.dylib rebuilt from libphf/phf 1cb1f80 (universal arm64 + x86_64, macOS 11+, no OpenMP, only libSystem).
  • At startup the encoder encodes one pixel and refuses a library built before the options argument. Such a library reads the options pointer as out_size and returns empty frames instead of failing.

⚠️ Windows

bin/phf.dll predates the new signature, so on Windows the server now stops at startup with a clear error instead of streaming empty frames. It needs a rebuild from libphf/phf main with MSVC; there is no Windows cross-compiler on the machine this was prepared on. bin/README.md documents this.

Test plan

  • The startup check rejects the previous libphf.dylib with the "predates phf_encode_options_t" error.
  • Webcam (MacBook camera): 720p 30.0 fps, 1080p 27.8 → 30.0 fps. (Node WebSocket client, Apple M3 Pro.)
  • A live 1080p frame decodes with this repo's web/phf.js + web/phf.wasm (rc 0, no transparent pixels).
  • Rebuild bin/phf.dll and test on Windows.

🤖 Generated with Claude Code

…ylib

libphf/phf#2 added an options argument to phf_encode_memory(). The encoder
now passes { PHF_MODE_MED, PHF_EFFORT_FAST }: a fixed mode for camera and
video frames, encoded once without trials. PHFEncoder(mode=...) allows
PALETTE for screen content.

- bin/libphf.dylib rebuilt from libphf/phf 1cb1f80 (universal, macOS 11+,
  no OpenMP, depends only on libSystem).
- encoder.py encodes one pixel at startup and refuses a library built
  before the options argument (it would read the options pointer as
  out_size and return empty frames). bin/phf.dll is such a library; the
  README says so and how to rebuild it.

Measured with a Node WebSocket client on Apple M3 Pro: webcam 1080p
27.8 -> 30.0 fps; video files 720p/1080p stay at 30 fps with no gaps;
live frames decode with the new phf.wasm (rc 0, no transparent pixels).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@libphf libphf closed this Oct 28, 2026
@libphf
libphf deleted the chore/libphf-encode-modes branch October 28, 2026 20:02
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.

2 participants