SlimeCodec Convert v0.3.1 — Windows x64
========================================

NormMAP commutator-norm driven video re-encoder.
Reduces bitrate up to 60% at the same CRF by reallocating bits
away from low-motion blocks detected via commutator norm analysis.


QUICK START (GUI)
-----------------
1. Double-click  slimecodec-gui.exe
2. Click "Browse..." to select an input video
3. Adjust settings (or leave defaults)
4. Click "Convert"
5. Output file appears in the same folder as input (*_slime.mp4)


QUICK START (CLI)
-----------------
  slimecodec-convert.exe input.mp4 -o output.mp4


CLI OPTIONS
-----------
  slimecodec-convert.exe [OPTIONS] <INPUT>

  -o, --output <PATH>            Output file (default: {input}_slime.mp4)
      --codec <h264|av1>         Video codec (default: h264)
      --crf <N>                  Quality 0-51 (default: 23/h264, 35/av1)
      --strength <F>             NormMAP QP strength 0.0-1.0 (default: 0.15)
      --adaptive                 Per-block adaptive strength from d-value
      --adaptive-range <F>       Adaptive spread 0.0-1.0 (default: 0.67)
      --temporal                 Per-frame strength scaling by motion
      --auto-tune                Auto-derive strength/range from Pass 1 stats
      --block-size <4|8>         NormMAP block size (default: 8)
                                   4=finer ROI (4x resolution), 8=default
      --interlaced               Half-scan checkerboard (~50% faster Pass 1)
      --interlace-type <v2|v3|v4> Interlace mode (default: v2)
                                   v2=spatial interpolation
                                   v3=temporal smoothing
                                   v4=progressive decay
      --keyint <SEC>             Keyframe interval in seconds, 0=auto
      --normmap <PATH>           Write .normmap sidecar file
      --normmap-mode <0|1|2|3>   0=bitmask(default) 1=uint8-log 2=float16 3=GOP
      --pass1-only               Generate NormMAP only, skip re-encoding


EXAMPLES
--------
  # Basic conversion (H.264, CRF 23, strength 0.15)
  slimecodec-convert.exe video.mp4 -o output.mp4

  # Recommended: adaptive with interlaced scan
  slimecodec-convert.exe video.mp4 -o output.mp4 \
    --strength 0.3 --adaptive --adaptive-range 0.3 --interlaced

  # Stronger compression
  slimecodec-convert.exe video.mp4 -o output.mp4 --strength 0.3

  # Auto-tune (automatic optimal settings)
  slimecodec-convert.exe video.mp4 -o output.mp4 --auto-tune

  # AV1 output
  slimecodec-convert.exe video.mp4 -o output.mp4 --codec av1

  # HLS-ready with 2-second keyframe interval
  slimecodec-convert.exe video.mp4 -o output.mp4 --keyint 2


HOW IT WORKS
------------
SlimeCodec analyses consecutive video frames using the commutator norm
of NxN pixel blocks (8x8 default, 4x4 optional):

  d = ||[A, B]||_F = ||AB - BA||_F

where A and B are grayscale matrices of the same block in two adjacent
frames. Blocks with low d-values have minimal perceptual change and can
tolerate higher quantisation without visible quality loss.

Pipeline:
  Pass 1 — Decode all frames, compute d-values for every NxN block pair.
            With --block-size 4, 4x spatial resolution (4x4 blocks).
            With --interlaced, only half the blocks are computed per frame
            (checkerboard alternating), ~50% faster.
  Pass 2 — Re-encode with per-macroblock QP offsets via FFmpeg ROI side data.
            Low-d blocks get positive QP offset (more compression).
            High-d blocks keep base QP (preserve detail).

Audio streams are copied through without re-encoding (-c:a copy).
Original timestamps (PTS) and duration are preserved exactly.


INTERLACED SCAN MODES
---------------------
  v2 (spatial interpolation) — Default. Non-computed blocks are blended
     with computed neighbors (50% prev + 50% neighbor avg). Best balance
     of speed and compression quality.
  v3 (temporal smoothing) — 3-frame weighted moving average [0.25, 0.5, 0.25]
     applied after all frames. Smoothest d-values, but slightly lower
     compression (-45% vs -51% on test content).
  v4 (progressive decay) — Non-computed blocks decay x0.9 each frame.
     Good compression (-50%), gradually reduces stale values.


INCLUDED FILES
--------------
  slimecodec-gui.exe           GUI application (egui)
  slimecodec-convert.exe       CLI tool
  avcodec-61.dll               FFmpeg 7.1 libraries
  avdevice-61.dll
  avfilter-10.dll
  avformat-61.dll
  avutil-59.dll
  postproc-58.dll
  swresample-5.dll
  swscale-8.dll
  README.txt                   This file
  CHANGELOG.txt                Version history


SYSTEM REQUIREMENTS
-------------------
  - Windows 10/11 x64
  - No installation or runtime dependencies
  - All FFmpeg libraries are bundled


TRIAL
-----
This is a 30-day trial version. The trial period begins on first launch.
After 30 days, the application will stop and display a subscription notice.
The license is locked to the machine where the application is first run.

Subscribe: https://1.docokame.biz/slimecodec/
Contact:   sasaki@javatel.co.jp


LICENSE
-------
SlimeCodec is proprietary software. Patent pending.
Japanese Patent Application JP 2026-046609, filed 2026-03-20.
FFmpeg libraries are licensed under LGPL/GPL.
