What is the inefficency in Kodi for HEVC?
#1
So, I've noticed that in Windows using just a CPU, Kodi seems to have no chance of decoding 4K HEVC at 60fps. 24fps is doable but 60fps just peaks out. Even using my overclocked six core 4930K I can't get close to 4K HEVC at 60fps to work. I hit maybe 40fps tops, often more like 30.

Meanwhile MPC-HC can manage this no problem. Maybe 40%-50% CPU load. It's totally doable. My GPU is a R9 390X, so there's zero hardware acceleration for HEVC available. As far as I understand, while they are certainly different programs, FFMPEG is what is being used at the core of both problems. I get that different software has different performance but this seems to be a MASSIVE disparity between two pieces of software using the same core decoding solution. I've achieved similar results on a 3770K and 4590, so I don't think that this is machine specific.

So I was wondering if someone could explain to me why Kodi seems to be so much less efficient at decoding HEVC using software decoding in FFMPEG?
Reply
#2
To my knowledge R9 390X has UVD 6 that does support hevc.

Also possible that LAVFilters, which is used by MPC-HC, adds some additional capabilities.
Reply
#3
(2016-06-01, 21:55)FernetMenta Wrote: To my knowledge R9 390X has UVD 6 that does support hevc.

Also possible that LAVFilters, which is used by MPC-HC, adds some additional capabilities.

You're wrong about the 390X but so was I when I bought it. The 390 and 390X has UVD 4.2 as it's a GCN 1.1 chip. However the 380, 380X, have UVD 5.0 via their GCN 1.2 architecture and the Nano/Fury and beyond have UVD 6 also with GCN 1.2 architecture. So my 390X can't do anything beyond 4K H264. Yeah, the 390 and 390X have the crappiest secondary features, almost funny except that it's not.

Looking closely at MPC, it's using it's own software decoder, which is FFMPEG that it's built on, I even set the renderer to the old one that doesn't even support DXVA, and the 4930K is still spitting out buttery smooth 4K HEVC 60fps and 'Sofware Decoding' is what it's status screen is reporting. I'm pretty certain that MPC-HC is not doing any form of hybrid decoding and this system has no DXVA support for HEVC in it for any software to accidently use.

So why does Kodi seem to have a heart attack on the same files when the decoding core of both pieces of software are built around the same open source project. This isn't a small variation, this is 40% CPU usage full frame rate vs 100% CPU usage and 2/3rd frame rate. That difference is MASSIVE.

Using VLC, which is purely self-contained and again uses FFMPEG I get the same approximate results as MPC-HC gets.

So... Why?

Why does Kodi seem to be massively inefficient at this in comparison to something else using FFMPEG?
Reply
#4
I can't confirm your observations on my Macbook (i7). VLC completely fails to play this sample: http://demo-uhd3d.com/fiche.php?cat=uhd&id=96
Kodi skips but does much much better.
Reply
#5
Tried VLC on my Windows Laptop (I7, Lenovo W530) -> completely fails playing the above linked sample.
MPC-HC does better but far away from being smooth. Not sure how to tell MPC to disable hw acceleration (if this was activated)
Reply
#6
(2016-06-02, 20:35)FernetMenta Wrote: Tried VLC on my Windows Laptop (I7, Lenovo W530) -> completely fails playing the above linked sample.
MPC-HC does better but far away from being smooth. Not sure how to tell MPC to disable hw acceleration (if this was activated)

I think your machines may be insuficent for testing. I'm mainly tszfingt on a six core 4930k over clocked go 4.6 GHz,40-50% load on my test system may still be beyond anything the laptops you're testing on could ever reach. I'll post once I'm home from work, using your sample and using my 3770k and 4590 systems. I'll test with my 2630qm laptop as well, for good measure.
Reply
#7
That may explain it. For some reason Kodi limits ffmpeg threads to 8 (4 cores). I don't see any sense in this code and will drop it tomorrow.
Reply
#8
Be careful - it's a minimum (std::min) there in the code. It even makes less sense. All cores including HT ones should be used.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#9
I'm sorry but I am NOT posting with the sample clip. It's only downloading at 200KB/s, I worked 12hrs today, I work 12hrs tomorrow, I don't have time to wait for it to finish. I'll test using the sample later. I'm using a different 4K sample of some Japanese broadcast I got from Nyaa.eu which I won't link.

On my i7 3770K, a quad core overclocked 4.3ghz to with a Radeon HD 7950, again, hardware that can't possibly have any HEVC hardware decoding. I manage about 30% CPU usage in MPC-HC and in Kodi it comes short, CPU is 80% or higher, decoding framerate is about 30fps, it keeps getting behind the audio and once it's about 7 seconds out of sync it jumps the video ahead, garbling the image.

I've tried switching renders in MPC-HC and the 'Old Rendrer' is the slowest, it uses 50% CPU on my 4930K where as the enhanced video renderer manages 30% CPU usage or so on the 4930K.

A little slower and with less than 8MB of L2 Cache now! The i5 4590, clock speed quad core and this one lacks any hyper threading so it'll be less efficient with it's cores overall. This is a Haswell, it DOES have HEVC decoding, but the IGP is disabled because there's a Radeon HD 6950 in it instead. So no HEVC decoding is possible with how it's currently configured. With MPC-HC using the enhanced renderer we're seeing 80% or so CPU usage but it's much more irregular, ranging from 65% and sometimes kissing 100% but it seems to playback correctly. There could be the occasional dropped frame in there though. On Kodi we see the CPU nearly maxing out as best it can and a framerate of around 28fps.

So now I'm going to do a test, because I'm wondering if this is JUST HEVC. I'm going to test some 4K h.264 clips in software mode only. I'm going to use my Season 3 Video Game High School episodes since I have them laying around. I'm only testing on my i7 4930K. I'm wondering if it's an issue of rendering separate from decoding. ...But it would appear not, MPC-HC and Kodi both average around 15% CPU to decode this 4K, 24fps, h.264 encode. About the same really.

So I do have some HEVC 1080p 24fps files to test, let's do that next. ...And I'll spare you the boredom of specs, we see a similar disparity. 5% or so CPU usage on MPC-HC vs 10% or so on Kodi for the same file. That's double the CPU load to do the same task in HEVC. Though I admit that at such low demands, it can be hard to separate the decoding from the rest of the software and the background OS. I don't have time tonight but I will try to make a 1080p 60fps HEVC test file to better stress test the HEVC decoder at 1080p.

But I think Kodi may have a software HEVC issue. In software decoding MPC-HC and Kodi maintain parity for H.264 in software, but for HEVC there's a huge difference in performance. I'll post more probably Saturday night once I'm done my 68hr work week to try and help more. Sorry for the rushed, sloppy post, I got sleeping to go do soon. Tongue
Reply
#10
Could you by chance run an openelec, libreelec Nightly from usb stick? That sounds quite odd with that Hardware? Also post a Debug Log please.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#11
(2016-06-03, 06:36)fritsch Wrote: Could you by chance run an openelec, libreelec Nightly from usb stick? That sounds quite odd with that Hardware? Also post a Debug Log please.

Uhh, oh wow, like maybe Sunday? I'm stuck working long hours making the movies that people actually watch on Kodi. Tongue But I can give that a shot.
Reply
#12
Yeah, Fernet has changed the number of threads that are used for decoding. That code will come into the nightlies most likely tomorrow. So - first stay on windows, but update to tomorrow's nightly, please.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#13
Just try on my rig: i7 5930k (6 cores 12 threads) 3.5GHz and GTX980Ti (so no hardware decoding of HEVC)

1080p HEVC: CPU usage around 10-12%

4K 10bits HEVC: CPU usage around 20-25%

In both cases, all the 12 threads of the CPU seem to be used even if I use an old Krypton nightly build from April 1st
Moanbag is in da place!
Reply
#14
Yes. Starting tomorrow -> 16 threads will be used to compensate the async intrinsic operations. 12 *3 / 2 = 18, but we use 16 max.

You will see something like this in your log (core i3, 4 virtual cpus * 3 = 12 / 2 = 6 threads):
Quote:14:01:26 T:140345765537536 NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: HEVC (High Efficiency Video Coding)
14:01:26 T:140345765537536 DEBUG: CDVDVideoCodecFFmpeg - open frame threaded with 6 threads
14:01:26 T:140345765537536 DEBUG: CDVDVideoCodecFFmpeg - Updated codec: ff-hevc
14:01:27 T:140345765537536 DEBUG: CRenderManager::Configure - change configuration. 3840x2160. display: 3840x2160. framerate: 50.00. format: YV12P10
14:01:27 T:140348081105280 DEBUG: DeleteRenderer - deleting renderer

Compare it between today and tomorrow.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#15
(2016-06-03, 13:37)Gracus Wrote: 4K 10bits HEVC: CPU usage around 20-25%

In both cases, all the 12 threads of the CPU seem to be used even if I use an old Krypton nightly build from April 1st

Huh, what operating system are you running that on? I've tested on three different Windows 10 powered PCs and I can't make that remotely happen. I'm using 16.1 but just tested the recent nightly to no avail. I'm using the sample file provided in this thread and notta.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
What is the inefficency in Kodi for HEVC?00