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 8th July 2012, 11:36   #321  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@forclip,

With the script as quoted, and substituting a 384Kbit stereo .AC3 file I had lying around, I see no problem with any versions of Avisynth.dll from 2.5.8.5, 2.6.0.0, 2.6.0.1, 2.6.0.2, current CVS and my current development version. I used a fairly old modified NicAudio.dll I built myself based on version 2.0.0.5. circa 2007.

I tried a single pass linear save of the output stream as well as random spot playback.


From your avs_audio.png image, the bass25.wav sample has a big jump in level at around 2:10, this might be bugs with decoding your file with seeking. Add the EnsureVBRMP3Sync() filter to your NicAC3Source() and observe any change in behaviour. Also try to reproduce the results using ColorBars() in place of NicAC3Source() for the audio source.
IanB is offline   Reply With Quote
Old 9th July 2012, 01:28   #322  |  Link
forclip
Registered User
 
Join Date: Dec 2009
Posts: 63
Ok. With ColorBars() I also can reproduce this strange slowness issue, however audio output seems to be fine and it is not as slow as with the real sources. Using this script:
Code:
ColorBars().Trim(0, 50000)
MergeChannels(last, last, last)
MergeChannels(last, last)
ConvertAudioTo16bit()
with AviSynth 2.6 from 2009 it takes ~18sek to find the peaks. With more recent version(s) it takes ~23sek. Also, to get broken output my previous script can be simplified like this:
Code:
video = BlankClip(length=4248, fps=25.000, color=$000000)
audio = bassAudioSource("E:\Temp\1804_0.ac3")#.EnsureVBRMP3Sync()
AudioDub(video, audio)

MergeChannels(last, last)
ConvertAudioTo16bit()
The result is attached (and I will PM you with the source file). Uncommenting EnsureVBRMP3Sync() makes the things SLOW AS HELL, it takes something aboud 15 minutes to process! However, the output seems to be OK, but I've tried it only once since it is really VERY-VERY slow. But as I mentioned in my first post, this slowness sometimes appears, sometimes not, but most of the time it appears. Replacing avisynth.dll to version from 2009 - and exactly the same script ALWAYS takes only 4-5sek to precess, w\o any slowness. Before switching to AviSynth 2.6 (from 2.5.8 MT) I've never heard from my users about any problems related to audio processing (except "audio crash" that in 2.6 is fixed), now after we are using AviSynt 2.6, some of them reporting me that audio processing is SLOW from now. I can reproduce it on my side, also I can reproduce it in MeGUI, so this is not my app fault. This strange slowness can be reproduced with avs2wav too, but output seems to be OK, or I've tested it not very well..

Any ideas?
Attached Images
 
forclip is offline   Reply With Quote
Old 9th July 2012, 09:12   #323  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Please, send me also the source file 1804_0.ac3 to see if I can detect any trouble decoding whit NicAc3Source/bassAudioSource.

I don't know for what EnsureVBRMP3Sync() can make differences decoding CBR audio, like ac3 must be.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 10th July 2012, 05:02   #324  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@forclip,

Between 2.6.0.1 and 2.6.0.2 the ac_expected_next update line was moved later in the code, so for the no audio cache state the skipping chunks case was constantly being incorrectly triggered. This led to all the default audio caches needlessly becoming enabled resulting in lots of extra memcpy'ing happening, slowing things down. Not sure if it's the whole cause but it does have quite a performance impact.
Code:
...
  long _cs = ac_currentscore;
  if (start < ac_expected_next)
    _cs = InterlockedExchangeAdd(&ac_currentscore, -5) - 5;  // revisiting old ground - a cache could help
  else if (start > ac_expected_next)
    _cs = InterlockedDecrement(&ac_currentscore);            // skiping chunks - a cache might not help
  else // (start == ac_expected_next)
    _cs = InterlockedIncrement(&ac_currentscore);            // strict linear reading - why bother with a cache

...

>>  ac_expected_next = start + count;

  if (h_audiopolicy == CACHE_AUDIO_NONE || h_audiopolicy == CACHE_AUDIO_NOTHING) {
    child->GetAudio(buf, start, count, env);
    return;  // We are ok to return now!
  }

...

<<  ac_expected_next = start + count;

  while (count>maxsamplecount) {    //is cache big enough?

@tebasuna51,

EnsureVBRMP3Sync() adds a 1MB audio cache and causes a high penalty for any out of order accesses outside the audio cache (a seek to zero plus a linear read up to the new position). It made a good diagnostic tool here.
IanB is offline   Reply With Quote
Old 10th July 2012, 08:14   #325  |  Link
forclip
Registered User
 
Join Date: Dec 2009
Posts: 63
Great. Now I need to get a new build to check how it works..
forclip is offline   Reply With Quote
Old 10th July 2012, 22:02   #326  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by IanB View Post
...
EnsureVBRMP3Sync() adds a 1MB audio cache and causes a high penalty for any out of order accesses outside the audio cache (a seek to zero plus a linear read up to the new position). It made a good diagnostic tool here.
The: (a seek to zero plus a linear read up to the new position)

is only needed for VBR audio, with CBR you can access directly to needed frame to decode.

The GetAudio function from NicAc3Source do (with SAMPLES_PER_FRAME, StreamOffset and FrameLength fix and know for each ac3):

Quote:
if (start < BufferStart || start > BufferEnd)
{
// Calculate the index and the sample range of the required frame
_FrameIndex = FrameIndex;
FrameIndex = int(start / SAMPLES_PER_FRAME);
BufferStart = __int64(FrameIndex) * SAMPLES_PER_FRAME;
BufferEnd = BufferStart + SAMPLES_PER_FRAME;

// Seek to the frame, if required
if (FrameIndex != _FrameIndex + 1)
{
_fseeki64(Stream, StreamOffset + __int64(FrameIndex) * __int64(FrameLength), SEEK_SET);
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 10th July 2012, 23:52   #327  |  Link
forclip
Registered User
 
Join Date: Dec 2009
Posts: 63
IanB
Thanks for the fix and thanks for the build, seems like this issue is not reproducible anymore
forclip is offline   Reply With Quote
Old 11th July 2012, 12:10   #328  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by forclip View Post
IanB
Thanks for the fix and thanks for the build, seems like this issue is not reproducible anymore
What build work for you?
The last AVS 2.6.0 Alpha 3 [110525] in SourceForge or a new one?
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 11th July 2012, 23:19   #329  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
I gave forclip a private copy of my experimental development version. I have checked the fix into CVS.

The problem was as described above with the ac_expected_next calc being to late in the code.
IanB is offline   Reply With Quote
Old 29th July 2012, 15:46   #330  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Hi, two comments:

In conditional_functions.cpp:
Code:
AVSValue MinMaxPlane::MinMax(AVSValue clip, void* user_data, float threshold, int plane, int mode, IScriptEnvironment* env) {
  ...
    env->ThrowError("Compare Plane: This filter can only be used within run-time filters");
should be MinMax Plane instead of Compare Plane.

Also in avisynth.cpp:
Code:
PVideoFrame __stdcall ScriptEnvironment::NewVideoFrame(const VideoInfo& vi, int align) {
  ...

  if (vi.IsPlanar() && !vi.IsY8()) { // Planar requires different math ;)
    const int xmod  = 1 << vi.GetPlaneWidthSubsampling (PLANAR_U);
empty space should be removed (between sampling and the bracket), or is that allowed?
Wilbert is offline   Reply With Quote
Old 29th July 2012, 16:32   #331  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Wilbert View Post
Code:
    const int xmod  = 1 << vi.GetPlaneWidthSubsampling (PLANAR_U);
empty space should be removed (between sampling and the bracket), or is that allowed?
White space is not significant, so it's OK.
But perhaps for aesthetic reasons, all three uses of GetPlaneXXXSubsampling in that function should be written the same way.
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 29th July 2012 at 16:34.
Gavino is offline   Reply With Quote
Old 29th July 2012, 20:26   #332  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
This looks like a bug from Y8 to ConvertToRGB24(), to me.

Code:
Colorbars().convertToY8()
Addborders(0,0,5,0)
#crop(0,0,-5,0)		# Uncomment, No Red Stripe.
ConvertToRGB24()	# Produces LHS vertical Red Stripe in Current VDub & MediaPlayer Classic Home Cinema.
#ConvertToRGB32() 	# No red stripe
#Addborders(3,0,0,0)    # EDIT: Red stripe still there.
EDIT: Tried values up to about 15, only adding 5 on RHS produced the single pixel wide stripe.
__________________
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; 29th July 2012 at 21:05.
StainlessS is offline   Reply With Quote
Old 29th July 2012, 22:07   #333  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
EDIT: Tried values up to about 15, only adding 5 on RHS produced the single pixel wide stripe.
Good one. The following shows the same problem:
Code:
Colorbars(width=645, height=480, pixel_type="YV24")
ConvertToRGB24()
It looks like the left column of pixels is not being written in ConvertYV24ToRGB for pixel_step=3 (RGB24) in some cases. It's in the assembly stuff i think, so i need to pass.
Wilbert is offline   Reply With Quote
Old 29th July 2012, 23:29   #334  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Code:
Colorbars().convertToY8()
ERR=1				# Vary ERR 0+, Errors at eg 5, 21, 37, 53, 69
Addborders(0,0,ERR*16 + 5,0)
#crop(0,0,-5,0)		# Uncomment, No Red Stripe.
ConvertToRGB24()	# Produces LHS Red Stripe in Current VDub & MediaPlayer Class Home Cinema.
#ConvertToRGB32() 	# No red stripe
#Addborders(3,0,0,0) # EDIT: Red stripe still there.
Seems to be every multiple of 16 + 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 ???
StainlessS is offline   Reply With Quote
Old 30th July 2012, 00:07   #335  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Yes the RGB24 overrun save and mask code is borked. It shows up for width%16 == 5.

:Edit: RGB24 AddBorders(N, x, 0, y), N not mod 12 or not mod 16 is also borked.

Last edited by IanB; 31st July 2012 at 06:43.
IanB is offline   Reply With Quote
Old 2nd August 2012, 02:30   #336  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Fix committed to CVS ConvertToRGB24()

Fix committed to CVS AddBorders()
IanB is offline   Reply With Quote
Old 6th August 2012, 09:33   #337  |  Link
ryrynz
Registered User
 
ryrynz's Avatar
 
Join Date: Mar 2009
Posts: 3,650
I have to ask.. how's development coming along IanB? Your first post for this thread mentioned an update when you had more time three years ago.
ryrynz is offline   Reply With Quote
Old 6th August 2012, 10:46   #338  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
There is an update and its called v2.6.0 alpha3 25 May 2011 (about 14.5 months ago, not 3 years).
See 1st post.

EDIT: Thread was started 2009, but has endured several editions of v2.6.
EDIT: Perhaps a more (current) full date in thread title would be better, ie the year.
__________________
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; 6th August 2012 at 17:32.
StainlessS is offline   Reply With Quote
Old 15th August 2012, 13:10   #339  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Why don't we have IsY8 and IsYV411 at the script level? We currently have to write helper functions to achieve this, which is not very convenient. To know the chroma subsampling H & V ratios would be useful too.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 15th August 2012, 14:04   #340  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by cretindesalpes View Post
Why don't we have IsY8 and IsYV411 at the script level? We currently have to write helper functions to achieve this, which is not very convenient. To know the chroma subsampling H & V ratios would be useful too.
+1 on that.
__________________
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

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


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