pinterf / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
208 stars 24 forks source link

MixAudio() produces stitches #25

Open keytouch opened 5 years ago

keytouch commented 5 years ago

MixAudio() produces stitches. When using MeGUI's downmix function

function c6_stereo(clip a) { fl = GetChannel(a, 1) fr = GetChannel(a, 2) fc = GetChannel(a, 3) lf = GetChannel(a, 4) sl = GetChannel(a, 5) sr = GetChannel(a, 6) fl_sl = MixAudio(fl, sl, 0.2929, 0.2929) fr_sr = MixAudio(fr, sr, 0.2929, 0.2929) fc_lf = MixAudio(fc, lf, 0.2071, 0.2071) l = MixAudio(fl_sl, fc_lf, 1.0, 1.0) r = MixAudio(fr_sr, fc_lf, 1.0, 1.0) return MergeChannels(l, r) }

It produces stitches. Additionally, the process speed is much lower than using official avs2.6 when MixAudio() is engaged. Here's the file that can reproduce the issue without difficulty. test.zip When using official avs2.6, I tried to find anything wrong, but it works well.

keytouch commented 5 years ago

Besides, Output using megui's wrapper produces much more stitches than using avs2pipemod

pinterf commented 5 years ago

Hi, x86 or x64?

keytouch commented 5 years ago

It was on x86, I will have a test on x64 now.

keytouch commented 5 years ago

It's the same behaviour on x64.

pinterf commented 5 years ago

-what is the speed difference you encounter (cacheing - if any - I suppose is totally different between classic and avs+) -what's your avspipemod commandline (to test similarly) My script now: function c6_stereo(clip a) { fl = GetChannel(a, 1) fr = GetChannel(a, 2) fc = GetChannel(a, 3) lf = GetChannel(a, 4) sl = GetChannel(a, 5) sr = GetChannel(a, 6) fl_sl = MixAudio(fl, sl, 0.2929, 0.2929) fr_sr = MixAudio(fr, sr, 0.2929, 0.2929) fc_lf = MixAudio(fc, lf, 0.2071, 0.2071) l = MixAudio(fl_sl, fc_lf, 1.0, 1.0) r = MixAudio(fr_sr, fc_lf, 1.0, 1.0) return MergeChannels(l, r) }

a=FFAudioSource("original_dts-hd.dts") v=BlankClip(length=10000000) AudioDub(v,c6_stereo(a))#.Info()

keytouch commented 5 years ago

Weirder now, with,

function c6_stereo(clip a) { fl = GetChannel(a, 1) fr = GetChannel(a, 2) fc = GetChannel(a, 3) lf = GetChannel(a, 4) sl = GetChannel(a, 5) sr = GetChannel(a, 6) fl_sl = MixAudio(fl, sl, 0.2929, 0.2929) fr_sr = MixAudio(fr, sr, 0.2929, 0.2929) fc_lf = MixAudio(fc, lf, 0.2071, 0.2071) l = MixAudio(fl_sl, fc_lf, 1.0, 1.0) r = MixAudio(fr_sr, fc_lf, 1.0, 1.0) return MergeChannels(l, r) } a=FFAudioSource("original_dts-hd.dts") v=BlankClip(length=10000000) AudioDub(v,c6_stereo(a))#.Info()

It's good, AND speed is normal. HOWEVER, with,

function c6_stereo(clip a) { fl = GetChannel(a, 1) fr = GetChannel(a, 2) fc = GetChannel(a, 3) lf = GetChannel(a, 4) sl = GetChannel(a, 5) sr = GetChannel(a, 6) fl_sl = MixAudio(fl, sl, 0.2929, 0.2929) fr_sr = MixAudio(fr, sr, 0.2929, 0.2929) fc_lf = MixAudio(fc, lf, 0.2071, 0.2071) l = MixAudio(fl_sl, fc_lf, 1.0, 1.0) r = MixAudio(fr_sr, fc_lf, 1.0, 1.0) return MergeChannels(l, r) } a=LWLibavAudioSource("original_dts-hd.dts") v=BlankClip(length=10000000) AudioDub(v,c6_stereo(a))#.Info()

It comes again, with slow speed.

keytouch commented 5 years ago

I will first investigate a bit into bit comparison of ff and lsmash alone for sake of consistency.

keytouch commented 5 years ago

All tracks decoded fine, no differences found.

Comparing: "C:\Users\\Desktop\test_alone_ff.flac" "C:\Users\\Desktop\test_alone_lm.flac" Compared 3081216 samples. No differences in decoded data found. Channel peaks: 0.0781555 0.1070557 0.2019653 0.0453491 0.0375061 0.0741272

Total duration processed: 1:04.192 Time elapsed: 0:00.698 91.98x realtime

keytouch commented 5 years ago

The above result is performed without any mixdown or process other than source filter.

keytouch commented 5 years ago

avs2pipemod.exe -wav test.avs > testout.wav same behaviour as directly inputting avs in megui.

FFAudioSource() == LWLibavAudioSource() == GOOD FFAudioSource() + c6_stereo() != LWLibavAudioSource() + c6_stereo() FFAudioSource() + c6_stereo() == GOOD

keytouch commented 5 years ago

avs2pipemod test batch test1.zip ff_stereo.wav and lw_stereo.wav won't match. ff.wav and lw.wav match.