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

View Poll Results: Do you interpolate?
Yes, always 1 10.00%
Sometimes 2 20.00%
No, I don't like it 2 20.00%
No, I don't know what it is/etc 5 50.00%
Multiple Choice Poll. Voters: 10. You may not vote on this poll

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th April 2020, 13:48   #1  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Convert one color (r,g,b/y,u,v) to another (hue)?

I'm quite out of touch, but:

Say I want to convert BLACK (hex= #000000; decimal=rgb(0,0,0)) to a hue of blue. Any spectrum of blue that I will use something like HEX to determine.

I have ChromeDepth 3D glasses (passive) that are enjoyable for a number of movies and certainly a number of scenes where red is used to bring attention to the front and blue to the furthest point away from me.

I use SVP to interpolate some movies to 60fps and then use my ChromaDepth 3D glasses to watch, to further enhance the 3D quality.

My machine is fast enough to use the most insane settings with SVP. And the ChromaDepth glasses help draw out more for the experience.

But, I feel I can do this better by adding a minor blue hue to all values of black (probably up to 16 luminence to meet TV standards).
Since most black content will amount to shadow details, it should be safe to turn the pure black values to a certain hue of blue. Even if just the lightest hue of blue with the least transparency.
That should help establish a difference in depth with the ChromaDepth 3D glasses, as blue is the furthest object in ChromaDepth.

It's been a long time, so I can't really just throw something randomin to FFDshow to make a difference.

What are my options and what's the maximum I can work with?
I'll re-encode my bluray/UHD-bluray collection if I have to.

tl;dr: I need to turn 0,0,0 to blue. Not pure blue, but allow a level of transparency so there's a hint of blue on all black. Guessing that most black will turn out to be shadows, so as to help with the ChromaDepth 3D glasses.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)

Last edited by Sparktank; 14th April 2020 at 13:54.
Sparktank is offline   Reply With Quote
Old 14th April 2020, 13:52   #2  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
RE: The Poll. Yes, I always interpolate when I watch movies. I rip my discs then watch them in ~60fps (60.000/1.001) with my ChromaDepth 3D glasses (passive).
Sometimes, I'll try my Pulfrich Effect glasses (also passive).
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th April 2020, 14:22   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,282
I'm going for "No, I don't know what it is/etc".
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 14th April 2020, 14:58   #4  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
I know it's simple and I'm just not thinking straight.

But, how do I change a hex color value in Y'U'V' to include a degree of pure blue.
From black yuv(16,128,128) (according to avspmod grabbing y'u'v' colors) to a light degree of blue yuv(48,199,116).

I'm so tired and dense right now to think of the solution on my own.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th April 2020, 15:03   #5  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
trevlac's TweakColor:

https://forum.doom9.org/showthread.p...threadid=74334

The source is there if you need some enhancement I could help.
videoh is offline   Reply With Quote
Old 14th April 2020, 15:45   #6  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Quote:
Originally Posted by videoh View Post
trevlac's TweakColor:

https://forum.doom9.org/showthread.p...threadid=74334

The source is there if you need some enhancement I could help.
Unfortunately, it leads to an error.
I'm using x64 AVS+.

Although, that does give me an idea to use Tweak/SmoothLevels.

FTR, I'd use FFDshow and apply a blue over the entire screen, but isolating to black value is better.

Watching Tron: Legacy (2011) like this, is pretty close to how I first watched it in theaters.

I've even got a VR headset to watch it in 3D.

I really just want to play with everything I've got.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th April 2020, 16:10   #7  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by Sparktank View Post
Unfortunately, it leads to an error.
I'm using x64 AVS+.
No problem. I'll fix it up for that.

Last edited by videoh; 14th April 2020 at 16:32.
videoh is offline   Reply With Quote
Old 14th April 2020, 16:23   #8  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
That'd be great to try out!

I've a couple projects to try out and report back how it turned out.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 14th April 2020, 16:27   #9  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Here you go:

http://rationalqm.us/misc/TweakColor.rar

Let me know what is needed functionality-wise and I can probably help out.

Bullwinkle (can't let Rocky have all the fun)

Last edited by videoh; 14th April 2020 at 16:30.
videoh is offline   Reply With Quote
Old 14th April 2020, 22:23   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,282
VH, I was halfway through doin' an x64 version of TweakColor when I saw your post and so gave it up.

One small point, right at the end of source, I see that you changed the original code

Code:
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) {
    env->AddFunction("TweakColor",
		"c[hue]f[sat]f[bright]f[cont]f[coring]b[startHue]i[endHue]i[maxSat]i[minSat]i[smooth]i",
		TweakColor::Create, 0);


    return "`TweakColor' ....";
}
to
Code:
const AVS_Linkage *AVS_linkage = 0;
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, AVS_Linkage* vectors)
{
	AVS_linkage = vectors;
    env->AddFunction("TweakColor",
		"c[hue]f[sat]f[bright]f[cont]f[coring]b[startHue]i[endHue]i[maxSat]i[minSat]i[smooth]i",
		TweakColor::Create, 0);
    return 0;
}
Probably not a big problem but according to eg SDK/SimpleSample/ :- http://avisynth.nl/index.php/Filter_SDK/SimpleSample

AvisynthPluginInit2 (and presumably AvisynthPluginInit3) should return a pointer to constant string ie the plugin description.

Apps that load avs plugins dont often use that returned string pointer, but I think that AvsEdit may have(not sure, something defo did), in order to show
some basic info on the plugin, usually just the name and maybe author.
I knew that I had seen someone that returned 0 instead of string pointer but could never remember who the culprit was, now I remember

EDIT:
Quote:
A freeform name of the plugin.
I dont think above is my description, but gotten from SDK somewhere. I used that phrase here(end of code block):- https://forum.doom9.org/showthread.p...58#post1538558
Code:
  //  return "'Example' Example plugin";
  return ("'" AVISYNTHNAME "' " AVISYNTHNAME " plugin");
  // A freeform name of the plugin. Dont think this returned string is actually used for anything in Avisynth.
}
I have pointed out many times on-site that some unknown person returns 0 instead of pointer to string,
and although avisynth itself does not use the string pointer, I am sure that at least one app did (probably none do now, due to said unknown person ).

EDIT:
Quote:
A freeform name of the plugin.
Point being that return value and intent may be better described elsewhere in SDK [I have not looked further].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th April 2020 at 01:15.
StainlessS is offline   Reply With Quote
Old 14th April 2020, 22:34   #11  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Well StainlessS, it's freeform so I can say whatever I want, even nothing.

I don't like to hard code stuff like that. Ya'know? Just rubs me the wrong way. I prefer this way:

https://www.youtube.com/watch?v=kIDWgqDBNXA

Last edited by videoh; 15th April 2020 at 01:25.
videoh is offline   Reply With Quote
Old 15th April 2020, 12:20   #12  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Here is the original advice from the creator of Avisynth, Ben Rudiak-Gould (I have a copy of his old website):

Quote:
The return value of AvisynthPluginInit is a string which can contain any message you like, such as a notice identifying the version and author of the plugin. This string becomes the return value of LoadPlugin, and will almost always be ignored. You can also just return 0 if you prefer.
I prefer 0.
videoh is offline   Reply With Quote
Old 15th April 2020, 12:23   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,282
Thanks VH, dont think I've ever seen that before, think caused crash for AvsEdit, and it was fixed somehow, maybe stopped using it or tested for null pointer before use.
(I used to use AvsEdit all of the time, even though I totally hated that damn thing, I is awkward).

EDIT: Script removed, did not work as intended in v3.5.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th April 2020 at 13:34.
StainlessS is offline   Reply With Quote
Old 15th April 2020, 12:32   #14  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Hmm, never heard of AvsEdit. Its thread has been inactive for almost 4 years. I use AvsPMod now and again when I need something like that.
videoh is offline   Reply With Quote
Old 15th April 2020, 12:45   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,282
From Wiki:- http://avisynth.nl/index.php/Plugins#LoadPlugin
Quote:
LoadPlugin

Loads one or more standard (C++) AviSynth plugins.

LoadPlugin(string filename [, string filename...])

string filename =

The path of the .DLL file(s).
No mention at all of return type.

Quote:
never heard of AvsEdit
Dont bother trying it, its infuriating, written in either Delphi or VB I think [I got the source somewhere, maybe].
EDIT: I use PsPad (mostly for quick hack/init of script, thereafter usually VD2 unless final formatting text, TAB expand to SPACE for D9 or similar).

EDIT: Actually, LoadPlugin (in Avs+ v3.5) returns True, so returning pointer to string or 0 (null pointer) is now moot.
Code:
Function LoadPlugReturnValue(string PlugName) { return "'" + string(LoadPlugin(PlugName)) + "'" }

Plug1="C:\Z\Example.dll"          # x64 Example.dll (source returning something like: "'Example' Example filter")
Plug2="C:\Z\TweakColor.dll"       # x64 TweakColor recompile DG (source returning 0)

s1=LoadPlugReturnValue(Plug1)
s2=LoadPlugReturnValue(Plug2)

S="Plug1 '" + Plug1 + " = " + s1 + Chr(10) + \
  "Plug2 '" + Plug2 + " = " + s2
return MessageClip(S)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th April 2020 at 13:41.
StainlessS is offline   Reply With Quote
Old 16th April 2020, 00:16   #16  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Okay, I've been having a wild time playing with this.
I actually strayed from my original project and decided to make some wallpapers using this.

This is doing a pretty good job at changing colors. And it really lets you see what the frame consists of, colorwise.
I can already see quite a bit of the cyan/blue bleed into the blacks in this movie for a lot of scenes.

Original Frame:
003699 Tron Legacy


Now converting the blue range to have some red range in it:
003699 Tron Legacy - TweakColor(sat=1.2,startHue=290,endHue=350,maxSat=115,minSat=0, hue=218, smooth=64)


This other one I like because of the rainblow flairs added to it:
003748 Tron Legacy


003748 Tron Legacy - TweakColor(sat=1.2,startHue=290,endHue=350,maxSat=115,minSat=0, hue=100, smooth=64)


And now raising the min saturation to be effected:
003748 Tron Legacy - TweakColor(sat=1.2,startHue=290,endHue=350,maxSat=115,minSat=64, hue=100, smooth=64)


And now back to red/magenta:
003748 Tron Legacy - TweakColor(sat=1.2,startHue=290,endHue=350,maxSat=115,minSat=0, hue=218, smooth=64)



So to make the entire movie try give more depth for my ChromaDepth glasses, i'll have to play around with quite a few scenes. Find a reasonable compromise for the whole movie or do it chapter by chapter.
The saturation effect won't be that strong in the end. This is just I can see what's going on.

This movie already does a good job mixing in blue hues to the black colors so I'm already getting that extra bit of depth with the ChromaDepth glasses.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 16th April 2020, 00:50   #17  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 942
Additionally, for AVS+, it's best to use: Prefetch(threads=1)
Or else you get frames that don't get affected at all. Creates a scene that rapidly switches from normal to altered so quickly that you might as well put up a seizure warning.

Thanks for the build videoh!
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 16th April 2020, 01:52   #18  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
You're welcome of course and it's great to see you having success. Let's not forget the great trevlac who created TweakColor(). May the video gods be with him, and us all.
videoh is offline   Reply With Quote
Old 16th April 2020, 01:56   #19  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by StainlessS View Post
VH, I was halfway through doin' an x64 version of TweakColor when I saw your post and so gave it up.
What did Magnus Carlsen say? Too weak too slow!

https://www.youtube.com/watch?v=EY27lgnPKWI

Sorry, couldn't resist.
videoh is offline   Reply With Quote
Old 16th April 2020, 11:35   #20  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,282
Who said chess was boring ?
[Me probably]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply

Tags
chroma depth, color hex, interpolation

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 09:09.


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