Log in

View Full Version : AviSynth 2.5.7 [Jan 7th] (was RC-3 [Dec 31st])


Pages : [1] 2

IanB
24th December 2006, 16:57
Okay RC-3 has gone live!

Get AviSynth_257.exe (http://downloads.sourceforge.net/avisynth2/Avisynth_257.exe) and Avisynth_257_src.zip (http://downloads.sourceforge.net/avisynth2/Avisynth_257_src.zip) from Sourceforge.

For the bandwidth conservative this release is the same as RC-3 (+4 Russian Doco updates)
==============================================
Summary of changelist (with respect to v2.56)
Avisynth COM object now implements IAVIStreaming interface.
DirectShowSource() enhancements.
Added KillVideo() verb.
TimeStretch SoundTouch library update, fixes and access to tuning parameter.
Explicitly try to request full sample rate, all channels and float, 32 bit then 24 bit samples from the audio codec.
File input/output support for WAVE_FORMAT_IEEE_FLOAT audio.
File input more than 2 channels in the audio stream.
Installer enhancments. Handling of readonly/protected target files.
Avisynth_c interface enhancments.
Hack for Fraunhoffer MP3 codec to work when wBitPerSample==16.
Added Portugese translation by RoLon.
Partly updated French translation by JasonFly.
Subtitle multi line text.
xxxFPS("preset") string preset FPS values.
ImageSource no longer uses static buffer.
Fixed Negative int arg handling for ApplyRange() and Animate().
Fixed SaveString memory block overrun.
Fixed $Plugin!Functionname!Param$ bug.
Fixed Various resource leaks.
Fixed runtime mixed SEH/C++ exception handling for XPsp2.
Fixed CAVIStreamSynth::Read audio buffer overrun.
Fixed Assert("...%...") crash.
Fixed Number parser returning inaccurate float conversions.
Fixed resizer subpixel shifting functionality and bad edge condition handling.
YUV ColorBars now match BT.801-1.
TCPDeliver updates, crash fixes and enhancments, big buffers.
Fixed Turn*() YUY2 mod 2 height test.
Fixed AVISource() corrupted error messages.
Fixed AVISource() direct input drop frame handling.
Remove 50 plugin auto prescan load limit.
Bracketless call of functions without arguments now get a cache.
Over-range numbers now raise a compile time exception.
xxxFPS(float) now uses continued fraction to generate a minimal rational pair.
ConvertFPS() blend mode works for all pixel formats.
SaveString memory blocks are now 32 bit aligned.
Default planar chroma planes mod 16 aligned.
See ChangeList (http://avisynth2.cvs.sourceforge.net/*checkout*/avisynth2/docs/english/changelist.htm?revision=1.64) for details
==============================================
RC-3
Okay last minute fixes from RC-2
Fix Cache of a cache of a cache .... problem (regression)
Have parser check for cache of a cache and skip extra instances.
Change ImageSource to not use a static buffer.
The rest as per RC-2 ....
See Post 3 (http://forum.doom9.org/showthread.php?p=921135#post921135) for the RC-2 updates.

Romario
24th December 2006, 17:10
Thanks.

Wilbert
24th December 2006, 17:16
Changelist with respect to RC1:

Additions:
* Blur()/Sharpen() MMX=False option to force use of C++ routines.
* Explicitly try to request input sample rate from the audio codec (Tritical).

Bugfixes:
* Fixed DirectShowSource greyframe regression.
* Fixed DirectShowSource audio format negotiation regression.
* Fixed TCPDeliver YV12 transfer 50% to much data.
* Fixed TCPDeliver do Makewritable before getting params.
* Fixed TCPDeliver audio transfer off by 4 bytes.
* Fixed resizer core boundary condition crashes/errors/glitches.
* Fixed Invert() crash with small widths.
* Fixed small memory leak Amplify().
* Fixed grey frames with internal start, stop, start while DSS is initializing.
* Fixed AudioChannels() returning non-zero when no audio (Tritical).

Optimizations:
* TCPDeliver big buffer enhancement (retro from 2.6 stream).

Changes:
* TCPDeliver add icon, make all resource US English.

Wilbert
24th December 2006, 17:18
Great work! Nice Xmas present :)

Btw, did you look at this problem: http://forum.doom9.org/showthread.php?p=900807#post900807 ?

Adub
24th December 2006, 19:45
Thanks Guys! Excellent work!

CruNcher
25th December 2006, 01:54
Yep thx IanB and Merry Christmas to you and the other contribs and devs :)

netsnake
25th December 2006, 04:41
thanks~ IanB and Merry Christmas to you

Pookie
26th December 2006, 03:55
Happy Festivus, Everyone !

IanB
26th December 2006, 07:49
Btw, did you look at this problem: http://forum.doom9.org/showthread.php?p=900807#post900807 ?Sorry, :o that one half slipped thru the cracks. I looked at it at the time and couldn't reproduce the problem, got distracted and forgot to ask for more details. I've now added a note to my 2.58/2.60 list.

Ebobtron
27th December 2006, 10:17
I'll add my thanks and best wishes for holiday happiness. ;)


function anslide(string file, int length, int dir, string IO, string zf)
{
a = ImageSource(file, start=0, end=0, fps=29.97).ConvertToRGB32

a = a.Lanczos4Resize(w, h)
return a.loop(length)
}
The above works and is faster than the following. But eats all the physical memory in a computer, fatally.
{
a = ImageSource(file, start=0, end=length-1, fps=29.97).ConvertToRGB32

a = a.Lanczos4Resize(w, h)
return a
}
My system slowly moves everything to the page file till there is nothing left that can be moved. The encoding process ends, terminates, crashes, pick one. (depends on the encoding app)

I have tried different combinations, ImageReader etc. It is not the ImageSource or Reader, appears to be with the Loop function. Found this Christmas day while making my dear one a slide show, checked current version before this post. This, of course only shows up if you like half hour slide shows.

Project contains 94 slides mostly jpegs with about 12 minutes of video, while encoding you can slowly watch the page file grow. It will crash while playing if you wish to wait long enough.


Thanks
Robert

shon3i
27th December 2006, 19:58
Is any chance to make avisynth to process pitcutre via gpu?

Adub
27th December 2006, 20:02
That would be sweet!

tsp
27th December 2006, 20:27
Is any chance to make avisynth to process pitcutre via gpu?

What do you mean exactly?

shon3i
27th December 2006, 21:35
What do you mean exactly?
I mean like you FFT3DGPU, but all internal avisynth filters to can use GPU instead CPU for processing.

martino
28th December 2006, 01:51
So what's the feedback from people who updated???

foxyshadis
28th December 2006, 03:50
The less feedback there is, the more stable it must be. :p Such has been the case for me, I haven't run across any of the old problems.

IanB
28th December 2006, 06:41
@Ebobtron,

So the image file is read once only, ImageSource uses a static buffer to hold the image, which does not get released until you close the script. I am guessing you are loading 94 big .JPGs, each with a separate ImageSource. So you end up trying to buffer 94 x 5+ megapixel BMP's. Which doesn't work very well.

The speed difference is because in the 1st case you resize each image once then loop it. In the 2nd case you resize each and every frame.

Both case exhibit the problem, I guess the 1st case also has some pathological swiss cheese issue with the cache which makes it a lot worse.

If the image files are consecutively numbered and the same size use the printf form for the filename in ImageSource, i.e. ImageSource("C:\Images\Img_%04d.jpg", 1, 99) this will load Img_0001 thru to Img_0099 as frames 0 to 98. If you set fps=0.1 and use ConvertFPS(29.97) each image will be displayed for 10 seconds.

Alternatively you could abuse FrameEvaluate to load and release each ImageSource in turn as a workaround.

In the medium term will see if I can redesign the code to avoid the static buffer.

IanB
28th December 2006, 08:34
@martino,

2.5.7 is primarily a maintainance release with very few new features, so the theory is it should work better than 2.5.6 in all cases. Of course not all bugs get fixed correctly, so you do get the occasional regression error.

This is the 2nd Release Candidate, so I am hoping all the regression of errors have been reported and fixed correctly. If no one reports any then this release will become the official 2.5.7 So please give it a spin now!

At this point I am only fixing things that worked in 2.5.6 and got broken subsequently. Bug's like the ones Wilbert and Ebobtron just reported were in both 2.5.5 and 2.5.6 so will now have to wait for the next release.

It only take a minute to install versions of Avisynth. The installer is designed to overwrite an existing version so flipping versions should be straight forward. If it is not then please report the problem

Ebobtron
28th December 2006, 11:47
@IanB
Thanks very much

Wilbert
28th December 2006, 15:50
Sorry, that one half slipped thru the cracks. I looked at it at the time and couldn't reproduce the problem, got distracted and forgot to ask for more details. I've now added a note to my 2.58/2.60 list.
It's probably not avs fault, but a problem of my setup.

It's a bit hard writing docs if stuff is not working as it should :) Let me summarize the problems i have (it's all about getting multichannel stuff in AviSynth). The following works correctly:

1) Opening (uncompressed) 5.1 WAV with WavSource.
2) Opening 5.1 AC3/DTS with NicAudio.

The following produces 2.0 output (while it should be 5.1):

1a) Opening 5.1 AC3/DTS in WAV with WAVSource and VCMACM.
1b) Opening 5.1 AC3/DTS in AVI with AVISource and VCMACM.

[However opening 5.1 AC3/DTS in AVI in VDub is done correctly (VCMACM is indeed used when looking at file properties), so VCMACM is installed correctly.]

2a) Opening 5.1 AC3/DTS in WAV with DirectShowSource using WAVE parser and ffdshow (dts decoding enabled and uncompressed: all supported set).

2b) Opening 5.1 AC3/DTS in WAV with DirectShowSource using WAVE parser and AC3Filter.

2c) Opening 5.1 AC3/DTS in AVI with DSS (using either ffdshow or AC3Filter).

My speaker setup is set to 5.1 (in ffdshow/AC3Filter downmixing is UNchecked). I've run use-waveout-no-dsound.reg if that helps anything.

Anybody any hints what i'm doing wrong, or things i need to check?

IanB
29th December 2006, 00:06
Well for 1a, 1b gonna have to poke a known example with the debugger to see what is happening. For reference does an older VDub still get 5.1. Try a late 1.4 or an early 1.5 the code there will be pretty much the same as AVS uses. Maybe Avery has fixed something we can fix likewise.

For 2a, 2b, 2c A DSS logfile of the open sequench could shed some light. (logmask=-1 pls)

Wilbert
29th December 2006, 14:47
The files:
http://www.geocities.com/wilbertdijkhof/SurroundTest.dts
http://www.geocities.com/wilbertdijkhof/SurroundTest_DTS.wav
http://www.geocities.com/wilbertdijkhof/1280x720_PAL_Mpeg4+DTS_in_AVI.avi

1a) Opening 5.1 AC3/DTS in WAV with WAVSource and VCMACM.
1b) Opening 5.1 AC3/DTS in AVI with AVISource and VCMACM.
Same problem (2.0 output) in VDub 1.4.13 and 1.5.10.

2a) Opening 5.1 AC3/DTS in WAV with DirectShowSource using WAVE parser and ffdshow (dts decoding enabled and uncompressed: all supported set).
log, script and graph: logs.zip

2b) Opening 5.1 AC3/DTS in WAV with DirectShowSource using WAVE parser and AC3Filter.
log, script and graph: logs.zip

2c) Opening 5.1 AC3/DTS in AVI with DSS (using either ffdshow or AC3Filter).
Ok, i didn't test this one correctly, because this one works as it should (returns 5.1 ch).

IanB
31st December 2006, 03:54
http://www.geocities.com/wilbertdijkhof/1280x720_PAL_Mpeg4+DTS_in_AVI.avi
404 Not found! Spelling ???

2c) Opening 5.1 AC3/DTS in AVI with DSS (using either ffdshow or AC3Filter).Ok, i didn't test this one correctly, because this one works as it should (returns 5.1 ch).Need the log for this one to compare a working with a not working from the same machine.

IanB
31st December 2006, 09:46
@Wilbert,

Well the DSS mode just straight up bids stereo, no negotiation, no compromises, just do it! Sir YES Sir!

So if you run these graphs in GraphEdit you get stereo there as well? And what about old mplayer2?

So then what Direct Show apps actually give you 5.1?

I am suspecting there is some magic incantation, like __HIRESOUTPUT for WMA, that need to be cast before it does the good stuff.

Wilbert
31st December 2006, 14:23
http://www.geocities.com/wilbertdijk...DTS_in_AVI.avi
404 Not found! Spelling ???
ftp and character problems (i guess) ... Try a zipped version one:
http://www.geocities.com/wilbertdijkhof/avi_dts.zip

This stuff is working on my nerves:
Need the log for this one to compare a working with a not working from the same machine.
This morning, for some reason, the following script:

DirectShowSource("D:\Captures\1280x720_PAL_Mpeg4+DTS_in_AVI.avi")

resulted in an access violation (see avi_dts_ac3filter.txt), while the corresponding graph plays fine. I could have sworn this worked yesterday .

When i make a graph out of it (1280x720_PAL_Mpeg4+DTS_in_AVI.avi, avi splitter, ac3filter, wavout removed), it loads and plays fine as 5.1 (see avi_dts_ac3filter_grf.txt) in AviSynth.


About DTS and AC3 in WAV. When playing them (using AC3Filter) in WMP6.4/MPC/GraphEdit all i get is garbled noise with 2.0ch. So ok, this has nothing to do with AviSynth. Let's focus on 5.1 avi and AviSource first :)

When I install RC3 this one plays fine too: http://www.geocities.com/wilbertdijkhof/logs3.zip

IanB
1st January 2007, 12:57
That avi_dts.zip, whoa! that's one M*F* weird avi! The avi audio header sayswFormattag 0x2001 (dts?)
nChannels 5 <= Should be 6
nSamplesPerSec 0xBB80 (48000)
nAvgBytesPerSec 0x00017068 (94312) = 754496 bit/sec
nBlockAlign 0x0001
wBitsPerSample 0x0000
cbSize 0x0000So you are at the mercy of whatever 0x2001 ACM codec you have installed. Possible the new ACM negotiation we now do, like ask for 5 channels, is confusing the codec. Binary Edit the header and change the 5 to a 6, offset 0x16A (362) and see what happens.

This morning, for some reason, the following script:DirectShowSource("D:\Captures\1280x720_PAL_Mpeg4+DTS_in_AVI.avi")resulted in an access violation (see avi_dts_ac3filter.txt), while the corresponding graph plays fine. I could have sworn this worked yesterday .build:Nov 27 2006 [12:11:30] This is a version that negotiates audio but before the audio negotiation bulletproofing went in. The codec tried to negotiate subtype {0000....0-00} => null pointer! Please use the DSS that comes with RC3.

IanB
1st January 2007, 13:04
@IanB
Thanks very muchRemoveing the static buffer stuff in ImageSource was trivial so I dropped it into RC3.

Please give your fast script a try and report on the results.

Wilbert
1st January 2007, 17:29
So you are at the mercy of whatever 0x2001 ACM codec you have installed. Possible the new ACM negotiation we now do, like ask for 5 channels, is confusing the codec. Binary Edit the header and change the 5 into a 6, offset 0x16A (362) and see what happens.
Ok, for clarity, i changed the 5 into 6 in the following line:

00 0160: 73 74 72 66 12 00 00 00 01 20 05 00 80 BB 00 00

and saved it. When opening the modified avi in VDub, it is indeed reported as 5.1 instead of 5 (under file info), so that's good i suppose.

However when i open the modified avi with AviSource.Info in VDub it still reports two channels.

build:Nov 27 2006 [12:11:30] This is a version that negotiates audio but before the audio negotiation bulletproofing went in. The codec tried to negotiate subtype {0000....0-00} => null pointer! Please use the DSS that comes with RC3.
Yes, if i use RC3, that DSS script works fine (as i wrote in the previous post).

Ebobtron
3rd January 2007, 06:13
Happy New Year back to you. :)

Thank you, I did not expect that you could or would address this so soon. I am reluctant to report that I can see no real difference in behavior with my script. Around 20,000 frames the preview window in HC went black with little letters describing some error, HC's error line showed a script error.

The function is anslide (animate slide)


tx1 = "Hi, this is the beginning"

f1 = "C:\Documents and Settings\HP_Administrator\My Documents\My Pictures\hanna\P0010.bmp"
f94 = "C:\Documents and Settings\HP_Administrator\My Documents\My Pictures\hanna\P0641.bmp"

global imagcount = 0

function anslide(string file, int length, int dir, string IO, string zf)
{

f = Value(zf)

global imagcount = imagcount + 1

facstrg = (IO == "In") ? "Spline(n,0,1," + string(length-1) + "," + zf + ")" : \
(IO == "Out") ? "Spline(n,0," + zf + "," + string(length-1) + ", 1)" : zf

a = ImageSource(file, start=0, end=0, fps=29.97, use_devil=FALSE). \
ConvertToRGB32

bc = BlankClip(length=1, width=720, height=480, pixel_type="RGB32", fps=29.97, \
audio_rate=48000, stereo=TRUE, sixteen_bit=TRUE)

ar = float(width(a)) / float(height(a))

w = ((a.width/2) > (a.height/2)) ? 720 : int((480*ar)*1.125)
h = ((a.width/2) > (a.height/2)) ? 480 : 480

a = (imagcount == 13) ? a.Crop(0,0,width(a)-50,height(a)). \
AddBorders(50, 0,0,0, color=$222222) : a

a = ((a.width/2) > (a.height/2)) ? a.Lanczos4Resize(w, h) : \
bc.Overlay(Lanczos4Resize(a, w, h), x=((720-w)/2))

#a = a.Lanczos4Resize(w, h)
a = a.Loop(length)

inxstrg = (dir == 2) ? String(720/2) : \
\
(dir == 8) ? String(720/2) : \
\
(dir == 5) ? String(720/2) : \
\
(dir == 6) || (dir == 3) || (dir == 9) ? \
"Spline(n,0," + String(720/2) + "," + String(length-1) + "," + \
String(((720/2)*f) - (((720*f)-720 ))) + ")" : \
\
(dir == 4) || (dir == 1) || (dir == 7) ? \
"Spline(n,0," + String((720/2)) + "," + String(length-1) + "," + \
String(360*f) + ")" : "0"

inystrg = (dir == 1) || (dir == 2) || (dir == 3) ? \
"Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(((h/2)*f)-((h*f-h))) + ")": \
(dir == 7) || (dir == 8) || (dir == 9) ? \
"Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(240*f) + ")" : \
(dir == 5) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(480/2) + ")" : \
(dir == 6) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(480/2) + ")" : \
(dir == 4) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(480/2) + ")" : "0"

outxstrg = (dir == 2) ? "Spline(n,0," + String(720/2) + "," + String(length-1) + "," + \
string(720/2) + ")" : \
(dir == 8) ? "Spline(n,0," + String(720/2) + "," + String(length-1) + "," + \
string(720/2) + ")" : \
(dir == 5) ? "Spline(n,0," + String(720/2) + "," + String(length-1) + "," + \
string(720/2) + ")" : \
(dir == 6) || (dir == 3) || (dir == 9) ? \
"Spline(n,0," + string(((720/2)*f)-(((720*f)-720))) + "," + \
String(length-1) + "," + String(720/2) + ")" : \
(dir == 4) || (dir == 1) || (dir == 7) ? \
"Spline(n,0," + string(360*f) + "," + String(length-1) + "," + \
String((720/2)) + ")" : "0"

outystrg = (dir == 1) || (dir == 2) || (dir == 3) ? \
"Spline(n,0," + String(((h/2)*f)-((h*f-h))) + \
"," + String(length-1) + "," + String(480/2) + ")": \
(dir == 7) || (dir == 8) || (dir == 9) ? \
"Spline(n,0," + string(240*f) + "," + \
String(length-1) + "," + String(480/2) + ")" : \
(dir == 5) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
String(480/2) + ")" : \
(dir == 6) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(480/2) + ")" : \
(dir == 4) ? "Spline(n,0," + String(480/2) + "," + String(length-1) + "," + \
string(480/2) + ")" : "0"

dxstrg = (IO == "In") ? inxstrg : outxstrg

dystrg = (IO == "In") ? inystrg : \
(IO == "Zm") ? inystrg : outystrg

out = a.zoom(factor=facstrg, width=720, height=480, \
dstx = dxstrg, dsty = dystrg, \
angle="0", show=false)
#out = a
# angle="Spline(n,0,-0,299,-0)"
# dstx="Spline(n,0,360,299,280)"
# dsty="Spline(n,0,240,299,450)"

aud = Tone(length=length, frequency=400, samplerate=48000, \
channels=2, type="Silence", level=0)

debug = true

return !debug ? AudioDub(out, aud) : \
AudioDub(out, aud).subtitle(string(ar)+" "+string(Framecount(out))+" "+ \
string(imagcount))
}

bdVid = DirectShowSource(\
"C:\Documents and Settings\HP_Administrator\My Documents\My DV\BugDance.avi", \
audio=TRUE).trim(904,4044).ConvertToRGB32(interlaced=TRUE). \
AmplifydB(-9, -9)

b = BlankClip(length=150, width=720, height=480, pixel_type="rgb32", fps=29.97, \
audio_rate=48000, stereo=TRUE, sixteen_bit=TRUE)

open = b.Subtitle(tx1, \
100, y=180, first_frame=0, last_frame=149, font="Amazone BT", \
size=62, text_color=$e1e1e1, halo_color=$000001, align=4, lsp=4). \
FadeIn(45)

close1 = b.Subtitle("blah blah", \
360, y=180, first_frame=0, last_frame=149, font="Amazone BT", \
size=62, text_color=$e1e1e1, halo_color=$000001, align=5, lsp=4)



t1 = b.Subtitle("January 2004", \
b.width/2, y=380, first_frame=0, last_frame=149, font="Amazone BT", \
size=62, text_color=$e1e1e1, halo_color=$000001, align=5).trim(0, 120).FadeIn(45)

Dissolve(b.trim(0, 135),open,\
\
t1, anslide(f1, 300, 5, "In", "1.70"), \
anslide(f2, 300, 8, "Out", "1.80"), \
bdVid, anslide(f94, 300, 5, "In", "1.4"), \
\
b.loop(2)++ close1.loop(2).FadeIO(45)++ \
b.loop(2), 45).AssumeBFF

Subtitle("Thanksgiving", \
x=b.width/2, y=380, first_frame=3360, last_frame=3440, font="Amazone BT", \
size=52, text_color=$ffffff, halo_color=$000000, align=5)

Subtitle("Hanukkah", \
x=b.width/2, y=110, first_frame=5070, last_frame=5150, font="Amazone BT", \
size=52, text_color=$ffffff, halo_color=$000000, align=5)

Subtitle("Christmas 2004", \
x=b.width/2, y=380, first_frame=5580, last_frame=5660, font="Amazone BT", \
size=52, text_color=$ffffff, halo_color=$000000, align=5)


MixAudio(WAVSource("C:\Documents and Settings\HP_Administrator\My Documents\hanna.wav"))

The original scripts average image size was 2272 x 1704 (jpegs), a few were 720 x 480 and two were larger scans, total slide count 107. About 27,285 frames from slides.

After your comments (http://forum.doom9.org/showthread.php?p=922210#post922210) I down-sized the slides to 795 x 596 and saved them as bitmaps, (switching to bitmaps from jpegs speeds up script loading big time) no speed-up encoding but the max page file I saw was 600 MB. If you comment out the zoom function from the script it runs real time but eats up the memory anyway.

It is funny; I can hear(hard-drive), or I could hear(huge jpeg) each image load the first pass through the script. It still seems to be maintaining the image in memory, because the images display immediately.

Because I like the resizers in AviSynth better than my batch resize software, I am going to begin working on a any file type to properly sized bmp out thing or something.

The more reasonable sized images seem to change the behavior, I'll keep you informed.

Alternatively you could abuse FrameEvaluate to load and release each ImageSource in turn as a workaround.Example please?

:thanks: Thanks for your help

IanB
3rd January 2007, 09:42
@Ebobtron,

BlankClip also allocates a static frame buffer per instance. This cannot be changed. You have one inside function anslide so get one per instance of anslide. Declare bc global outside the scope of anslide and just use the single global one everywhere.

Forget the FrameEvaluate it won't help.

Please do not reduce the complexity and size of example scripts when it is the complexity or size that is causing the problem. The posted script does not fail unless I increase the number of images loaded to 120. Hence I am not actually fixing your problem.

Please do remove all the pretty dross that does not effect problem i.e. <in out><x y>strg spline zoom stuff.

Please do provide source or reference of personal library functions like zoom.

Ebobtron
3rd January 2007, 11:36
@Ebobtron,

Please do not reduce the complexity and size of example scripts when it is the complexity or size that is causing the problem. The posted script does not fail unless I increase the number of images loaded to 120. Hence I am not actually fixing your problem.forum would not allow whole script, I cut out the repetitive stuff, yes I get that.


Please do remove all the pretty dross that does not effect problem i.e. <in out><x y>strg spline zoom stuff.
:) dross, really? :rolleyes: At least you think it's pretty. :)

Please do provide source or reference of personal library functions like zoom.Personal? I wish I could write something like that, get it here (http://www.avisynth.org/warpenterprises/files/zoom_25_dll_20050122.zip)
If you want the whole script I'll have to upload to FilmCutter's (http://members.aol.com/avsfilmcutter/index.html) webspace. And before I forget, thank you.
:thanks:

IanB
3rd January 2007, 14:31
Well it's all about singing from the same hymn sheet. I know roughly where you are coming from, so I can reconstruct a script, but I do it the way I think it should be written and possibly with an aim towards what I might suspect the bug to be. Clearly this causes wrong conclusions, yes image source's static buffer was a bad thing, but it was not whole cause of your problem, it may end up being unrelated.

It is better if you prune down the fancy parts of your script, if just to make sure it doesn't effect your problem.

Try globalizing the BlankClip, if it still fails please upload the simplest script that demonstrates the problem.

Ebobtron
4th January 2007, 07:15
Thanks IanB for being so patient with me. I'll get this right someday.
Ok back to the drawing board, start over.

I know that I have seen something that is not working as advertised. In thinking about it, my assumption that Loop() was at fault broke a cardinal rule about troubleshooting. That rule is "Don’t describe the fault, describe the symptoms without conclusions". Let the person you are asking take their own swing at it.

Sorry. :o

all jpegs used in this test are 2272 x 1704 or 1704 x 2272
I have 1 GB of memory installed, 960 MB available.

"SetMemoryMax(32)" did, I say did sit as the first line in my original script. Many test scripts I worked with did not include SetMemoryMax(32).

Without SetMemoryMax(32) the following script works just fine, system page file stays below 500 MB. Both FilmCutter's and MediaPlayerClassic's peak mem usage never exceed 220 MB.

With SetMemoryMax(32) both FilmCutter's and MediaPlayerClassic's peak mem usage will soar over 700 MB with FilmCutter's peak above 790 MB. Systems page file will hit 1 GB by slide number 27, 2 GB by slide 64 with FilmCutter showing error at slide 66 with MPC 1 slide sooner because FilmCutter was in memory.

Error displayed by both viewers:
CAVIS Stream Synth: System Exception Access violation 0x0 reading from 0x0

Setting SetMemoryMax(32) to 64 delays the problem, and 128
may resolve it, although I have not attempted to test that high.

The script shown below provides the example need for this post. The areas colored orange like this text generate incorrect frame counts for slides that are taller than wide.

SetMemoryMax(32)

f1 = "P8080001.JPG"
f2 = "P8080002.JPG"
f3 = "P8080003.JPG"

f4 = "P8090004.JPG"
f5 = "P8090005.JPG"
f6 = "P8090006.JPG"
f7 = "P8090007.JPG"
f8 = "P8090008.JPG"
f9 = "P8090009.JPG"
f10 = "P8090010.JPG"

f11 = "P8100011.JPG"
f12 = "P8100012.JPG"
f13 = "P8100013.JPG"
f14 = "P8100014.JPG"
f15 = "P8100015.JPG"
f16 = "P8100016.JPG"
f17 = "P8100017.JPG"
f18 = "P8100018.JPG"
f19 = "P8100019.JPG"
f20 = "P8100020.JPG"

f21 = "P8100021.JPG"
f22 = "P8100022.JPG"
f23 = "P8100023.JPG"
f24 = "P8100024.JPG"
f25 = "P8100025.JPG"
f26 = "P8100026.JPG"
f27 = "P8100027.JPG"
f28 = "P8100028.JPG"
f29 = "P8100029.JPG"
f30 = "P8100030.JPG"

f31 = "P8100031.JPG"
f32 = "P8100032.JPG"
f33 = "P8100033.JPG"
f34 = "P8100034.JPG"
f35 = "P8100035.JPG"
f36 = "P8100036.JPG"
f37 = "P8100037.JPG"
f38 = "P8100038.JPG"
f39 = "P8100039.JPG"
f40 = "P8100040.JPG"

f41 = "P8100041.JPG"
f42 = "P8100042.JPG"
f43 = "P8100043.JPG"
f44 = "P8100044.JPG"
f45 = "P8100045.JPG"
f46 = "P8100046.JPG"
f47 = "P8100047.JPG"
f48 = "P8100048.JPG"
f49 = "P8100049.JPG"
f50 = "P8100050.JPG"

f51 = "P8100051.JPG"
f52 = "P8100052.JPG"
f53 = "P8100053.JPG"
f54 = "P8100054.JPG"
f55 = "P8100055.JPG"
f56 = "P8100056.JPG"
f57 = "P8100057.JPG"
f58 = "P8100058.JPG"
f59 = "P8100059.JPG"
f60 = "P8100060.JPG"

f61 = "P8100061.JPG"
f62 = "P8100062.JPG"
f63 = "P8100063.JPG"
f64 = "P8100064.JPG"
f65 = "P8100065.JPG"
f66 = "P8100066.JPG"
f67 = "P8100067.JPG"
f68 = "P8100068.JPG"


b = BlankClip(length=300, width=720, height=480, pixel_type="RGB32", fps=29.97, \
audio_rate=48000, stereo=TRUE, sixteen_bit=TRUE)

global imagcount = 0
global bc = trim(b, 0 , 0).KillAudio

function getslide(string file, int length)
{

global imagcount = imagcount + 1

sfps = (299.700/length)*.10

a = ImageSource(file, start=0, end=0, fps=sfps, use_devil=FALSE). \
ConvertToRGB32

#a = ImageSource(file, start=0, end=0, fps=29.97, use_devil=FALSE). \
# ConvertToRGB32

ar = float(width(a)) / float(height(a))

w = ((a.width/2) > (a.height/2)) ? 720 : int((480*ar)*1.125)
h = ((a.width/2) > (a.height/2)) ? 480 : 480


a = ((a.width/2) > (a.height/2)) ? a.Lanczos4Resize(w, h) : \
bc.Overlay(Lanczos4Resize(a, w, h), x=((720-w)/2))

out = a.ConvertFPS(29.97)
#out = a.loop(length)

aud = Tone(length=(length/framerate(out)), frequency=400, samplerate=48000, \
channels=2, type="Silence", level=0)

debug = true

return !debug ? AudioDub(out, aud) : \
AudioDub(out, aud). \
subtitle(string(ar)+" "+string(imagcount))
}


Dissolve(b, \
\
getslide(f1, 300), \
getslide(f2, 300), \
getslide(f3, 300), \
getslide(f4, 300), \
getslide(f5, 300), \
getslide(f6, 300), \
getslide(f7, 300), \
getslide(f8, 300), \
getslide(f9, 300), \
getslide(f10, 300), \
\
getslide(f11, 300), \
getslide(f12, 300), \
getslide(f13, 300), \
getslide(f14, 300), \
getslide(f15, 300), \
getslide(f16, 300), \
getslide(f17, 300), \
getslide(f18, 300), \
getslide(f19, 300), \
getslide(f20, 300), \
\
getslide(f21, 300), \
getslide(f22, 300), \
getslide(f23, 300), \
getslide(f24, 300), \
getslide(f25, 300), \
getslide(f26, 300), \
getslide(f27, 300), \
getslide(f28, 300), \
getslide(f29, 300), \
getslide(f30, 300), \
\
getslide(f31, 300), \
getslide(f32, 300), \
getslide(f33, 300), \
getslide(f34, 300), \
getslide(f35, 300), \
getslide(f36, 300), \
getslide(f37, 300), \
getslide(f38, 300), \
getslide(f39, 300), \
getslide(f40, 300), \
\
getslide(f41, 300), \
getslide(f42, 300), \
getslide(f43, 300), \
getslide(f44, 300), \
getslide(f45, 300), \
getslide(f46, 300), \
getslide(f47, 300), \
getslide(f48, 300), \
getslide(f49, 300), \
getslide(f50, 300), \
\
getslide(f51, 300), \
getslide(f52, 300), \
getslide(f53, 300), \
getslide(f54, 300), \
getslide(f55, 300), \
getslide(f56, 300), \
getslide(f57, 300), \
getslide(f58, 300), \
getslide(f59, 300), \
getslide(f60, 300), \
\
getslide(f61, 300), \
getslide(f62, 300), \
getslide(f63, 300), \
getslide(f64, 300), \
getslide(f65, 300), \
getslide(f66, 300), \
getslide(f67, 300), \
getslide(f68, 300), \
\
b,45).AssumeBFF

#audio tracks removed

Before you slap me, I started using AviSynth on a 600 MHz system with 256 MB of mem, encodes could take days. I have gotten use to having SetMemMax in my scripts. Thought it was part of the dross. :D

;)

Thank you

IanB
5th January 2007, 01:43
@Ebobtron,

Okay, really cool bug. It's present in 2.5.6 as well so I won't be cutting a new 2.5.7. Work around do not SetMemoryMax() less than what a script actually needs to render a full GetFrame chain without resorting to frame stealing from the promoted region of the cache.

Problem goes like this :-
Lots of instances of getslide() function.
SetMemoryMax() low enough to cause VFB stealing.
Varying VFB sizes.
A Cache instance that can have a high hit rate. (ConvertFPS or Loop in this case).
Cache servicing ConvertFPS on the 1st hit starts promoting it's VFB's.
Total VFB pool is small so other VFB uses cause ConvertFPS's VFB to get stollen (lots of other VFB's but all wrong size).
On the next hit ConvertFPS's cache starts protecting it's VFB's by locking them.
Current slide finishes, next starts, different instance of getslide(), different instances of all contained classes.
Any locked VFB's stay locked, cache instance never accessed again to unlock VFB.
Repeat until all memory used.

I have many changes for the cache and memory management to put in 2.6, this will get fixed then.


Hints for your function:-

global bc = trim(b, 0 , -1).KillAudio # (0,0) is the whole clip

ImageSource(..., pixel_type="RGB32")

Use AddBorders() instead of Overlay(), it internally converts to YUV24 and back again. For other cases with YUY2 and RGB32 data, Layer() is a lot faster if it has the required feature.

The loop idea is fine, the ConvertFPS alternative ends up being the same. 6 or 0.5 Dozen?

It probably doesn't matter but for NTSC work 29.97 is not exactly 30000/1001. Put an AssumeFPS(30000, 1001, False) at the end of your script if it ever matters.

Ebobtron
5th January 2007, 06:55
@Ebobtron,

Okay, really cool bug. It's present in 2.5.6 as well so I won't be cutting a new 2.5.7.As to be expected, thanks alot anyway. I have learned a lot.Work around do not SetMemoryMax() less than what a script actually needs to render a full GetFrame chain without resorting to frame stealing from the promoted region of the cache....and if I knew how to determine that number I might be discussing AviSynth's code, not it's scripts. see end of post.


Hints for your function:-

global bc = trim(b, 0 , -1).KillAudio # (0,0) is the whole clip
... opps, this clip kind of wacks out the convertfps thing
... final script uses " global bc = b.KillAudio "
... " bc.Overlay(Lanczos4Resize(a, w, h), x=((720-w)/2)) " needs to be
... " bc.ChangeFPS(sfps, linear=FALSE).Overlay(Lanczos4Resize(a, w, h), x=((720-w)/2)) " global bc must be full clip because
... " a = a.ConvertFPS(29.970) " follows
... something about the "full clip" else "bc" after ConvertFPS has zero frame count.

ImageSource(..., pixel_type="RGB32")
... yes but (use_devil=false, pixel_type="RGB32") gets me an RGB32 only error. Devil was crashing but seems ok with (use_devil=true, pixel_type="RGB32") now ??? would memoryMax affect this.

Use AddBorders() instead of Overlay(), it internally converts to YUV24 and back again. For other cases with YUY2 and RGB32 data, Layer() is a lot faster if it has the required feature.
... was considering that, must make sure that zoom doesn't mess the aspect ratio.
... reason for overlay was to add borders to 3/4 pics.
... when zooming in or out with Zoom(), image edge flickers, small may not, I know that large black border does not.
... need to try this
The loop idea is fine, the ConvertFPS alternative ends up being the same. 6 or 0.5 Dozen?
... will make that stuff at the top easier
... could have told me sooner, I am not a math wiz, even worse,
... took me days to come up with " (299.700/length)*.10 "
... don't no one ask me how or why it works, I don't know and don't care
It probably doesn't matter but for NTSC work 29.97 is not exactly 30000/1001. Put an AssumeFPS(30000, 1001, False) at the end of your script if it ever matters.
... quite often I use 29.970
... when I notice reported framerates like 29.9699999
... 29.970 is more like 29.97002997003
So we have a memory management issue, not using SetMemoryMax() is not a solution. Redid old script restoring the jpegs and huge bitmaps added the global blankclip and made convertfps produce the proper number of frames for both 4/3 and 3/4 along with, of course, the long compile time, removed SetMemoryMax and she crashed at 96 slides, can I guess that default is 64, 512 takes a big chunk to start with but uses less memory by scripts end.

Adding global blankclip produces odd field / frame issue. There is always another NIGYYSOAB. ;)

Next post.Thanks for your time and extraordinary work on this wondrous thing, AviSynth.

IanB
7th January 2007, 11:16
2.5.7-RC3 is now 2.5.7!

JarrettH
7th January 2007, 18:08
Still need to use ColorMatrix with the new version?

Serbianboss
7th January 2007, 18:12
Just 2 questions:

1. Does filters from 2.6 work with 2.7 version(convolution,peachsmoother...)

2. Does is 2.7 faster than previous version?

Wilbert
7th January 2007, 18:22
I fixed the version numbers for you:
1. Does filters from 2.56 work with 2.57 version(convolution,peachsmoother...)
Yes of course.

2. Does is 2.57 faster than previous version?
No, it's mostly a bugfix release.

@JarrettH,
Still need to use ColorMatrix with the new version?
? Whether you need ColorMatrix has nothing to do with the AviSynth, but has everything to do with your source and your final output format.

JarrettH
7th January 2007, 18:32
Oh ok :cool:

Can I install on top of 2.5?

tsp
7th January 2007, 19:18
Oh ok :cool:

Can I install on top of 2.5?

yes...

Serbianboss
7th January 2007, 19:20
Does is enough just to uninstall older avisynth from start menu or we need to uninstall some more.

foxyshadis
7th January 2007, 19:50
Man, you guys are overthinking things. Just install it, and if it doesn't work, reinstall the old one. The important part of avisynth is just one file - avisynth.dll - which is easily replaced, and it doesn't change your configuration at all. (Unlike, say, SUPER.) No need to uninstall anything.

(If you do need to uninstall it, the uninstaller will remove the dll, the support folder, and the registry entries, as it should.)

tateu
15th January 2007, 13:23
I am experiencing a strange issue with Avisynth_257 (2005-12-14) and YV12 that is causing problems (scrambled looking video) for my input plugins (OMFInput and possibly QTInput). The same code worked better in v2.56 (I usually only work with images that are 720 in width), although now that I am looking at the following table...I wonder if GetPitch even worked 100% correct in v2.56. If YV12 images have to be Mod 4 in width, why does GetPitch only return Mod 16 in v2.56 and Mod 32 in v2.57? Shouldn't it return Mod 4 also?

Source frame is YV12.
PVideoFrame src = child->GetFrame(n, env);
int src_pitch = src->GetPitch();

Image | Image | GetPitch | GetPitch
Width | Height | v2.56 | v2.57
-------|---------|-----------|------------
128 | 480 | 128 | 128
132 | 480 | 144 | 160
160 | 480 | 160 | 160
164 | 480 | 176 | 192
172 | 480 | 176 | 192
176 | 480 | 176 | 192
| | |
704 | 480 | 704 | 704
708 | 480 | 720 | 736
716 | 480 | 720 | 736
720 | 480 | 720 | 736
728 | 480 | 736 | 736
736 | 480 | 736 | 736
748 | 480 | 752 | 768
752 | 480 | 752 | 768
760 | 480 | 768 | 768
768 | 480 | 768 | 768

Am I missing something here or is it really an error in AviSynth?

Thanks.

tsp
15th January 2007, 13:42
tateu: it was changed to mod16 aligned chroma data with YV12 (to improve performance with MMX/SSE instructions)

foxyshadis
15th January 2007, 14:02
Pitch is just an artifact of storage, it's always >= width. You need to make sure that you process with width but shift by pitch. (You're safe enough by processing all the way out to pitch if you want, though.) You should always be using loops with this basic structure:

srcp=src.GetReadPtr(plane);
src_pitch=src.GetPitch(plane)
height = src.GetHeight(plane);
width = src.GetWidth(plane);

for (int y=0; y<height; ++y)
{
for (int x=0; x<width; ++x)
{
dstp[x+y*dst_pitch] = srcp[x+y*src_pitch];
}
}

or the multithreading unfriendly method, if it's more clear:

for (int y=0; y<height; ++y)
{
for (int x=0; x<width; ++x)
{
dstp[x] = srcp[x];
}
srcp += src_pitch;
dstp += dst_pitch;
}

And equivalent optimizations, of course.

Note that every clip has its own pitch, and pitch can vary between frames, so it's unsafe to ever assume anything about it.

tateu
15th January 2007, 21:44
tsp:
Ok, It looks like I missed seeing that in the change log ("Default planar chroma planes mod 16 aligned")...but GetPitch in v2.57 is returning mod 32 for YV12. If it had been returning Mod 16, I never would have noticed a problem. Although, if I had written my code correctly (but where's the fun in that?), I would not have noticed it either. It's a lot better to trust in the AviSynth developer's code rather than anything I write...so I guess I should go and fix my code.

foxyshadis:
Thanks for the tip...if I had done it like that originally, the changes would not have broken my code.

squid_80
16th January 2007, 02:02
tsp:
Ok, It looks like I missed seeing that in the change log ("Default planar chroma planes mod 16 aligned")...but GetPitch in v2.57 is returning mod 32 for YV12.
For the chroma planes or the luma plane? IIRC the luma plane is mod32 to satisfy luma pitch = 2* chroma pitch.

IanB
16th January 2007, 03:04
Looks like everybody has covered all the issues here.

To re-emphasize

Do not assume any relationship between width and pitch in your code, always look up pitch per frame!

You can rely on pitch being >= width for all format.
You can rely on pitch being at least mod 4 for YUY2 and RGB32 formats.
You can rely on pitch being at least mod 16 for Planar formats.

Note Mod4 includes Mod16 includes Mod32!

P.S. "can rely on" also implies that all plugins must strive to output frames that comply with this!

P.P.S RGB24 is the poor cousin here and gets no promised alignments.

tsp
16th January 2007, 18:33
IanB: so if I call
env->NewVideoFrame(vi,-2);
the pitch will be at least mod4?