PDA

View Full Version : Can x264 encode slice by slice?


chen
28th September 2005, 12:12
H.264 Standards indicate that a picture can be or partitioned into more than one slice or encoded as a whole ( in this case the pic is considered as a single slice). But is x264 able to encode a frame slice by slice? If so, is it automatically decided by the encoder itself how to partition a pic into slices, or is there a parameter that users can set in order to affect the way of partitioning?

stephanV
28th September 2005, 12:18
slicing is used if you use multithreaded encoding AFAIK.

chen
28th September 2005, 12:50
oh, i see. The parameter --threads <integer> enables paralell encoding, whichs means slices will be used. But is a frame to be uniformly partitioned into slices?

stephanV
28th September 2005, 13:05
I think yes. I doubt sliced encoding could give you any improvement in quality if that is what you are looking for. So considering that and the reason why slices are used (to speed up encoding) it probably makes most sense to have equal sized slices (if anything else is actually possible)

708145
29th September 2005, 00:29
I think yes. I doubt sliced encoding could give you any improvement in quality if that is what you are looking for. So considering that and the reason why slices are used (to speed up encoding) it probably makes most sense to have equal sized slices (if anything else is actually possible)

slices decrease quality at same bitrate.

Kopernikus
29th September 2005, 10:09
IIRC x264 partitions the picture in macroblock raster scan, so with 2 slices the fist half of rasterscanned macroblocks belong to slice 1 and second half belongs to slice 2.

omion
29th September 2005, 10:47
IIRC x264 partitions the picture in macroblock raster scan, so with 2 slices the fist half of rasterscanned macroblocks belong to slice 1 and second half belongs to slice 2.
I've heard that too, but I've been wondering: why do they do it that way?

From what I know, the only reason that quality decreases is that you can't do spatial prediction between the slices, and therefore it would make sense to make the "stitch" as small as possible. Since most movies are wider than they are tall, it would make more sense to use the left/right halves.

(Generalizing, you want all the slices to be as close to a square as possible, because that maximizes the number of internal macroblocks)

... but that's assuming I know what I'm talking about :D

chen
29th September 2005, 12:01
The parameter "--threads " enables us to partition a frame into slices and each slice is packaged in a NAL unit which is called "coded slice NAL unit". According to H.264 syntax, a coded slice NAL unit of a non-IDR picture can be further partitioned into 3 NAL units, and this is the so-called "slice data partitioning". I wonder whether x264 enables this function.

Kopernikus
29th September 2005, 17:37
x264 doesnt support slice data partitioning

Sirber
29th September 2005, 18:12
slices decrease quality at same bitrate.I heard it was about 0.1db.

Sharktooth
29th September 2005, 18:14
It can be even less (or maybe more). It depends on the source... however as a general rule less slices = more quality.

puffpio
30th September 2005, 02:36
what about an encoder farm thing

like 1st pass the master computer determines where all the I P B frames are....
then for the 2nd pass it assigns cpu1 to frames 1-10, cpu2 11-20...etc...and then combines it all together?

the way teh work could be dividided up is a chunk of frames..beginning w/ an I frame...that way each chunk of work is independant of the other...
once the encoding of a chunk is done it could report back to the master process about rate information and stuff...
could work for multicore, multiprocessor..and even a clustered network situation

akupenguin
30th September 2005, 03:50
It's being done: ELDER (http://forum.doom9.org/showthread.php?t=87715&highlight=elder)