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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th March 2018, 02:15   #4001  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,267
Dont know if below is bugged, or misleading error message, or both.

Code:
# OK
Blankclip(Length=1,Width=1,height=1,Pixel_type="YV24").PointResize(256,256)

# Resize: source image too small for this resize method. Width=1, Support=1.
Blankclip(Length=1,Width=1,height=1,Pixel_type="YV24").BilinearResize(256,256)

# Resize: source image too small for this resize method. Width=2, Support=2.
Blankclip(Length=1,Width=4,height=4,Pixel_type="YV12").BicubicResize(256,256)   # NOTE, YV12, Presumably error for chroma

# Resize: source image too small for this resize method. Width=2, Support=2.
Blankclip(Length=1,Width=2,height=2,Pixel_type="YV24").BicubicResize(256,256)   # NOTE, YV24

# Resize: source image too small for this resize method. Width=4, Support=4.
Blankclip(Length=1,Width=4,height=4,Pixel_type="YV24").Lanczos4Resize(256,256)

# Resize: source image too small for this resize method. Width=4, Support=4.
Blankclip(Length=1,Width=4,height=4,Pixel_type="YV24").GaussResize(256,256)

# Resize: source image too small for this resize method. Width=4, Support=4.
Blankclip(Length=1,Width=4,height=4,Pixel_type="YV24").BlackmanResize(256,256)

# Resize: source image too small for this resize method. Width=3, Support=3.
Blankclip(Length=1,Width=3,height=3,Pixel_type="YV24").LanczosResize(256,256)

# Resize: source image too small for this resize method. Width=4, Support=4.
Blankclip(Length=1,Width=4,height=4,Pixel_type="YV24").sincResize(256,256)

# Resize: source image too small for this resize method. Width=2, Support=2.
Blankclip(Length=1,Width=2,height=2,Pixel_type="YV24").Spline16Resize(256,256)

# Resize: source image too small for this resize method. Width=3, Support=3.
Blankclip(Length=1,Width=3,height=3,Pixel_type="YV24").Spline36Resize(256,256)

# Resize: source image too small for this resize method. Width=3, Support=3.
Blankclip(Length=1,Width=3,height=3,Pixel_type="YV24").Spline36Resize(256,256)

Return Last
For eg YV24, width=2, height=2, Says width = 2, Support=2 (when it clearly produces an error message, ie seems not to support 2).

Think its been like this 4E4 (believe it exists as above in avs standard).

EDIT: Presume similar on height, untried.
__________________
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; 19th March 2018 at 18:37.
StainlessS is offline   Reply With Quote
Old 19th March 2018, 03:32   #4002  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,377
>Dont know if below is bugged, or misleading error message, or both.
misleading I'd say
Quote:
avs_core\filters\resample_functions.cpp(247)
if (source_size <= filter_support) {
env->ThrowError("Resize: Source image too small for this resize method. Width=%d, Support=%d", source_size, int(ceil(filter_support)));
}
EDIT one quick fix
Quote:
if (source_size <= filter_support) {
env->ThrowError("Resize: Source image too small for this resize method. Width=%d, Minimum=%d", source_size, int(ceil(filter_support))+1 );
}
So instead of
Quote:
source image too small for this resize method. Width=1, Support=1.
you would see
Quote:
source image too small for this resize method. Width=1, Minimum=2.

Last edited by raffriff42; 19th March 2018 at 04:13.
raffriff42 is offline   Reply With Quote
Old 19th March 2018, 14:08   #4003  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,084
Maybe it's because I'm tired, but if a filter is supposed to support value X (as per filter_support in the code there), it shouldn't be erroring out when equal to the value of filter_support. It only should in the less than case. Unless filter_support is not actually the minimum supported value, but the maximum unsupported value (in which case it being named 'filter_support' in the code is also misleading or incorrect).

In other words, either the operator in the code is wrong (it should be just <, not <=) or the naming of both 'filter_support' and the 'Support' field in the error message are wrong.
qyot27 is offline   Reply With Quote
Old 24th March 2018, 04:44   #4004  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,377
I'm getting access violations when downsizing inside an Animate call. Maybe it's just my system.
It does not happen in AVS 2.6.1, and it does not happen when "z_" avsresize filters are substituted.
Code:
ColorbarsHD(width=640, height=400)

## optional - these do not change the test result
KillAudio
ConvertToYV12
Trim(0, length=150)

Animate(0, 120, "_MyBlur", 0.0, 60.0)

## optional - make the clip longer so AvsMeter can chew on it
R=Reverse 
Last+Reverse
Loop(100)

return Last

function _MyBlur(clip C, float rad)
{
    ##
    ## HEART OF THE TEST:
    ## BilinearResize causes intermittent...
    ##   | Exception 0xC0000005 [STATUS_ACCESS_VIOLATION]
    ##   | Module:   C:\Windows\system32\KERNELBASE.dll
    ##   | Address:  0x00007FFF071D92FC
    ## (64-bit)
    ## or...
    ##   | Exception 0xC0000005 [STATUS_ACCESS_VIOLATION]
    ##   | Module:   C:\Windows\SysWOW64\avisynth.DLL
    ##   | Address:  0x618064ED
    ## (32-bit)
    ## but avsresize "z_BilinearResize" is OK
    ##
    return (rad<0.1) ? C
    \ : C.BilinearResize(
    \        m4(Float(C.Width)/(rad+1.0)), 
    \        m4(FLoat(C.Height)/(rad+1.0)))
    \    .GaussResize(
    \        C.Width, C.Height, p=19)
}

### MOD-4-and-at-least-16 helper function
## @ Didée
function m4(float f) 
{
    (f<16) ? 16 : Int(Round(f/4.0)*4)
}

Last edited by raffriff42; 24th March 2018 at 04:46.
raffriff42 is offline   Reply With Quote
Old 24th March 2018, 05:01   #4005  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,267
Did not try z_lib resizers, but your script (as supplied, running for 3 mins) does OK on XP32 bit.

EDIT: OK after redo at 6 mins.

Why this, (Round produces an Int already, you can answer for Didee if you like [did it change in more recent version of Avs])
Code:
(f<16) ? 16 : Int(Round(f/4.0)*4)
EDIT: Only relevant mention of round I could find,
Quote:
Changes from 2.06
Fixed ceil, floor and round functions.
Avs+ thread 1 Million and 25 thousand views since Sept 2013, WOW ! [cookies seem to track if user viewed already].
__________________
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; 24th March 2018 at 05:47.
StainlessS is offline   Reply With Quote
Old 24th March 2018, 08:04   #4006  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by raffriff42 View Post
I'm getting access violations when downsizing inside an Animate call. Maybe it's just my system.
It does not happen in AVS 2.6.1, and it does not happen when "z_" avsresize filters are substituted.
Thanks, reproduced.
EDIT: and fixed on git.

Last edited by pinterf; 26th March 2018 at 09:26. Reason: fix ready
pinterf is offline   Reply With Quote
Old 26th March 2018, 02:49   #4007  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 165
I'm curious, is it still best practice not to cache frames ever, for any purpose, as this post suggests? I'm still running into a few performance issues and I think they may be, at least in part, due to hammering the PCIe bus constantly when moving frames between the CPU and GPU.
__________________
My filters: DupStep | PointSize
`Orum is offline   Reply With Quote
Old 27th March 2018, 00:21   #4008  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 701
merge seems broken with 10 12 14 bit clip
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 27th March 2018, 02:17   #4009  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,267
Yoda, give some example for Pintef, please.
__________________
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 28th March 2018, 01:04   #4010  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 701
Quote:
Originally Posted by StainlessS View Post
Yoda, give some example for Pintef, please.
Code:
convertbits(10) #12 or 14
merge(last,0.33)
convertbits(8)
I also notice some memory leak since few releases, with avspmod, it will eat a lot of ram even with few previews after script modifications, but not sure is an avs+ bug or avspmod or other filter. It usually thrown an out of memory error like "can't access frame at this position" and then I get even some windows stuff not working well.
__________________
powered by Google Translator

Last edited by Motenai Yoda; 28th March 2018 at 01:15.
Motenai Yoda is offline   Reply With Quote
Old 28th March 2018, 03:52   #4011  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 165
Quote:
Originally Posted by Motenai Yoda View Post
I also notice some memory leak since few releases, with avspmod
I noticed something similar with ThrowError() and a lot of text, where AvsPmod (and not AviSynth+ I think--I'll have to test in another app when I have time) would essentially turn into this:
Code:
for(;;)
    malloc(1000000);
In any case I would never assume leaks or bugs are in AviSynth+ by testing with only AvsPmod, considering how insanely buggy AvsPmod alone is.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 28th March 2018 at 04:03.
`Orum is offline   Reply With Quote
Old 28th March 2018, 10:35   #4012  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,073
Quote:
Originally Posted by `Orum View Post
I noticed something similar with ThrowError() and a lot of text, where AvsPmod (and not AviSynth+ I think--I'll have to test in another app when I have time) would essentially turn into this:
Code:
for(;;)
    malloc(1000000);
In any case I would never assume leaks or bugs are in AviSynth+ by testing with only AvsPmod, considering how insanely buggy AvsPmod alone is.
If AvsPmod attempts to catch an exception thrown from inside Avisynth (for example, if a plugin raises an error using Avisynth's ThrowError), then yes, it'll most likely leak the exception object (if the catch actually works at all, which isn't certain either). Attempting to catch an exception from across a DLL boundary should in general never be done. It is only safe if both sides are built with the exact same compiler and linked with exactly the same runtime, but even then, just don't. Avisynth API calls should never be wrapped in try/catch blocks. See this article on the wiki.
TheFluff is offline   Reply With Quote
Old 28th March 2018, 14:53   #4013  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 165
Quote:
Originally Posted by TheFluff View Post
it'll most likely leak the exception object
That still doesn't explain why it would endlessly allocate memory until it couldn't any more.

Anyway, the point was that at the very least AvsP[mod] shouldn't be a test for memory leaks from AviSynth+. It should be tested with something a lot more stable, e.g. VirtualDub, avs2yuv, AVSmeter, etc. And even then, to make sure the leak is within AviSynth+ itself one should avoid external filters.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 28th March 2018 at 14:56.
`Orum is offline   Reply With Quote
Old 28th March 2018, 21:33   #4014  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
New build with important fixes and some minor tweaks. Thanks for the reports.
Download Avisynth+ r2664-MT


In this changelog I left there intentionally some lines about a finally postponed modification. Read it as a preliminary info (32 bit float YUV chroma format). We could start a discussion about it.

Code:
20180328 r2664
--------------
-   Fix: YUY2 Sharpen overflow artifacts - e.g. Sharpen(0.6)
-   Fix: Levels: 32 bit float shift in luma
-   Fix: Merge sse2 for 10-14bits (regression)
-   Fix: AVX2 resizer possible access violation in extreme resizes (e.g. 600->20)
-   Fix: 32bit float PlanarRGB<->YUV conversion matrix
-   Fix: VfW: fix b64a output for OPT_Enable_b64a=true
-   Enhanced: VfW output P010 and P016 conversion to SSE2 (VfW output is used by VirtualDub for example)
-   Enhanced: ColorYUV: recalculate 8-16 bit LUT in GetFrame only when changed frame-by-frame (e.g. in autowhite)
-   Enhanced: ConvertBits 32->8 sse2/avx2 and 32->10..16 sse41/avx2 (8-15x speed)

Not included, preliminary for the near future:
-   Big change: 32 bit float YUV formats, U and V are now zero based.
    Internally YUV 32 bit float chroma center became 0.0 (the neutral value which is 128 in the 8-bit world)
    Like in VapourSynth or in avsresizer using z.lib image library.
    'Expr' changes are affecting built-in constants/operators when used in chroma plane of a 32bit clip.
    - 'cmin', 'cmax' return the zero-based shifted versions of the 16 and 240 (8 bit) values
    - For U and V planes, constant 'range_half' results in 0.0 instead of the old 0.5
    - 'scaleb' will also give zero-based result when found in an expression for chroma plane 
      (e.g. for a 32 bit float clip the '128 scaleb' will result in 0.0 instead of 128/255 for U and V planes)
      But 'scalef' when the target or source of the constant conversion is 32bits, remains independent from the plane type.
    - 'range_max' is 0.5 for 32 bit float chroma
    - new constant 'range_min', which is -0.5 for 32 bit float chroma, (0 otherwise)
    
    Additional warning: when you move 32bit float U or V plane to Y using CombinePlane, you have to be sure 
    that your filters do not rely on this new Y plane being in 0..1 range. Or else convert it by using Expr("x 0.5 +") to the 0..1 range
    Similarly: ExtractU and ExtractV will simply return the unaltered chroma planes, which are now zero-centered
pinterf is offline   Reply With Quote
Old 29th March 2018, 16:22   #4015  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 506
Thanks for the update.
I do not know if someone happens to me but the downloads by GitHub are very slow, and I have problems entering to avisynth.nl.
__________________
By law and justice!

Flea Market
GMJCZP is offline   Reply With Quote
Old 29th March 2018, 16:23   #4016  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 165
Are variables not cached along with frames? For example (forgive the obvious assumptions made, it's just to illustrate the problem):
Code:
#define MAX_DELTA 1

for(int f = 0; f < 100; f++) {
	PVideoFrame vf = clip->GetFrame(f, env);
	
	strstream dbg;
	dbg << env->GetVarDef("FFPICT_TYPE", AVSValue('?')).AsInt() << ends;
	OutputDebugStringA(dbg.str());
	dbg.freeze(false);
	
	for(int n = 1, n <= MAX_DELTA; n++)
		foo(vf, clip->GetFrame(f + n, env)); // What foo() does isn't really relevant here, just know that it doesn't request any frames
}
If you raise MAX_DELTA, you suddenly get different output for your FFPICT_TYPE vars! This could also be a bug in FFVideoSource() but it seems more likely (to me, anyway) that the variables set when a frame is retrieved are not cached and restored when that frame is requested again and returned from AviSynth+'s cache later on. So, is that the case?

Edit: I can write my own filter in order to rule out (or in) FFVideoSource() as the problem if you'd like.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 29th March 2018 at 16:35.
`Orum is offline   Reply With Quote
Old 29th March 2018, 17:03   #4017  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Avisynth has no frame properties like Vapoursynth has. The method of filling the variable is a workaround hack which probably works only when the variable is constant.
You can define a filter to NonCachedGenericVideoFilter, like Reverse or Loop works internally.
pinterf is offline   Reply With Quote
Old 29th March 2018, 17:31   #4018  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 165
Quote:
Originally Posted by pinterf View Post
The method of filling the variable is a workaround hack which probably works only when the variable is constant.
Ah, that's unfortunate. I don't suppose there's any chance this will change in the future?
Quote:
Originally Posted by pinterf View Post
You can define a filter to NonCachedGenericVideoFilter
Correct me if I'm wrong but this won't fix the issue if, for example, you have a script like this:
Code:
FFVideoSource("foo.mkv")
bar()
myfilter()
If bar() is someone else's filter that's cached and does frame requests outside of the current frame, my filter would still have issues getting the correct FFPICT_TYPE, right?

Edit: Now that I think about it, even if AviSynth+ cached these it would still require the earlier filter to do the request for any non-offset frames last. For instance, if you think about a filter that does a temporal blend of frame 'f' with radius 'x' (forward and backward), it would still have to request frame 'f' last and not frame 'f + x' to get the variable correct. It seems like a better solution is to either parse the the FFVideoSource() cache (if that even contains the picture types), or the source file itself, but neither is friendly if there's a simple Trim() in the script before it hits myfilter(). In any case, there's no general solution, as even the idea of a picture type disappears with any temporal filtering.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 29th March 2018 at 19:17.
`Orum is offline   Reply With Quote
Old 29th March 2018, 20:37   #4019  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 506
Quote:
Originally Posted by GMJCZP View Post
I do not know if someone happens to me but the downloads by GitHub are very slow, and I have problems entering to avisynth.nl.
Someone?
__________________
By law and justice!

Flea Market
GMJCZP is offline   Reply With Quote
Old 29th March 2018, 21:20   #4020  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,983
Quote:
Originally Posted by GMJCZP View Post
Thanks for the update.
I do not know if someone happens to me but the downloads by GitHub are very slow, and I have problems entering to avisynth.nl.
Quote:
Originally Posted by GMJCZP View Post
Someone?
No problems here.
poisondeathray 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 03:32.


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