Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th May 2021, 00:32   #21  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Why do you need visual difference to be accurate? I don't want a half baked color space function, that's why I made this and also as a learning reference.

Some other additions are ACES spaces, custom chroma resamplers for the YUV<->RGB conversion, or PC/TV range input/output for this conversion.

I will release v1.0 final for SDR, and target v2.0 for HDR (uncharted territory for me).
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 16th May 2021, 03:24   #22  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 447
I appreciate your work and the time you spared but saying "half baked color space function" about zimg is not serious and someone reading this would get completely wrong impression (about zimg).

That precision you're talking about it would matter when you can get the final result in float (still questionable - no visible difference) but in the end you have to go lower integer and to use some rounding.

Also... you have intermediate result with source bit depth (the output from YCbCrToRGB and the intput in RGBToYCbCr) that wipes the precision you're trying to achieve if the input clip is not in float (input bit depth -> float -> input_depth -> float -> input_depth):
Code:
YCbCrToRGB(YCbCrToRGB_mat("601")).RGBToYCbCr(RGBToYCbCr_mat("709"))
avsresize equivalent would be (assuming 8-bit input) (8-bit -> float -> 8-bit -> float -> 8-bit);
Code:
z_ConvertFormat(pixel_type="rgbp", colorspace_op="601:709:709=>rgb:709:709", resample_filter="spline36")
z_ConvertFormat(pixel_type="yv12", colorspace_op="rgb:709:709=>709:709:709", resample_filter="spline36")
But here you have intermediate result in float and this leads to final result with higher precision than above examples (input bit depth -> float -> input_depth):
Code:
z_ConvertFormat(colorspace_op="601:709:709:l=>709:709:709:l",resample_filter="spline36",  dither_type="none")
For ColorSpace("601","709","spline36","spline36",true,false) again the intermediate result is in input_depth.
StvG is offline   Reply With Quote
Old 16th May 2021, 16:23   #23  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Sorry if it sounded like that, I wasn't talking about any particular plugin but my own code. Why would I limit myself to what others have done? If I'm not bringing anything new to the table there's no meaning in the project. As I noted above, new color spaces, new algos, range conversion, and so on. I have used zimg library before through ImageMagick and it's a great tool, I simply don't like how it has been presented as avs+ plugin.

About the precision:
You can use ConvertBits() to use any precision on your chain, I find this a feature and not a detriment, you can see how precision makes a difference for color space conversions.
RGB will turn into RGBP16 for ConvertBits(16), which is 16-bit integer, "is it the same as float?" NO, but that's the point of the project, it scales with improvements on the avs+ side (looking forward to 16 half float). Meanwhile I'm currently working on 32-bit float support.

I'm in the process of updating a bunch of scripts to replace masktools2 to Expr() (check my Github), and the same principle applies, any performance improvement over Expr() will automatically translate into the scripts running faster. Currently the only hindrance is convolutions (mt_edge, mt_xxpand, etc), there aren't fast alternatives for avs+ like in VS and thus it presents the bottleneck of most scripts.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 16th May 2021 at 17:31.
Dogway is offline   Reply With Quote
Old 21st May 2021, 01:31   #24  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
RC6: https://github.com/Dogway/Avisynth-S....v1.0.RC1.avsi
kedautinh12 is offline   Reply With Quote
Old 3rd June 2021, 18:15   #25  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
I released RC9, this is a good candidate for 1.0 final so some feedback would be good, specially on argument coherency and chroma placement accuracy.
Recently added chroma placement option from/to RGB, linear_in/out options, and format out conversion.

The goal here is not speed as I can't compete with highly accelerated plugins but accuracy and reliance. The script is very straight forward, easy to use and easy to understand so it can be easily debugged. Also I want to make it a reference for accuracy, where all others compare against, for that I derived all the constants I could (except for RGB<->XYZ transforms), namely chroma placement shifts, kr, kb, kg coefficients, Pb, Pr, Nb and Nr coefficients, offset values for piecewise gamma function, etc.


Quote:
Originally Posted by StvG View Post
Shouldn't ColorSpace("601","709","spline36","spline36",true,false) be the same as YCbCrToRGB(YCbCrToRGB_mat("601")).RGBToYCbCr(RGBToYCbCr_mat("709")) ?
Now back to the hot topic, is RGB a color space? as I said, I don't think so. I call RGB a color format, although in fact it is a color "model", just like YUV. This is independent from color spaces, if you think about it all color space conversions happen through RGB (and XYZ) space, if you work with Nuke, Resolve, Photoshop, Blender... they are RGB based and color management aware at the same time.

Following some quotes I found while researching for a side project.

tftcentral:
Quote:
Nearly every capture - or display device nowadays uses an RGB color model to describe the color for every pixel. (...). This data has a little meaning though without a color space assigned to it. A pixel with 8-bit color depth per channel with RGB value [255; 0; 0] would obviously be red. But without a color space assigned there would be no way to tell what the chromaticity for red should be.
Wikipedia: RGB:
Quote:
The RGB color model itself does not define what is meant by red, green, and blue colorimetrically, and so the results of mixing them are not specified as absolute, but relative to the primary colors. When the exact chromaticities of the red, green, and blue primaries are defined, the color model then becomes an absolute color space, such as sRGB or Adobe RGB; see RGB color space for more details.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 24th June 2021, 09:56   #26  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
Dogway, earlier versions of the script had a WhitePoint function. I haven’t found information about this feature. Is it correcting the white balance? Can you explain what she does?
Arx1meD is offline   Reply With Quote
Old 24th June 2021, 11:24   #27  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Yes, I moved it to Grade Pack since it is a less technical and more a look function. In Transforms Pack there's only c_adaptation() which does chromatic adaptation of known color spaces, defined by the "source" and "target" arguments.

WhitePoint() doesn't correct anything per se, it is similar to the Tweak() internal function but instead of the HUE wheel it modifies color based on the daylight correlated color temperature (ie. cooler or warmer white point) as a mathematically accurate function, unlike most other solutions I have seen.

I also want to add that current RC17 of Transforms Pack is very outdated and not representative of final version. I'm finishing development of v1.0, it's actually finished but in debug stage so I hope to release it in less than a week time.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 24th June 2021, 13:21   #28  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
Dogway, thanks.
Can your Transforms Pack be used to change the white balance?
Arx1meD is offline   Reply With Quote
Old 24th June 2021, 17:48   #29  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Use WhitePoint() for that in Grade Pack. It requires Transforms Pack though for the matrix functions and it's developed a bit ahead so you need to remove all the ", fulls=fs)" references.

EDIT: Topic moved to Filters Packs thread.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 19th August 2021 at 23:48.
Dogway is offline   Reply With Quote
Reply

Tags
colorspace, conversion, format, matrix, temperature

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.