Log in

View Full Version : AviSynth+, basic filters that work with RGBAPS color format?


TomArrow
22nd November 2018, 22:16
I'm doing the following:


video=FFVideoSource("HDRVideo.mkv")
video=video.ConvertBits(16).ConvertToYUV444()
video=Spline36ResizeMT(video,1920,800,SetAffinity=false).Sharpen(0.2)
video=z_ConvertFormat(video,pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none").DGHable(exposure=0.1,d=0.00001,e=0.0295,f=0.3,a=5)
video=z_ConvertFormat(video,pixel_type="YUV444P16",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
video

The main purpose of this is the HDR to SDR tonemapping via DGHable.

But here I was wondering, is there any way to adjust the image in the RGBPS color format? That's the format it has after the first call to z_ConvertFormat and as I understand it, this is a floating point format in which the image is stored in linear color space.

It would be nice if I could make some very basic adjustments to the image in this colorspace. For example contrast, gain, etc. for a very rudimentary color correction. In particular I'd like trying to just scale the green channel down a little bit (say, multiply it with 0.95).

Unfortunately RGBAdjust doesn't work in RGBPS. Tweak doesn't work for obvious reasons.

Is there some kind of list of filters that actually are compatible with this color format?

I know I could just make the tweaks after it's converted back to a "normal" color format, but I want to play around with the linear color space a bit.

pinterf
22nd November 2018, 22:22
Expr filter should work. And I'll have a look at RGBAdjust why it stuck in the stone age.

poisondeathray
22nd November 2018, 23:18
Levels() works in RGBPS ok too

Request: Can someone re-write HistogramRGBLevels , HistogramRGBParade, functions so they compatible with other bit depths?
http://avisynth.nl/index.php/Histograms_in_RGB_%26_CMY

jpsdr
23rd November 2018, 10:08
If you want, you can try this, if you're using my plugins (if you want to convert HDR PQ to SDR) :

video=FFVideoSource("HDRVideo.mkv")
video=video.ConvertBits(16).ConvertToYUV444()
video=Spline36ResizeMT(video,1920,800,SetAffinity=false).Sharpen(0.2)
video=ConvertYUVtoLinearRGB(video,Color=0,OutputMode=2).DGHable(...)
video=ConvertLinearRGBtoYUV()
video

If you don't need separate tuning, DGHable will very probably be faster than my ConvertRGB_Hable_HDRtoSDR.

TomArrow
23rd November 2018, 13:33
Expr filter should work. And I'll have a look at RGBAdjust why it stuck in the stone age.

Thanks man. Can you give me a quick example of how Expr works? I read the page but it doesn't click yet.

Say I want to multiply the green channel with 0.98, how would I go about that?

TomArrow
23rd November 2018, 13:36
If you want, you can try this, if you're using my plugins (if you want to convert HDR PQ to SDR) :

video=FFVideoSource("HDRVideo.mkv")
video=video.ConvertBits(16).ConvertToYUV444()
video=Spline36ResizeMT(video,1920,800,SetAffinity=false).Sharpen(0.2)
video=ConvertYUVtoLinearRGB(video,Color=0,OutputMode=2).DGHable(...)
video=ConvertLinearRGBtoYUV()
video

If you don't need separate tuning, DGHable will very probably be faster than my ConvertRGB_Hable_HDRtoSDR.

Pardon me, but I don't entirely understand what you are suggesting. You replaced those z_ConvertFormat calls with other functions. Is there a benefit to that?

pinterf
23rd November 2018, 14:21
Thanks man. Can you give me a quick example of how Expr works? I read the page but it doesn't click yet.

Say I want to multiply the green channel with 0.98, how would I go about that?

rgbclip=rgbclip.Expr("x","x 0.98 *","x")

TomArrow
23rd November 2018, 15:49
rgbclip=rgbclip.Expr("x","x 0.98 *","x")

Fucking fantastic, thank you so much, now I think I get it! Though it seems that I have an older version where this will multiply the blue channel due to that GBR ordering bug, but no problem at all, I see the logic behind it now. :)

jpsdr
23rd November 2018, 16:08
As you're using one of my filters, Spline36ResizeMT, maybe you want to try/test those on my HDRTools, it's a plugin dedicated to HDR/SDR work, if you're interested or curious to check.

TomArrow
23rd November 2018, 16:29
As you're using one of my filters, Spline36ResizeMT, maybe you want to try/test those on my HDRTools, it's a plugin dedicated to HDR/SDR work, if you're interested or curious to check.

Ah, I see. I'm gonna be honest, I mostly just modified the script that came with ripbot264, that's why I'm using your filters. Nice meeting you though, I didn't realize the community was this tight knit. :)

Gonna check out your projects.