[x264-devel] Re: parallising the encoder

Loren Merritt lorenm at u.washington.edu
Wed Apr 6 18:00:48 CEST 2005


On Wed, 6 Apr 2005, Tom Jacobs wrote:

> i am planning on parallelising the x264 encoder and would really appreciate
> some help.  i have only briefly looked at the code (only got it yesterday)
> but have been looking at the JM code (which i must say is a horror to read
> with nasty global structures).
>
> my first thoughts about parallelising the encoder was to do it at the MB
> level since this is what i have done for both mpeg2 and xvid. the all the
> advanced feature of the h264 standard and all the extra predictions from
> the current frame needed i thought i may wimp out and look at the slice
> level. the slice level looks promising since all MB within the slice are
> Independence and it is not a to coarse level to make a shared memory system
> inefficient.
>
> in the JM code i could set as input parameters what kind of slice mode i
> wanted (how many MB per slice or how many bytes). i haven't seen this input
> in x264. having said that there are flags for different slice mode. can
> these be used?
>
> also is there a loop of some type that where it loops over slices?

You probably don't want to parallelize MBs. The extra predictions are no 
problem (just encode each line 2 MBs behind the previous), but it would 
mean you have to save residual coefficients and such, and delay bitstream 
writing. And delayed bitstream writing could hurt RD, whenever that 
gets finished. And with different MBs taking much different amounts of 
time, I would imagine syncing the lines would reduce the benefits of 
parallelizing.
With slices you sacrifice about 1% bitrate for much simpler code.
The 3rd possibility is to parallelize at the frame level. But that's back 
to complex code, since it requires duplicating large parts of the encoder 
context and keeping track of multiple DPBs and stuff.

x264 doesn't do slices yet, but it's mostly working at
http://students.washington.edu/lorenm/src/x264/x264_slices.3.diff
(based on a patch by Champ Yen).

--Loren Merritt

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list