[x264-devel] Boundary constraints

Loren Merritt lorenm at u.washington.edu
Sat Nov 24 10:08:42 CET 2007


On Wed, 21 Nov 2007, Etienne Bömcke wrote:

>> Do your banners go only on the bottom of the frame, or would you
>> ever want to replace e.g. the left side? Your example is
>> inconsistent: 200x576 would be a side.
>
> You're right about the dimensions, it was a mistake. I meant something
> like 720x150. As for now I only need bottom banners, but if there's a
> way to do this with any part of the sequence that would be way better.
>
>> This is important bause you really don't want to implement it
>> without slices, and slices normally only stack vertically.
>
> I'm afraid I don't really understand this... I thought about using
> slices, but as x264 currently doesn't support slices I was wondering
> if there was another way to achieve that goal. When you say slices
> only stack vertically, are you talking about that patch of yours you
> were mentioning in a former mail?

The following pertains to what is possible within the H.264 standard, not 
any specific implementation. I don't foresee a patch for any of these 
methods being clean enough nor useful enough to accept in x264, but that 
doesn't stop you from implementing it on your own.

In every case, I will talk only about appending videos. If you also want 
the original frame without any overlays, then just treat the overlayed 
piece of the original frame as another potential video to be appended.

Method 1, for vertically stacked videos only:
Make sure the top video uses no motion vectors off the bottom, nor subpel 
motion vectors within 3 pixels of the bottom (because subpel interpolation 
would involve pixels off the bottom), and likewise for the top edge of the 
bottom video. Make sure all the videos use the same frame types. Then 
concatenate pairs of frames, adjust first_mb of the bottom slice, disable 
deblocking across slice boundaries, and you have one multisliced video. No 
bitstream rewriting is necessary outside the headers.

Method 2, for any arrangement of videos:
Code the individual videos with the same motion constraints as (1). When 
concatenating frames, add slice groups to specify shapes other than a 
vertical stack. Slice groups require Extended profile, which is 
incompatible with cabac, 8x8dct, cqm, and a few other features.

Method 3, for any arrangement of videos:
Code the individual videos with the same motion constraints as (1). 
Additionally, the top-left macroblock in all intra frames in the video(s) 
to be placed on the bottom/right must be coded with a sufficiently low QP 
that its DC coefficient is lossless. The top-left macroblock in non-intra 
frames must be either similarly lossless or not intra. All other intra 
blocks on the edge must use vertical or horizontal prediction (depending 
on which edge it is), not DC prediction. Either don't use deblocking at 
all, or make the macroblocks along the edge sufficiently low QP that they 
don't get deblocked. If all of those constraints are satisfied, then you 
can rewrite the bitstream to merge the videos without slices.

Method 4, for any arrangement of videos:
Use switching pictures. But these also require Extended profile, and slice 
groups are better for your purpose.

--Loren Merritt


More information about the x264-devel mailing list