pinterf / AviSynthPlus

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

ConvertToYV1* are notably slower than ConvertToYV24 when converting from RGB #19

Closed magiblot closed 5 years ago

magiblot commented 6 years ago

Hi there,

I have experienced some issues with the performance of the ConvertToYV12 and ConvertToYV16 functions (and their ConvertToYUV4xx equivalents).

In summary, doing a RGB->YV24->YV1* conversion path results in a higher processing speed than a direct RGB->YV1* conversion, in my IvyBridge (up to AVX) processor. I have made some measurements which show what I'm saying (the numbers are average FPS measured with AVSMeter):

imatge

I used the following source to run these tests. Then I added the Convert calls below:

ImageSource("tivissa-turisme-terres-ebre-ribera-catalunya-2.jpg",end=400)

The picture (1746x1200) can be found here: http://www.turismeriberaebre.org/municipi/tivissa/tivissa-turisme-terres-ebre-ribera-catalunya-2/. However, the issue is not exclusive to image sources.

Cheers.

pinterf commented 6 years ago

Good catch, reproduced, for me speed penalty is 2x (Source: colorbars). I suppose the result of the internal RGB->444 conversion is not cached while when you convert it to 444 by a separate script filter, the clip is cached. 444->420 conversion is done by using three internal filters (Y copy, and U and V are the results of the appropriately parameterized resizers), all of them has the 444 clip as input. Probably this step would benefit if the 444 clip is cached. But I need to investigate it further.

magiblot commented 6 years ago

Interesting. Do you think this may be a regression? I would like to try to reproduce this on older versions later when I get home.

pinterf commented 6 years ago

It was always working in avs+ like that, classic avs was not affected probably due the different caching mechanism. Anyway, problem was fixed in https://github.com/pinterf/AviSynthPlus/commit/4c06703fd6de5f346f2695c0e48b87e9c7fc666e Thanks for your good eyes.

magiblot commented 6 years ago

You are welcome. Thank you for working so hard!

magiblot commented 6 years ago

In my previous example there is another performance issue: ImageSource. In 64-bit AviSynth, it runs at ~17 fps for me when called just like above. On the other hand, ColorBars runs at ~150 fps (or 130 with staticframes=false). More interestingly, the following runs at ~210 fps:

ImageSource("tivissa-turisme-terres-ebre-ribera-catalunya-2.jpg",end=0)
Loop(4000)

However, ImageSource can also read image sequences so it's a bit more complex case than ColorBars. This is issue is not as crucial, though.

pinterf commented 6 years ago

Fixed, for some reason it was removed some years ago here: https://github.com/pinterf/AviSynthPlus/commit/fe9dab1bddd089c0908b83969c4a97b625db1d91

magiblot commented 6 years ago

Thank you very much. It seems curious to me that the fix is almost a one-liner. Is there any documentation on how to use the Cache feature?


De: Ferenc Pintér notifications@github.com Enviat el: dilluns, 27 d’agost de 2018 16:03:49 Per a: pinterf/AviSynthPlus A/c: magiblot; Author Tema: Re: [pinterf/AviSynthPlus] ConvertToYV1* are notably slower than ConvertToYV24 when converting from RGB (#19)

Fixed, for some reason it was removed some years ago here: fe9dab1https://github.com/pinterf/AviSynthPlus/commit/fe9dab1bddd089c0908b83969c4a97b625db1d91

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/pinterf/AviSynthPlus/issues/19#issuecomment-416237418, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATwQWaVJWHTJ_avvIpX7VKY-A0NIJvtZks5uU_xFgaJpZM4VxGhs.

pinterf commented 6 years ago

Don't know. A quick search: http://avisynth.nl/index.php/Filter_SDK/Env_Invoke InternalCache and Cache are synonyms in Avs+

magiblot commented 6 years ago

That link is clear enough. Thank you very much.