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. |
5th March 2013, 21:22 | #61 | Link |
Registered User
Join Date: Dec 2009
Posts: 63
|
I can easily reproduce this AccessViolations with simple script like this:
Code:
BlankClip(1001, 754, 562, Pixel_type="y8") ConvertToRGB32() In MPC-HC - by reloading the script. In MeGUI script creator - by reloading preview window. ... All the time it is AccesViolation, or app just dissapeared, or other things like "Parser: Unknown error". Actually, I came to this not from this bugreport, but from my own bug report, when the user told me that everything works fine when he uses DirectShow preview of the script (a simple player that based on DirectShow), but when switching to our own preview engine (that uses AviSynth.dll directly via AviSynthWrapper.dll) he've got alot of AcessViolations. Most of the time - on unloading AviSynth (when PClip var = some_clip; do something; and then on unloading var=NULL; - here, when destroying IClip on Release()). And then I remembered that in second case everything is Convert`edToRGB32() in AviSynthWrapper. Added ConvertToRGB32() at the end of the script - and now I can reproduce AVs with DirectShow too. Tested with Alpha4 and latest MT build; on Win XP SP2 with Intel Q6600 cpu. |
6th March 2013, 09:02 | #62 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Confirmed with VDMod and VD 1.9.11
Also Access violation with arg names supplied ie Code:
#BlankClip(1001, 754, 562, Pixel_type="y8") BlankClip(length=1001, width=754, height=562, Pixel_type="y8") ConvertToRGB32() VD 1st load may play OK, bomb on reload. VDMod, Bombs on reload and if exit without reload or play. XP32SP3 AppCompat.txt From VDMod bomb on noplay exit: http://www.mediafire.com/?dmy86jv3uxsogke
__________________
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 ??? |
6th March 2013, 13:06 | #63 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Failure is for aligned SSE3+ code path in ConvertYV24toRGB for widths 16*N+1, N a positive integer greater than 1.
Code:
N=2 BlankClip(10, 16*N+1, 16, Pixel_type="YV24") ConvertToRGB() Fixed in CVS. |
6th March 2013, 16:38 | #65 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Quote:
|
||
6th March 2013, 17:06 | #66 | Link |
Registered User
Join Date: Dec 2009
Posts: 63
|
There is also different source colorspaces (Y8 in my sample and YV12 was reported to me), but I hope that it makes no difference and affected code path is the same.
P.S. it would be nice to have a project files for something like MSVC2008\2010 on the CVS.. Last edited by forclip; 6th March 2013 at 18:49. |
6th March 2013, 22:20 | #67 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Well it's actually 16*N+[1..7] that are wrong, but they get harder to expose.
Wrong buffer length is (width*4 + 32), used buffer length is ((width+15)/16*64), the overrun is ((7 - (width-1)%16)*4) Code:
W%16 Overrun 1 28 2 24 3 20 4 16 5 12 6 8 7 4 |
13th March 2013, 15:03 | #68 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
I was looking at the additions for BlankClip. Why not add video (with the default parameters) when supplying an audio only template, instead of checking of the one the parameters width, height or pixel_type is set? Likewise for a video only template.
|
13th March 2013, 21:58 | #69 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@Wilbert,
So when you do BlankClip(Clip) you get identical clip properties to the template. If it's audio only you get a blank audio only clip. If it's video only you get a blank video only clip. If you start to modify the parameters to force a video or audio track, now you start with good defaults rather then possibly (probably) invalid junk from the template. |
17th March 2013, 17:58 | #71 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
|
Mmmm, i didn't realize you already documented everything ;( My fault of course.
Regarding the bit functions. Is there a difference between BitRShiftL, BitRShiftU and BitRShiftU for example? If not, why the need for three of them? I would also like to ask you to remove tau (as being 2 pi). It's not used in the scientific literature: http://en.wikipedia.org/wiki/Tau_%28...opular_culture, while it can denote a lot of other things: http://en.wikipedia.org/wiki/Tau. |
17th March 2013, 23:44 | #72 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Possibly a bit over-redundant but this is what we have, it allows building selections from Bit[LR]shift[AL] or Bit[LR]shift[SU] :-
7 synonyms for Left Shift, X << Y, bottom bits are always zero filled. bitlshift Left Shift bitlshiftl Left Shift Logical bitlshifta Left Shift Arithmetic bitlshiftu Left Shift Unsigned bitlshifts Left Shift Signed bitshl Shift Left bitsal Shift Arithmetic Left 3 synonyms for Unsigned Right Shift, (unsigned int)X << Y, top bits are zero filled. bitrshiftl Right Shift Logical bitrshiftu Right Shift Unsigned bitshr Shift Right 3 synonyms for Signed Right Shift, (int)X << Y, top bits are sign filled. bitrshifta Right Shift Arithmetic bitrshifts Right Shift Signed bitsar Shift Arithmetic Right 2 synonyms for Rotate Left, Top bit rolls to Bottom bit. bitlrotate Left Rotate bitrol Rotate Left 2 synonyms for Rotate Right, Bottom bit rolls to Top bit. bitrrotate Right Rotate bitror Rotate Right I added Tau() as a stir of a friend who is an avid Tau'ist, who I regularly poke with "The area of a circle is ∏rē". So I will take it out. |
8th April 2013, 13:03 | #73 | Link | |
Registered User
Join Date: Nov 2005
Posts: 693
|
Quote:
I'm trying to load a cue-indexed audiosong from a TAK-image which starts at 40053972 samples (908.25333s) and is 16986144 samples (385.17333s) long: Code:
LoadDll("C:\Program Files\AviSynth 2.6.0\plugins\tak_deco_lib.dll") BassAudioSource("D:\Test\Image.tak") AudioTrim(40053972/44100,-16986144/44100) AudioTrim(Float(40053972)/44100,Float(-16986144)/44100) ConvertAudioTo16bit With the 2nd AudioTrim foobar returns 16986144 samples, but when I then bit-compare the Avisynth-script and the cue-indexed TAK-song, it doesn't seem to be accurate: Code:
Differences found in 1 out of 1 track pairs. Comparing: "D:\Test\Image.tak" / index: 3 "D:\Test\Image.avs" Differences found: 33952821 sample(s), starting at 0.0000000 second(s), peak: 1.4393005 at 35.8453061 second(s), 2ch - Is it possible to AudioTrim with sample accuracy?
__________________
My hobby website |
|
8th April 2013, 20:05 | #75 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
Ah, got it. Thanks for the heads-up, Rumbah.
Another weird example: Another song within the same TAK-image starts at 113414616 samples (2571.76s) and is 21692496 samples (491.89333s) long: Code:
LoadDll("C:\Program Files\AviSynth 2.6.0\plugins\tak_deco_lib.dll") BassAudioSource("D:\Test\Image.tak") AudioTrim(113414616/44100.0,-21692496/44100.0) AudioTrim(113414616/44100.0,135107112/44100.0) ConvertAudioTo16bit Happens to WavSource() too, so at least BassAudio isn't faulty. Remove both AudioTrim()'s and bit-compare that to the entire TAK-image also results in 'no differences found'.
__________________
My hobby website |
8th April 2013, 23:32 | #76 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Avisynth floats have 24 bit precision, which gives an accuracy of about 1 part in 16.8 million (2^24). So any sample start, end or length values larger than this (which your examples all have) will not be sample-accurate. |
|
9th April 2013, 00:56 | #77 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@CoRoNe,
You are running into lack of precision with single precision floats. Floats only have a 24 bit mantissa so numbers bigger than 16,777,216 can not be represented exactly. Which for the way you are using the arithmetic and with 44100Hz streams is about 380.4 seconds (349.5 for 48000Hz). The code internally uses 64 bit integers and double precision floats, so as long as you feed it from the script with single precision numbers that can be represented exactly you can achieve audio sample exact results. You can trim between 1.0 and 16,777,215.0 integer seconds of audio exactly from the start of a clip. So to crib the precision do the AudioTrim in stages. Using integer arithmetic calculate whole seconds and a remainder. Code:
... Start=113414616/44100 Sremainder=(113414616%44100)/44100.0 Duration=21692496/44100 Dremainder=(21692496%44100)/44100.0 AudioTrim(Start, 0) # Chop off start integer seconds AudioTrim(Sremainder, 0) # Chop off start remaining fractional second # Chop full seconds and join with remaining fractional second AudioTrim(0, -Duration) + AudioTrim(Duration, -Dremainder) Code:
Trim::Trim(double starttime, double endtime, PClip ... ... __int64 esampleno = 0; ... audio_offset = min(max(__int64(starttime*vi.audio_samples_per_second + 0.5), 0), ... ... if (endtime == 0.0) esampleno = vi.num_audio_samples; else if (endtime < 0.0) esampleno = __int64((starttime-endtime)*vi.audio_samples_per_second + 0.5); else esampleno = __int64(endtime*vi.audio_samples_per_second + 0.5); |
9th April 2013, 21:29 | #78 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
Code:
LoadDll("C:\Program Files\AviSynth 2.6.0\plugins\tak_deco_lib.dll") BassAudioSource("D:\Test\Image.tak") AudioTrim(113414616/44100, 0) AudioTrim((113414616%44100)/44100.0, 0) AudioTrim(0, -21692496/44100) + AudioTrim(21692496/44100, -(21692496%44100)/44100.0) ConvertAudioTo16bit Code:
All tracks decoded fine, no differences found. Comparing: "D:\Test\Image.tak" / index: 7 "D:\Test\Image.avs" No differences in decoded data found. However, I've tried to come up with some script to mimic the cutting I did with Audacity earlier, but although the amount of samples are the same, there's a glitch at the cutting-point: Code:
Src=BassAudioSource("D:\Test\Image.tak") Prt1=Src.AudioTrim(113414616/44100, 0) Prt1=Prt1.AudioTrim((113414616%44100)/44100.0, 0) Prt1=Prt1.AudioTrim(0, -11161180/44100) + AudioTrim(11161180/44100, -(11161180%44100)/44100.0) Prt2=Src.AudioTrim(128129206/44100, 0) Prt2=Prt2.AudioTrim((128129206%44100)/44100.0, 0) Prt2=Prt2.AudioTrim(0, -6977906/44100) + AudioTrim(6977906/44100, -(6977906%44100)/44100.0) Prt1+Prt2 Code:
A=AudioTrim(113414616/44100.0, 124575796/44100.0) B=AudioTrim(128129206/44100.0, 135107112/44100.0) A+B
__________________
My hobby website |
9th April 2013, 23:38 | #79 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Code:
... Prt1=Prt1.AudioTrim(0, -11161180/44100) + Prt1.AudioTrim(11161180/44100, -(11161180%44100)/44100.0) ... Prt2=Prt2.AudioTrim(0, -6977906/44100) + Prt2.AudioTrim(6977906/44100, -(6977906%44100)/44100.0) It should give an error 'invalid params to AudioTrim()' (unless some earlier part of the script sets an implicit 'last'). |
|
10th April 2013, 00:14 | #80 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
Yeah, that! Lot's of '#'s for testing, but I forgot one it seems. Prt1 and Prt2 did the trick. Thanks! Silly me. Like I said, it's been a while.
__________________
My hobby website |
|
|