umezawatakeshi / utvideo

Ut Video Codec Suite - fast lossless video codec
http://umezawatakeshi.github.io/utvideo/
GNU General Public License v2.0
288 stars 12 forks source link

Can you expand the AVX/AVX2 CPU support for the 4:2:0 8bit (ULH0) formats too? #36

Closed Cuberlain closed 3 years ago

Cuberlain commented 3 years ago

Dear Umezawatakeshi!

Can you expand the AVX/AVX2 CPU support for th 4:2:0 8bit formats too? Especially for the ULH0 NV12 and YV12 input formats. I read an Utvideo history in this webpage: http://umezawa.dyndns.info/archive/utvideo/utvideo-19.0.1-readme.en.html

....and I realized that higher colorspaces have AVX/AVX2 support since a long time. It would mean high improvement of performance in YUV 4:2:0 compression!

I often record 4K camera videos with UT video to mini laptop via HDMI-USB3 converter stick, when I walking on the streets.

Thank you for your reply!

Best regards! Bye!

umezawatakeshi commented 3 years ago

I could not understand what you are requesting from me. The optimized routines are added as needed and are not implemented because AVX(2) does not make it faster.

Cuberlain commented 3 years ago

I could not understand what you are requesting from me. The optimized routines are added as needed and are not implemented because AVX(2) does not make it faster.

Hello Umezawatakeshi!

I read this info about AVX and AVX2 in "the Read me" file of Utvideo: http://umezawa.dyndns.info/archive/utvideo/utvideo-22.2.0-readme.en.html

Quote: Version 12.1.0

Performance Improvements

    ULRG,ULRA,ULY2: Speed up encoding from native colorspace if AVX instructions are available. About 10% faster in case of x86, and about 12% faster in case of x64.
    ULRG,ULRA,ULY2: Speed up decoding video that were encoded with "Optimize for compression ratio" option to native colorspace if AVX instructions are available. About 5% faster in case of both x86 and x64.

Bug fixes

    UMRG, UMRA: In pre-AVX2 environment, intraframe encoding result is wrong when the remainder of width divided by 64 is 32.

" end of quote.

So I read that the above mentioned color spaces (ULRG,ULRA,ULY29) have AVX and AVX2 support, However I did not see any AVX or AVX2 support for the ULH0 (8bit YUV 4:2:0) colorspace encoding.

Maybe it is just a small (close to invisible) difference for a strong computer, but it would be big difference and important for slower small machines like a mini-laptop, what I use to capture NV12 HDMI video of my camcorder.

Thank you for your reply!

umezawatakeshi commented 3 years ago

Ah, I finally understand what you are talking about.

As it turns out, what you're looking for is either already implemented or not needed.

--

Here is some technical information.

Firstly, as of version 12, ULRA, ULRG, and ULY2 supported some packed formats as native colorspace formats such as YUY2. AVX2 are used to reorder them quickly. On the other hand, ULY0 only supported YV12 as its native colorspace format. YV12 is a planar format, so there is no need to reorder it originally. Also, in version 22.1.0, when ULY0 supported NV12, which is a partially packed format, the AVX2 optimized reordering routines were added from the beginning.

Secondly, the current version is accelerated by methods that are not faster with AVX2. In version 20.3.0, the aforementioned reordering process and the subsequent processing were done simultaneously, resulting in a significant speedup. In this case, using AVX2 does not speed up the process. This speed is much faster than using AVX2 in the non-simultaneous case.

Cuberlain commented 3 years ago

Umezawatakeshi! , thank you for your detailed technical answer!

I have an other question. In many capture/recorder softwares you can choose from many types of Utvideo codecs. In some softwares however neglect my choice. For example: I chose ULH0 in Daum's Potplayer, when I want to record from an NV12 camcorder device, but somehow the result is always captured in RGB color. So the capture softwares can overwrite my original choice (ULH0) and put the video arbitrarily into RGB format? How is it possible? Is this a bug in their potplayer? I can't write to Potplayer, because I couldn't even register to their forum. (maybe their website has technical problems) https://potplayer.daum.net/forum/ucp.php?mode=login

umezawatakeshi commented 3 years ago

If you have another question, you should open another issue.