Log in

View Full Version : Avisynth 2.5 real world performance benefits


Pages : [1] 2

patja
30th January 2003, 22:38
Does anyone have some real world performance benchmarks comparing processing times for Avisynth 2 to 2.5? My understanding is one of the chief benefits of sticking in the YV12 space is performance, with the secondary benefit being some minor quality improvements due to staying in a single color space.

I only work with HDTV encoding, either to WMV or DVD. I did one comparison of HDTV 1080i to WMV 720p and saw almost zero performance improvement. Maybe windows media encoder is the gating factor in performance for both of these scenarios (maybe it isn't pulling frames at max avisynth+plugin capacity in either scenario). All I'm doing in avisynth is a telecide using the new decomb.dll and a lanczosresize. a 7:22 length clip took 54:25 using the old avisynth and 52:28 using the new one.

Haven't tried running the same clip through tmpgenc to DVD format yet as a comparitive benchmark, but this first test made me wonder under what scenarios are people seeing real-world performance benefits of avisynth 2.5.

Asmodian
30th January 2003, 22:53
Going from DVD to Xvid in Vdubmod I got a very significant performance increase by changing to 2.5, though I cannot remember the actuall difference in time i think it was on the order of 25% but the %gain is very dependent on the filter chain so....

sh0dan
30th January 2003, 22:56
The primary speedup will mostly apply if your destination supports YV12 input. Otherwise your material will still be converted to YUY2 - or even worse, RGB (as it is the case with TMPGEnc). This will be done by a video codec (DivX or XviD, XviD being the fastest).

If your destination only supports YUY2 or RGB, the best way to benefit from the speedup is to convert to that colorspace before delivering it to the encoder.

VirtualDubMod supports passing YV12 to XviD and DivX - I don't know if Nic's WMV-encoder does.

In general it depends on the filters you are applying. Decomb has not yet been optimized for YV12 for instance, so if you'd post the script that would also help.

Also there is an unresolved issue that still offers lower performance in some cases (I'm refering to the "makewriable issue"). Once this is resolved we'd be able to get even more speed.

patja
30th January 2003, 23:50
Here's my script:

LoadPlugin("d:\tools\avisynth25\mpeg2dec3.dll")
LoadPlugin("d:\tools\avisynth25\decomb.dll")
MPEG2Source("F:\YR.d2v")
Telecide(reverse=false,swap=false,firstlast=false,post=true,threshold=15,dthreshold=9,blend=true,chroma=false,y0=0,y1=0)
LanczosResize(1280,720)

Evil Andy
31st January 2003, 11:55
Before installing 2.5 I did a quick encode from a vob using no plugins other than mpeg2dec and then did the same encode using 2.5 and mpeg2dec3

I got an almost bang on the dot 20% speed increase.

N_F
31st January 2003, 12:02
I got 20-25% increased speed.

bond
31st January 2003, 12:07
hm i didnt noticed any speed increase with avisynth2.5 with an dvd -> avi encode by using xvid and virtualdubmod.

here is my .avs script:

LoadPlugin("C:\PROGRA~1\AVISYNTH 2.5\PLUGINS\mpeg2dec3.dll")
mpeg2source("C:\Eigene Dateien\Eigene Videos\movie.d2v")
trim(140153,147269)
crop(2,80,716,418)
BicubicResize(640,256,0,0.5)

the final .avi is in yuy2, why?

seewen
31st January 2003, 12:43
Maybe your source is not in YV12 or you don't use a XviD supporting YV12 ( last Keopi are able to ) or you don't use "FastRecompress" in VdubMod.

DBaT
31st January 2003, 12:43
@bond

If you used fastrecompress in vdubmod it should be YV12.
For me ffdshow shows in information field sometimes YV12 as YUY2
and sometimes as YV12 as it should.

bond
31st January 2003, 13:09
my source is the matrix dvd

i used fastrecompress in vdubmod

i used koepis 260103 unstable build

bsplayer shows that the dvd and the avi both are "YUY2 DR-Overlay". can this be true?

:(

Evil Andy
31st January 2003, 13:19
@bond
If you load up the following script in VDubMod and look in File->File Information does it show it as YV12 there?

LoadPlugin("C:\PROGRA~1\AVISYNTH 2.5\PLUGINS\mpeg2dec3.dll")
mpeg2source("C:\Eigene Dateien\Eigene Videos\movie.d2v")

bond
31st January 2003, 16:26
Originally posted by Evil Andy
@bond
If you load up the following script in VDubMod and look in File->File Information does it show it as YV12 there?

LoadPlugin("C:\PROGRA~1\AVISYNTH 2.5\PLUGINS\mpeg2dec3.dll")
mpeg2source("C:\Eigene Dateien\Eigene Videos\movie.d2v") it says yv12!

how can i find out if the .avi is yv12 too?

markrb
31st January 2003, 16:40
I am getting a modest speed increase doing DVD to mpv in CCE.
I have gone from 1.33 to .1.37 -> 1.40.
Not much, but I do have to convert back to YUY2.
edit: Now it's up to 1.57. A full .24 higher then before.
I guess it just takes longer to achieve a stable speed then the old version.


I do have resample audio in the script.
What is this I am seeing that this might cause a slowdown?
I am not doing audio at all in CCE, but I have an AMD chip and I always use it to avoid issues.

Mark

sh0dan
31st January 2003, 18:12
If there is no audio in the clip, Resampleaudio() will have no effect.

jang0
31st January 2003, 19:25
Originally posted by sh0dan
If there is no audio in the clip, Resampleaudio() will have no effect.

I'm using the combination of Avisynth 2.5 beta, mpeg2dec3 v1.00, VirtualdubMod 4.1.13.1 and Xvid Koepi 26012003 build (latest unstable binary) and a vob source which is of course yv12. When putting info() in the filter chain, it always displays YV12, the same applies for "File Information" in Virtualdub mod. But when encoding the file with xvid using "fast recompress", ffdshow displays YUY2 as colorspace. Is it wrong what ffdshow reports? how can i veryfy that no color space conversions are done and the resulting avi is really in yv12 color space?

markrb
31st January 2003, 23:16
I have always had issues with avisynth and CCE if I don't add the resampleaudio command.
It was shown that with AMD cpu's if you don't add resampleaudio(44100) CCE blows up even if you are not doing audio in CCE. The original VOB has audio, it's just not being encoded by CCE.

There is plenty of info around the forum on this issue.

Has this changed with the new version of avisynth?

DVD2SVCD adds it to the avs file for the reason stated above.

I don't know what has happened, but now CCE crashes all the time with the new avisynth file no matter what I do. I will have to look into this further.

edit: I now see the post I should have read all along. I haven't tried it yet, but I will soon. I never saw the addaudio plugin to fix the AMD issue until just now. I should have read more before posting.

Mark

sh0dan
31st January 2003, 23:39
Originally posted by jang0
ffdshow displays YUY2 as colorspace.

(I hope I understand your question correctly)

The AVI is in MPEG4 - not in any specific colorspace. Only uncompressed video is in a certian colorspace. Some codecs do however accept different colorspaces for both input and output (and then does the appropriate conversion).

So the input the encoder recieves when the file is compressed, doesn't have any influence on the output of the decoder. You can feed RGB into the encoder, and ffdshow will still show YUY2.

btw, isn't this a problem only present in the CCE 2.50 version, and fixed inlater versions?

SiXXGuNNZ
1st February 2003, 00:46
I see no improvement in my encoding speed

I still use gknot to make the avs file, maybe this is why?

I only use the resize and crop in gknot, and it loads like 8 filters, which ones am I actually using when making this thru gknot?

my script

#
# Created with Gordian Knot
#
# http://gknot.doom9.org
#
# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\MPEG2Dec3.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\decomb.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\IVTC.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\Avisynth_Spatial.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\GreedyHMA.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\TomsMoComp.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\vobsub.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\SimpleResize.dll")
#
# SOURCE
mpeg2source("D:\DOWNLOADS\The.Matrix\15.d2v")
#
# TRIM
#trim(startframe,endframe)
#
# IVTC
#Telecide().Decimate(5)
# or use
#IVTC(44,11,95)
#GreedyHMA(1,0,4,0,0,0,0,0)
#
# DEINTERLACING (1)
#FieldDeinterlace()
#TomsMoComp(1,5,1)
#
# CROPPING
crop(0,64,718,348)
#
# DEINTERLACING (2)
#SeparateFields().SelectEven()
# or maybe
#GreedyHMA(1,0,0,0,0,0,0,0)
#
#
# SUBTITLES
#VobSub("FileName")
#
# RESIZING
BicubicResize(704,288,0,0.5)
#
# DENOISING: choose one combination (or none)
# 1) little noise (fast)
#TemporalSmoother(2,1)
#
# 2) medium noise (slow)
#SpatialSoftenMMX(1,4,6,false,false,4,4,6,8)
#TemporalSmoother(2)
#
# 3) heavy noise (very slow, you have been warned)
#SpatialSoftenMMX(2,4,6,false,false,4,4,6,8)
#TemporalSmoother(3)
#SpatialSoftenMMX(1,4,6,false,false,4,4,6,8)
#
# BORDERS
#AddBorders(left,top,right,bottom)
#
# COMPRESSIBILITY CHECK
# !!!!Snip Size now has to be 14 for use in GKnot!
#SelectRangeEvery(280,14)
#
# FOOL CCEnc
#ResampleAudio(44100)


I always use fast recompress and I dont process the audio thru gknot, I do it seperately and join it after the encode.

jang0
1st February 2003, 00:46
Originally posted by sh0dan
(I hope I understand your question correctly)

The AVI is in MPEG4 - not in any specific colorspace. Only uncompressed video is in a certian colorspace. Some codecs do however accept different colorspaces for both input and output (and then does the appropriate conversion).

So the input the encoder recieves when the file is compressed, doesn't have any influence on the output of the decoder. You can feed RGB into the encoder, and ffdshow will still show YUY2.

Oh, i don't know much about video codecs, i thought even if a video is compressed, it still stores color information in a certain color space, but this doesn't seem to be the case, so my question was pointless. :o
But I wonder why ffdshow outputs mpeg4->yuy2. i thought, when displaying video on a computer monitor, things have to be converted to RGB anyway. :confused:

SiXXGuNNZ
1st February 2003, 00:57
okay, so I am an idiot :D

the #'s mean not used :p

well here is the new script I used, and it still is about 12fps, same as before when using 2.07

LoadPlugin("C:\PROGRA~1\GORDIA~1\MPEG2Dec3.dll")
mpeg2source("D:\DOWNLOADS\The.Matrix\15.d2v")
crop(0,64,718,348)
LanczosResize(704,288)

Guest
1st February 2003, 03:34
I can't make any sense of sh0dan's statement either.

Acaila
1st February 2003, 09:30
@SiXXGuNNZ:

LanczosResize is what is slowing you down. Try BicubicResize or even SimpleResize and you should see a vast speed improvement.

sillKotscha
1st February 2003, 13:25
BicublinResize.dll is a good alternative, too... damn fast!!

you'll have 3 possiblities


- FastBilinear is like trbarry's simpleresize
- FastBicubic is a unfiltered Bicubic resampler
- Bicublin use bicubic on Y plane and bilinear on UV planes.



Edit:
I know it's a major goal of everyone to have a significant speed improvement but isn't even better to have a very stable avisynth release with enormous possibilities... and knowing how to use it correct will give you the speed you've expected ;)

sh0dan
1st February 2003, 13:48
Originally posted by neuron2
I can't make any sense of sh0dan's statement either.

I'm just trying to clear out a misunderstanding, that the encoded video is in either YUY2 or YV12 colorspace! So what ffdshow is showing when the encoded video is played has nothing to do with the colorspace it was encoded in.

sh0dan
1st February 2003, 13:49
Originally posted by SiXXGuNNZ
I see no improvement in my encoding speed


Are you using vdubmod? If not, you will not get any significant speedup.

scmccarthy
1st February 2003, 17:24
@sh0dan&bondThe AVI is in MPEG4 - not in any specific colorspace. Only uncompressed video is in a certian colorspace. Not true. (Ce n'est pas vrai?)

Divx and Xvid both encode everything to the YV12 color space. And any mpeg4 decoder will convert that to RGB while displaying it on a computer screen. mpeg2 and mpeg4 use YV12. DVDs are in mpeg2 and divx is mpeg4. The first divx 3.11 alpha is a hack of microsofts mpeg4 codec. With AviSynth 2.5, the video can be encoded into an avi file without converting to another color space along the way.

What the BSplayer says about the color space means nothing! That is because every divx avi file is going to be in the same color space, no matter how is was encoded. Anything based on an MPEG4 codec does have a specific color space: YV12.

@bond

And of course sh0dan definitely knows this, I think the term 'overlay' refers to the way the bsplayer decodes the YV12 file.

divx files being in the YV12 color space is not new, what is new is AviSynth being able to deliver that color space directly to the encoder with out doing intermediate processing in YUY2 or RGB. This only affects the encoding process, not the decoding process of any player. That has not changed a bit. Mmmm, I could have put this last paragraph at the start of my post and it would have beed a lot shorter.

And yes, I am oversimplifying, mpeg2 and mpeg4 can use both YUY2 and YV12. But DVD and mpeg4 codecs in windows PCs actually, the same applies to linux, oh, and quicktime!, but that's not divx, it's just based on mpeg4 as well. both use YV12. They are both only a subset of the total specifications.

Stephen

SiXXGuNNZ
1st February 2003, 20:58
yes I am using the latest vdubmod, with the updated exe from january

I'll mess around with my resize filters, thanks guys :)

bond
2nd February 2003, 15:54
scmccarthy

thanks that cleared up the whole thing!

so how can i be sure that there is no internal yv12 -> yuy2 (or whatever) -> yv12 color conversion in avisynth25; in which cases will this be still possible?

sh0dan
2nd February 2003, 20:16
Internally in AviSynth there will be _no_ conversion, unless you specify it. What can happend is that the application you are using isn't accepting YV12 input and therefore requests YUY2 instead. Then the DivX or XviD codec will kick in and convert the video to the format requested.

Virtual Dub will not accept YV12, and will request YUY2. VirtualDubMod does accept YV12. TMPEGEnc only accepts RGB24. CCE accepts RGB32 and YUY2.

bond
2nd February 2003, 20:28
hm so perhaps the new xvid codec caused the "non speed increase"!

thanks for the info

Leolo
3rd February 2003, 17:26
Hi people,

Do you know if it's possible to determine exactly which colorspace has been used to encode an MPEG2 file??

I have many MPEG2 files, but I'm afraid that maybe some of them have been encoded using YUY2 instead of YV12!!

@Evil Andy

Will your script tell me the exact colorspace that has been used to encode my files or will it just tell me the colorspace that MPEG2Dec3 is forcing them to be??

I mean, does Avisynth 2.5 really know in what colorspace was the file encoded, or does it just believe what MPEG2Dec3 says??

Sorry if this question is absurd, but I'm still very confused.

Thanks a million.
Regards.

sh0dan
3rd February 2003, 17:38
@Leolo/all: This is what I was trying to write above, but I wasn't very clear about it.


An MPEG^ file is NOT coded in the colorspace you supply it with - it is ALWAYS compressed as YV12.
When you feed YUY2 to your encoder it is ALWAYS converted to YV12.
When an MPEG^ is decoded the decoder might deliver in another format than YV12 - however, the file is still stored as YV12.


^ MPEG = all MPEG formats, both MPEG 1,2 and 4. There are slight variations, but that is not important here. Xvid, DivX are also MPEG's.

Sorry to spell it out - I just don't want any more misunderstandings here. (I hope you see what I meant above, now ;) )

Leolo
3rd February 2003, 19:10
Hi sh0dan,

Thanks a lot for the explanation!

However, there's still one thing I don't understand: why do all MPEG files use only the YV12 colorspace??

Is YV12 the same as Chroma 4:2:0 ? And is YUY2 the same as Chroma 4:2:2 ??

Could it be possible to find an MPEG file that uses YUY2 instead of YV12?

Which tool can we use to be completely sure of this?

Thanks a lot.
Regards.

Guest
3rd February 2003, 20:03
Actually the MPEG2 spec defines the color format as one of the following:

4:2:0 Y Cb Cr
4:2:2 Y Cb Cr
4:4:4 Y Cb Cr

Y Cb Cr corresponds to Y U V. 4:2:0 Y Cb Cr corresponds to YV12 and 4:2:2 Y Cb Cr corresponds to YUY2. So it is not true that MPEG must be YV12. The format is specified in the chroma_format field of the sequence extension of the MPEG syntax.

Leolo
4th February 2003, 02:49
Hi,

Thank you very much neuron2, now I understand. As scmccarthy said, maybe sh0dan was oversimplifying a bit in order to make the explanation easier.

By the way, I've found a nice tool to check mpeg streams and files. It shows a lot of detailed info, including the chroma format!

It's here:
http://www.tecoltd.com/bitratev.htm

Do you know if MPEG2Dec3 can read the "chroma_format" field and select the best output format automatically? Or is it mandatory to find out the chroma format by hand?

Thanks.
Best regards.

Guest
4th February 2003, 04:11
Originally posted by Leolo
Do you know if MPEG2Dec3 can read the "chroma_format" field and select the best output format automatically? Or is it mandatory to find out the chroma format by hand?
Although MPEG2 can support multiple formats, DVD's use only the 4:2:0 (YV12) format. So since mpeg2dec works with a .D2V file produced by DVD2AVI, you can be sure that you will only get YV12 data. Perhaps this is what sh0dan had in mind.

trbarry
4th February 2003, 05:51
I think all the DVD2AVI's and MPEG2DEC's are based more or less upon the same encoder, which does indeed have code in it for 4:2:2 and 4:4:4.

But probably no one really knows whether it works because in MPEG2 those are mostly reserved for studio profile use.

- Tom

scmccarthy
4th February 2003, 07:07
@LeolaDo you know if it's possible to determine exactly which colorspace has been used to encode an MPEG2 file?? There is no such thing as an mpeg2 file. You might have a file that conforms to the mpeg2 standard that an mpeg2 decoder can read, but mpeg2 is a broad standard and any file you may have uses a very small subset of that. As neuron2 already pointed out, if you are talking about vob files, then it is YV12. YUY2 is possible for mpeg-2, but not if it is a DVD.

If there is something absurd about your question, it is the over generality of the word mpeg-2. Any explanation of mpeg-2 in general will seem to contradict someone who makes assumptions about what type of files you are probably dealing with. Most of us know what we are talking about even if we don't appear to agree.

Stephen

fisix
4th February 2003, 12:36
Originally posted by trbarry
I think all the DVD2AVI's and MPEG2DEC's are based more or less upon the same encoder, which does indeed have code in it for 4:2:2 and 4:4:4.

But probably no one really knows whether it works because in MPEG2 those are mostly reserved for studio profile use.

- Tom

what is 'studio profile use'? just wondering.

fisix
4th February 2003, 12:48
Originally posted by neuron2
Actually the MPEG2 spec defines the color format as one of the following:

4:2:0 Y Cb Cr
4:2:2 Y Cb Cr
4:4:4 Y Cb Cr

Y Cb Cr corresponds to Y U V. 4:2:0 Y Cb Cr corresponds to YV12 and 4:2:2 Y Cb Cr corresponds to YUY2. So it is not true that MPEG must be YV12. The format is specified in the chroma_format field of the sequence extension of the MPEG syntax.


this is a very good post to remember. i believe that when i capture to my wintv card i am given the option to capture to 4:2:0, which might speed encoding a bit when i open in avisynth etc etc, correct?

except that i don't think that huffyuv has an option to save in yv12. has anyone looked at making a fast huffman compressor that saves in yv12? i thought someone was thinking about it a while back but i don't have the info.

finally, if i do a digital video capture, then is the DirectShowSource command stream from yv12 or do i have to do a conversion? that last one might be better placed in the dv forum, but i'll start here.

thanks

-fisix

Belgabor
4th February 2003, 16:33
This forum is just too active ;)

look here (http://forum.doom9.org/showthread.php?s=&threadid=38389). To make it short, its in the works but not ready yet.

trbarry
4th February 2003, 18:32
"what is 'studio profile use'? just wondering"

My copy of Video Demystified says that is the old name for the MPEG-2 4:2:2 profile. I don't know if 4:4:4 ever got approved but there is some code for it in DVD2AVI and the MPEG-2 sample decoder source code.

- Tom

Bulletproof
4th February 2003, 18:41
I think some studios use 4:4:4 for green/blue screening.

scmccarthy
5th February 2003, 01:02
I believe 4:4:4 Y Cb Cr is only created as a step towards converting to RGB. I don't believe it is really used as a color space in mpeg-2. I am going to check on that though.

Stephen

scmccarthy
6th February 2003, 11:45
In store.c, there is a 4:4:4 YUV output format where each plane is written to a separate file, *.Y, *.U, and *.V respectively. 4:4:4 YUV formats are probably only used during processing on the way to YUY2 or YV12.

trbarry
6th February 2003, 19:25
"4:4:4 YUV formats are probably only used during processing on the way to YUY2 or YV12."

On the way to YV12 from where? I don't think there are any RGB MPEG-2 DVD's.

- Tom

scmccarthy
6th February 2003, 22:57
@tom

I suppose it all starts from film doesn't it? And imported to a computer at a very high resolution. I don't remember if it is sampled in RGB or YUV. But initially, All planes will be the same size, sampled at 10 bits.

Stephen

trbarry
6th February 2003, 23:29
Okay, sorry. I thought you were saying that is how DVD2AVI was using it.

- Tom

scmccarthy
7th February 2003, 06:18
@tom

I was talking about the precedent to DVD2AVI. store.c, not store.cpp.
But later, I realized that if I want to study software to understand mpeg-2, I should study mpeg2enc instead of mpeg2dec. store(all versions) outputs in formats not nesessarily part of mpeg-2, like RGB. If I found the range of formats the encoder encodes into, then I'd know definitively. I have not seen any examples of mpeg-2 files in anything other than YUY2 and YV12. And you know DVD is always in YV12. Tom, I don't know why you fell back to DVD, when you are studying HDTV. That is in mpeg-2 as well isn't it?

@leola

If you work with mpeg-2 files that are not based on DVD, we'd like to know what it is. It's nice to expand our knowlege of what mpeg-2 encompasses. MPEG-2 was conceived as a computer, interleaved television broadcasting, and digital TV format. Prior to that, MPEG-1 was no good for television broadcasting, because it did not support interleaving, only progressive frames for Video CD. Any individual application of MPEG-2 is only a subset of the total format. Therefore, the only way to get a well rounded understanding of it is to collect as many different applications of the format as possible.

Stephen

Guest
7th February 2003, 07:19
There is no mystery about what MPEG2 is and no need to collect a bunch of applications to understand it. The MPEG2 specifications answer all the questions you allude to.

You might be surprised to know that the DirecTV satellite TV service debuted using MPEG1 (the MPEG2 encoders were not yet available and the spec was not quite finalized), so to say it was no good for TV broadcasting is uninformed.

I have all the specifications so if you have any specific questions about MPEG1 or MPEG2, just fire away. :)