[FFmpeg-devel] [RFC/PATCH] MV-HEVC decoding

Anton Khirnov anton at khirnov.net
Tue Aug 27 18:04:40 EEST 2024


Hi,
this patchset adds support for decoding MV-HEVC (multiview, typically
used for stereoscopic 3D video). The code currently supports at most two
views, with the second depending on the first (i.e. using it for inter
prediction). Both views have to be of the same size; the spec allows
them not to be, but I'm not supporting that, or a lot of other insanity
in there.

The frames for both views are interleaved in the output, with side data
indicating which one has which view ID. If the relevant SEI is present,
we also add side data indicating which view is left or right.

Since the API caller needs to request the views it wants, and all the
multilayer configuration is potentially per-sequence, there needs to be
a negotiation process where the decoder exports available views and the
caller picks from them. I'm implementing this by adding several
decoder-private AVOptions, meant to be accessed from get_format(). Some
of them are read-only and the caller reads available view IDs (and
positions, if known) from them. The others are writable, and are used to
receive the caller's choice.

One potential point of discussion is that the caller may want to know
the view ID in its get_buffer2() callback (this is actually used in the
ffmpeg CLI code). One potential option is attaching the view ID side
data before calling get_buffer2(), but that is quite unusual and would
require changes to the progress frame API. For now, I'm using another
read-only decoder-private AVOption for that. Opinions welcome.

I'm also adding nontrivial support for this to ffmpeg CLI, which mainly
means extending stream specifiers to allow specifying individual views,
e.g. "-map 0:v:0:vpos:left" selects the left view (see TFM for more
details).

The set should be mostly functional, I'm tagging it as RFC because
there's a little polishing left to do, and a few tests left to add.
Testing and review welcome. You can fetch the set from
git://git.khirnov.net/libav, branch 'mv-hevc'.

Cheers,
-- 
Anton Khirnov



More information about the ffmpeg-devel mailing list