Kodi Community Forum
Solved Multi-threaded h264 decoding in Frodo? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Solved Multi-threaded h264 decoding in Frodo? (/showthread.php?tid=151680)



Multi-threaded h264 decoding in Frodo? - foolosophy - 2013-01-11

Hi. I compiled Frodo RC3 (XBMC 12.0-RC3 Git:20130102-7a6cb7f) with --enable-external-ffmpeg flag but XBMC does not decode h264 video the same way ffplay does. I am particularly interested in getting XBMC to play video using all CPU cores available. On XBMC 11 this used to work fine and I was able to play 1080p x264 files without any "choppyness".

I'm on Arch Linux x86_64. If I play a file with ffplay, it is played using more than one core smoothly. But if I open the same file with XBMC, playback is choppy in CPU intensive parts (frames are dropped): only one core is used (to 100%).

This line of xbmc.log is particularly interesting:
Code:
INFO: ffmpeg[E9FFB700]: [h264] Cannot parallelize deblocking type 1, decoding such frames in sequential order

Hardware: Intel® Atom™ CPU D510 @ 1.66GHz (no external GPU, only the one included on die, which is pretty bad)
Linux 3.6.11
ffmpeg 1.0.1 with pthreads
x264 20121113-1

File codecs:
Stream #0:0(eng), 3, 1/1000: Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1001/48000, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng), 8, 1/1000: Audio: ac3, 48000 Hz, 5.1(side), s16, 640 kb/s (default)

Is there any way to modify XBMC's code to allow decoding of h264 video with more than one thread?




RE: Multi-threaded h264 decoding in Frodo? - basco - 2013-01-11

Are you able to play 1080i @ 50 hz with deinterlacing using pure cpu processing?


RE: Multi-threaded h264 decoding in Frodo? - foolosophy - 2013-01-11

If you mean 50fps... I guess I never tried. All the videos I remember watching were at most 30fps. But yeah, I've been able to watch without a hiccup 1080p videos with it.

If you mean something different... I did not understand what.


RE: Multi-threaded h264 decoding in Frodo? - basco - 2013-01-11

oh i my post was nog entirely clear.
i would like to use a cpu (not a gpu) for 1080i (recordings, live tv) decoding.
that's one part

and i wonder if it is possible to deinterlace the 1080i video at 50 fps also by cpu on top of that?
that's the second part.

i can't seem to find examples of people that have done this....
1080p is no very cpu extensive since it does not need to be deinterlaced.


RE: Multi-threaded h264 decoding in Frodo? - foolosophy - 2013-01-11

If you send me a link to a downloadable non-copyrighted file of "1080i video at 50 fps" I can test and tell you.


RE: Multi-threaded h264 decoding in Frodo? - FernetMenta - 2013-01-11

@foolosophy - currently we have disabled multi-threaded decoding because it breaks hw decoders. They badly fail when using this.

@basco - yes, you can engage de-interlaceing done by cpu. Don't you find the de-interlacing option when using sw decoder?


RE: Multi-threaded h264 decoding in Frodo? - foolosophy - 2013-01-11

@FernetMenta - OK, can you tell me how to enable it for my own personal build? I don't use HW decoders.

Do you know how is this implemented in the code? If I am using external (multithreadded) ffmpeg, why does XBMC play the file with one single thread anyway?


RE: Multi-threaded h264 decoding in Frodo? - FernetMenta - 2013-01-11

see: https://github.com/elupus/xbmc/commit/a0fc63df945440719a724d80ab0afbc28f67263e


RE: Multi-threaded h264 decoding in Frodo? - foolosophy - 2013-01-12

Thank you! I would have never found it. Commenting that line solved it!


RE: Multi-threaded h264 decoding in Frodo? - fritsch - 2013-01-12

It works even easier - lol:

Check, try to use:

Code:
if (!m_bSoftware)
   m_pCodecContext->thread_type = FF_THREAD_SLICE;

This will restore the normal behaviour, when the software decoder is used - so for all Hi10p files, e.g.


RE: Multi-threaded h264 decoding in Frodo? - fritsch - 2013-01-12

I sent a PR: https://github.com/xbmc/xbmc/pull/2064

This makes in deed hi10p 1080 work on my fusion - without any hazzle.