[FFmpeg-devel] [PATCH/RFC] H.264 FMO+ASO decoding

Stefan Gehrer stefan.gehrer
Wed Jul 21 22:20:36 CEST 2010


Hi,

attached is a patch that implements the header stuff for FMO decoding
in H.264 baseline streams. It decodes the slice group map and also
provides means that at the start of a slice the actual x/y position
of the first macroblock can be determined from first_mb_in_slice.
If this is done, slices can be decoded out of order, i.e.
first_mb_in_slice does not have to increase for slices of the same
picture (aka ASO).
Let's take as example a tiny video of 4x3 macroblocks which
has a slice group map with two slice groups like this:

1  1  1  1
1  0  0  1
1  1  1  1

Each slice group itself (0 or 1) is decoded in raster-scan order,
so that the macroblock addresses are as follows:

2  3  4  5
6  0  1  7
8  9 10 11

So if a slice comes along with first_mb_in_slice equal to 7 we need
to start decoding at MB position x=3 and y=1.

Unfortunately, the real challenge starts here. A lot of neighbor
context handling (i4x4 modes, non-zero counts, MVs) has to be
handled differently when the assumption of raster-scan order of
macroblocks is not true anymore. Also, deblocking can only be done
after the picture has been fully decoded. This is because deblocking
goes across slice boundaries and slice group boundaries and the
neighbor MB might just happen to be the last to be decoded in the
picture.
Considering the heavy optimizations that have been done in the
normal decoding paths I guess there would be some outcry if in
many places in the MB decoding a conditional like
if(pps->slice_group_count > 1)
would appear.
So my feeling is that if FMO is to be implemented it may be best
to have a new code path for the slice data decoding, a
baseline-FMO-specific version of decode_slice() and some of its
subfunctions maybe?
Opinions welcome.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h264_fmo.diff
Type: text/x-diff
Size: 12916 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100721/ca6f20c5/attachment.diff>



More information about the ffmpeg-devel mailing list