Manual WP

From Avisynth wiki
Jump to: navigation, search
Author crabshank
Version 2020-09-04
Download C_Manual_WP_x64.dll
Category Adjustment Filters
License Open source
Discussion Doom9 Forum



Manual_WP allows you to fix the white balance of media by changing the white point of it using the appropriate Bradford transform and transfer functions for 11 colour spaces (see "mode" parameter).

It allows you to enter the xy value directly or, much more easily, enter the RGB values (0-255/0-65535) that you wish to turn grey. It also allows you to enter a target white point for the final output ("dst_x" and "dst_y" parameters).


Syntax and Parameters

Manual_WP (clip, float "x", float "y", int "R", int "G", int "B", int "mode", int "debug", float "debug_val", bool "sixtyFour", float "dst_x", float "dst_y", bool "auto_WP", string "file", string "log_id", bool "overwrite", bool "linear", string "edits", int "ed_off")

clip   =
Input clip, must be RGB32 or RGB64.

float  x = 0.312727
float  y = 0.329023
Range: 0.0 to 1.0 by 0.0001

int  R = -1
int  G = -1
int  B = -1
Set R, G and B as valid integers (0-255/0-65535) and it will use the xy value required to turn this specified RGB colour grey, even if x and y are specified as well (so it takes precedence).

int  mode = 0
  • 0 - sRGB (default)
  • 1 - Rec. 601 NTSC
  • 2 - Rec. 601 PAL
  • 3 - Rec. 709
  • 4 - Rec. 2020
  • 5 - DCI-P3
  • 6 - Display P3
  • 7 - Orginal NTSC (47 CFR § 73.682 - TV transmission standards)
  • 8 - Rec. 601 D93 (Use for Japanese media)
  • 9 - Rec. 709 D93 (Some Japanese media may use this)
  • 10 - DCI-P3 (D60/ACES)
  • 11 - Rec. 2100/2020 Hybrid Log-Gamma

int  debug = 0
  • 0 - Off (default)
  • 1 - pow(Saturation, debug_val)
  • 2 - Outputs all pixels >= debug_val (0-1), and blacks out all pixels < debug_val in saturation.
  • 3 - Outputs, in black, all pixels that have had at least a (debug_val)% reduction in saturation.
  • 4 - Outputs:
    • Saturation decreased: Hues from 157.5° (min) to 240° (max) (Cyan -> Blue)
    • Saturation increased: Hues from 307.5° (min) to 7.5° (max) (Magenta -> Orange)
    • Value (HSV): 1-debug_val

float  debug_val = 1.0
Range: 0.0 to 1.0 by 0.001

bool  sixtyFour = false
It's not necessary to set this argument, because the plugin will automatically detect if RGB64 is used.
True (not recommended) - Force 64-bit processing in plugin.

float  dst_x = 0.312727
float  dst_y = 0.329023
Set a target output white point for the output (other than D65).

bool  auto_WP = false
If set to true, it attempts to find the ideal pixel in the frame for the white point.

string  file = ""
Enter the path to the file which you would like to write the debug data for auto_WP mode (e.g. "C:\vid_WP.txt").

string  log_id = ""
On each line of the debug file will be written: "log_id: R, G, B - Frame number". N.B. the RGB values are the input to the plugin.

bool  overwrite = true
By default (true), the debug file will be overwritten if a file with the same name already exists every time the plugin is loaded; setting this to false will append to the file if it already exists.

bool  linear = false
Takes linear RGB as input and outputs linear RGB.

string  edits = ""







= trim(start, end).Manual_WP(R=R, G=G, B=B, x=x, y=y, ..., edits=s)

N.B. All characters except: "{",", "-", "0-9", ".", "," and "}"; are removed from the input string.

N.N.B. The maximum number of edits in one string is defined as "MAX_PATH" in Windows (260 usually).

int  ed_off = 0
e.g. ed_off=-1: use the RGB values from the previous (current-1) {R,G,B,start,end}, from the edits' string.

Note: It's important to use D93 modes where appropriate.



External Links

  • GitHub - Source code repository.

Back to External Filters

Personal tools