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 31st December 2004, 04:04   #1  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
How to adjust RGB saturation?

I seem to have run into a brick wall here. I want to adjust the saturation of an RGB clip to 83% in Avisynth, and there doesn't seem to be any way to do it without converting to YUY2. I prefer not to do that because I'm trying to fit Avisynth into a larger processing chain and I don't want to downsample the chroma information at this stage in the chain. (It's a long story...)

The documentation mentions a function called "HSIAdjust" which existed in earlier versions, but was removed in favor of a newer "Tweak" function which only supports YUV. Did the "HSIAdjust" function support RGB? And if so, which was the last version of Avisynth to include it?

Is there any other way (besides Tweak) to adjust saturation in Avisynth, and keep the full RGB image?
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 04:21   #2  |  Link
ObiKenobi
Guest
 
Posts: n/a
There is a virtualdub filter you could import to do this, http://neuron2.net/hue.html
  Reply With Quote
Old 31st December 2004, 05:28   #3  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
Thank you. Actually I tried doing that but I couldn't figure out the parameter list for the filter in Avisynth. Can you help?

FWIW, here is an example of what I tried:

Code:
LoadVirtualDubPlugin("Hue.vdf","Hue",0)
AVISource("Video1.avi")
Hue(0,0.85,1,"rgbycm")
This reflects the parameters I see displayed in VirtualDub's filter list. I've tried many combinations, but I always get the error "Invalid arguments to function 'Hue'".
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 05:41   #4  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
It's easier if you use the VirtualDub filter import script.

If you look at the VD_Hue function, you will see that the last argument isn't a string; it's a bitmask.
stickboy is offline   Reply With Quote
Old 31st December 2004, 06:05   #5  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
Thanks, hopefully that will get me going again.

Forgive me for a little rant, but I consider it a gross oversight if the current Avisynth can't perform such a simple, basic task internally. Furthermore, I think it's an embarrassment if the "HSIAdjust" filter was removed unnecessarily without a suitable replacement filter in place. (To be fair though, I still don't know for certain that "HSIAdjust" supported RGB...)

A humble plea to the developers: Any chance the "Tweak" filter will support RGB in the future?
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 06:10   #6  |  Link
ObiKenobi
Guest
 
Posts: n/a
Quote:
Originally posted by fccHandler
A humble plea to the developers: Any chance the "Tweak" filter will support RGB in the future?
It already does...

From the Avisynth page:

  Reply With Quote
Old 31st December 2004, 06:28   #7  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
Hmm... What page is that from? The reference I'm accustomed to is http://www.avisynth.org/Tweak but it doesn't mention colorspace support.

The Avisynth version I'm currently using is 2.54 (January 26, 2004). Can you confirm that upgrading to the latest version will enable RGB in Tweak? (I tend to loathe upgrading my trusted software...)
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 06:32   #8  |  Link
ObiKenobi
Guest
 
Posts: n/a
I got that snapshot from: http://www.avisynth.org/FiltersByCategory which lists the filters and the colorspaces they support.

Last edited by ObiKenobi; 31st December 2004 at 06:49.
  Reply With Quote
Old 31st December 2004, 06:41   #9  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
It doesn't work in my version. I get the error "Tweak: YUV data only (no RGB)." Have you actually tried it yourself? If the newest version will work then I'll certainly upgrade, but it would be nice to have some confirmation first.
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 06:47   #10  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
You edited your post! No fair.

To address your edit, I'm not at all confident that the information on your linked page is correct. So to say that "HSIAdjust" supported the same colorspaces as "Tweak" is worthless if we can't confirm that Tweak supports the colorspaces listed.
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 06:47   #11  |  Link
ObiKenobi
Guest
 
Posts: n/a
Just tried it now and it doesn't seem to work with RGB. I had never used it before with RGB input but I remember that that page has always listed Tweak as having RGB support.
  Reply With Quote
Old 31st December 2004, 06:54   #12  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
Just to ease my mind, what version are you using?
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 06:56   #13  |  Link
ObiKenobi
Guest
 
Posts: n/a
Right now 2.56, but I just installed that about 5 minutes ago. Before that I was using 2.55 and it had the same error message.

Last edited by ObiKenobi; 31st December 2004 at 07:06.
  Reply With Quote
Old 31st December 2004, 07:13   #14  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
You edited your (already edited) post again!

You realize this disrupts the flow of the conversation? Anyway, I guess I'll wait a while and see if Wilbert has any thoughts to contribute. It seems to me a bit of a hassle to have to import an external VirtualDub filter to perform what (I believe) should be an inherent task.

But thanks ObiKenobi for your quick responses! I much appreciate it.
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 07:14   #15  |  Link
ObiKenobi
Guest
 
Posts: n/a
Quote:
Originally posted by fccHandler
You edited your (already edited) post again!
Sorry, but it wasn't anything significant that I edited out, just the quote that wasn't really necessary.

Quote:
Originally posted by fccHandler
It seems to me a bit of a hassle to have to import an external VirtualDub filter to perform what (I believe) should be an inherent task.
Definitely. It is odd that the filter doesn't support RGB input.

Last edited by ObiKenobi; 31st December 2004 at 07:17.
  Reply With Quote
Old 31st December 2004, 08:11   #16  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
HSIAdjust was removed in 2.5.2 (this is described in the changelist that comes with AviSynth).

HSIAdjust did not support RGB either (I checked with 2.5.0).
stickboy is offline   Reply With Quote
Old 31st December 2004, 08:59   #17  |  Link
fccHandler
Registered Jedi
 
Join Date: Jan 2003
Location: Georgia, U.S.A.
Posts: 733
You are right again, stickboy.

But don't you think "described" is too strong a word? My copy of changelist.htm just says, "Removed HSIAdjust()." Two words, plain and simple. Hardly what I would call a "description". Really just a "notification." And not even close to an "explanation".

Anyway my problem has been solved for the moment, with your help, and I'm encoding my video right now. Your suggestion to use the VirtualDub filter import script did the trick.

Thanks also for checking the HSIAdjust function. So are we to conclude that control of RGB saturation has never been supported in any version of Avisynth? (I'm shocked.)
__________________
May the FOURCC be with you...
fccHandler is offline   Reply With Quote
Old 31st December 2004, 09:20   #18  |  Link
ARDA
Registered User
 
Join Date: Nov 2001
Posts: 291
Maybe this

http://www.avisynth.org/RGBAdjust

another thread with same subjetc

http://forum.doom9.org/showthread.ph...ight=RGBAdjust

I hope this can be usefull
ARDA
ARDA is offline   Reply With Quote
Old 31st December 2004, 09:36   #19  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Quote:
Originally posted by fccHandler
Thanks also for checking the HSIAdjust function. So are we to conclude that control of RGB saturation has never been supported in any version of Avisynth? (I'm shocked.)
It's not really that shocking.

Adjusting saturation doesn't make a lot of sense in RGB. It'd probably have to convert to YUV internally anyway.

It's too bad that AviSynth supports only YUY2 and YV12, though, which downsample the chroma.
Quote:
Two words, plain and simple. Hardly what I would call a "description". Really just a "notification." And not even close to an "explanation".
Well, I meant in response to your questions about what the last version was that had it.

If you want a fuller explanation:
Quote:
Adjusts colors in HSI space. Tweak works better except it doesn't have gamma. Since Tweak is technologically leaps and bounds ahead of HSI, they should be merged (just add gamma to tweak) or HSI should simply be dropped before someone gets dependant on it. HSI behavior is unpredictable at anything more than very minor corrections.
From http://www.avisynth.org/HSIAdjust
stickboy is offline   Reply With Quote
Old 31st December 2004, 14:12   #20  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Hi guys

Quote:
You realize this disrupts the flow of the conversation? Anyway, I guess I'll wait a while and see if Wilbert has any thoughts to contribute. It seems to me a bit of a hassle to have to import an external VirtualDub filter to perform what (I believe) should be an inherent task.
Some random comments.

1) Tweak requires YUV (I corrected the info at www.avisynth.org).

2) HSIAdjust also required YUV (I corrected the info at www.avisynth.org).

Quote:
Thanks also for checking the HSIAdjust function. So are we to conclude that control of RGB saturation has never been supported in any version of Avisynth? (I'm shocked.)
Yup. A while ago I started porting Graft's hue filter to AviSynth. I will finish it one day. But, I'm not sure it will be faster than

clip.ConvertToYUY2.Tweak(hue=...)

The main difference is that with Tweak you have to rotate the entire range of colors, while in VD_Hue you can rotate just a few colors. I think TweakColor (by Trevlac) can do the latter though.

The problem with Graft's hue filter is that I don't understand where the hue transformation is coming from. Perhaps someone can explain it to me? The relation between hue and (r,g,b) is nonlinear, but it is linearized in some way. I guess I have to ask Donald about this when he comes back.

Quote:
It's too bad that AviSynth supports only YUY2 and YV12, though, which downsample the chroma.
AviSynth v3 will support YUV 4:4:4 as you probably know

Last edited by Wilbert; 31st December 2004 at 14:16.
Wilbert is offline   Reply With Quote
Reply

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 11:03.


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