Log in

View Full Version : Can h.264 decoders use all four cores?


Chengbin
28th June 2008, 17:26
I'm wondering if h.264 decoders can take advantage of quad core processors?

Dark Shikari
28th June 2008, 17:29
Sure, why not?

CoreAVC and DivX decoders both support 4 cores (the latter actually supports up to 8).

LoRd_MuldeR
28th June 2008, 17:41
Note: The H.264 decoder from "libavcodec", which is used by most OpenSource applications (MPlayer, VLC Player, ffdshow, Avidemux, etc.) has very limited multi-threading support until now...

Chengbin
28th June 2008, 17:53
What do you mean "until now". Does it mean there is one now that support multi-threading?

LoRd_MuldeR
28th June 2008, 18:19
What do you mean "until now". Does it mean there is one now that support multi-threading?

Again: There are commercial H.264 decoders that support multi-threading for a long time now! The CoreAVC Decoder is one example. The DivX H.264 Decoder is another example, although there only is a beta version available at the moment. The only noteworthy OpenSource H.264 decoder I'm aware of is the one from "libavcodec". That decoder has no official multi-threading support yet, but there is an (unofficial) patch floating around that will allow the H.264 decoder to use two threads (one for CABAC decoding, one for the rest). That multi-threading method isn't as efficient as the method used by the commercial decoders. But at least it gives some additional speed-up to libavcodec's H.264 decoder. If that isn't fast enough for you, spend 15$ for CoreAVC ...

Chengbin
28th June 2008, 19:07
is there any difference in quality of the decoded video using open source and commercial decoders?

Just a question, if I spend money on a commercial H.264 encoder, will I get a better picture quality than the open source x264 encoders assuming the output files have the same size?

LoRd_MuldeR
28th June 2008, 19:47
is there any difference in quality of the decoded video using open source and commercial decoders?

Nope. All H.264 decoders will give 100% identical output from the same input file. Well, except there is a bug in the decoder :p

But you don't have to worry, libavcodec's H.264 decoder is working correctly :)

Just a question, if I spend money on a commercial H.264 encoder, will I get a better picture quality than the open source x264 encoders assuming the output files have the same size?

x264 is one of the most advanced H.264 encoders available. It can compete with commercial encoders quality-wise and speed-wise :cool:

So most likely you won't get a significantly better quality (relative to filesize) using a commercial H.264 encoder. In fact the opposite might happen...

Chengbin
29th June 2008, 01:04
At what kind of bitrate will a Q6600 (single core only) lag when decoding a H.264 video?

LoRd_MuldeR
29th June 2008, 01:09
At what kind of bitrate will a Q6600 (single core only) lag when decoding a H.264 video?

The bitrate is one factor, but it's not the only factor! So it's hard to say...

I can tell you that on my Q6600 I can play all those 1080p trailers without problem. That is using MPlayer with "libavcodec" decoder :cool:

Chengbin
29th June 2008, 02:05
What are the other factors?

LoRd_MuldeR
29th June 2008, 02:08
What are the other factors?

Resolution, framerate, profile, content of the video...

ericab
29th June 2008, 03:06
lord mulder:

where can i find this "patch" for libavcodec ?

id like to try a test compile myself

could you provide us a link ?

LoRd_MuldeR
29th June 2008, 03:08
lord mulder:

where can i find this "patch" for libavcodec ?

id like to try a test compile myself

could you provide us a link ?

I think it was posted on the mailing list a while ago. But you could simply get a recent build of ffdshow-tryouts instead of compiling yourself...

petran79
29th June 2008, 16:14
Does the same apply also to the Divx/Xvid codec?

or do both the commercial version of Divx decoder and the libavcodec use multiple cores in this case?

Btw is it possible to apply the ffdshow filters to a video file while decoding it externally with CoreAVC?

Eg, contrast, deinterlace, screenshot etc....

LoRd_MuldeR
30th June 2008, 14:05
Does the same apply also to the Divx/Xvid codec?
or do both the commercial version of Divx decoder and the libavcodec use multiple cores in this case?

I think both MPEG-4 ASP encoders, DivX (commerical) and Xvid (OpenSource), do support multi-threading.
But Xvid's multi-threading capabilities are very limited. I'm not sure about DivX here.

BTW: Xvid is not part of "libavcodec". The latter comes with it's own MPEG-4 ASP encoder and decoder.

Btw is it possible to apply the ffdshow filters to a video file while decoding it externally with CoreAVC?

Yes it is. Simply put ffdshow between CoreAVC and the video renderer in your filter chain...

_xxl
30th June 2008, 14:15
Latest DivX MPEG-4 ASP should support multi-threading decoding and encoding.

Chengbin
30th June 2008, 21:01
Is it normal for a Q6600 (single core)to choke on a h.264 video file encoded at around 30000kbps with a resolution of 1920x800?

clsid
30th June 2008, 21:07
Yes, not surprising with such a very high bitrate.

LoRd_MuldeR
30th June 2008, 21:44
Is it normal for a Q6600 (single core)to choke on a h.264 video file encoded at around 30000kbps with a resolution of 1920x800?

Using which player, which decoder and which renderer ???

Chengbin
30th June 2008, 21:47
Using MPC, and libavcodec

LoRd_MuldeR
30th June 2008, 21:54
Using MPC, and libavcodec

Try again with Haali Renderer and raise the number of buffered frames to maximum, if you don't use Haali Renderer yet.
This may help to ensure smooth playback when your system is close to it's limit...

Chengbin
1st July 2008, 03:40
Thanks a lot. Now it is smoother. I've learned a lot from you.

Just another question. I noticed that when I use Haali video renderer, task manager shows it uses four cores evenly (20-25% for all cores), but when I use ffdshow's decoder, it only uses a single core, so that core is running at near 100%. But how come Haali's decoder can't use the remaining 75% of the cores? I noticed that if I jump straight into a challanging scene, my Q6600 chokes, and each of my cores don't go past 30%. Why is that?

Dark Shikari
1st July 2008, 03:49
Thanks a lot. Now it is smoother. I've learned a lot from you.

Just another question. I noticed that when I use Haali video renderer, task manager shows it uses four cores evenly (20-25% for all cores), but when I use ffdshow's decoder, it only uses a single core, so that core is running at near 100%. But how come Haali's decoder can't use the remaining 75% of the cores? I noticed that if I jump straight into a challanging scene, my Q6600 chokes, and each of my cores don't go past 30%. Why is that?There is no Haali decoder; Haali's Renderer is just that--a renderer. The FFDshow decoder is singlethreaded, though it has an option to multithread the CABAC decoding for some extra performance.

Ranguvar
1st July 2008, 03:51
I'd try disabling the inloop deblocking for that. I know both CoreAVC and libavcodec have options for it. It should help your speed, and at such a ridiculous bitrate, it shouldn't hurt the quality TOO much.

LoRd_MuldeR
1st July 2008, 04:08
I'd try disabling the inloop deblocking for that. I know both CoreAVC and libavcodec have options for it. It should help your speed, and at such a ridiculous bitrate, it shouldn't hurt the quality TOO much.
@Chengbin:

Note that in contrast to MPEG-4 ASP (e.g. DivX, Xvid) the "Deblocking" filter is an integral part of AVC/H.264 (e.g. x264).
So if you disable Deblocking in your H.264 decoder this will unavoidably lead to distortions, although it may give some additional speed-up.

Again: If you want a really fast H.264 decoder, buy Core AVC for only 15$. There also is a 14-day trial version for free...

petran79
1st July 2008, 11:09
Yes it is. Simply put ffdshow between CoreAVC and the video renderer in your filter chain...

I do not know exactly the correct process for this so I tried the following

if I enable in ffdshow in the codecs/raw video the YV12 option and disable the H264 codec, then in MPC both ffdshow video and CoreAVC load and I can apply the ffsdhow effects directly on the video file.

Now I dont know whether this takes more system resources but it works. CoreAVC is accepted because if I disable both this and the ffdshow H264 codec, then another codec from Avermedia loads with ffdshow

LoRd_MuldeR
1st July 2008, 12:36
if I enable in ffdshow in the codecs/raw video the YV12 option and disable the H264 codec, then in MPC both ffdshow video and CoreAVC load and I can apply the ffsdhow effects directly on the video file. Now I dont know whether this takes more system resources but it works.

This sounds like the proper way to do it.

Of course this will require additional system resources. But either you want to use ffdshow as a post-processor or not. If you want to use it as a post-processor, this will cost you some system resources. If you are not willing to spend additional system resources, then use the CoreAVC Decoder alone and abdicate post-processing...

Chengbin
1st July 2008, 13:35
There is no Haali decoder; Haali's Renderer is just that--a renderer. The FFDshow decoder is singlethreaded, though it has an option to multithread the CABAC decoding for some extra performance.

How do you enable that?

@Chengbin:

Note that in contrast to MPEG-4 ASP (e.g. DivX, Xvid) the "Deblocking" filter is an integral part of AVC/H.264 (e.g. x264).
So if you disable Deblocking in your H.264 decoder this will unavoidably lead to distortions, although it may give some additional speed-up.

Again: If you want a really fast H.264 decoder, buy Core AVC for only 15$. There also is a 14-day trial version for free...

I wish I can buy that, but my parents are not the most enthusiathic people when it comes to buying things online. They much rather go into a store and buy it, even if the price is higher. Like when I bought my shure earphones, I could of gotten them online for $80, but my parents told me to go to Future Shop and buy it for $130. The only exceptions are the large, known stores such as Dell. So there is no way that I could get CoreAVC, unless some stores sell it.

BTW, is there a way to get the audio decoded by another core, or hardware decode it by my Creative X-Fi XtremeMusic?

lol_123
1st July 2008, 13:57
I'm wondering if h.264 decoders can take advantage of quad core processors?

As long as the H.264 decoder is using MP architecture, for example,
if it is using OpenMP architecture, it will support mutiple cores.

Actually, it is very easy to support multiple coes for a decoder.
if you have 2 cores, just split image into half-half, let each processor decode half image, if you have 8 cores, then just split it into 8, let each processor deocode 1/8 image.

LoRd_MuldeR
1st July 2008, 14:18
Actually, it is very easy to support multiple coes for a decoder.
if you have 2 cores, just split image into half-half, let each processor decode half image, if you have 8 cores, then just split it into 8, let each processor deocode 1/8 image.

Nope. It's not that easy as you might think. I'm not an expert, but video (de)compression is very complex!
For example you might not be able to decompress one line of the frame, before having decompressed all the previous lines.
Also you might not be able to decompress a pixel, before having decompressed all previous pixels in the current line.
Last but not least you might not be able to decompress a frame before having decompressed all previous (reference) frames.
Those restrictions make multi-threading a nightmare for the developers...

Of course there are ways to circumvent such restrictions with "smart" algorithms, but it's a lot work to implement that!
There is a reason why very few H.264 decoders can compete with CoreAVC Decoder speed-wise :p

Chengbin
2nd July 2008, 00:36
Is there a way to get the audio decoded by another core, or hardware decode it (if possible) by my Creative X-Fi XtremeMusic?

foxyshadis
2nd July 2008, 01:58
With ffdshow or MPC, audio should already be decoded by another core. Both halves of the graph are independent (the decoding and rendering should also be independent threads). It's just such a tiny % that you might not even notice it.

You can consider getting a secured credit card or a debit card, which you can generally get as a minor (14+ depending on the state and bank). Or tell your parents about one-time use numbers offered by BofA and other banks - much more secure for online purchases. Otherwise you're kind of up a creek; ffdshow's performance is as good as you'll get in free software if you can't use MPC's DXVA, you have to wait on others to work on further libavcodec multithreading.

Chengbin
2nd July 2008, 02:55
You can consider getting a secured credit card or a debit card, which you can generally get as a minor (14+ depending on the state and bank). Or tell your parents about one-time use numbers offered by BofA and other banks - much more secure for online purchases. Otherwise you're kind of up a creek; ffdshow's performance is as good as you'll get in free software if you can't use MPC's DXVA, you have to wait on others to work on further libavcodec multithreading.

I'm 13. And there is no way that I can get a credit card, and I wouldn't be able to convince them (no use). They just don't like shopping on the internet. They rather drive me to Future Shop and buy it, which is quite a bit more expensive (but better service and return policy), like when I bought my Shure e2c ($150 vs $80 on internet), Logitech Z-5500 ($570 vs $350), etc.

ranpha
2nd July 2008, 12:17
I think you can just use MPC-HC internal decoder that also support SMP. If MPC-HC is not your thing, you can get the stand-alone filter, which is usable for all DirectShow-based players like WMP. With your Q6600, you should be able to play all kinds of 1080p h.264 files perfectly, even without DXVA.

clsid
2nd July 2008, 15:21
The internal decoder of MPC-HC is based on the same code as used by ffdshow. So its performance will also be insufficient for Chengbin.

Chengbin
2nd July 2008, 17:38
I just downloaded MPC-HC, and I kick myself for not finding this software soon enough. Now I can use my 8800GT to hardware accelerate my H.264 movies. The images look sharper with greater color fidelity. My old MPC seems to have displayed too much contrast in the image, making it a bit (but very noticeably) white. My only problem with that player is that it would play a 720x480 file in that resolution and aspect ratio instead of the correct aspect ratio of 4:3.

ranpha
2nd July 2008, 19:25
Well, if the video is 720x480 in the first place, I would want to play that file to play in that resolution without any strecthing. Anyway, you can force 4:3 by right-clicking on the screen while a video play, select Video Frame ---> Override Aspect Ratio ---> 4:3.

LoRd_MuldeR
2nd July 2008, 20:05
720x480 is the normal NTSC resolution. This can be either 4:3 or 16:9, depending on the PAR (Pixel Aspect Ratio).
It' called "anamorphic" video. Maybe MPC-HC's internal H.264 decoder doesn't handle anamorphic video well in DXVA mode ???

clsid
2nd July 2008, 20:43
If the colors look too light in MPC(-HC) then change the video renderer in the options. For example VMR-9 often uses the wrong levels.

Chengbin
3rd July 2008, 20:02
Although that could be adjusted, image sharpness and skin tones can't. But it doesn't matter because MPC-HC perfects it for me.