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 7th December 2013, 17:19   #81  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 405
Quote:
Originally Posted by Gavino View Post
Variables don't have types, only values do.
You are absolutely right. I meant it that way but I did not use the right words. I wanted to say 'after assigning a literal numeric expression without decimal point to a variable, I can use the variable where an integer is required' (the variable can hold different types later or before).
martin53 is offline   Reply With Quote
Old 7th December 2013, 17:32   #82  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,377
The reason I mentioned it is this line in your code:
Code:
     iMinLuma = max( RT_VarExist("fgY_yMax") ? fGY_yMax : 18, iMinLuma)
If fgY_yMax holds a float value, then iMinLuma will be assigned a float, and can't be used as an index in RT_ArraySet(). Is that possibly the source of the error?
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 7th December 2013, 22:22   #83  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 405
That line was one suspect for me, too. The name of the variable suggests it. But it comes from RT_YStats(), which allows a prefix to write several statistics variables in one pass; and the suffix yMax is for YPlaneMax() - nothing with a fractional part.
martin53 is offline   Reply With Quote
Old 8th December 2013, 04:23   #84  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,155
Quote:
Originally Posted by martin53 View Post
That line was one suspect for me, too. The name of the variable suggests it. But it comes from RT_YStats(), which allows a prefix to write several statistics variables in one pass; and the suffix yMax is for YPlaneMax() - nothing with a fractional part.
I've just taken a look at source and think not possible that RT_YStats returns anything other than Int for yMax, flags really should be checked for valid return results, I dont like the checking for VarExist instead. Perhaps fGY_yMax is assigned float elsewhere in script.

EDIT: Suggest removal of 'round()' temp fixes, as they will hide cause of error, better to find than hide.
Also suggest m53 uses same version AWB as users to avoid confusion with line numbers.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

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

Last edited by StainlessS; 8th December 2013 at 12:18.
StainlessS is offline   Reply With Quote
Old 8th December 2013, 12:36   #85  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 405
I share the opinion about round().
Also agree to change to flags check. Please review if this is OK, 'cause I currently have little time to test the script, can only edit and believe.
Code:
flags = RT_YStats(cU,   mask=cGamutMask, delta=delta, threshold=MINMAX_THRESH, flgs=$17, prefix="fGU_", MaskMin=18, MaskMax=255)
iMinLuma = max( BitAnd(flags, 2)>0 ? fGY_yMax : 18, iMinLuma)
Was my fault to use my proceeding script instead of published version for checks. I promise amendment
martin53 is offline   Reply With Quote
Old 8th December 2013, 13:21   #86  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,155
Should be BitAnd(flags, 1)>0 or RT_BitTST(flags,1) (returns bool)

EDIT: ABOVE is RUBBISH, you were correct with
BitAnd(flags, 2)>0 (or RT_BitTST(flags,1) OK)
I must have a brain tumor (or a hangover)

Code:
  Flgs_Bit_Number   Add_To_Flgs     Equivalent_Function             Local_Var_Set_Excluding_Prefix
     0                 1($01)        RT_YPlaneMin()                     "yMin"        (0->255)
     1                 2($02)        RT_YPlaneMax()                     "yMax"        (0->255)
     2                 4($04)        RT_YPlaneMinMaxDifference()        "yMinMaxDiff" (0->255)
     3                 8($08)        RT_YPlaneMedian()                  "yMed"        (0->255)
     4                16($10)        RT_AverageLuma()                   "yAve"        (0.0->255.0)
     5                32($20)        RT_YPlaneStdev()                   "yStdev"      (0.0->255.0)
     6                64($40)        RT_YInRange()                      "yInRng"      (0.0->1.0)
     7               128($80)        RT_YPNorm()                        "yPNorm"      (0.0->??? depends upon d and u)
Flags arg $17 is yMin, yMax, yMinMaxDiff, yAve. yMax is bit 1.

maybe easier:
Code:
flags = RT_YStats(cU,   mask=cGamutMask, delta=delta, threshold=MINMAX_THRESH, flgs=$17, prefix="fGU_", MaskMin=18, MaskMax=255)
iMinLuma = max( flags !=0 ? fGY_yMax : 18, iMinLuma)
so long as the flags arg bit is set for returning fGY_yMax, the version you gave is more rigidly correct, but compare non zero can be
same for whatever (valid) var you are interested in.
Assuming all flags arg bits valid, and pixels found in mask within maskmin, maskmax, then will return same as flags arg.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

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

Last edited by StainlessS; 8th December 2013 at 15:39.
StainlessS is offline   Reply With Quote
Old 8th December 2013, 14:19   #87  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 405
If the symbol fGY_yMax does not exist in AviSynth's variables stomach - is the code safe then?

You know, I'm talking about the classical problem

Code:
if(var_does_not_exist || var>0) {
  ...
}
which is only safe because there's the agreement that the evaluation is immediately stopped after the result is final (which is true for one true term in an or clause).

In some languages, one must code
Code:
if (var_does_not_exist)
  ...
else
  if (var>0)
    ...
  endif
endif
martin53 is offline   Reply With Quote
Old 8th December 2013, 14:52   #88  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,155
If flags arg had bit 1 set and returned flags is non zero then the yMax variable (with whatever correct prefix) has been set and DOES exist.
However if returned flags is zero then you cannot assume anything about the ymax variable (it may or may not exist, it was not created nor changed).

Quote:
is the code safe then?
Presume you mean this
Quote:
flags !=0 ? fGY_yMax : 18
Yes, above is safe.

Ternary/Conditional Operator, [ (condition) ? result1 : result2 ] evaluates one or other result, not both.


You did at one point ask if anyone objected to "%%%" sequence, I meant to answer but forgot. "%%" is used as escaped "%"
in RT_DebugF() and RT_String() to embed a percent symbol into string without being interpreted as a variable insertion point.
Using "%%%" might at some point in future be a problem (although perhaps unlikely). Suggest maybe change to eg "@@@"
or similar (not backslash '\\\').

EDIT:
this
Code:
if(var_does_not_exist || var>0) {  ... }
about same as this
Code:
if(flags==0 || var>0) {  ... } # failed
although it dont seem to make sense that non existent var judged same as var>0.

this makes more sense
Code:
if(flags==0 || var<=0) {  ... } # failed
2nd part only evaluated if first part false.

or
Code:
if(flags!=0 && var>0) {  ... } # passed, var exists and is greater than zero
2nd part only evaluated if first part true.

EDIT: You use eg this
Quote:
dPurple = Round(Default(dPurple, 3)) #where dPurple is function arg type Int
It is not necessary to use Round() on Int function args, they are guaranteed to be type Int (or perhaps Undefined if optional).
It would only be necessary if you coded something like this
Quote:
dPurple = Round(Default(dPurple, 3.0))
eg
Quote:
amount = Float(Default(amount, 1.0)) #where amount is function arg type Float
is a good idea to avoid Integer math as client supplied Int arg would be accepted as valid Float (but actually be type Int),
[as Gavino said, IsFloat() really means IsNumeric()].
In an earlier post you put results of IsInt() and IsFloat() on frame, you would want to check IsInt() first and only after failure
test for IsFloat().

An Int is a Float, but a Float is NOT an Int (or rather, an Int is accepted as a Float).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

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

Last edited by StainlessS; 9th December 2013 at 12:03.
StainlessS is offline   Reply With Quote
Old 5th January 2014, 01:21   #89  |  Link
alexx7777
Registered User
 
Join Date: Mar 2012
Posts: 58
AWB будет работать с setmtmode (x) - . То, что x-это лучше?
Setmtmode(5)
DirectShowSource("video")
Setmtmode(x)
SeparateFields()
AWB()
Weave()

Last edited by alexx7777; 5th January 2014 at 21:09.
alexx7777 is offline   Reply With Quote
Old 9th March 2014, 12:29   #90  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 177
Hello,

I try AWB function, but il get error "invalide arguments to function MT_expand"

I have load this plugins

mt_masktools-26.dll
CallCmd.dll
dither-1.25.1\win32\dither.dll
GRunT101\GRunT.dll
GScript_11\GScript.dll
RT_Stats_25&26_dll_v1.30_20131219\Avisynth26\RT_Stats26.dll
and import this scrip
dither-1.25.1\dither.avsi

I tried this poor script
LoadPlugin("C:\masktools-v2.0a48\mt_masktools-26.dll")
AVISource("C:\my video.avi")
mt_expand(chroma="process")

The MT_expand's arguments are good

I do not find where is the problem in AWB script script version 1st December. Thanks for help.
Bernardd is offline   Reply With Quote
Old 12th March 2014, 18:22   #91  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 852
Hi Bernardd!
Avisynth version?
mt_maaktools-26 version?
Date dll.
Some time ago I am using AWB and all was O'k.
yup.
yup is offline   Reply With Quote
Old 15th March 2014, 01:01   #92  |  Link
Bernardd
Registered User
 
Join Date: Jan 2012
Location: Toulon France
Posts: 177
Thanks yup,
but i think is not problem with avisynth and plugin version. The AWB script line is mt_expand(chroma="process"). This call is ok with my poor script and not inside AWB script. Why ?
Bernard
Bernardd is offline   Reply With Quote
Old 15th March 2014, 06:04   #93  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 852
Hi Bernardd!
I also have problem with AWB script, but last version work for me.
You can also can try
http://forum.doom9.org/showthread.ph...98#post1622598
It is work better than built-in ColorYUV.
yup.
yup is offline   Reply With Quote
Old 23rd March 2014, 18:23   #94  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 619
Hi, get a error:

I use this script:

Code:
A=Import("E:\Dragon Ball\DB_1\001\1. Deinterlacing.avs").\
subtitle(string("Original")).Crop(0,0,-360,0)

B=Import("E:\Dragon Ball\DB_1\001\1. Deinterlacing with AutoWhite.avs").\
subtitle(string("Modificado"),align=9).Crop(362,0,0,0).AddBorders(2, 0, 0, 0,$00FFFF00)

Stackhorizontal(A,B)
1. Deinterlacing.avs is:

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_1\001\VideoFile.d2v", info=3)

ColorMatrix(hints=true, threads=0,interlaced=true)

assumebff()

tfm(order=0,pp=6,mode=4).tdecimate(mode=1)
1. Deinterlacing with AutoWhite.avs is:

Code:
DGDecode_mpeg2source("E:\Dragon Ball\DB_1\001\VideoFile.d2v", info=3)

ColorMatrix(hints=true, threads=0,interlaced=true)

assumebff()

tfm(order=0,pp=6,mode=4).tdecimate(mode=1)

AWB(amount=1.0,dither=true,ThSc=20,show=1).tweak(bright=0,cont=1.1)
This error merge when I set show=1.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Nvidia GTX750 2GB DDR5 + SSD Vertex 4 256 GB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 25th March 2014, 23:49   #95  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 405
Thanks to other members who help - I am on a far east trip with no spare time. Will try to help after return.
martin53 is offline   Reply With Quote
Old 26th March 2014, 22:45   #96  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,175
cPre can be replaced by cRGB in the avsi.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 1st December 2014, 04:48   #97  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 48
Unsupported colorspace

I have been trying to load AWB into avisynth 2.6 without success.
I'm think everything has been loaded as it should be.
The error that occurs is: MT Expand : Unsupported colorspace, masktools only supports planar YUV colospaces. Regardless of the conversions I apply (YV12,YV16,YV24 or any other) the same error occurs.
Anyone have a solution?
I have installed the latest masktools v2.0a48
Thanks
goorawin is offline   Reply With Quote
Old 1st December 2014, 14:29   #98  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,079
Quote:
Originally Posted by goorawin View Post
I have been trying to load AWB into avisynth 2.6 without success.
I'm think everything has been loaded as it should be.
The error that occurs is: MT Expand : Unsupported colorspace, masktools only supports planar YUV colospaces. Regardless of the conversions I apply (YV12,YV16,YV24 or any other) the same error occurs.
Anyone have a solution?
I have installed the latest masktools v2.0a48
Thanks
The reason you get that error is that either you installed mt_masktools-25.dll which is for AviSynth 2.5 (should work with YV12), that's not the case so more than likely you installed mt_masktools-26.dll which is no longer compatible with the latest AviSynth 2.6 Alpha 4/5.
So what should I do? Download and install MaskTools v2.0b1, make sure to download masktools2-x86.zip.

Last edited by Reel.Deel; 1st December 2014 at 14:48.
Reel.Deel is offline   Reply With Quote
Old 1st December 2014, 21:57   #99  |  Link
goorawin
Registered User
 
Join Date: Feb 2012
Posts: 48
Awb

Thanks for that information. The new masktools version solved the error.
goorawin is offline   Reply With Quote
Reply

Tags
awb, color, colorbalance

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 02:51.


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