RGBAdapt

From Avisynth wiki
Revision as of 17:40, 1 July 2020 by Reel.Deal (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Abstract
Author StainlessS
Version v0.5
Download RgbAdapt_25_26_x86_x64_dll_v0.05_20190303.zip
Category Adjustment Filters
License GPLv2
Discussion Doom9 Thread

Contents

Description

Another RGB color correction plugin, it also also includes a graffer.

Requirements


*** vcredist_x86.exe is required for GamMatch-x86
*** vcredist_x64.exe is required for GamMatch-x64


Syntax and Parameters

RGBAdapt(clip c, \
    \ Float "R_Bias"=0.0,Float "R_Gain"=1.0,Float "R_Cont"=1.0,Float "R_RPow"=1.0,Float "R_Spow"=1.0,Float "R_SPMid"=0.5,Bool "R_Pord"=false,
    \ Float "G_Bias"=0.0,Float "G_Gain"=1.0,Float "G_Cont"=1.0,Float "G_RPow"=1.0,Float "G_Spow"=1.0,Float "G_SPMid"=0.5,Bool "G_Pord"=false,
    \ Float "B_Bias"=0.0,Float "B_Gain"=1.0,Float "B_Cont"=1.0,Float "B_RPow"=1.0,Float "B_Spow"=1.0,Float "B_SPMid"=0.5,Bool "B_Pord"=false,
    \ Int "R_IMin"=0,Int "R_OMin"=0,Int "R_IMax"=255,Int "R_OMax"=255,
    \ Int "G_IMin"=0,Int "G_OMin"=0,Int "G_IMax"=255,Int "G_OMax"=255,
    \ Int "B_IMin"=0,Int "B_OMin"=0,Int "B_IMax"=255,Int "B_OMax"=255
    \ )

Bias    -512.0 -> 512.0.                Bias = Brightness.
Gain    -8.0   -> 8.0                   Gain = Zero relative contrast.
Cont    -8.0   -> 8.0                   Cont = Centre relative Contrast.
RPow    0.1    -> 4.0                   RPow = Gamma, r shaped power curve.
SPow    0.1    -> 4.0                   SPow = S shaped power curve.
SPMid   0.01   -> 0.99                  SPMid = Controls Inflection point for S shaped power curve, 0.5 = mid point ie 0.5*255.0
Pord    True/False                      Pord=Rpow processed first (False) or SPow first (True). The power functions are non commutative.

    Assuming all settings apart from RPow, SPow and SPMid at defaults:-
    Pord Default (false) RPow1st, when modifying RPow or SPow, the SPow power curve inflection point will
      remain fixed at Y = SPMid * 255.0, Rpow will slide it left or right.
    Pord SPow1st, when modifying RPow or SPow, the SPow power curve inflection point will remain fixed
      at X = SPMid * 255.0, RPow will slide it up or down.

New args v0.3
IMin    0 -> 255 : IMin <= (IMax+1)
OMin    0 -> 255
IMax    0 -> 255 : (IMin-1) <= IMax
OMax    0 -> 255

 Any INPUT value less than IMin will be mapped to OMin (both default to 0), and values greater than IMax will be mapped to
OMax (both default to 255). With default settings the Min/Max options have no effect.
These options allow for weird shaped LUT's to eg create masks. Example, Leaving all other settings at default and
for some channel set IMax to eg 127 and OMax to 64 would map all input above 127 to 64 while leaving everything else untouched.
If you additionally set eg IMin=128 and OMin=180, then 0-127 would map to 180 and 128->255 map to 64.
The IMin <= (IMax+1) requirement allows you to map the entire 0->255 range to any two output values.



RgbAdapt_Graffer.exe demos the plugin and all arguments. (Will require VB6 runtimes, most will already have these.)


Graffer_Update,
The button "Get Fn Call From ClipBoard" reads in RgbAdapt settings from the clipboard, in format as created via RT_String().
Can write to Clipboard using ClipBoard plugin.

Ie, ALL 33 args In Default Order, with exception of the first clip argument which should be omitted.

Format = "RgbAdapt("         +
    \ "%f,%f,%f,%f,%f,%f,%s" +
    \ "%f,%f,%f,%f,%f,%f,%s" +
    \ "%f,%f,%f,%f,%f,%f,%s" +
    \ "%d,%d,%d,%d"          +
    \ "%d,%d,%d,%d"          +
    \ "%d,%d,%d,%d"          +
    \ ")"

CBStr=RT_String(Format,
    \ red_bias, red_gain, red_cont, red_rpow, red_spow, r_spmid, r_pord,
    \ grn_bias, grn_gain, grn_cont, grn_rpow, grn_spow, g_spmid, g_pord,
    \ blu_bias, blu_gain, blu_cont, blu_rpow, blu_spow, b_spmid, b_pord,
    \ red_imin, red_omin, red_imax, red_omax,
    \ grn_imin, grn_omin, grn_imax, grn_omax,
    \ blu_imin, blu_omin, blu_imax, blu_omax
    \ )

err = ClipBoard_PutText(CBStr)
Assert(Err==0, "Error writing to ClipBoard")

##################
Reading Data written to clipboard via RgbAdapt_Graffer button "Copy Fn Call to Clipboard",
Use ClipBoard_GetText() to return as formatted below. (Add "c." before result to use c clip or without defaults to Last clip).
Or just use CTRL/V to insert from ClipBoard.

"""RgbAdapt(
  \ R_Bias=0.1,R_Gain=1.001,R_Cont=1.001,R_Rpow=1.001,R_Spow=1.001,R_SPMid=0.501,R_Pord=True,
  \ G_Bias=0.1,G_Gain=1.001,G_Cont=1.001,G_Rpow=1.001,G_Spow=1.001,G_SPMid=0.501,G_Pord=True,
  \ B_Bias=0.1,B_Gain=1.001,B_Cont=1.001,B_Rpow=1.001,B_Spow=1.001,B_SPMid=0.501,B_Pord=True,
  \ R_IMin=1,R_OMin=1,R_IMax=254,R_OMax=254,
  \ G_IMin=1,G_OMin=1,G_IMax=254,G_OMax=254,
  \ B_IMin=1,B_OMin=1,B_IMax=254,B_OMax=254
  \ )
"""


Examples

RGBAdapt16() takes 8 bit interleaved RGB and produces Stack16 interleaved RGB, MSB on top.
Can use something like:-

AviSource("blah.avi").ConvertToRGB32
RGBAdapt16(R_SPow=1.2,G_SPow=1.2,B_SPow=1.2)
Dither_convert_rgb_to_yuv(ShowRed("yv12"), ShowGreen("yv12"), ShowBlue("yv12"), lsb=false)
return Last


Changelog

v0.5, 03 Mar 2019.
 * Latest release

v0.4, 06 Dec 2018
 * Added RGBAdapt16() arguments identical to RGBAdapt().
 * Takes 8 bit interleaved RGB and produces Stack16 interleaved RGB, MSB on top.


Archived Downloads

Version Download Mirror
v0.05 RgbAdapt_25&26_x86_x64_dll_v0.05_20190303.zip RgbAdapt_25_26_x86_x64_dll_v0.05_20190303.zip


External Links




Back to External Filters

Personal tools