Vapoursynth ColorAdjust (HAVC)

From wiki.selur.net
Jump to navigation Jump to search

ColorAdjust (HAVC) is a post-processing step for clips that were already colorized by an AI colorizer: it stabilizes the colors over time and can improve contrast and brightness. It is part of HAVC (Hybrid Automatic Video Colorizer).

Filtering → Vapoursynth → Color → Coloring

ColorAdjust (HAVC) controls in Hybrid
ColorAdjust (HAVC) controls in Hybrid

What it does

  • ReColor: the clip is colorized again with the exemplar model ColorMNet, using its own frames at scene changes as color references. This makes the colors more consistent from frame to frame; higher strengths are more stable but less vivid.
  • B&W tune: improves contrast and brightness of the colored frames, optionally blended with the untuned frames.

With B&W tune none and ReColor off the clip stays unchanged.

Requirements

  • Windows with an NVIDIA graphics card (CUDA) and Hybrid's torch add-on (package vshavc).

Settings

Control Parameter Range / values Hybrid default Meaning
B&W tune BlackWhiteTune none, light, medium, strong none Strength of the contrast and brightness improvement.
B&W mode BlackWhiteMode CLAHE (luma), Simple RGB, CLAHE RGB, CLAHE (luma) + Simple RGB, ScaleAbs-LUT, Multi-Scale Retinex (HAVC), Multi-Scale Retinex (B&W) CLAHE (luma) Method of the improvement; only with B&W tune.
BW Blend BlackWhiteBlend on/off on Blend the tuned frames with the untuned ones; only with B&W tune.
ReColor ReColor on/off on Recolor with ColorMNet for temporal stability.
Strength Strength very low, low, medium, high, very high very low Stability of the recoloring; higher is more stable but more washed out.
Threshold (SC) ScThreshold 0 – 1 0.10 Scene change threshold for choosing the reference frames.
MinFreq (SC) ScMinFreq 0 – 1500 0 Forces a reference frame at least every n frames; 0 = off.
ScNormalize ScNormalize on/off on Normalizes the frames before scene detection, which makes soft cuts easier to detect.
DeepExVivid DeepExVivid on/off on With ColorMNet: resets the model memory at each reference frame, which keeps the colors more vivid.

Example

Default settings (ReColor with very low strength) on a colorized 10-bit YUV 4:2:0 source:

# adjusting color space from YUV420P10 to RGB24 for vsColorAdjust
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_in_s="limited", dither_type="error_diffusion", range_s="full")
# stabilize colors using ColorAdjust (HAVC)
clip = havc.HAVC_ColorAdjust(clip, BlackWhiteTune="none", DeepExVivid=True)
# adjusting output color from RGB24 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_in_s="full", range_s="limited")

How Hybrid calls it

  • The clip is converted to 8-bit full-range RGB before the filter and back afterwards; width and height are made even.
  • B&W tune and DeepExVivid are always written (their defaults in HAVC differ from Hybrid's); B&W mode and Blend only with a B&W tune; the ReColor settings only with ReColor; everything else only when it differs from the default.
  • ColorAdjust (HAVC) also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

HAVC (HAVC_ColorAdjust)

HAVC by Dan64 combines several colorization models for video. HAVC_ColorAdjust uses the clip itself as external reference clip for ColorMNet ("reference clip same as video") and its B&W tuning and deflicker functions. The strength is applied as a reference-merge weight (very low strength = very high merge).

Sources

  • vs-havc README
  • The function's documentation in the vshavc package
  • Hybrid's tooltips